From b1ecb903c582bf0023d0fdd6ac1ac6427e8f41a7 Mon Sep 17 00:00:00 2001 From: Complex Date: Fri, 28 Jul 2023 16:28:13 +0200 Subject: [PATCH 01/10] Config Option | Added to Furniture | Docs Updated --- README.md | 12 ++++++++++++ client/cl_property.lua | 2 +- shared/config.lua | 41 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 216f746..8eb795c 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,18 @@ This will open a furniture store complete with all of the props. Select an item > Note: The place on ground button sometimes does not work properly depending on where the native detects the ground to be. +## Dynamic Doors Preview & Setup + +https://github.com/complexza/ps-housing/assets/74205343/1af960a4-66ac-4d93-abc7-8eddd9802976 + +https://github.com/complexza/ps-housing/assets/74205343/d6ca08d3-70ae-4c1e-970e-bddac9143ba2 + +### Setup +- You will need to set the `Config.EnableDynanicDoors = true` +- You will have to add this convar into your server.cfg `setr game_enableDynamicDoorCreation "true"` + +> Note: The convar has to be in your server.cfg inorder for the doors to be dynamic! + # Important * Players need to place their [stash](https://github.com/Project-Sloth/ps-housing/blob/7efd2009050b9a20969877cf69b284352a9309bf/shared/config.lua#LL426C96-L426C96) and [wardrobe](https://github.com/Project-Sloth/ps-housing/blob/7efd2009050b9a20969877cf69b284352a9309bf/shared/config.lua#L427) or else they wont have one. Check [Config](https://github.com/Project-Sloth/ps-housing/blob/7efd2009050b9a20969877cf69b284352a9309bf/shared/config.lua#L422) for more information. diff --git a/client/cl_property.lua b/client/cl_property.lua index 8be77b7..eb85e08 100644 --- a/client/cl_property.lua +++ b/client/cl_property.lua @@ -438,7 +438,7 @@ function Property:LoadFurniture(furniture) local entity = CreateObjectNoOffset(hash, coords.x, coords.y, coords.z, false, true, false) SetModelAsNoLongerNeeded(hash) SetEntityRotation(entity, furniture.rotation.x, furniture.rotation.y, furniture.rotation.z, 2, true) - FreezeEntityPosition(entity, true) + if not Config.DynamicDoors then FreezeEntityPosition(entity, true) end if furniture.type and Config.FurnitureTypes[furniture.type] then diff --git a/shared/config.lua b/shared/config.lua index a47e646..b97db37 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -18,13 +18,15 @@ Config.AccessCanEditFurniture = true -- Draw the poly for the property Config.DebugMode = true - function Debug(...) if Config.DebugMode then print(...) end end +-- Enables Dynamic Doors as Furniture +Config.DynamicDoors = false + Config.PoliceJobNames = { -- add multiple police jobs that are allowed to raid properties! "police", -- "police2", @@ -1220,6 +1222,43 @@ Config.Furnitures = { } }, + { + category = "Doors", -- All from Base Game. + items = { + { ["object"] = "v_corp_hicksdoor", ["price"] = 300, ["label"] = "White Door" }, + { ["object"] = "v_ilev_247_offdorr", ["price"] = 300, ["label"] = "24/7 Wooden Door" }, + { ["object"] = "v_ilev_arm_secdoor", ["price"] = 300, ["label"] = "Security Door" }, + { ["object"] = "v_ilev_bank4door01", ["price"] = 300, ["label"] = "Bank Glass Door" }, + { ["object"] = "v_ilev_bk_gate", ["price"] = 300, ["label"] = "Fancy Metal Gate" }, + { ["object"] = "v_ilev_cbankcountdoor01", ["price"] = 300, ["label"] = "Bank Office Door" }, + { ["object"] = "v_ilev_cd_door", ["price"] = 300, ["label"] = "Wooden Door with Glass" }, + { ["object"] = "v_ilev_cm_door1", ["price"] = 300, ["label"] = "Light Blue Door" }, + { ["object"] = "v_ilev_dev_door", ["price"] = 300, ["label"] = "Black House Door" }, + { ["object"] = "v_ilev_door_orangesolid", ["price"] = 300, ["label"] = "Orange Solid Door" }, + { ["object"] = "v_ilev_fa_backdoor", ["price"] = 300, ["label"] = "Dirty Glass Door" }, + { ["object"] = "v_ilev_gangsafedoor", ["price"] = 300, ["label"] = "Gang Safe Door" }, + { ["object"] = "v_ilev_gc_door02", ["price"] = 300, ["label"] = "Office Door" }, + { ["object"] = "v_ilev_janitor_frontdoor", ["price"] = 300, ["label"] = "White Mesh Door" }, + { ["object"] = "v_ilev_rc_door1", ["price"] = 300, ["label"] = "Yellow Fire Door" }, + { ["object"] = "v_ilev_roc_door2", ["price"] = 300, ["label"] = "Solid Red Door" }, + { ["object"] = "v_ilev_sol_off_door01", ["price"] = 300, ["label"] = "Solid Wooden Door" }, + { ["object"] = "v_ilev_stad_fdoor", ["price"] = 300, ["label"] = "Glass Door with Rails" }, + { ["object"] = "v_ilev_tort_door", ["price"] = 300, ["label"] = "Door with Danger Sign" }, + { ["object"] = "v_ilev_trevtraildr", ["price"] = 300, ["label"] = "Trailer Door" }, + { ["object"] = "prop_cs_fridge_door", ["price"] = 300, ["label"] = "Fridge Door" }, + { ["object"] = "prop_artgallery_dl", ["price"] = 300, ["label"] = "White Art Gallery Door" }, + { ["object"] = "prop_bh1_09_mp_l", ["price"] = 300, ["label"] = "Weazel Plaza Door" }, + { ["object"] = "prop_bh1_48_backdoor_l", ["price"] = 300, ["label"] = "Black Glass Door" }, + { ["object"] = "prop_casino_door_01r", ["price"] = 300, ["label"] = "Casino Glass Door" }, + { ["object"] = "prop_cs4_11_door", ["price"] = 300, ["label"] = "White Door with Small Window" }, + { ["object"] = "prop_cs6_03_door_r", ["price"] = 300, ["label"] = "Antique Wooden Door" }, + { ["object"] = "prop_grumandoor_r", ["price"] = 300, ["label"] = "Golden Snake Door" }, + { ["object"] = "prop_motel_door_09", ["price"] = 300, ["label"] = "Motel Door" }, + { ["object"] = "v_61_hlw_mesh_doorbroken", ["price"] = 300, ["label"] = "Broken White Door" }, + { ["object"] = "prop_fnclink_03gate5", ["price"] = 300, ["label"] = "Chainlink Fence" }, + } + }, + { category = "Misc", items = { From a60c6c508b5ffc17446477c4d2614e13d3176d53 Mon Sep 17 00:00:00 2001 From: Rian <74205343+complexza@users.noreply.github.com> Date: Fri, 28 Jul 2023 16:29:29 +0200 Subject: [PATCH 02/10] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8eb795c..f7811f6 100644 --- a/README.md +++ b/README.md @@ -49,9 +49,9 @@ This will open a furniture store complete with all of the props. Select an item ## Dynamic Doors Preview & Setup -https://github.com/complexza/ps-housing/assets/74205343/1af960a4-66ac-4d93-abc7-8eddd9802976 +https://github.com/complexza/ps-housing/assets/74205343/fef28197-8e95-4b5f-aba8-b3e5409456d8 -https://github.com/complexza/ps-housing/assets/74205343/d6ca08d3-70ae-4c1e-970e-bddac9143ba2 +https://github.com/complexza/ps-housing/assets/74205343/196bb25e-75b9-42f6-b1c3-fe86ad477544 ### Setup - You will need to set the `Config.EnableDynanicDoors = true` From 9bd71269609db2233d511a09d1396755cffd8818 Mon Sep 17 00:00:00 2001 From: Complex Date: Fri, 28 Jul 2023 22:39:53 +0200 Subject: [PATCH 03/10] Fixed Furniture Falling through Shell --- client/cl_property.lua | 9 ++++-- shared/config.lua | 62 +++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/client/cl_property.lua b/client/cl_property.lua index eb85e08..23e014a 100644 --- a/client/cl_property.lua +++ b/client/cl_property.lua @@ -430,16 +430,19 @@ function Property:OpenDoorbellMenu() end function Property:LoadFurniture(furniture) - local coords = GetOffsetFromEntityInWorldCoords(self.shellObj, furniture.position.x, furniture.position.y, - furniture.position.z) + local coords = GetOffsetFromEntityInWorldCoords(self.shellObj, furniture.position.x, furniture.position.y, furniture.position.z) local hash = furniture.object lib.requestModel(hash) local entity = CreateObjectNoOffset(hash, coords.x, coords.y, coords.z, false, true, false) SetModelAsNoLongerNeeded(hash) SetEntityRotation(entity, furniture.rotation.x, furniture.rotation.y, furniture.rotation.z, 2, true) - if not Config.DynamicDoors then FreezeEntityPosition(entity, true) end + if furniture.type == 'door' and Config.EnableDynamicDoors then + Debug("Object: "..furniture.label.." wont be frozen") + else + FreezeEntityPosition(entity, true) + end if furniture.type and Config.FurnitureTypes[furniture.type] then Config.FurnitureTypes[furniture.type](entity, self.property_id, self.propertyData.shell) diff --git a/shared/config.lua b/shared/config.lua index b97db37..b551fce 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -1225,37 +1225,37 @@ Config.Furnitures = { { category = "Doors", -- All from Base Game. items = { - { ["object"] = "v_corp_hicksdoor", ["price"] = 300, ["label"] = "White Door" }, - { ["object"] = "v_ilev_247_offdorr", ["price"] = 300, ["label"] = "24/7 Wooden Door" }, - { ["object"] = "v_ilev_arm_secdoor", ["price"] = 300, ["label"] = "Security Door" }, - { ["object"] = "v_ilev_bank4door01", ["price"] = 300, ["label"] = "Bank Glass Door" }, - { ["object"] = "v_ilev_bk_gate", ["price"] = 300, ["label"] = "Fancy Metal Gate" }, - { ["object"] = "v_ilev_cbankcountdoor01", ["price"] = 300, ["label"] = "Bank Office Door" }, - { ["object"] = "v_ilev_cd_door", ["price"] = 300, ["label"] = "Wooden Door with Glass" }, - { ["object"] = "v_ilev_cm_door1", ["price"] = 300, ["label"] = "Light Blue Door" }, - { ["object"] = "v_ilev_dev_door", ["price"] = 300, ["label"] = "Black House Door" }, - { ["object"] = "v_ilev_door_orangesolid", ["price"] = 300, ["label"] = "Orange Solid Door" }, - { ["object"] = "v_ilev_fa_backdoor", ["price"] = 300, ["label"] = "Dirty Glass Door" }, - { ["object"] = "v_ilev_gangsafedoor", ["price"] = 300, ["label"] = "Gang Safe Door" }, - { ["object"] = "v_ilev_gc_door02", ["price"] = 300, ["label"] = "Office Door" }, - { ["object"] = "v_ilev_janitor_frontdoor", ["price"] = 300, ["label"] = "White Mesh Door" }, - { ["object"] = "v_ilev_rc_door1", ["price"] = 300, ["label"] = "Yellow Fire Door" }, - { ["object"] = "v_ilev_roc_door2", ["price"] = 300, ["label"] = "Solid Red Door" }, - { ["object"] = "v_ilev_sol_off_door01", ["price"] = 300, ["label"] = "Solid Wooden Door" }, - { ["object"] = "v_ilev_stad_fdoor", ["price"] = 300, ["label"] = "Glass Door with Rails" }, - { ["object"] = "v_ilev_tort_door", ["price"] = 300, ["label"] = "Door with Danger Sign" }, - { ["object"] = "v_ilev_trevtraildr", ["price"] = 300, ["label"] = "Trailer Door" }, - { ["object"] = "prop_cs_fridge_door", ["price"] = 300, ["label"] = "Fridge Door" }, - { ["object"] = "prop_artgallery_dl", ["price"] = 300, ["label"] = "White Art Gallery Door" }, - { ["object"] = "prop_bh1_09_mp_l", ["price"] = 300, ["label"] = "Weazel Plaza Door" }, - { ["object"] = "prop_bh1_48_backdoor_l", ["price"] = 300, ["label"] = "Black Glass Door" }, - { ["object"] = "prop_casino_door_01r", ["price"] = 300, ["label"] = "Casino Glass Door" }, - { ["object"] = "prop_cs4_11_door", ["price"] = 300, ["label"] = "White Door with Small Window" }, - { ["object"] = "prop_cs6_03_door_r", ["price"] = 300, ["label"] = "Antique Wooden Door" }, - { ["object"] = "prop_grumandoor_r", ["price"] = 300, ["label"] = "Golden Snake Door" }, - { ["object"] = "prop_motel_door_09", ["price"] = 300, ["label"] = "Motel Door" }, - { ["object"] = "v_61_hlw_mesh_doorbroken", ["price"] = 300, ["label"] = "Broken White Door" }, - { ["object"] = "prop_fnclink_03gate5", ["price"] = 300, ["label"] = "Chainlink Fence" }, + { ["object"] = "v_ilev_fa_frontdoor", ["price"] = 300, ["type"] = "door", ["label"] = "White Door" }, + { ["object"] = "v_ilev_247_offdorr", ["price"] = 300, ["type"] = "door", ["label"] = "24/7 Wooden Door" }, + { ["object"] = "v_ilev_arm_secdoor", ["price"] = 300, ["type"] = "door", ["label"] = "Security Door" }, + { ["object"] = "v_ilev_bank4door01", ["price"] = 300, ["type"] = "door", ["label"] = "Bank Glass Door" }, + { ["object"] = "v_ilev_bk_gate", ["price"] = 300, ["type"] = "door", ["label"] = "Fancy Metal Gate" }, + { ["object"] = "v_ilev_cbankcountdoor01", ["price"] = 300, ["type"] = "door", ["label"] = "Bank Office Door" }, + { ["object"] = "v_ilev_cd_door", ["price"] = 300, ["type"] = "door", ["label"] = "Wooden Door with Glass" }, + { ["object"] = "v_ilev_cm_door1", ["price"] = 300, ["type"] = "door", ["label"] = "Light Blue Door" }, + { ["object"] = "v_ilev_dev_door", ["price"] = 300, ["type"] = "door", ["label"] = "Black House Door" }, + { ["object"] = "v_ilev_door_orangesolid", ["price"] = 300, ["type"] = "door", ["label"] = "Orange Solid Door" }, + { ["object"] = "v_ilev_fa_backdoor", ["price"] = 300, ["type"] = "door", ["label"] = "Dirty Glass Door" }, + { ["object"] = "v_ilev_gangsafedoor", ["price"] = 300, ["type"] = "door", ["label"] = "Gang Safe Door" }, + { ["object"] = "v_ilev_gc_door02", ["price"] = 300, ["type"] = "door", ["label"] = "Office Door" }, + { ["object"] = "v_ilev_janitor_frontdoor", ["price"] = 300, ["type"] = "door", ["label"] = "White Mesh Door" }, + { ["object"] = "v_ilev_rc_door1", ["price"] = 300, ["type"] = "door", ["label"] = "Yellow Fire Door" }, + { ["object"] = "v_ilev_roc_door2", ["price"] = 300, ["type"] = "door", ["label"] = "Solid Red Door" }, + { ["object"] = "v_ilev_sol_off_door01", ["price"] = 300, ["type"] = "door", ["label"] = "Solid Wooden Door" }, + { ["object"] = "v_ilev_stad_fdoor", ["price"] = 300, ["type"] = "door", ["label"] = "Glass Door with Rails" }, + { ["object"] = "v_ilev_tort_door", ["price"] = 300, ["type"] = "door", ["label"] = "Door with Danger Sign" }, + { ["object"] = "v_ilev_trevtraildr", ["price"] = 300, ["type"] = "door", ["label"] = "Trailer Door" }, + { ["object"] = "prop_cs_fridge_door", ["price"] = 300, ["type"] = "door", ["label"] = "Fridge Door" }, + { ["object"] = "prop_artgallery_dl", ["price"] = 300, ["type"] = "door", ["label"] = "White Art Gallery Door" }, + { ["object"] = "prop_bh1_09_mp_l", ["price"] = 300, ["type"] = "door", ["label"] = "Weazel Plaza Door" }, + { ["object"] = "prop_bh1_48_backdoor_l", ["price"] = 300, ["type"] = "door", ["label"] = "Black Glass Door" }, + { ["object"] = "prop_casino_door_01r", ["price"] = 300, ["type"] = "door", ["label"] = "Casino Glass Door" }, + { ["object"] = "prop_cs4_11_door", ["price"] = 300, ["type"] = "door", ["label"] = "White Door with Small Window" }, + { ["object"] = "prop_cs6_03_door_r", ["price"] = 300, ["type"] = "door", ["label"] = "Antique Wooden Door" }, + { ["object"] = "prop_grumandoor_r", ["price"] = 300, ["type"] = "door", ["label"] = "Golden Snake Door" }, + { ["object"] = "prop_motel_door_09", ["price"] = 300, ["type"] = "door", ["label"] = "Motel Door" }, + { ["object"] = "v_61_hlw_mesh_doorbroken", ["price"] = 300, ["type"] = "door", ["label"] = "Broken White Door" }, + { ["object"] = "prop_fnclink_03gate5", ["price"] = 300, ["type"] = "door", ["label"] = "Chainlink Fence" }, } }, From b9673c5cf2983ba20842217fcfe226767cf048c9 Mon Sep 17 00:00:00 2001 From: Rian <74205343+complexza@users.noreply.github.com> Date: Sat, 29 Jul 2023 13:27:22 +0200 Subject: [PATCH 04/10] Update README.md Co-authored-by: BackSH00TER <18689469+BackSH00TER@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7811f6..6ede71f 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ https://github.com/complexza/ps-housing/assets/74205343/196bb25e-75b9-42f6-b1c3- - You will need to set the `Config.EnableDynanicDoors = true` - You will have to add this convar into your server.cfg `setr game_enableDynamicDoorCreation "true"` -> Note: The convar has to be in your server.cfg inorder for the doors to be dynamic! +> Note: The convar has to be in your server.cfg in order for the doors to be dynamic! # Important From cfcbde9f067b2b2a820fcd8f72319b79937c8c0d Mon Sep 17 00:00:00 2001 From: Complex Date: Sat, 29 Jul 2023 13:33:15 +0200 Subject: [PATCH 05/10] Readme Fixes & Changes --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6ede71f..12b2886 100644 --- a/README.md +++ b/README.md @@ -47,14 +47,18 @@ This will open a furniture store complete with all of the props. Select an item > Note: The place on ground button sometimes does not work properly depending on where the native detects the ground to be. -## Dynamic Doors Preview & Setup +## Dynamic Doors + +Dynamic Doors will turn placed doors into actual working doors, Instead of them being static. (See videos below) + +### Preview https://github.com/complexza/ps-housing/assets/74205343/fef28197-8e95-4b5f-aba8-b3e5409456d8 https://github.com/complexza/ps-housing/assets/74205343/196bb25e-75b9-42f6-b1c3-fe86ad477544 ### Setup -- You will need to set the `Config.EnableDynanicDoors = true` +- You will need to set the `Config.EnableDynamicDoors = true` - You will have to add this convar into your server.cfg `setr game_enableDynamicDoorCreation "true"` > Note: The convar has to be in your server.cfg in order for the doors to be dynamic! From 3ad5a51ee8b333c391a3cb9989c72700e9707e24 Mon Sep 17 00:00:00 2001 From: Complex Date: Sat, 29 Jul 2023 13:35:13 +0200 Subject: [PATCH 06/10] Small Fixes --- client/cl_property.lua | 2 +- shared/config.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/cl_property.lua b/client/cl_property.lua index 23e014a..f7cbe1e 100644 --- a/client/cl_property.lua +++ b/client/cl_property.lua @@ -438,7 +438,7 @@ function Property:LoadFurniture(furniture) SetModelAsNoLongerNeeded(hash) SetEntityRotation(entity, furniture.rotation.x, furniture.rotation.y, furniture.rotation.z, 2, true) - if furniture.type == 'door' and Config.EnableDynamicDoors then + if furniture.type == 'door' and Config.DynamicDoors then Debug("Object: "..furniture.label.." wont be frozen") else FreezeEntityPosition(entity, true) diff --git a/shared/config.lua b/shared/config.lua index b551fce..84f6523 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -24,7 +24,7 @@ function Debug(...) end end --- Enables Dynamic Doors as Furniture +-- Enables Dynamic Doors Config.DynamicDoors = false Config.PoliceJobNames = { -- add multiple police jobs that are allowed to raid properties! From 6bff8d2aa1d580d96160d7bf867b344fd46c708b Mon Sep 17 00:00:00 2001 From: Complex Date: Sat, 29 Jul 2023 13:35:39 +0200 Subject: [PATCH 07/10] readme changes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 12b2886..c8e474a 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ https://github.com/complexza/ps-housing/assets/74205343/fef28197-8e95-4b5f-aba8- https://github.com/complexza/ps-housing/assets/74205343/196bb25e-75b9-42f6-b1c3-fe86ad477544 ### Setup -- You will need to set the `Config.EnableDynamicDoors = true` +- You will need to set the `Config.DynamicDoors = true` - You will have to add this convar into your server.cfg `setr game_enableDynamicDoorCreation "true"` > Note: The convar has to be in your server.cfg in order for the doors to be dynamic! From 1a359ed24a91ef3b5c414a60be3e7e0405cad601 Mon Sep 17 00:00:00 2001 From: Complex Date: Sat, 29 Jul 2023 14:38:10 +0200 Subject: [PATCH 08/10] Enabled Doors to be Removed. --- html/index.js | 2 +- ui/src/components/OwnedItems.svelte | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/html/index.js b/html/index.js index b89e075..e753fa5 100644 --- a/html/index.js +++ b/html/index.js @@ -3414,7 +3414,7 @@ void main() { float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function dg(r,e,t){let n=new Uo;const i=new Qe,s=new Qe,o=new Ut,a=new cg({depthPacking:af}),l=new ug,c={},u=t.maxTextureSize,f={[ti]:Jt,[Jt]:ti,[Pn]:Pn},h=new Xn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Qe},radius:{value:4}},vertexShader:fg,fragmentShader:hg}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const _=new Xt;_.setAttribute("position",new Dn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new pe(_,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=pc,this.render=function(M,y,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||M.length===0)return;const C=r.getRenderTarget(),T=r.getActiveCubeFace(),b=r.getActiveMipmapLevel(),S=r.state;S.setBlending(ei),S.buffers.color.setClear(1,1,1,1),S.buffers.depth.setTest(!0),S.setScissorTest(!1);for(let F=0,k=M.length;Fu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/B.x),i.x=s.x*B.x,O.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/B.y),i.y=s.y*B.y,O.mapSize.y=s.y)),O.map===null){const R=this.type!==xr?{minFilter:Vt,magFilter:Vt}:{};O.map=new ii(i.x,i.y,R),O.map.texture.name=L.name+".shadowMap",O.camera.updateProjectionMatrix()}r.setRenderTarget(O.map),r.clear();const J=O.getViewportCount();for(let R=0;R0||y.map&&y.alphaTest>0){const S=T.uuid,F=y.uuid;let k=c[S];k===void 0&&(k={},c[S]=k);let L=k[F];L===void 0&&(L=T.clone(),k[F]=L),T=L}if(T.visible=y.visible,T.wireframe=y.wireframe,C===xr?T.side=y.shadowSide!==null?y.shadowSide:y.side:T.side=y.shadowSide!==null?y.shadowSide:f[y.side],T.alphaMap=y.alphaMap,T.alphaTest=y.alphaTest,T.map=y.map,T.clipShadows=y.clipShadows,T.clippingPlanes=y.clippingPlanes,T.clipIntersection=y.clipIntersection,T.displacementMap=y.displacementMap,T.displacementScale=y.displacementScale,T.displacementBias=y.displacementBias,T.wireframeLinewidth=y.wireframeLinewidth,T.linewidth=y.linewidth,w.isPointLight===!0&&T.isMeshDistanceMaterial===!0){const S=r.properties.get(T);S.light=w}return T}function x(M,y,w,C,T){if(M.visible===!1)return;if(M.layers.test(y.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&T===xr)&&(!M.frustumCulled||n.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,M.matrixWorld);const F=e.update(M),k=M.material;if(Array.isArray(k)){const L=F.groups;for(let O=0,B=L.length;O=1):H.indexOf("OpenGL ES")!==-1&&(R=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),J=R>=2);let Q=null,K={};const ve=r.getParameter(3088),se=r.getParameter(2978),j=new Ut().fromArray(ve),ee=new Ut().fromArray(se);function te(U,W,ie){const he=new Uint8Array(4),be=r.createTexture();r.bindTexture(U,be),r.texParameteri(U,10241,9728),r.texParameteri(U,10240,9728);for(let Ke=0;Kene||P.height>ne)&&(re=ne/Math.max(P.width,P.height)),re<1||E===!0)if(typeof HTMLImageElement!="undefined"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&P instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&P instanceof ImageBitmap){const fe=E?wc:Math.floor,Pe=fe(re*P.width),de=fe(re*P.height);v===void 0&&(v=g(Pe,de));const $=Y?g(Pe,de):v;return $.width=Pe,$.height=de,$.getContext("2d").drawImage(P,0,0,Pe,de),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Pe+"x"+de+")."),$}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function M(P){return wo(P.width)&&wo(P.height)}function y(P){return a?!1:P.wrapS!==mn||P.wrapT!==mn||P.minFilter!==Vt&&P.minFilter!==ln}function w(P,E){return P.generateMipmaps&&E&&P.minFilter!==Vt&&P.minFilter!==ln}function C(P){r.generateMipmap(P)}function T(P,E,Y,ne,re=!1){if(a===!1)return E;if(P!==null){if(r[P]!==void 0)return r[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let fe=E;return E===6403&&(Y===5126&&(fe=33326),Y===5131&&(fe=33325),Y===5121&&(fe=33321)),E===33319&&(Y===5126&&(fe=33328),Y===5131&&(fe=33327),Y===5121&&(fe=33323)),E===6408&&(Y===5126&&(fe=34836),Y===5131&&(fe=34842),Y===5121&&(fe=ne===ot&&re===!1?35907:32856),Y===32819&&(fe=32854),Y===32820&&(fe=32855)),(fe===33325||fe===33326||fe===33327||fe===33328||fe===34842||fe===34836)&&e.get("EXT_color_buffer_float"),fe}function b(P,E,Y){return w(P,Y)===!0||P.isFramebufferTexture&&P.minFilter!==Vt&&P.minFilter!==ln?Math.log2(Math.max(E.width,E.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?E.mipmaps.length:1}function S(P){return P===Vt||P===Jo||P===Us?9728:9729}function F(P){const E=P.target;E.removeEventListener("dispose",F),L(E),E.isVideoTexture&&_.delete(E)}function k(P){const E=P.target;E.removeEventListener("dispose",k),B(E)}function L(P){const E=n.get(P);if(E.__webglInit===void 0)return;const Y=P.source,ne=m.get(Y);if(ne){const re=ne[E.__cacheKey];re.usedTimes--,re.usedTimes===0&&O(P),Object.keys(ne).length===0&&m.delete(Y)}n.remove(P)}function O(P){const E=n.get(P);r.deleteTexture(E.__webglTexture);const Y=P.source,ne=m.get(Y);delete ne[E.__cacheKey],o.memory.textures--}function B(P){const E=P.texture,Y=n.get(P),ne=n.get(E);if(ne.__webglTexture!==void 0&&(r.deleteTexture(ne.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let re=0;re<6;re++)r.deleteFramebuffer(Y.__webglFramebuffer[re]),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer[re]);else{if(r.deleteFramebuffer(Y.__webglFramebuffer),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer),Y.__webglMultisampledFramebuffer&&r.deleteFramebuffer(Y.__webglMultisampledFramebuffer),Y.__webglColorRenderbuffer)for(let re=0;re=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),J+=1,P}function Q(P){const E=[];return E.push(P.wrapS),E.push(P.wrapT),E.push(P.wrapR||0),E.push(P.magFilter),E.push(P.minFilter),E.push(P.anisotropy),E.push(P.internalFormat),E.push(P.format),E.push(P.type),E.push(P.generateMipmaps),E.push(P.premultiplyAlpha),E.push(P.flipY),E.push(P.unpackAlignment),E.push(P.encoding),E.join()}function K(P,E){const Y=n.get(P);if(P.isVideoTexture&&st(P),P.isRenderTargetTexture===!1&&P.version>0&&Y.__version!==P.version){const ne=P.image;if(ne===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ne.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Re(Y,P,E);return}}t.bindTexture(3553,Y.__webglTexture,33984+E)}function ve(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Re(Y,P,E);return}t.bindTexture(35866,Y.__webglTexture,33984+E)}function se(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Re(Y,P,E);return}t.bindTexture(32879,Y.__webglTexture,33984+E)}function j(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Ce(Y,P,E);return}t.bindTexture(34067,Y.__webglTexture,33984+E)}const ee={[bo]:10497,[mn]:33071,[So]:33648},te={[Vt]:9728,[Jo]:9984,[Us]:9986,[ln]:9729,[Vu]:9985,[Rr]:9987};function ue(P,E,Y){if(Y?(r.texParameteri(P,10242,ee[E.wrapS]),r.texParameteri(P,10243,ee[E.wrapT]),(P===32879||P===35866)&&r.texParameteri(P,32882,ee[E.wrapR]),r.texParameteri(P,10240,te[E.magFilter]),r.texParameteri(P,10241,te[E.minFilter])):(r.texParameteri(P,10242,33071),r.texParameteri(P,10243,33071),(P===32879||P===35866)&&r.texParameteri(P,32882,33071),(E.wrapS!==mn||E.wrapT!==mn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(P,10240,S(E.magFilter)),r.texParameteri(P,10241,S(E.minFilter)),E.minFilter!==Vt&&E.minFilter!==ln&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const ne=e.get("EXT_texture_filter_anisotropic");if(E.magFilter===Vt||E.minFilter!==Us&&E.minFilter!==Rr||E.type===Mi&&e.has("OES_texture_float_linear")===!1||a===!1&&E.type===Dr&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||n.get(E).__currentAnisotropy)&&(r.texParameterf(P,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,i.getMaxAnisotropy())),n.get(E).__currentAnisotropy=E.anisotropy)}}function N(P,E){let Y=!1;P.__webglInit===void 0&&(P.__webglInit=!0,E.addEventListener("dispose",F));const ne=E.source;let re=m.get(ne);re===void 0&&(re={},m.set(ne,re));const fe=Q(E);if(fe!==P.__cacheKey){re[fe]===void 0&&(re[fe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,Y=!0),re[fe].usedTimes++;const Pe=re[P.__cacheKey];Pe!==void 0&&(re[P.__cacheKey].usedTimes--,Pe.usedTimes===0&&O(E)),P.__cacheKey=fe,P.__webglTexture=re[fe].texture}return Y}function Re(P,E,Y){let ne=3553;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(ne=35866),E.isData3DTexture&&(ne=32879);const re=N(P,E),fe=E.source;t.bindTexture(ne,P.__webglTexture,33984+Y);const Pe=n.get(fe);if(fe.version!==Pe.__version||re===!0){t.activeTexture(33984+Y),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);const de=y(E)&&M(E.image)===!1;let $=x(E.image,de,!1,u);$=It(E,$);const xe=M($)||a,we=s.convert(E.format,E.encoding);let Ae=s.convert(E.type),ge=T(E.internalFormat,we,Ae,E.encoding,E.isVideoTexture);ue(ne,E,xe);let Me;const Fe=E.mipmaps,Ze=a&&E.isVideoTexture!==!0,ct=Pe.__version===void 0||re===!0,U=b(E,$,xe);if(E.isDepthTexture)ge=6402,a?E.type===Mi?ge=36012:E.type===xi?ge=33190:E.type===Ki?ge=35056:ge=33189:E.type===Mi&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===bi&&ge===6402&&E.type!==bc&&E.type!==xi&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=xi,Ae=s.convert(E.type)),E.format===nr&&ge===6402&&(ge=34041,E.type!==Ki&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=Ki,Ae=s.convert(E.type))),ct&&(Ze?t.texStorage2D(3553,1,ge,$.width,$.height):t.texImage2D(3553,0,ge,$.width,$.height,0,we,Ae,null));else if(E.isDataTexture)if(Fe.length>0&&xe){Ze&&ct&&t.texStorage2D(3553,U,ge,Fe[0].width,Fe[0].height);for(let W=0,ie=Fe.length;W>=1,ie>>=1}}else if(Fe.length>0&&xe){Ze&&ct&&t.texStorage2D(3553,U,ge,Fe[0].width,Fe[0].height);for(let W=0,ie=Fe.length;W0&&ct++,t.texStorage2D(34067,ct,Me,$[0].width,$[0].height));for(let W=0;W<6;W++)if(de){Fe?t.texSubImage2D(34069+W,0,0,0,$[W].width,$[W].height,Ae,ge,$[W].data):t.texImage2D(34069+W,0,Me,$[W].width,$[W].height,0,Ae,ge,$[W].data);for(let ie=0;ie=34069&&re<=34074)&&r.framebufferTexture2D(36160,ne,re,n.get(Y).__webglTexture,0),t.bindFramebuffer(36160,null)}function Te(P,E,Y){if(r.bindRenderbuffer(36161,P),E.depthBuffer&&!E.stencilBuffer){let ne=33189;if(Y||Xe(E)){const re=E.depthTexture;re&&re.isDepthTexture&&(re.type===Mi?ne=36012:re.type===xi&&(ne=33190));const fe=_t(E);Xe(E)?h.renderbufferStorageMultisampleEXT(36161,fe,ne,E.width,E.height):r.renderbufferStorageMultisample(36161,fe,ne,E.width,E.height)}else r.renderbufferStorage(36161,ne,E.width,E.height);r.framebufferRenderbuffer(36160,36096,36161,P)}else if(E.depthBuffer&&E.stencilBuffer){const ne=_t(E);Y&&Xe(E)===!1?r.renderbufferStorageMultisample(36161,ne,35056,E.width,E.height):Xe(E)?h.renderbufferStorageMultisampleEXT(36161,ne,35056,E.width,E.height):r.renderbufferStorage(36161,34041,E.width,E.height),r.framebufferRenderbuffer(36160,33306,36161,P)}else{const ne=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let re=0;re0&&Xe(P)===!1){const de=fe?E:[E];Y.__webglMultisampledFramebuffer=r.createFramebuffer(),Y.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,Y.__webglMultisampledFramebuffer);for(let $=0;$0&&Xe(P)===!1){const E=P.isWebGLMultipleRenderTargets?P.texture:[P.texture],Y=P.width,ne=P.height;let re=16384;const fe=[],Pe=P.stencilBuffer?33306:36096,de=n.get(P),$=P.isWebGLMultipleRenderTargets===!0;if($)for(let xe=0;xe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function st(P){const E=o.render.frame;_.get(P)!==E&&(_.set(P,E),P.update())}function It(P,E){const Y=P.encoding,ne=P.format,re=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||P.format===yo||Y!==ni&&(Y===ot?a===!1?e.has("EXT_sRGB")===!0&&ne===gn?(P.format=yo,P.minFilter=ln,P.generateMipmaps=!1):E=Tc.sRGBToLinear(E):(ne!==gn||re!==Si)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",Y)),E}this.allocateTextureUnit=H,this.resetTextureUnits=R,this.setTexture2D=K,this.setTexture2DArray=ve,this.setTexture3D=se,this.setTextureCube=j,this.rebindTextures=Ue,this.setupRenderTarget=lt,this.updateRenderTargetMipmap=xt,this.updateMultisampleRenderTarget=Mt,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Xe}function gg(r,e,t){const n=t.isWebGL2;function i(s,o=null){let a;if(s===Si)return 5121;if(s===qu)return 32819;if(s===Yu)return 32820;if(s===Wu)return 5120;if(s===ju)return 5122;if(s===bc)return 5123;if(s===Xu)return 5124;if(s===xi)return 5125;if(s===Mi)return 5126;if(s===Dr)return n?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Zu)return 6406;if(s===gn)return 6408;if(s===Qu)return 6409;if(s===Ku)return 6410;if(s===bi)return 6402;if(s===nr)return 34041;if(s===yo)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Ju)return 6403;if(s===$u)return 36244;if(s===ef)return 33319;if(s===tf)return 33320;if(s===nf)return 36249;if(s===Ns||s===Os||s===Fs||s===zs)if(o===ot)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===Ns)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Os)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Fs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===zs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Ns)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Os)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Fs)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===zs)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===$o||s===ea||s===ta||s===na)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===$o)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ea)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===ta)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===na)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===rf)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===ia||s===ra)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===ia)return o===ot?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===ra)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===sa||s===oa||s===aa||s===la||s===ca||s===ua||s===fa||s===ha||s===da||s===pa||s===ma||s===ga||s===_a||s===va)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===sa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===oa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===aa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===la)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===ca)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===ua)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===fa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===ha)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===da)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===pa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===ma)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===ga)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===_a)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===va)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===ks)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===ks)return o===ot?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===sf||s===xa||s===Ma||s===ba)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===ks)return a.COMPRESSED_RED_RGTC1_EXT;if(s===xa)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Ma)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===ba)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ki?n?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class _g extends sn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class rs extends Et{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vg={type:"move"};class ao{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new rs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new rs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new rs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,n),d=this._getHandJoint(c,v);m!==null&&(d.matrix.fromArray(m.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.jointRadius=m.radius),d.visible=m!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),p=.02,_=.005;c.inputState.pinching&&h>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(vg)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new rs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class xg extends $t{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:bi,u!==bi&&u!==nr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===bi&&(n=xi),n===void 0&&u===nr&&(n=Ki),super(null,i,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Vt,this.minFilter=l!==void 0?l:Vt,this.flipY=!1,this.generateMipmaps=!1}}class Mg extends ar{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,h=null,p=null,_=null;const v=t.getContextAttributes();let m=null,d=null;const g=[],x=[],M=new Set,y=new Map,w=new sn;w.layers.enable(1),w.viewport=new Ut;const C=new sn;C.layers.enable(2),C.viewport=new Ut;const T=[w,C],b=new _g;b.layers.enable(1),b.layers.enable(2);let S=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getGripSpace()},this.getHand=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getHandSpace()};function k(j){const ee=x.indexOf(j.inputSource);if(ee===-1)return;const te=g[ee];te!==void 0&&te.dispatchEvent({type:j.type,data:j.inputSource})}function L(){i.removeEventListener("select",k),i.removeEventListener("selectstart",k),i.removeEventListener("selectend",k),i.removeEventListener("squeeze",k),i.removeEventListener("squeezestart",k),i.removeEventListener("squeezeend",k),i.removeEventListener("end",L),i.removeEventListener("inputsourceschange",O);for(let j=0;j=0&&(x[ue]=null,g[ue].disconnect(te))}for(let ee=0;ee=x.length){x.push(te),ue=Re;break}else if(x[Re]===null){x[Re]=te,ue=Re;break}if(ue===-1)break}const N=g[ue];N&&N.connect(te)}}const B=new I,J=new I;function R(j,ee,te){B.setFromMatrixPosition(ee.matrixWorld),J.setFromMatrixPosition(te.matrixWorld);const ue=B.distanceTo(J),N=ee.projectionMatrix.elements,Re=te.projectionMatrix.elements,Ce=N[14]/(N[10]-1),oe=N[14]/(N[10]+1),Te=(N[9]+1)/N[5],je=(N[9]-1)/N[5],ye=(N[8]-1)/N[0],Ue=(Re[8]+1)/Re[0],lt=Ce*ye,xt=Ce*Ue,Mt=ue/(-ye+Ue),_t=Mt*-ye;ee.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(_t),j.translateZ(Mt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert();const Xe=Ce+Mt,st=oe+Mt,It=lt-_t,P=xt+(ue-_t),E=Te*oe/st*Xe,Y=je*oe/st*Xe;j.projectionMatrix.makePerspective(It,P,E,Y,Xe,st),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}function H(j,ee){ee===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ee.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(i===null)return;b.near=C.near=w.near=j.near,b.far=C.far=w.far=j.far,(S!==b.near||F!==b.far)&&(i.updateRenderState({depthNear:b.near,depthFar:b.far}),S=b.near,F=b.far);const ee=j.parent,te=b.cameras;H(b,ee);for(let ue=0;ueN&&(y.set(ue,ue.lastChangedTime),n.dispatchEvent({type:"planechanged",data:ue}))}}_=null}const se=new Oc;se.setAnimationLoop(ve),this.setAnimationLoop=function(j){K=j},this.dispose=function(){}}}function bg(r,e){function t(m,d){m.matrixAutoUpdate===!0&&m.updateMatrix(),d.value.copy(m.matrix)}function n(m,d){d.color.getRGB(m.fogColor.value,Dc(r)),d.isFog?(m.fogNear.value=d.near,m.fogFar.value=d.far):d.isFogExp2&&(m.fogDensity.value=d.density)}function i(m,d,g,x,M){d.isMeshBasicMaterial||d.isMeshLambertMaterial?s(m,d):d.isMeshToonMaterial?(s(m,d),f(m,d)):d.isMeshPhongMaterial?(s(m,d),u(m,d)):d.isMeshStandardMaterial?(s(m,d),h(m,d),d.isMeshPhysicalMaterial&&p(m,d,M)):d.isMeshMatcapMaterial?(s(m,d),_(m,d)):d.isMeshDepthMaterial?s(m,d):d.isMeshDistanceMaterial?(s(m,d),v(m,d)):d.isMeshNormalMaterial?s(m,d):d.isLineBasicMaterial?(o(m,d),d.isLineDashedMaterial&&a(m,d)):d.isPointsMaterial?l(m,d,g,x):d.isSpriteMaterial?c(m,d):d.isShadowMaterial?(m.color.value.copy(d.color),m.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function s(m,d){m.opacity.value=d.opacity,d.color&&m.diffuse.value.copy(d.color),d.emissive&&m.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.bumpMap&&(m.bumpMap.value=d.bumpMap,t(d.bumpMap,m.bumpMapTransform),m.bumpScale.value=d.bumpScale,d.side===Jt&&(m.bumpScale.value*=-1)),d.normalMap&&(m.normalMap.value=d.normalMap,t(d.normalMap,m.normalMapTransform),m.normalScale.value.copy(d.normalScale),d.side===Jt&&m.normalScale.value.negate()),d.displacementMap&&(m.displacementMap.value=d.displacementMap,t(d.displacementMap,m.displacementMapTransform),m.displacementScale.value=d.displacementScale,m.displacementBias.value=d.displacementBias),d.emissiveMap&&(m.emissiveMap.value=d.emissiveMap,t(d.emissiveMap,m.emissiveMapTransform)),d.specularMap&&(m.specularMap.value=d.specularMap,t(d.specularMap,m.specularMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);const g=e.get(d).envMap;if(g&&(m.envMap.value=g,m.flipEnvMap.value=g.isCubeTexture&&g.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap){m.lightMap.value=d.lightMap;const x=r.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=d.lightMapIntensity*x,t(d.lightMap,m.lightMapTransform)}d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,m.aoMapTransform))}function o(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform))}function a(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,g,x){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*g,m.scale.value=x*.5,d.map&&(m.map.value=d.map,t(d.map,m.uvTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function c(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function u(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function f(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function h(m,d){m.metalness.value=d.metalness,d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,m.metalnessMapTransform)),m.roughness.value=d.roughness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,m.roughnessMapTransform)),e.get(d).envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function p(m,d,g){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,m.sheenColorMapTransform)),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,m.sheenRoughnessMapTransform))),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,m.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(m.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===Jt&&m.clearcoatNormalScale.value.negate())),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,m.iridescenceMapTransform)),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=g.texture,m.transmissionSamplerSize.value.set(g.width,g.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,m.transmissionMapTransform)),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,m.specularColorMapTransform)),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,d){d.matcap&&(m.matcap.value=d.matcap)}function v(m,d){const g=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(g.matrixWorld),m.nearDistance.value=g.shadow.camera.near,m.farDistance.value=g.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Sg(r,e,t,n){let i={},s={},o=[];const a=t.isWebGL2?r.getParameter(35375):0;function l(g,x){const M=x.program;n.uniformBlockBinding(g,M)}function c(g,x){let M=i[g.id];M===void 0&&(_(g),M=u(g),i[g.id]=M,g.addEventListener("dispose",m));const y=x.program;n.updateUBOMapping(g,y);const w=e.render.frame;s[g.id]!==w&&(h(g),s[g.id]=w)}function u(g){const x=f();g.__bindingPointIndex=x;const M=r.createBuffer(),y=g.__size,w=g.usage;return r.bindBuffer(35345,M),r.bufferData(35345,y,w),r.bindBuffer(35345,null),r.bindBufferBase(35345,x,M),M}function f(){for(let g=0;g0){w=M%y;const k=y-w;w!==0&&k-S.boundary<0&&(M+=y-w,b.__offset=M)}M+=S.storage}return w=M%y,w>0&&(M+=y-w),g.__size=M,g.__cache={},this}function v(g){const x={boundary:0,storage:0};return typeof g=="number"?(x.boundary=4,x.storage=4):g.isVector2?(x.boundary=8,x.storage=8):g.isVector3||g.isColor?(x.boundary=16,x.storage=12):g.isVector4?(x.boundary=16,x.storage=16):g.isMatrix3?(x.boundary=48,x.storage=48):g.isMatrix4?(x.boundary=64,x.storage=64):g.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",g),x}function m(g){const x=g.target;x.removeEventListener("dispose",m);const M=o.indexOf(x.__bindingPointIndex);o.splice(M,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function d(){for(const g in i)r.deleteBuffer(i[g]);o=[],i={},s={}}return{bind:l,update:c,dispose:d}}function yg(){const r=Nr("canvas");return r.style.display="block",r}class Hc{constructor(e={}){const{canvas:t=yg(),context:n=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;n!==null?h=n.getContextAttributes().alpha:h=o;let p=null,_=null;const v=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ni,this.useLegacyLights=!0,this.toneMapping=Rn,this.toneMappingExposure=1;const d=this;let g=!1,x=0,M=0,y=null,w=-1,C=null;const T=new Ut,b=new Ut;let S=null,F=t.width,k=t.height,L=1,O=null,B=null;const J=new Ut(0,0,F,k),R=new Ut(0,0,F,k);let H=!1;const Q=new Uo;let K=!1,ve=!1,se=null;const j=new vt,ee=new I,te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ue(){return y===null?L:1}let N=n;function Re(A,z){for(let Z=0;Z0?_=m[m.length-1]:_=null,v.pop(),v.length>0?p=v[v.length-1]:p=null};function Tt(A,z,Z,G){if(A.visible===!1)return;if(A.layers.test(z.layers)){if(A.isGroup)Z=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(z);else if(A.isLight)_.pushLight(A),A.castShadow&&_.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||Q.intersectsSprite(A)){G&&ee.setFromMatrixPosition(A.matrixWorld).applyMatrix4(j);const me=Xe.update(A),De=A.material;De.visible&&p.push(A,me,De,Z,ee.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(A.isSkinnedMesh&&A.skeleton.frame!==je.render.frame&&(A.skeleton.update(),A.skeleton.frame=je.render.frame),!A.frustumCulled||Q.intersectsObject(A))){G&&ee.setFromMatrixPosition(A.matrixWorld).applyMatrix4(j);const me=Xe.update(A),De=A.material;if(Array.isArray(De)){const ze=me.groups;for(let Be=0,Ge=ze.length;Be0&&ht(X,ae,z,Z),G&&Te.viewport(T.copy(G)),X.length>0&&Lt(X,z,Z),ae.length>0&&Lt(ae,z,Z),me.length>0&&Lt(me,z,Z),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function ht(A,z,Z,G){if(se===null){const De=oe.isWebGL2;se=new ii(1024,1024,{generateMipmaps:!0,type:Ce.has("EXT_color_buffer_half_float")?Dr:Si,minFilter:Rr,samples:De&&a===!0?4:0})}const X=d.getRenderTarget();d.setRenderTarget(se),d.clear();const ae=d.toneMapping;d.toneMapping=Rn,Lt(A,Z,G),Ue.updateMultisampleRenderTarget(se),Ue.updateRenderTargetMipmap(se);let me=!1;for(let De=0,ze=z.length;De0&&Ue.useMultisampledRTT(A)===!1?X=ye.get(A).__webglMultisampledFramebuffer:X=Ge,T.copy(A.viewport),b.copy(A.scissor),S=A.scissorTest}else T.copy(J).multiplyScalar(L).floor(),b.copy(R).multiplyScalar(L).floor(),S=H;if(Te.bindFramebuffer(36160,X)&&oe.drawBuffers&&G&&Te.drawBuffers(A,X),Te.viewport(T),Te.scissor(b),Te.setScissorTest(S),ae){const ze=ye.get(A.texture);N.framebufferTexture2D(36160,36064,34069+z,ze.__webglTexture,Z)}else if(me){const ze=ye.get(A.texture),Be=z||0;N.framebufferTextureLayer(36160,36064,ze.__webglTexture,Z||0,Be)}w=-1},this.readRenderTargetPixels=function(A,z,Z,G,X,ae,me){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let De=ye.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&me!==void 0&&(De=De[me]),De){Te.bindFramebuffer(36160,De);try{const ze=A.texture,Be=ze.format,Ge=ze.type;if(Be!==gn&&$.convert(Be)!==N.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ve=Ge===Dr&&(Ce.has("EXT_color_buffer_half_float")||oe.isWebGL2&&Ce.has("EXT_color_buffer_float"));if(Ge!==Si&&$.convert(Ge)!==N.getParameter(35738)&&!(Ge===Mi&&(oe.isWebGL2||Ce.has("OES_texture_float")||Ce.has("WEBGL_color_buffer_float")))&&!Ve){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}z>=0&&z<=A.width-G&&Z>=0&&Z<=A.height-X&&N.readPixels(z,Z,G,X,$.convert(Be),$.convert(Ge),ae)}finally{const ze=y!==null?ye.get(y).__webglFramebuffer:null;Te.bindFramebuffer(36160,ze)}}},this.copyFramebufferToTexture=function(A,z,Z=0){const G=Math.pow(2,-Z),X=Math.floor(z.image.width*G),ae=Math.floor(z.image.height*G);Ue.setTexture2D(z,0),N.copyTexSubImage2D(3553,Z,0,0,A.x,A.y,X,ae),Te.unbindTexture()},this.copyTextureToTexture=function(A,z,Z,G=0){const X=z.image.width,ae=z.image.height,me=$.convert(Z.format),De=$.convert(Z.type);Ue.setTexture2D(Z,0),N.pixelStorei(37440,Z.flipY),N.pixelStorei(37441,Z.premultiplyAlpha),N.pixelStorei(3317,Z.unpackAlignment),z.isDataTexture?N.texSubImage2D(3553,G,A.x,A.y,X,ae,me,De,z.image.data):z.isCompressedTexture?N.compressedTexSubImage2D(3553,G,A.x,A.y,z.mipmaps[0].width,z.mipmaps[0].height,me,z.mipmaps[0].data):N.texSubImage2D(3553,G,A.x,A.y,me,De,z.image),G===0&&Z.generateMipmaps&&N.generateMipmap(3553),Te.unbindTexture()},this.copyTextureToTexture3D=function(A,z,Z,G,X=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ae=A.max.x-A.min.x+1,me=A.max.y-A.min.y+1,De=A.max.z-A.min.z+1,ze=$.convert(G.format),Be=$.convert(G.type);let Ge;if(G.isData3DTexture)Ue.setTexture3D(G,0),Ge=32879;else if(G.isDataArrayTexture)Ue.setTexture2DArray(G,0),Ge=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}N.pixelStorei(37440,G.flipY),N.pixelStorei(37441,G.premultiplyAlpha),N.pixelStorei(3317,G.unpackAlignment);const Ve=N.getParameter(3314),tt=N.getParameter(32878),Bt=N.getParameter(3316),cn=N.getParameter(3315),oi=N.getParameter(32877),yt=Z.isCompressedTexture?Z.mipmaps[0]:Z.image;N.pixelStorei(3314,yt.width),N.pixelStorei(32878,yt.height),N.pixelStorei(3316,A.min.x),N.pixelStorei(3315,A.min.y),N.pixelStorei(32877,A.min.z),Z.isDataTexture||Z.isData3DTexture?N.texSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,Be,yt.data):Z.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),N.compressedTexSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,yt.data)):N.texSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,Be,yt),N.pixelStorei(3314,Ve),N.pixelStorei(32878,tt),N.pixelStorei(3316,Bt),N.pixelStorei(3315,cn),N.pixelStorei(32877,oi),X===0&&G.generateMipmaps&&N.generateMipmap(Ge),Te.unbindTexture()},this.initTexture=function(A){A.isCubeTexture?Ue.setTextureCube(A,0):A.isData3DTexture?Ue.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?Ue.setTexture2DArray(A,0):Ue.setTexture2D(A,0),Te.unbindTexture()},this.resetState=function(){x=0,M=0,y=null,Te.reset(),xe.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}}class wg extends Hc{}wg.prototype.isWebGL1Renderer=!0;class Eg extends Et{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Vc extends cr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Je(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const al=new I,ll=new I,cl=new vt,lo=new Do,ss=new Ss;class Kn extends Et{constructor(e=new Xt,t=new Vc){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;il)continue;h.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(h);Te.far||t.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const d=Math.max(0,o.start),g=Math.min(m.count,o.start+o.count);for(let x=d,M=g-1;xl)continue;h.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(h);we.far||t.push({distance:w,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new pt(f,3)),this.setAttribute("normal",new pt(h,3)),this.setAttribute("uv",new pt(p,2));function g(){const M=new I,y=new I;let w=0;const C=(t-e)/n;for(let T=0;T<=s;T++){const b=[],S=T/s,F=S*(t-e)+e;for(let k=0;k<=i;k++){const L=k/i,O=L*l+a,B=Math.sin(O),J=Math.cos(O);y.x=F*B,y.y=-S*n+m,y.z=F*J,f.push(y.x,y.y,y.z),M.set(B,C,J).normalize(),h.push(M.x,M.y,M.z),p.push(L,1-S),b.push(_++)}v.push(b)}for(let T=0;T.9&&C<.1&&(x<.2&&(o[g+0]+=1),M<.2&&(o[g+2]+=1),y<.2&&(o[g+4]+=1))}}function h(g){s.push(g.x,g.y,g.z)}function p(g,x){const M=g*3;x.x=e[M+0],x.y=e[M+1],x.z=e[M+2]}function _(){const g=new I,x=new I,M=new I,y=new I,w=new Qe,C=new Qe,T=new Qe;for(let b=0,S=0;b0)&&p.push(x,M,w),(d!==n-1||l{const r={show:Ye(!1),cameraPosition:Ye({x:0,y:0,z:1}),cameraLookAt:Ye({x:0,y:0,z:10}),objectPosition:Ye({x:0,y:0,z:10}),objectEuler:Ye(new yi(0,0,0,"ZXY")),entity:Ye(0)};return{...r,...{setupModel(t){r.cameraPosition.set(Vi(t.cameraPosition)),r.cameraLookAt.set(Vi(t.cameraLookAt)),r.objectPosition.set(Vi(t.objectPosition)),r.objectEuler.set(new yi(Kt.degToRad(t.objectRotation.x),Kt.degToRad(t.objectRotation.z),Kt.degToRad(t.objectRotation.y),"YZX")),r.show.set(!0),r.entity.set(t.entity)},updateCamera(t){r.cameraPosition.set(Vi(t.cameraPosition)),r.cameraLookAt.set(Vi(t.cameraLookAt))},updateCameraPosition(t){r.cameraPosition.set(t.cameraPosition)},updateCameraLookAt(t){r.cameraLookAt.set(t.cameraLookAt)},sendMovementUpdate(t){at("moveObject",t)},sendRotationUpdate(t){const n=fs(t);at("rotateObject",{x:Kt.radToDeg(n.x).toFixed(2),y:Kt.radToDeg(n.y).toFixed(2),z:Kt.radToDeg(n.z).toFixed(2)})}}}};var _n=Pg();function Lg(r){let e,t,n,i;const s=r[1].default,o=xn(s,r,r[0],null);return{c(){e=q("div"),o&&o.c(),V(e,"class","absolute")},m(a,l){Oe(a,e,l),o&&o.m(e,null),t=!0,n||(i=ac(Rg.call(null,e,{to:"body"})),n=!0)},p(a,[l]){o&&o.p&&(!t||l&1)&&bn(o,s,a,a[0],t?Mn(s,a[0],l,null):Sn(a[0]),null)},i(a){t||(_e(o,a),t=!0)},o(a){Se(o,a),t=!1},d(a){a&&Ne(e),o&&o.d(a),n=!1,i()}}}function Rg(r,{to:e}){const t=document.querySelector(e);return t&&t.appendChild(r),{}}function Dg(r,e,t){let{$$slots:n={},$$scope:i}=e;return r.$$set=s=>{"$$scope"in s&&t(0,i=s.$$scope)},[i,n]}class Yc extends gt{constructor(e){super(),mt(this,e,Dg,Lg,ft,{})}}function pl(r){let e,t;const n=r[2].default,i=xn(n,r,r[5],null);return{c(){e=q("main"),i&&i.c(),V(e,"class","svelte-1fnr7mh")},m(s,o){Oe(s,e,o),i&&i.m(e,null),t=!0},p(s,o){i&&i.p&&(!t||o&32)&&bn(i,n,s,s[5],t?Mn(n,s[5],o,null):Sn(s[5]),null)},i(s){t||(_e(i,s),t=!0)},o(s){Se(i,s),t=!1},d(s){s&&Ne(e),i&&i.d(s)}}}function ml(r){let e,t;return e=new Yc({props:{$$slots:{default:[Ig]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&34&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function Ig(r){let e,t,n,i,s,o,a,l,c,u;return{c(){e=q("div"),t=q("div"),n=q("p"),n.textContent="Are you sure you want to exit? You have items in your cart.",i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[3]),Le(l,"click",r[4])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,qt(u)}}}function Ug(r){let e,t,n,i=r[0]&&pl(r),s=r[1]&&r[0]&&ml(r);return{c(){i&&i.c(),e=le(),s&&s.c(),t=ri()},m(o,a){i&&i.m(o,a),Oe(o,e,a),s&&s.m(o,a),Oe(o,t,a),n=!0},p(o,[a]){o[0]?i?(i.p(o,a),a&1&&_e(i,1)):(i=pl(o),i.c(),_e(i,1),i.m(e.parentNode,e)):i&&(Wn(),Se(i,1,1,()=>{i=null}),jn()),o[1]&&o[0]?s?(s.p(o,a),a&3&&_e(s,1)):(s=ml(o),s.c(),_e(s,1),s.m(t.parentNode,t)):s&&(Wn(),Se(s,1,1,()=>{s=null}),jn())},i(o){n||(_e(i),_e(s),n=!0)},o(o){Se(i),Se(s),n=!1},d(o){i&&i.d(o),o&&Ne(e),s&&s.d(o),o&&Ne(t)}}}function Ng(r,e,t){let n,i;Ee(r,Cn,f=>t(6,n=f)),Ee(r,zt,f=>t(7,i=f));let{$$slots:s={},$$scope:o}=e,a;ji.subscribe(f=>{t(0,a=f)}),an("setVisible",f=>{ji.set(f),f&&Ie(zt,i=!1,i)});let l=!1;or(()=>{const f=h=>{a&&["Escape"].includes(h.code)&&(n.length>0?t(1,l=!0):(at("hoverOut"),at("hideUI"),t(1,l=!1),ji.set(!1),_n.show.set(!1),vn.set(null)))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)});const c=()=>{t(1,l=!1)},u=()=>{at("hideUI"),t(1,l=!1),ji.set(!1),_n.show.set(!1)};return r.$$set=f=>{"$$scope"in f&&t(5,o=f.$$scope)},[a,l,s,c,u,o]}class Og extends gt{constructor(e){super(),mt(this,e,Ng,Ug,ft,{})}}const Fg=()=>!window.invokeNative,Ao=(r,e=0)=>{if(Fg())for(const t of r)setTimeout(()=>{window.dispatchEvent(new MessageEvent("message",{data:{action:t.action,data:t.data}}))},e)};function gl(r,e,t){const n=r.slice();return n[6]=e[t],n}function _l(r,e,t){const n=r.slice();return n[9]=e[t],n}function vl(r){let e,t=r[1],n=[];for(let i=0;i{t(0,n=!n)},c=>{if(c.custom==!0){c.customFunction();return}Ao([{action:c.action,data:c.data}])}]}class Bg extends gt{constructor(e){super(),mt(this,e,kg,zg,ft,{})}}function bl(r,e,t){const n=r.slice();return n[15]=e[t],n[17]=t,n}function Sl(r){let e,t,n,i=r[15].label+"",s,o,a,l,c,u,f,h=r[15].price+"",p,_,v,m,d,g;function x(){return r[8](r[15])}function M(){return r[10](r[15])}return{c(){e=q("button"),t=q("div"),n=q("p"),s=rt(i),o=le(),a=q("div"),l=q("p"),l.textContent="Price:",c=le(),u=q("p"),f=rt("$"),p=rt(h),_=le(),v=q("div"),v.innerHTML='',m=le(),V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(l,"class","text-[color:var(--color-text)] text-[1.2rem]"),V(u,"class","text-[color:var(--color-accent)] ml-2 font-bold text-[1.2rem]"),V(a,"class","flex"),V(t,"class","w-full h-full flex flex-col justify-center items-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] aspect-square h-full grid place-items-center justify-center items-center"),V(e,"class","h-full w-[30rem] bg-[color:var(--color-secondary)] flex flex-row items-center hover:cursor-pointer")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"mouseenter",x),Le(v,"mouseleave",r[9]),Le(e,"click",M),Le(e,"mouseleave",r[11])],d=!0)},p(y,w){r=y,w&8&&i!==(i=r[15].label+"")&&At(s,i),w&8&&h!==(h=r[15].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,qt(g)}}}function yl(r){let e,t;return e=new Yc({props:{$$slots:{default:[Gg]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&262246&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function Gg(r){let e,t,n,i,s,o,a,l,c,u;return{c(){e=q("div"),t=q("div"),n=q("p"),n.textContent=`Are you sure you want to stop placing this current\r - furniture?`,i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[13]),Le(l,"click",r[14])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,qt(u)}}}function Hg(r){let e,t,n,i,s,o,a,l=r[3].items,c=[];for(let f=0;f{u=null}),jn())},i(f){s||(_e(u),s=!0)},o(f){Se(u),s=!1},d(f){f&&Ne(e),rr(c,f),r[12](null),f&&Ne(n),u&&u.d(f),f&&Ne(i),o=!1,a()}}}function Vg(r,e,t){let n,i,s,o;Ee(r,$n,g=>t(3,n=g)),Ee(r,Zi,g=>t(4,i=g)),Ee(r,vn,g=>t(5,s=g)),Ee(r,zt,g=>t(6,o=g));let a;function l(g){g=window.event||g;var x=Math.max(-1,Math.min(1,g.wheelDelta||-g.detail));t(0,a.scrollLeft-=x*50,a),g.preventDefault()}let c=!1,u=null;const f=g=>{at("hoverIn",g)},h=()=>{at("hoverOut")},p=g=>{if(at("hoverOut"),g.type){const x=i.filter(y=>y.type===g.type);let M=g.max||1;if(x.length>=M){at("showNotification",{type:"error",message:`You can only have ${M} of this item!`});return}}s!=null?(t(1,c=!0),t(2,u=g)):(at("previewFurniture",g),Ie(vn,s=g,s),Ie(zt,o=!0,o))},_=()=>{at("hoverOut")};function v(g){Vn[g?"unshift":"push"](()=>{a=g,t(0,a)})}return[a,c,u,n,i,s,o,l,f,h,p,_,v,()=>{t(1,c=!1),t(2,u=null)},()=>{at("previewFurniture",u),Ie(vn,s=u,s),Ie(zt,o=!0,o),t(1,c=!1),t(2,u=null)}]}class Wg extends gt{constructor(e){super(),mt(this,e,Vg,Hg,ft,{})}}function jg(r,e,t){let n,i,s,o,a,l;Ee(r,Zi,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),Ee(r,zt,u=>t(3,o=u)),Ee(r,ms,u=>t(4,a=u)),Ee(r,ji,u=>t(5,l=u)),Ao([{action:"setVisible",data:!0}]),Ao([{action:"setBrowserMode",data:!0}]);function c(u){u.key==="="&&Ie(ji,l=!0,l)}return an("setBrowserMode",u=>{Ms.set(u),console.log("browser mode enabled"),u?window.addEventListener("keydown",c):window.removeEventListener("keydown",c)}),an("setupModel",u=>{_n.show.set(!0),_n.setupModel(u)}),an("updateCamera",u=>{_n.updateCamera(u)}),an("setFurnituresData",u=>{ms.set(u),$n.set(a[0])}),an("addToCart",u=>{Ie(Cn,i=[...i,u],i),_n.show.set(!1),Ie(zt,o=!1,o)}),an("removeFromCart",u=>{Ie(Cn,i=i.filter(f=>f.entity!=u.entity),i),Ie(Cn,i=[...i],i),Ie(vn,s=null,s),_n.show.set(!1)}),an("clearCart",()=>{Ie(Cn,i=[],i)}),an("setOwnedItems",u=>{Ie(Zi,n=u,n)}),an("removeOwnedItem",u=>{let f=n.filter(h=>h.id!=u.id);Ie(Zi,n=[...f],n)}),[]}class Xg extends gt{constructor(e){super(),mt(this,e,jg,null,ft,{})}}function wl(r,e,t){const n=r.slice();return n[20]=e[t],n[22]=t,n}function El(r){let e,t,n;return{c(){e=q("input"),e.autofocus=!0,V(e,"class","min-w-[10rem] h-[4.5rem] px-[1rem] text-[1.6rem] bg-[color:var(--color-tertiary)]"),V(e,"type","text"),V(e,"placeholder","Search")},m(i,s){Oe(i,e,s),Tn(e,r[1]),e.focus(),t||(n=Le(e,"input",r[13]),t=!0)},p(i,s){s&2&&e.value!==i[1]&&Tn(e,i[1])},d(i){i&&Ne(e),t=!1,n()}}}function Tl(r){let e,t=r[20].category+"",n,i,s;function o(){return r[15](r[22])}return{c(){e=q("button"),n=rt(t),V(e,"class","whitespace-nowrap w-fit px-10 h-[4.5rem] text-[1.6rem] bg-[color:var(--color-secondary)] grid place-items-center transition-all duration-200 ease-in-out svelte-vkl3yg"),ps(e,"selected",r[0]===r[22])},m(a,l){Oe(a,e,l),D(e,n),i||(s=Le(e,"click",o),i=!0)},p(a,l){r=a,l&4&&t!==(t=r[20].category+"")&&At(n,t),l&1&&ps(e,"selected",r[0]===r[22])},d(a){a&&Ne(e),i=!1,s()}}}function qg(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m=r[9].length+"",d,g,x,M,y,w,C=r[10].length+"",T,b,S,F,k,L,O,B=r[4]&&El(r),J=r[2],R=[];for(let H=0;H',i=le(),B&&B.c(),o=le(),a=q("div"),l=q("button"),l.textContent="All Objects",c=le();for(let H=0;Ht(2,n=C)),Ee(r,$n,C=>t(5,i=C)),Ee(r,zt,C=>t(6,s=C)),Ee(r,Er,C=>t(7,o=C)),Ee(r,Tr,C=>t(8,a=C)),Ee(r,Zi,C=>t(9,l=C)),Ee(r,Cn,C=>t(10,c=C));let u=-1,f;function h(C){C=window.event||C;var T=Math.max(-1,Math.min(1,C.wheelDelta||-C.detail));t(3,f.scrollLeft-=T*50,f),C.preventDefault()}let p=!1,_="";const v=()=>{t(4,p=!p),s&&Ie(zt,s=!1,s)};function m(){_=this.value,t(1,_)}const d=()=>{t(0,u=-1);const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i),s&&Ie(zt,s=!1,s)},g=C=>{t(0,u=C),Ie($n,i=n[C],i),s&&Ie(zt,s=!1,s)};function x(C){Vn[C?"unshift":"push"](()=>{f=C,t(3,f)})}const M=()=>{Ie(Er,o=!1,o),Ie(Tr,a=!a,a)},y=()=>{Ie(Tr,a=!1,a),Ie(Er,o=!o,o)},w=()=>{Ie(zt,s=!s,s)};return r.$$.update=()=>{if(r.$$.dirty&7)if(_.length>0){let C=null;u==-1?C=n.flatMap(b=>b.items):C=n[u].items;const T=C.filter(b=>b.label.toLowerCase().includes(_.toLowerCase()));Ie($n,i={category:"Search Results",items:T},i)}else if(u===-1){const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i)}else Ie($n,i=n[u],i)},[u,_,n,f,p,i,s,o,a,l,c,h,v,m,d,g,x,M,y,w]}class Zg extends gt{constructor(e){super(),mt(this,e,Yg,qg,ft,{})}}function Al(r,e,t){const n=r.slice();return n[7]=e[t],n[9]=t,n}function Cl(r){let e,t,n,i,s,o,a,l,c,u,f,h=r[1].reduce(Ll,0)+"",p,_,v,m,d,g,x,M,y=r[1],w=[];for(let C=0;CYOUR SHOPPING CART

",n=le(),i=q("div");for(let C=0;C',d=le(),g=q("button"),g.innerHTML="

Purchase

",V(t,"class","font-medium"),V(i,"class","flex flex-col gap-2 overflow-scroll h-[73%] scroll-style scroll-style-vertical"),V(a,"class","text-[1.6rem] w-full h-full flex items-center justify-between"),V(m,"class","bg-[color:var(--color-secondary)] mt-2 font-medium h-full w-[20%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(g,"class","bg-[color:var(--color-accent)] text-[2rem] mt-2 font-medium h-full w-[79%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(v,"class","flex w-full h-full justify-between"),V(o,"class","flex flex-col gap-2 items-center justify-center h-[5rem] mt-10"),V(e,"class","w-[40rem] h-[60rem] bg-[color:var(--color-primary)] absolute right-0 -top-[65rem] flex flex-col gap-[1rem] p-12")},m(C,T){Oe(C,e,T),D(e,t),D(e,n),D(e,i);for(let b=0;b',m=le(),V(n,"class","text-[2rem]"),V(u,"class","text-[color:var(--color-accent)] font-bold ml-2"),V(a,"class","flex text-[1.5rem]"),V(t,"class","flex flex-col gap-2 w-full text-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square"),V(e,"class","flex flex-row gap-2 w-full min-h-[8rem] justify-between bg-[color:var(--color-secondary)] items-center")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"click",x),Le(e,"click",M)],d=!0)},p(y,w){r=y,w&2&&i!==(i=r[7].label+"")&&At(s,i),w&2&&h!==(h=r[7].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,qt(g)}}}function Qg(r){let e,t=r[0]&&Cl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Cl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}const Ll=(r,e)=>r+e.price;function Kg(r,e,t){let n,i,s;return Ee(r,Er,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),[n,i,s,u=>{at("removeCartItem",u)},u=>{at("selectCartItem",u)},()=>Ie(Er,n=!1,n),()=>{Ie(vn,s=null,s),at("buyCartItems")}]}class Jg extends gt{constructor(e){super(),mt(this,e,Kg,Qg,ft,{})}}function Rl(r,e,t){const n=r.slice();return n[5]=e[t],n[7]=t,n}function Dl(r){let e,t,n,i,s,o,a,l,c,u=r[1],f=[];for(let h=0;h',o=le(),a=q("div");for(let h=0;h',V(e,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square")},m(s,o){Oe(s,e,o),t||(n=Le(e,"click",i),t=!0)},p(s,o){r=s},d(s){s&&Ne(e),t=!1,n()}}}function Ul(r){let e,t,n,i,s,o=r[5].label+"",a,l,c,u,f;function h(){return r[3](r[5])}let p=!r[5].type&&Il(r);return{c(){e=q("div"),t=q("button"),t.innerHTML='',n=le(),i=q("div"),s=q("h1"),a=rt(o),l=le(),p&&p.c(),c=le(),V(t,"class","bg-[color:var(--color-tertiary)] text-[2rem] w-[4rem] h-[4rem] text-center aspect-square"),V(s,"class","text-[2rem]"),V(i,"class","flex flex-col gap-2 w-full"),V(e,"class","flex flex-row gap-2 w-full justify-between bg-[color:var(--color-secondary)] p-4 items-center")},m(_,v){Oe(_,e,v),D(e,t),D(e,n),D(e,i),D(i,s),D(s,a),D(e,l),p&&p.m(e,null),D(e,c),u||(f=Le(t,"click",h),u=!0)},p(_,v){r=_,v&2&&o!==(o=r[5].label+"")&&At(a,o),r[5].type?p&&(p.d(1),p=null):p?p.p(r,v):(p=Il(r),p.c(),p.m(e,c))},d(_){_&&Ne(e),p&&p.d(),u=!1,f()}}}function $g(r){let e,t=r[0]&&Dl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Dl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}function e_(r,e,t){let n,i;return Ee(r,Tr,l=>t(0,n=l)),Ee(r,Zi,l=>t(1,i=l)),[n,i,()=>Ie(Tr,n=!1,n),l=>{at("selectOwnedItem",l)},l=>{at("removeOwnedItem",l)}]}class t_ extends gt{constructor(e){super(),mt(this,e,e_,$g,ft,{})}}function n_(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m,d,g,x=r[1].toFixed(1)+"",M,y,w,C,T,b,S;return t=new Zg({}),i=new Wg({}),o=new Jg({}),l=new t_({}),{c(){e=q("div"),nt(t.$$.fragment),n=le(),nt(i.$$.fragment),s=le(),nt(o.$$.fragment),a=le(),nt(l.$$.fragment),c=le(),u=q("div"),f=q("i"),h=le(),p=q("p"),p.textContent="C",_=le(),v=q("div"),m=q("i"),d=le(),g=q("p"),M=rt(x),y=le(),w=q("input"),V(f,"class","fa-solid fa-video text-[white]"),V(p,"class","font-semibold"),jo(u,"border-color",r[0]?"white":"var(--color-tertiary)"),V(u,"class","absolute -top-[5rem] text-[2rem] right-0 w-[8rem] border-[0.3rem] h-[4rem] bg-[color:var(--color-primary)] flex flex-row gap-[1rem] items-center justify-center"),V(m,"class","fa-solid fa-eye text-[white]"),V(g,"class","font-semibold text-center w-[4rem]"),V(w,"id","slider"),V(w,"type","range"),V(w,"min","1.0"),V(w,"max","12.5"),V(w,"step","0.5"),V(w,"class","w-full"),V(v,"class","flex flex-row gap-[1rem] items-center absolute left-0 -top-[5rem] w-[30rem] h-fit p-4 bg-[color:var(--color-primary)]"),V(e,"class",C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(r[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all")},m(F,k){Oe(F,e,k),$e(t,e,null),D(e,n),$e(i,e,null),D(e,s),$e(o,e,null),D(e,a),$e(l,e,null),D(e,c),D(e,u),D(u,f),D(u,h),D(u,p),D(e,_),D(e,v),D(v,m),D(v,d),D(v,g),D(g,M),D(v,y),D(v,w),Tn(w,r[1]),T=!0,b||(S=[Le(w,"change",r[3]),Le(w,"input",r[3]),Le(w,"change",r[4])],b=!0)},p(F,[k]){(!T||k&1)&&jo(u,"border-color",F[0]?"white":"var(--color-tertiary)"),(!T||k&2)&&x!==(x=F[1].toFixed(1)+"")&&At(M,x),k&2&&Tn(w,F[1]),(!T||k&4&&C!==(C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(F[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all"))&&V(e,"class",C)},i(F){T||(_e(t.$$.fragment,F),_e(i.$$.fragment,F),_e(o.$$.fragment,F),_e(l.$$.fragment,F),T=!0)},o(F){Se(t.$$.fragment,F),Se(i.$$.fragment,F),Se(o.$$.fragment,F),Se(l.$$.fragment,F),T=!1},d(F){F&&Ne(e),et(t),et(i),et(o),et(l),b=!1,qt(S)}}}function i_(r,e,t){let n;Ee(r,zt,c=>t(2,n=c));let i=!1,s=5;function o(c){c.target instanceof HTMLInputElement||c.target instanceof HTMLTextAreaElement||c.key==="c"&&(at("freecamMode",!0),Ie(zt,n=!0,n),t(0,i=!0))}an("freecamMode",c=>{c==!1&&(Ie(zt,n=!1,n),t(0,i=!1))}),or(()=>{window.addEventListener("keypress",o),at("freecamMode",!1),at("setHoverDistance",s),Ie(zt,n=!1,n),t(0,i=!1)});function a(){s=cs(this.value),t(1,s)}return[i,s,n,a,()=>{at("setHoverDistance",s)}]}class r_ extends gt{constructor(e){super(),mt(this,e,i_,n_,ft,{})}}const s_={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` + furniture?`,i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[13]),Le(l,"click",r[14])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,qt(u)}}}function Hg(r){let e,t,n,i,s,o,a,l=r[3].items,c=[];for(let f=0;f{u=null}),jn())},i(f){s||(_e(u),s=!0)},o(f){Se(u),s=!1},d(f){f&&Ne(e),rr(c,f),r[12](null),f&&Ne(n),u&&u.d(f),f&&Ne(i),o=!1,a()}}}function Vg(r,e,t){let n,i,s,o;Ee(r,$n,g=>t(3,n=g)),Ee(r,Zi,g=>t(4,i=g)),Ee(r,vn,g=>t(5,s=g)),Ee(r,zt,g=>t(6,o=g));let a;function l(g){g=window.event||g;var x=Math.max(-1,Math.min(1,g.wheelDelta||-g.detail));t(0,a.scrollLeft-=x*50,a),g.preventDefault()}let c=!1,u=null;const f=g=>{at("hoverIn",g)},h=()=>{at("hoverOut")},p=g=>{if(at("hoverOut"),g.type){const x=i.filter(y=>y.type===g.type);let M=g.max||1;if(x.length>=M){at("showNotification",{type:"error",message:`You can only have ${M} of this item!`});return}}s!=null?(t(1,c=!0),t(2,u=g)):(at("previewFurniture",g),Ie(vn,s=g,s),Ie(zt,o=!0,o))},_=()=>{at("hoverOut")};function v(g){Vn[g?"unshift":"push"](()=>{a=g,t(0,a)})}return[a,c,u,n,i,s,o,l,f,h,p,_,v,()=>{t(1,c=!1),t(2,u=null)},()=>{at("previewFurniture",u),Ie(vn,s=u,s),Ie(zt,o=!0,o),t(1,c=!1),t(2,u=null)}]}class Wg extends gt{constructor(e){super(),mt(this,e,Vg,Hg,ft,{})}}function jg(r,e,t){let n,i,s,o,a,l;Ee(r,Zi,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),Ee(r,zt,u=>t(3,o=u)),Ee(r,ms,u=>t(4,a=u)),Ee(r,ji,u=>t(5,l=u)),Ao([{action:"setVisible",data:!0}]),Ao([{action:"setBrowserMode",data:!0}]);function c(u){u.key==="="&&Ie(ji,l=!0,l)}return an("setBrowserMode",u=>{Ms.set(u),console.log("browser mode enabled"),u?window.addEventListener("keydown",c):window.removeEventListener("keydown",c)}),an("setupModel",u=>{_n.show.set(!0),_n.setupModel(u)}),an("updateCamera",u=>{_n.updateCamera(u)}),an("setFurnituresData",u=>{ms.set(u),$n.set(a[0])}),an("addToCart",u=>{Ie(Cn,i=[...i,u],i),_n.show.set(!1),Ie(zt,o=!1,o)}),an("removeFromCart",u=>{Ie(Cn,i=i.filter(f=>f.entity!=u.entity),i),Ie(Cn,i=[...i],i),Ie(vn,s=null,s),_n.show.set(!1)}),an("clearCart",()=>{Ie(Cn,i=[],i)}),an("setOwnedItems",u=>{Ie(Zi,n=u,n)}),an("removeOwnedItem",u=>{let f=n.filter(h=>h.id!=u.id);Ie(Zi,n=[...f],n)}),[]}class Xg extends gt{constructor(e){super(),mt(this,e,jg,null,ft,{})}}function wl(r,e,t){const n=r.slice();return n[20]=e[t],n[22]=t,n}function El(r){let e,t,n;return{c(){e=q("input"),e.autofocus=!0,V(e,"class","min-w-[10rem] h-[4.5rem] px-[1rem] text-[1.6rem] bg-[color:var(--color-tertiary)]"),V(e,"type","text"),V(e,"placeholder","Search")},m(i,s){Oe(i,e,s),Tn(e,r[1]),e.focus(),t||(n=Le(e,"input",r[13]),t=!0)},p(i,s){s&2&&e.value!==i[1]&&Tn(e,i[1])},d(i){i&&Ne(e),t=!1,n()}}}function Tl(r){let e,t=r[20].category+"",n,i,s;function o(){return r[15](r[22])}return{c(){e=q("button"),n=rt(t),V(e,"class","whitespace-nowrap w-fit px-10 h-[4.5rem] text-[1.6rem] bg-[color:var(--color-secondary)] grid place-items-center transition-all duration-200 ease-in-out svelte-vkl3yg"),ps(e,"selected",r[0]===r[22])},m(a,l){Oe(a,e,l),D(e,n),i||(s=Le(e,"click",o),i=!0)},p(a,l){r=a,l&4&&t!==(t=r[20].category+"")&&At(n,t),l&1&&ps(e,"selected",r[0]===r[22])},d(a){a&&Ne(e),i=!1,s()}}}function qg(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m=r[9].length+"",d,g,x,M,y,w,C=r[10].length+"",T,b,S,F,k,L,O,B=r[4]&&El(r),J=r[2],R=[];for(let H=0;H',i=le(),B&&B.c(),o=le(),a=q("div"),l=q("button"),l.textContent="All Objects",c=le();for(let H=0;Ht(2,n=C)),Ee(r,$n,C=>t(5,i=C)),Ee(r,zt,C=>t(6,s=C)),Ee(r,Er,C=>t(7,o=C)),Ee(r,Tr,C=>t(8,a=C)),Ee(r,Zi,C=>t(9,l=C)),Ee(r,Cn,C=>t(10,c=C));let u=-1,f;function h(C){C=window.event||C;var T=Math.max(-1,Math.min(1,C.wheelDelta||-C.detail));t(3,f.scrollLeft-=T*50,f),C.preventDefault()}let p=!1,_="";const v=()=>{t(4,p=!p),s&&Ie(zt,s=!1,s)};function m(){_=this.value,t(1,_)}const d=()=>{t(0,u=-1);const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i),s&&Ie(zt,s=!1,s)},g=C=>{t(0,u=C),Ie($n,i=n[C],i),s&&Ie(zt,s=!1,s)};function x(C){Vn[C?"unshift":"push"](()=>{f=C,t(3,f)})}const M=()=>{Ie(Er,o=!1,o),Ie(Tr,a=!a,a)},y=()=>{Ie(Tr,a=!1,a),Ie(Er,o=!o,o)},w=()=>{Ie(zt,s=!s,s)};return r.$$.update=()=>{if(r.$$.dirty&7)if(_.length>0){let C=null;u==-1?C=n.flatMap(b=>b.items):C=n[u].items;const T=C.filter(b=>b.label.toLowerCase().includes(_.toLowerCase()));Ie($n,i={category:"Search Results",items:T},i)}else if(u===-1){const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i)}else Ie($n,i=n[u],i)},[u,_,n,f,p,i,s,o,a,l,c,h,v,m,d,g,x,M,y,w]}class Zg extends gt{constructor(e){super(),mt(this,e,Yg,qg,ft,{})}}function Al(r,e,t){const n=r.slice();return n[7]=e[t],n[9]=t,n}function Cl(r){let e,t,n,i,s,o,a,l,c,u,f,h=r[1].reduce(Ll,0)+"",p,_,v,m,d,g,x,M,y=r[1],w=[];for(let C=0;CYOUR SHOPPING CART

",n=le(),i=q("div");for(let C=0;C',d=le(),g=q("button"),g.innerHTML="

Purchase

",V(t,"class","font-medium"),V(i,"class","flex flex-col gap-2 overflow-scroll h-[73%] scroll-style scroll-style-vertical"),V(a,"class","text-[1.6rem] w-full h-full flex items-center justify-between"),V(m,"class","bg-[color:var(--color-secondary)] mt-2 font-medium h-full w-[20%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(g,"class","bg-[color:var(--color-accent)] text-[2rem] mt-2 font-medium h-full w-[79%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(v,"class","flex w-full h-full justify-between"),V(o,"class","flex flex-col gap-2 items-center justify-center h-[5rem] mt-10"),V(e,"class","w-[40rem] h-[60rem] bg-[color:var(--color-primary)] absolute right-0 -top-[65rem] flex flex-col gap-[1rem] p-12")},m(C,T){Oe(C,e,T),D(e,t),D(e,n),D(e,i);for(let b=0;b',m=le(),V(n,"class","text-[2rem]"),V(u,"class","text-[color:var(--color-accent)] font-bold ml-2"),V(a,"class","flex text-[1.5rem]"),V(t,"class","flex flex-col gap-2 w-full text-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square"),V(e,"class","flex flex-row gap-2 w-full min-h-[8rem] justify-between bg-[color:var(--color-secondary)] items-center")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"click",x),Le(e,"click",M)],d=!0)},p(y,w){r=y,w&2&&i!==(i=r[7].label+"")&&At(s,i),w&2&&h!==(h=r[7].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,qt(g)}}}function Qg(r){let e,t=r[0]&&Cl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Cl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}const Ll=(r,e)=>r+e.price;function Kg(r,e,t){let n,i,s;return Ee(r,Er,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),[n,i,s,u=>{at("removeCartItem",u)},u=>{at("selectCartItem",u)},()=>Ie(Er,n=!1,n),()=>{Ie(vn,s=null,s),at("buyCartItems")}]}class Jg extends gt{constructor(e){super(),mt(this,e,Kg,Qg,ft,{})}}function Rl(r,e,t){const n=r.slice();return n[5]=e[t],n[7]=t,n}function Dl(r){let e,t,n,i,s,o,a,l,c,u=r[1],f=[];for(let h=0;h',o=le(),a=q("div");for(let h=0;h',V(e,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square")},m(s,o){Oe(s,e,o),t||(n=Le(e,"click",i),t=!0)},p(s,o){r=s},d(s){s&&Ne(e),t=!1,n()}}}function Ul(r){let e,t,n,i,s,o=r[5].label+"",a,l,c,u,f;function h(){return r[3](r[5])}let p=r[5].type!="storage"&&r[5].type!="clothing"&&Il(r);return{c(){e=q("div"),t=q("button"),t.innerHTML='',n=le(),i=q("div"),s=q("h1"),a=rt(o),l=le(),p&&p.c(),c=le(),V(t,"class","bg-[color:var(--color-tertiary)] text-[2rem] w-[4rem] h-[4rem] text-center aspect-square"),V(s,"class","text-[2rem]"),V(i,"class","flex flex-col gap-2 w-full"),V(e,"class","flex flex-row gap-2 w-full justify-between bg-[color:var(--color-secondary)] p-4 items-center")},m(_,v){Oe(_,e,v),D(e,t),D(e,n),D(e,i),D(i,s),D(s,a),D(e,l),p&&p.m(e,null),D(e,c),u||(f=Le(t,"click",h),u=!0)},p(_,v){r=_,v&2&&o!==(o=r[5].label+"")&&At(a,o),r[5].type!="storage"&&r[5].type!="clothing"?p?p.p(r,v):(p=Il(r),p.c(),p.m(e,c)):p&&(p.d(1),p=null)},d(_){_&&Ne(e),p&&p.d(),u=!1,f()}}}function $g(r){let e,t=r[0]&&Dl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Dl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}function e_(r,e,t){let n,i;return Ee(r,Tr,l=>t(0,n=l)),Ee(r,Zi,l=>t(1,i=l)),[n,i,()=>Ie(Tr,n=!1,n),l=>{at("selectOwnedItem",l),console.log(l.type)},l=>{at("removeOwnedItem",l)}]}class t_ extends gt{constructor(e){super(),mt(this,e,e_,$g,ft,{})}}function n_(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m,d,g,x=r[1].toFixed(1)+"",M,y,w,C,T,b,S;return t=new Zg({}),i=new Wg({}),o=new Jg({}),l=new t_({}),{c(){e=q("div"),nt(t.$$.fragment),n=le(),nt(i.$$.fragment),s=le(),nt(o.$$.fragment),a=le(),nt(l.$$.fragment),c=le(),u=q("div"),f=q("i"),h=le(),p=q("p"),p.textContent="C",_=le(),v=q("div"),m=q("i"),d=le(),g=q("p"),M=rt(x),y=le(),w=q("input"),V(f,"class","fa-solid fa-video text-[white]"),V(p,"class","font-semibold"),jo(u,"border-color",r[0]?"white":"var(--color-tertiary)"),V(u,"class","absolute -top-[5rem] text-[2rem] right-0 w-[8rem] border-[0.3rem] h-[4rem] bg-[color:var(--color-primary)] flex flex-row gap-[1rem] items-center justify-center"),V(m,"class","fa-solid fa-eye text-[white]"),V(g,"class","font-semibold text-center w-[4rem]"),V(w,"id","slider"),V(w,"type","range"),V(w,"min","1.0"),V(w,"max","12.5"),V(w,"step","0.5"),V(w,"class","w-full"),V(v,"class","flex flex-row gap-[1rem] items-center absolute left-0 -top-[5rem] w-[30rem] h-fit p-4 bg-[color:var(--color-primary)]"),V(e,"class",C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(r[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all")},m(F,k){Oe(F,e,k),$e(t,e,null),D(e,n),$e(i,e,null),D(e,s),$e(o,e,null),D(e,a),$e(l,e,null),D(e,c),D(e,u),D(u,f),D(u,h),D(u,p),D(e,_),D(e,v),D(v,m),D(v,d),D(v,g),D(g,M),D(v,y),D(v,w),Tn(w,r[1]),T=!0,b||(S=[Le(w,"change",r[3]),Le(w,"input",r[3]),Le(w,"change",r[4])],b=!0)},p(F,[k]){(!T||k&1)&&jo(u,"border-color",F[0]?"white":"var(--color-tertiary)"),(!T||k&2)&&x!==(x=F[1].toFixed(1)+"")&&At(M,x),k&2&&Tn(w,F[1]),(!T||k&4&&C!==(C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(F[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all"))&&V(e,"class",C)},i(F){T||(_e(t.$$.fragment,F),_e(i.$$.fragment,F),_e(o.$$.fragment,F),_e(l.$$.fragment,F),T=!0)},o(F){Se(t.$$.fragment,F),Se(i.$$.fragment,F),Se(o.$$.fragment,F),Se(l.$$.fragment,F),T=!1},d(F){F&&Ne(e),et(t),et(i),et(o),et(l),b=!1,qt(S)}}}function i_(r,e,t){let n;Ee(r,zt,c=>t(2,n=c));let i=!1,s=5;function o(c){c.target instanceof HTMLInputElement||c.target instanceof HTMLTextAreaElement||c.key==="c"&&(at("freecamMode",!0),Ie(zt,n=!0,n),t(0,i=!0))}an("freecamMode",c=>{c==!1&&(Ie(zt,n=!1,n),t(0,i=!1))}),or(()=>{window.addEventListener("keypress",o),at("freecamMode",!1),at("setHoverDistance",s),Ie(zt,n=!1,n),t(0,i=!1)});function a(){s=cs(this.value),t(1,s)}return[i,s,n,a,()=>{at("setHoverDistance",s)}]}class r_ extends gt{constructor(e){super(),mt(this,e,i_,n_,ft,{})}}const s_={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; diff --git a/ui/src/components/OwnedItems.svelte b/ui/src/components/OwnedItems.svelte index 501a68a..bcd4060 100644 --- a/ui/src/components/OwnedItems.svelte +++ b/ui/src/components/OwnedItems.svelte @@ -34,6 +34,7 @@ class="bg-[color:var(--color-tertiary)] text-[2rem] w-[4rem] h-[4rem] text-center aspect-square" on:click={() => { SendNUI('selectOwnedItem', item) + console.log(item.type) }} > @@ -41,16 +42,16 @@

{item.label}

- {#if !item.type} - - {/if} + {#if item.type != 'storage' && item.type != 'clothing'} + + {/if} {/each} From 5314ad326b96157e97e52ba9bb3d40eb03e32e6c Mon Sep 17 00:00:00 2001 From: Complex Date: Sat, 29 Jul 2023 20:52:30 +0200 Subject: [PATCH 09/10] Removed Console Log --- html/index.js | 2 +- ui/src/components/OwnedItems.svelte | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/html/index.js b/html/index.js index e753fa5..c214e36 100644 --- a/html/index.js +++ b/html/index.js @@ -3414,7 +3414,7 @@ void main() { float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function dg(r,e,t){let n=new Uo;const i=new Qe,s=new Qe,o=new Ut,a=new cg({depthPacking:af}),l=new ug,c={},u=t.maxTextureSize,f={[ti]:Jt,[Jt]:ti,[Pn]:Pn},h=new Xn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Qe},radius:{value:4}},vertexShader:fg,fragmentShader:hg}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const _=new Xt;_.setAttribute("position",new Dn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new pe(_,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=pc,this.render=function(M,y,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||M.length===0)return;const C=r.getRenderTarget(),T=r.getActiveCubeFace(),b=r.getActiveMipmapLevel(),S=r.state;S.setBlending(ei),S.buffers.color.setClear(1,1,1,1),S.buffers.depth.setTest(!0),S.setScissorTest(!1);for(let F=0,k=M.length;Fu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/B.x),i.x=s.x*B.x,O.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/B.y),i.y=s.y*B.y,O.mapSize.y=s.y)),O.map===null){const R=this.type!==xr?{minFilter:Vt,magFilter:Vt}:{};O.map=new ii(i.x,i.y,R),O.map.texture.name=L.name+".shadowMap",O.camera.updateProjectionMatrix()}r.setRenderTarget(O.map),r.clear();const J=O.getViewportCount();for(let R=0;R0||y.map&&y.alphaTest>0){const S=T.uuid,F=y.uuid;let k=c[S];k===void 0&&(k={},c[S]=k);let L=k[F];L===void 0&&(L=T.clone(),k[F]=L),T=L}if(T.visible=y.visible,T.wireframe=y.wireframe,C===xr?T.side=y.shadowSide!==null?y.shadowSide:y.side:T.side=y.shadowSide!==null?y.shadowSide:f[y.side],T.alphaMap=y.alphaMap,T.alphaTest=y.alphaTest,T.map=y.map,T.clipShadows=y.clipShadows,T.clippingPlanes=y.clippingPlanes,T.clipIntersection=y.clipIntersection,T.displacementMap=y.displacementMap,T.displacementScale=y.displacementScale,T.displacementBias=y.displacementBias,T.wireframeLinewidth=y.wireframeLinewidth,T.linewidth=y.linewidth,w.isPointLight===!0&&T.isMeshDistanceMaterial===!0){const S=r.properties.get(T);S.light=w}return T}function x(M,y,w,C,T){if(M.visible===!1)return;if(M.layers.test(y.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&T===xr)&&(!M.frustumCulled||n.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,M.matrixWorld);const F=e.update(M),k=M.material;if(Array.isArray(k)){const L=F.groups;for(let O=0,B=L.length;O=1):H.indexOf("OpenGL ES")!==-1&&(R=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),J=R>=2);let Q=null,K={};const ve=r.getParameter(3088),se=r.getParameter(2978),j=new Ut().fromArray(ve),ee=new Ut().fromArray(se);function te(U,W,ie){const he=new Uint8Array(4),be=r.createTexture();r.bindTexture(U,be),r.texParameteri(U,10241,9728),r.texParameteri(U,10240,9728);for(let Ke=0;Kene||P.height>ne)&&(re=ne/Math.max(P.width,P.height)),re<1||E===!0)if(typeof HTMLImageElement!="undefined"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&P instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&P instanceof ImageBitmap){const fe=E?wc:Math.floor,Pe=fe(re*P.width),de=fe(re*P.height);v===void 0&&(v=g(Pe,de));const $=Y?g(Pe,de):v;return $.width=Pe,$.height=de,$.getContext("2d").drawImage(P,0,0,Pe,de),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Pe+"x"+de+")."),$}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function M(P){return wo(P.width)&&wo(P.height)}function y(P){return a?!1:P.wrapS!==mn||P.wrapT!==mn||P.minFilter!==Vt&&P.minFilter!==ln}function w(P,E){return P.generateMipmaps&&E&&P.minFilter!==Vt&&P.minFilter!==ln}function C(P){r.generateMipmap(P)}function T(P,E,Y,ne,re=!1){if(a===!1)return E;if(P!==null){if(r[P]!==void 0)return r[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let fe=E;return E===6403&&(Y===5126&&(fe=33326),Y===5131&&(fe=33325),Y===5121&&(fe=33321)),E===33319&&(Y===5126&&(fe=33328),Y===5131&&(fe=33327),Y===5121&&(fe=33323)),E===6408&&(Y===5126&&(fe=34836),Y===5131&&(fe=34842),Y===5121&&(fe=ne===ot&&re===!1?35907:32856),Y===32819&&(fe=32854),Y===32820&&(fe=32855)),(fe===33325||fe===33326||fe===33327||fe===33328||fe===34842||fe===34836)&&e.get("EXT_color_buffer_float"),fe}function b(P,E,Y){return w(P,Y)===!0||P.isFramebufferTexture&&P.minFilter!==Vt&&P.minFilter!==ln?Math.log2(Math.max(E.width,E.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?E.mipmaps.length:1}function S(P){return P===Vt||P===Jo||P===Us?9728:9729}function F(P){const E=P.target;E.removeEventListener("dispose",F),L(E),E.isVideoTexture&&_.delete(E)}function k(P){const E=P.target;E.removeEventListener("dispose",k),B(E)}function L(P){const E=n.get(P);if(E.__webglInit===void 0)return;const Y=P.source,ne=m.get(Y);if(ne){const re=ne[E.__cacheKey];re.usedTimes--,re.usedTimes===0&&O(P),Object.keys(ne).length===0&&m.delete(Y)}n.remove(P)}function O(P){const E=n.get(P);r.deleteTexture(E.__webglTexture);const Y=P.source,ne=m.get(Y);delete ne[E.__cacheKey],o.memory.textures--}function B(P){const E=P.texture,Y=n.get(P),ne=n.get(E);if(ne.__webglTexture!==void 0&&(r.deleteTexture(ne.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let re=0;re<6;re++)r.deleteFramebuffer(Y.__webglFramebuffer[re]),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer[re]);else{if(r.deleteFramebuffer(Y.__webglFramebuffer),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer),Y.__webglMultisampledFramebuffer&&r.deleteFramebuffer(Y.__webglMultisampledFramebuffer),Y.__webglColorRenderbuffer)for(let re=0;re=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),J+=1,P}function Q(P){const E=[];return E.push(P.wrapS),E.push(P.wrapT),E.push(P.wrapR||0),E.push(P.magFilter),E.push(P.minFilter),E.push(P.anisotropy),E.push(P.internalFormat),E.push(P.format),E.push(P.type),E.push(P.generateMipmaps),E.push(P.premultiplyAlpha),E.push(P.flipY),E.push(P.unpackAlignment),E.push(P.encoding),E.join()}function K(P,E){const Y=n.get(P);if(P.isVideoTexture&&st(P),P.isRenderTargetTexture===!1&&P.version>0&&Y.__version!==P.version){const ne=P.image;if(ne===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ne.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Re(Y,P,E);return}}t.bindTexture(3553,Y.__webglTexture,33984+E)}function ve(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Re(Y,P,E);return}t.bindTexture(35866,Y.__webglTexture,33984+E)}function se(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Re(Y,P,E);return}t.bindTexture(32879,Y.__webglTexture,33984+E)}function j(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Ce(Y,P,E);return}t.bindTexture(34067,Y.__webglTexture,33984+E)}const ee={[bo]:10497,[mn]:33071,[So]:33648},te={[Vt]:9728,[Jo]:9984,[Us]:9986,[ln]:9729,[Vu]:9985,[Rr]:9987};function ue(P,E,Y){if(Y?(r.texParameteri(P,10242,ee[E.wrapS]),r.texParameteri(P,10243,ee[E.wrapT]),(P===32879||P===35866)&&r.texParameteri(P,32882,ee[E.wrapR]),r.texParameteri(P,10240,te[E.magFilter]),r.texParameteri(P,10241,te[E.minFilter])):(r.texParameteri(P,10242,33071),r.texParameteri(P,10243,33071),(P===32879||P===35866)&&r.texParameteri(P,32882,33071),(E.wrapS!==mn||E.wrapT!==mn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(P,10240,S(E.magFilter)),r.texParameteri(P,10241,S(E.minFilter)),E.minFilter!==Vt&&E.minFilter!==ln&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const ne=e.get("EXT_texture_filter_anisotropic");if(E.magFilter===Vt||E.minFilter!==Us&&E.minFilter!==Rr||E.type===Mi&&e.has("OES_texture_float_linear")===!1||a===!1&&E.type===Dr&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||n.get(E).__currentAnisotropy)&&(r.texParameterf(P,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,i.getMaxAnisotropy())),n.get(E).__currentAnisotropy=E.anisotropy)}}function N(P,E){let Y=!1;P.__webglInit===void 0&&(P.__webglInit=!0,E.addEventListener("dispose",F));const ne=E.source;let re=m.get(ne);re===void 0&&(re={},m.set(ne,re));const fe=Q(E);if(fe!==P.__cacheKey){re[fe]===void 0&&(re[fe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,Y=!0),re[fe].usedTimes++;const Pe=re[P.__cacheKey];Pe!==void 0&&(re[P.__cacheKey].usedTimes--,Pe.usedTimes===0&&O(E)),P.__cacheKey=fe,P.__webglTexture=re[fe].texture}return Y}function Re(P,E,Y){let ne=3553;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(ne=35866),E.isData3DTexture&&(ne=32879);const re=N(P,E),fe=E.source;t.bindTexture(ne,P.__webglTexture,33984+Y);const Pe=n.get(fe);if(fe.version!==Pe.__version||re===!0){t.activeTexture(33984+Y),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);const de=y(E)&&M(E.image)===!1;let $=x(E.image,de,!1,u);$=It(E,$);const xe=M($)||a,we=s.convert(E.format,E.encoding);let Ae=s.convert(E.type),ge=T(E.internalFormat,we,Ae,E.encoding,E.isVideoTexture);ue(ne,E,xe);let Me;const Fe=E.mipmaps,Ze=a&&E.isVideoTexture!==!0,ct=Pe.__version===void 0||re===!0,U=b(E,$,xe);if(E.isDepthTexture)ge=6402,a?E.type===Mi?ge=36012:E.type===xi?ge=33190:E.type===Ki?ge=35056:ge=33189:E.type===Mi&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===bi&&ge===6402&&E.type!==bc&&E.type!==xi&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=xi,Ae=s.convert(E.type)),E.format===nr&&ge===6402&&(ge=34041,E.type!==Ki&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=Ki,Ae=s.convert(E.type))),ct&&(Ze?t.texStorage2D(3553,1,ge,$.width,$.height):t.texImage2D(3553,0,ge,$.width,$.height,0,we,Ae,null));else if(E.isDataTexture)if(Fe.length>0&&xe){Ze&&ct&&t.texStorage2D(3553,U,ge,Fe[0].width,Fe[0].height);for(let W=0,ie=Fe.length;W>=1,ie>>=1}}else if(Fe.length>0&&xe){Ze&&ct&&t.texStorage2D(3553,U,ge,Fe[0].width,Fe[0].height);for(let W=0,ie=Fe.length;W0&&ct++,t.texStorage2D(34067,ct,Me,$[0].width,$[0].height));for(let W=0;W<6;W++)if(de){Fe?t.texSubImage2D(34069+W,0,0,0,$[W].width,$[W].height,Ae,ge,$[W].data):t.texImage2D(34069+W,0,Me,$[W].width,$[W].height,0,Ae,ge,$[W].data);for(let ie=0;ie=34069&&re<=34074)&&r.framebufferTexture2D(36160,ne,re,n.get(Y).__webglTexture,0),t.bindFramebuffer(36160,null)}function Te(P,E,Y){if(r.bindRenderbuffer(36161,P),E.depthBuffer&&!E.stencilBuffer){let ne=33189;if(Y||Xe(E)){const re=E.depthTexture;re&&re.isDepthTexture&&(re.type===Mi?ne=36012:re.type===xi&&(ne=33190));const fe=_t(E);Xe(E)?h.renderbufferStorageMultisampleEXT(36161,fe,ne,E.width,E.height):r.renderbufferStorageMultisample(36161,fe,ne,E.width,E.height)}else r.renderbufferStorage(36161,ne,E.width,E.height);r.framebufferRenderbuffer(36160,36096,36161,P)}else if(E.depthBuffer&&E.stencilBuffer){const ne=_t(E);Y&&Xe(E)===!1?r.renderbufferStorageMultisample(36161,ne,35056,E.width,E.height):Xe(E)?h.renderbufferStorageMultisampleEXT(36161,ne,35056,E.width,E.height):r.renderbufferStorage(36161,34041,E.width,E.height),r.framebufferRenderbuffer(36160,33306,36161,P)}else{const ne=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let re=0;re0&&Xe(P)===!1){const de=fe?E:[E];Y.__webglMultisampledFramebuffer=r.createFramebuffer(),Y.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,Y.__webglMultisampledFramebuffer);for(let $=0;$0&&Xe(P)===!1){const E=P.isWebGLMultipleRenderTargets?P.texture:[P.texture],Y=P.width,ne=P.height;let re=16384;const fe=[],Pe=P.stencilBuffer?33306:36096,de=n.get(P),$=P.isWebGLMultipleRenderTargets===!0;if($)for(let xe=0;xe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function st(P){const E=o.render.frame;_.get(P)!==E&&(_.set(P,E),P.update())}function It(P,E){const Y=P.encoding,ne=P.format,re=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||P.format===yo||Y!==ni&&(Y===ot?a===!1?e.has("EXT_sRGB")===!0&&ne===gn?(P.format=yo,P.minFilter=ln,P.generateMipmaps=!1):E=Tc.sRGBToLinear(E):(ne!==gn||re!==Si)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",Y)),E}this.allocateTextureUnit=H,this.resetTextureUnits=R,this.setTexture2D=K,this.setTexture2DArray=ve,this.setTexture3D=se,this.setTextureCube=j,this.rebindTextures=Ue,this.setupRenderTarget=lt,this.updateRenderTargetMipmap=xt,this.updateMultisampleRenderTarget=Mt,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Xe}function gg(r,e,t){const n=t.isWebGL2;function i(s,o=null){let a;if(s===Si)return 5121;if(s===qu)return 32819;if(s===Yu)return 32820;if(s===Wu)return 5120;if(s===ju)return 5122;if(s===bc)return 5123;if(s===Xu)return 5124;if(s===xi)return 5125;if(s===Mi)return 5126;if(s===Dr)return n?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Zu)return 6406;if(s===gn)return 6408;if(s===Qu)return 6409;if(s===Ku)return 6410;if(s===bi)return 6402;if(s===nr)return 34041;if(s===yo)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Ju)return 6403;if(s===$u)return 36244;if(s===ef)return 33319;if(s===tf)return 33320;if(s===nf)return 36249;if(s===Ns||s===Os||s===Fs||s===zs)if(o===ot)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===Ns)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Os)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Fs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===zs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Ns)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Os)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Fs)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===zs)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===$o||s===ea||s===ta||s===na)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===$o)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ea)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===ta)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===na)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===rf)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===ia||s===ra)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===ia)return o===ot?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===ra)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===sa||s===oa||s===aa||s===la||s===ca||s===ua||s===fa||s===ha||s===da||s===pa||s===ma||s===ga||s===_a||s===va)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===sa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===oa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===aa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===la)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===ca)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===ua)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===fa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===ha)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===da)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===pa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===ma)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===ga)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===_a)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===va)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===ks)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===ks)return o===ot?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===sf||s===xa||s===Ma||s===ba)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===ks)return a.COMPRESSED_RED_RGTC1_EXT;if(s===xa)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Ma)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===ba)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ki?n?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class _g extends sn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class rs extends Et{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vg={type:"move"};class ao{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new rs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new rs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new rs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,n),d=this._getHandJoint(c,v);m!==null&&(d.matrix.fromArray(m.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.jointRadius=m.radius),d.visible=m!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),p=.02,_=.005;c.inputState.pinching&&h>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(vg)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new rs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class xg extends $t{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:bi,u!==bi&&u!==nr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===bi&&(n=xi),n===void 0&&u===nr&&(n=Ki),super(null,i,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Vt,this.minFilter=l!==void 0?l:Vt,this.flipY=!1,this.generateMipmaps=!1}}class Mg extends ar{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,h=null,p=null,_=null;const v=t.getContextAttributes();let m=null,d=null;const g=[],x=[],M=new Set,y=new Map,w=new sn;w.layers.enable(1),w.viewport=new Ut;const C=new sn;C.layers.enable(2),C.viewport=new Ut;const T=[w,C],b=new _g;b.layers.enable(1),b.layers.enable(2);let S=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getGripSpace()},this.getHand=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getHandSpace()};function k(j){const ee=x.indexOf(j.inputSource);if(ee===-1)return;const te=g[ee];te!==void 0&&te.dispatchEvent({type:j.type,data:j.inputSource})}function L(){i.removeEventListener("select",k),i.removeEventListener("selectstart",k),i.removeEventListener("selectend",k),i.removeEventListener("squeeze",k),i.removeEventListener("squeezestart",k),i.removeEventListener("squeezeend",k),i.removeEventListener("end",L),i.removeEventListener("inputsourceschange",O);for(let j=0;j=0&&(x[ue]=null,g[ue].disconnect(te))}for(let ee=0;ee=x.length){x.push(te),ue=Re;break}else if(x[Re]===null){x[Re]=te,ue=Re;break}if(ue===-1)break}const N=g[ue];N&&N.connect(te)}}const B=new I,J=new I;function R(j,ee,te){B.setFromMatrixPosition(ee.matrixWorld),J.setFromMatrixPosition(te.matrixWorld);const ue=B.distanceTo(J),N=ee.projectionMatrix.elements,Re=te.projectionMatrix.elements,Ce=N[14]/(N[10]-1),oe=N[14]/(N[10]+1),Te=(N[9]+1)/N[5],je=(N[9]-1)/N[5],ye=(N[8]-1)/N[0],Ue=(Re[8]+1)/Re[0],lt=Ce*ye,xt=Ce*Ue,Mt=ue/(-ye+Ue),_t=Mt*-ye;ee.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(_t),j.translateZ(Mt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert();const Xe=Ce+Mt,st=oe+Mt,It=lt-_t,P=xt+(ue-_t),E=Te*oe/st*Xe,Y=je*oe/st*Xe;j.projectionMatrix.makePerspective(It,P,E,Y,Xe,st),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}function H(j,ee){ee===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ee.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(i===null)return;b.near=C.near=w.near=j.near,b.far=C.far=w.far=j.far,(S!==b.near||F!==b.far)&&(i.updateRenderState({depthNear:b.near,depthFar:b.far}),S=b.near,F=b.far);const ee=j.parent,te=b.cameras;H(b,ee);for(let ue=0;ueN&&(y.set(ue,ue.lastChangedTime),n.dispatchEvent({type:"planechanged",data:ue}))}}_=null}const se=new Oc;se.setAnimationLoop(ve),this.setAnimationLoop=function(j){K=j},this.dispose=function(){}}}function bg(r,e){function t(m,d){m.matrixAutoUpdate===!0&&m.updateMatrix(),d.value.copy(m.matrix)}function n(m,d){d.color.getRGB(m.fogColor.value,Dc(r)),d.isFog?(m.fogNear.value=d.near,m.fogFar.value=d.far):d.isFogExp2&&(m.fogDensity.value=d.density)}function i(m,d,g,x,M){d.isMeshBasicMaterial||d.isMeshLambertMaterial?s(m,d):d.isMeshToonMaterial?(s(m,d),f(m,d)):d.isMeshPhongMaterial?(s(m,d),u(m,d)):d.isMeshStandardMaterial?(s(m,d),h(m,d),d.isMeshPhysicalMaterial&&p(m,d,M)):d.isMeshMatcapMaterial?(s(m,d),_(m,d)):d.isMeshDepthMaterial?s(m,d):d.isMeshDistanceMaterial?(s(m,d),v(m,d)):d.isMeshNormalMaterial?s(m,d):d.isLineBasicMaterial?(o(m,d),d.isLineDashedMaterial&&a(m,d)):d.isPointsMaterial?l(m,d,g,x):d.isSpriteMaterial?c(m,d):d.isShadowMaterial?(m.color.value.copy(d.color),m.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function s(m,d){m.opacity.value=d.opacity,d.color&&m.diffuse.value.copy(d.color),d.emissive&&m.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.bumpMap&&(m.bumpMap.value=d.bumpMap,t(d.bumpMap,m.bumpMapTransform),m.bumpScale.value=d.bumpScale,d.side===Jt&&(m.bumpScale.value*=-1)),d.normalMap&&(m.normalMap.value=d.normalMap,t(d.normalMap,m.normalMapTransform),m.normalScale.value.copy(d.normalScale),d.side===Jt&&m.normalScale.value.negate()),d.displacementMap&&(m.displacementMap.value=d.displacementMap,t(d.displacementMap,m.displacementMapTransform),m.displacementScale.value=d.displacementScale,m.displacementBias.value=d.displacementBias),d.emissiveMap&&(m.emissiveMap.value=d.emissiveMap,t(d.emissiveMap,m.emissiveMapTransform)),d.specularMap&&(m.specularMap.value=d.specularMap,t(d.specularMap,m.specularMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);const g=e.get(d).envMap;if(g&&(m.envMap.value=g,m.flipEnvMap.value=g.isCubeTexture&&g.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap){m.lightMap.value=d.lightMap;const x=r.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=d.lightMapIntensity*x,t(d.lightMap,m.lightMapTransform)}d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,m.aoMapTransform))}function o(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform))}function a(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,g,x){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*g,m.scale.value=x*.5,d.map&&(m.map.value=d.map,t(d.map,m.uvTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function c(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function u(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function f(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function h(m,d){m.metalness.value=d.metalness,d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,m.metalnessMapTransform)),m.roughness.value=d.roughness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,m.roughnessMapTransform)),e.get(d).envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function p(m,d,g){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,m.sheenColorMapTransform)),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,m.sheenRoughnessMapTransform))),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,m.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(m.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===Jt&&m.clearcoatNormalScale.value.negate())),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,m.iridescenceMapTransform)),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=g.texture,m.transmissionSamplerSize.value.set(g.width,g.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,m.transmissionMapTransform)),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,m.specularColorMapTransform)),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,d){d.matcap&&(m.matcap.value=d.matcap)}function v(m,d){const g=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(g.matrixWorld),m.nearDistance.value=g.shadow.camera.near,m.farDistance.value=g.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Sg(r,e,t,n){let i={},s={},o=[];const a=t.isWebGL2?r.getParameter(35375):0;function l(g,x){const M=x.program;n.uniformBlockBinding(g,M)}function c(g,x){let M=i[g.id];M===void 0&&(_(g),M=u(g),i[g.id]=M,g.addEventListener("dispose",m));const y=x.program;n.updateUBOMapping(g,y);const w=e.render.frame;s[g.id]!==w&&(h(g),s[g.id]=w)}function u(g){const x=f();g.__bindingPointIndex=x;const M=r.createBuffer(),y=g.__size,w=g.usage;return r.bindBuffer(35345,M),r.bufferData(35345,y,w),r.bindBuffer(35345,null),r.bindBufferBase(35345,x,M),M}function f(){for(let g=0;g0){w=M%y;const k=y-w;w!==0&&k-S.boundary<0&&(M+=y-w,b.__offset=M)}M+=S.storage}return w=M%y,w>0&&(M+=y-w),g.__size=M,g.__cache={},this}function v(g){const x={boundary:0,storage:0};return typeof g=="number"?(x.boundary=4,x.storage=4):g.isVector2?(x.boundary=8,x.storage=8):g.isVector3||g.isColor?(x.boundary=16,x.storage=12):g.isVector4?(x.boundary=16,x.storage=16):g.isMatrix3?(x.boundary=48,x.storage=48):g.isMatrix4?(x.boundary=64,x.storage=64):g.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",g),x}function m(g){const x=g.target;x.removeEventListener("dispose",m);const M=o.indexOf(x.__bindingPointIndex);o.splice(M,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function d(){for(const g in i)r.deleteBuffer(i[g]);o=[],i={},s={}}return{bind:l,update:c,dispose:d}}function yg(){const r=Nr("canvas");return r.style.display="block",r}class Hc{constructor(e={}){const{canvas:t=yg(),context:n=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;n!==null?h=n.getContextAttributes().alpha:h=o;let p=null,_=null;const v=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ni,this.useLegacyLights=!0,this.toneMapping=Rn,this.toneMappingExposure=1;const d=this;let g=!1,x=0,M=0,y=null,w=-1,C=null;const T=new Ut,b=new Ut;let S=null,F=t.width,k=t.height,L=1,O=null,B=null;const J=new Ut(0,0,F,k),R=new Ut(0,0,F,k);let H=!1;const Q=new Uo;let K=!1,ve=!1,se=null;const j=new vt,ee=new I,te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ue(){return y===null?L:1}let N=n;function Re(A,z){for(let Z=0;Z0?_=m[m.length-1]:_=null,v.pop(),v.length>0?p=v[v.length-1]:p=null};function Tt(A,z,Z,G){if(A.visible===!1)return;if(A.layers.test(z.layers)){if(A.isGroup)Z=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(z);else if(A.isLight)_.pushLight(A),A.castShadow&&_.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||Q.intersectsSprite(A)){G&&ee.setFromMatrixPosition(A.matrixWorld).applyMatrix4(j);const me=Xe.update(A),De=A.material;De.visible&&p.push(A,me,De,Z,ee.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(A.isSkinnedMesh&&A.skeleton.frame!==je.render.frame&&(A.skeleton.update(),A.skeleton.frame=je.render.frame),!A.frustumCulled||Q.intersectsObject(A))){G&&ee.setFromMatrixPosition(A.matrixWorld).applyMatrix4(j);const me=Xe.update(A),De=A.material;if(Array.isArray(De)){const ze=me.groups;for(let Be=0,Ge=ze.length;Be0&&ht(X,ae,z,Z),G&&Te.viewport(T.copy(G)),X.length>0&&Lt(X,z,Z),ae.length>0&&Lt(ae,z,Z),me.length>0&&Lt(me,z,Z),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function ht(A,z,Z,G){if(se===null){const De=oe.isWebGL2;se=new ii(1024,1024,{generateMipmaps:!0,type:Ce.has("EXT_color_buffer_half_float")?Dr:Si,minFilter:Rr,samples:De&&a===!0?4:0})}const X=d.getRenderTarget();d.setRenderTarget(se),d.clear();const ae=d.toneMapping;d.toneMapping=Rn,Lt(A,Z,G),Ue.updateMultisampleRenderTarget(se),Ue.updateRenderTargetMipmap(se);let me=!1;for(let De=0,ze=z.length;De0&&Ue.useMultisampledRTT(A)===!1?X=ye.get(A).__webglMultisampledFramebuffer:X=Ge,T.copy(A.viewport),b.copy(A.scissor),S=A.scissorTest}else T.copy(J).multiplyScalar(L).floor(),b.copy(R).multiplyScalar(L).floor(),S=H;if(Te.bindFramebuffer(36160,X)&&oe.drawBuffers&&G&&Te.drawBuffers(A,X),Te.viewport(T),Te.scissor(b),Te.setScissorTest(S),ae){const ze=ye.get(A.texture);N.framebufferTexture2D(36160,36064,34069+z,ze.__webglTexture,Z)}else if(me){const ze=ye.get(A.texture),Be=z||0;N.framebufferTextureLayer(36160,36064,ze.__webglTexture,Z||0,Be)}w=-1},this.readRenderTargetPixels=function(A,z,Z,G,X,ae,me){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let De=ye.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&me!==void 0&&(De=De[me]),De){Te.bindFramebuffer(36160,De);try{const ze=A.texture,Be=ze.format,Ge=ze.type;if(Be!==gn&&$.convert(Be)!==N.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ve=Ge===Dr&&(Ce.has("EXT_color_buffer_half_float")||oe.isWebGL2&&Ce.has("EXT_color_buffer_float"));if(Ge!==Si&&$.convert(Ge)!==N.getParameter(35738)&&!(Ge===Mi&&(oe.isWebGL2||Ce.has("OES_texture_float")||Ce.has("WEBGL_color_buffer_float")))&&!Ve){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}z>=0&&z<=A.width-G&&Z>=0&&Z<=A.height-X&&N.readPixels(z,Z,G,X,$.convert(Be),$.convert(Ge),ae)}finally{const ze=y!==null?ye.get(y).__webglFramebuffer:null;Te.bindFramebuffer(36160,ze)}}},this.copyFramebufferToTexture=function(A,z,Z=0){const G=Math.pow(2,-Z),X=Math.floor(z.image.width*G),ae=Math.floor(z.image.height*G);Ue.setTexture2D(z,0),N.copyTexSubImage2D(3553,Z,0,0,A.x,A.y,X,ae),Te.unbindTexture()},this.copyTextureToTexture=function(A,z,Z,G=0){const X=z.image.width,ae=z.image.height,me=$.convert(Z.format),De=$.convert(Z.type);Ue.setTexture2D(Z,0),N.pixelStorei(37440,Z.flipY),N.pixelStorei(37441,Z.premultiplyAlpha),N.pixelStorei(3317,Z.unpackAlignment),z.isDataTexture?N.texSubImage2D(3553,G,A.x,A.y,X,ae,me,De,z.image.data):z.isCompressedTexture?N.compressedTexSubImage2D(3553,G,A.x,A.y,z.mipmaps[0].width,z.mipmaps[0].height,me,z.mipmaps[0].data):N.texSubImage2D(3553,G,A.x,A.y,me,De,z.image),G===0&&Z.generateMipmaps&&N.generateMipmap(3553),Te.unbindTexture()},this.copyTextureToTexture3D=function(A,z,Z,G,X=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ae=A.max.x-A.min.x+1,me=A.max.y-A.min.y+1,De=A.max.z-A.min.z+1,ze=$.convert(G.format),Be=$.convert(G.type);let Ge;if(G.isData3DTexture)Ue.setTexture3D(G,0),Ge=32879;else if(G.isDataArrayTexture)Ue.setTexture2DArray(G,0),Ge=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}N.pixelStorei(37440,G.flipY),N.pixelStorei(37441,G.premultiplyAlpha),N.pixelStorei(3317,G.unpackAlignment);const Ve=N.getParameter(3314),tt=N.getParameter(32878),Bt=N.getParameter(3316),cn=N.getParameter(3315),oi=N.getParameter(32877),yt=Z.isCompressedTexture?Z.mipmaps[0]:Z.image;N.pixelStorei(3314,yt.width),N.pixelStorei(32878,yt.height),N.pixelStorei(3316,A.min.x),N.pixelStorei(3315,A.min.y),N.pixelStorei(32877,A.min.z),Z.isDataTexture||Z.isData3DTexture?N.texSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,Be,yt.data):Z.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),N.compressedTexSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,yt.data)):N.texSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,Be,yt),N.pixelStorei(3314,Ve),N.pixelStorei(32878,tt),N.pixelStorei(3316,Bt),N.pixelStorei(3315,cn),N.pixelStorei(32877,oi),X===0&&G.generateMipmaps&&N.generateMipmap(Ge),Te.unbindTexture()},this.initTexture=function(A){A.isCubeTexture?Ue.setTextureCube(A,0):A.isData3DTexture?Ue.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?Ue.setTexture2DArray(A,0):Ue.setTexture2D(A,0),Te.unbindTexture()},this.resetState=function(){x=0,M=0,y=null,Te.reset(),xe.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}}class wg extends Hc{}wg.prototype.isWebGL1Renderer=!0;class Eg extends Et{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Vc extends cr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Je(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const al=new I,ll=new I,cl=new vt,lo=new Do,ss=new Ss;class Kn extends Et{constructor(e=new Xt,t=new Vc){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;il)continue;h.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(h);Te.far||t.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const d=Math.max(0,o.start),g=Math.min(m.count,o.start+o.count);for(let x=d,M=g-1;xl)continue;h.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(h);we.far||t.push({distance:w,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new pt(f,3)),this.setAttribute("normal",new pt(h,3)),this.setAttribute("uv",new pt(p,2));function g(){const M=new I,y=new I;let w=0;const C=(t-e)/n;for(let T=0;T<=s;T++){const b=[],S=T/s,F=S*(t-e)+e;for(let k=0;k<=i;k++){const L=k/i,O=L*l+a,B=Math.sin(O),J=Math.cos(O);y.x=F*B,y.y=-S*n+m,y.z=F*J,f.push(y.x,y.y,y.z),M.set(B,C,J).normalize(),h.push(M.x,M.y,M.z),p.push(L,1-S),b.push(_++)}v.push(b)}for(let T=0;T.9&&C<.1&&(x<.2&&(o[g+0]+=1),M<.2&&(o[g+2]+=1),y<.2&&(o[g+4]+=1))}}function h(g){s.push(g.x,g.y,g.z)}function p(g,x){const M=g*3;x.x=e[M+0],x.y=e[M+1],x.z=e[M+2]}function _(){const g=new I,x=new I,M=new I,y=new I,w=new Qe,C=new Qe,T=new Qe;for(let b=0,S=0;b0)&&p.push(x,M,w),(d!==n-1||l{const r={show:Ye(!1),cameraPosition:Ye({x:0,y:0,z:1}),cameraLookAt:Ye({x:0,y:0,z:10}),objectPosition:Ye({x:0,y:0,z:10}),objectEuler:Ye(new yi(0,0,0,"ZXY")),entity:Ye(0)};return{...r,...{setupModel(t){r.cameraPosition.set(Vi(t.cameraPosition)),r.cameraLookAt.set(Vi(t.cameraLookAt)),r.objectPosition.set(Vi(t.objectPosition)),r.objectEuler.set(new yi(Kt.degToRad(t.objectRotation.x),Kt.degToRad(t.objectRotation.z),Kt.degToRad(t.objectRotation.y),"YZX")),r.show.set(!0),r.entity.set(t.entity)},updateCamera(t){r.cameraPosition.set(Vi(t.cameraPosition)),r.cameraLookAt.set(Vi(t.cameraLookAt))},updateCameraPosition(t){r.cameraPosition.set(t.cameraPosition)},updateCameraLookAt(t){r.cameraLookAt.set(t.cameraLookAt)},sendMovementUpdate(t){at("moveObject",t)},sendRotationUpdate(t){const n=fs(t);at("rotateObject",{x:Kt.radToDeg(n.x).toFixed(2),y:Kt.radToDeg(n.y).toFixed(2),z:Kt.radToDeg(n.z).toFixed(2)})}}}};var _n=Pg();function Lg(r){let e,t,n,i;const s=r[1].default,o=xn(s,r,r[0],null);return{c(){e=q("div"),o&&o.c(),V(e,"class","absolute")},m(a,l){Oe(a,e,l),o&&o.m(e,null),t=!0,n||(i=ac(Rg.call(null,e,{to:"body"})),n=!0)},p(a,[l]){o&&o.p&&(!t||l&1)&&bn(o,s,a,a[0],t?Mn(s,a[0],l,null):Sn(a[0]),null)},i(a){t||(_e(o,a),t=!0)},o(a){Se(o,a),t=!1},d(a){a&&Ne(e),o&&o.d(a),n=!1,i()}}}function Rg(r,{to:e}){const t=document.querySelector(e);return t&&t.appendChild(r),{}}function Dg(r,e,t){let{$$slots:n={},$$scope:i}=e;return r.$$set=s=>{"$$scope"in s&&t(0,i=s.$$scope)},[i,n]}class Yc extends gt{constructor(e){super(),mt(this,e,Dg,Lg,ft,{})}}function pl(r){let e,t;const n=r[2].default,i=xn(n,r,r[5],null);return{c(){e=q("main"),i&&i.c(),V(e,"class","svelte-1fnr7mh")},m(s,o){Oe(s,e,o),i&&i.m(e,null),t=!0},p(s,o){i&&i.p&&(!t||o&32)&&bn(i,n,s,s[5],t?Mn(n,s[5],o,null):Sn(s[5]),null)},i(s){t||(_e(i,s),t=!0)},o(s){Se(i,s),t=!1},d(s){s&&Ne(e),i&&i.d(s)}}}function ml(r){let e,t;return e=new Yc({props:{$$slots:{default:[Ig]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&34&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function Ig(r){let e,t,n,i,s,o,a,l,c,u;return{c(){e=q("div"),t=q("div"),n=q("p"),n.textContent="Are you sure you want to exit? You have items in your cart.",i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[3]),Le(l,"click",r[4])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,qt(u)}}}function Ug(r){let e,t,n,i=r[0]&&pl(r),s=r[1]&&r[0]&&ml(r);return{c(){i&&i.c(),e=le(),s&&s.c(),t=ri()},m(o,a){i&&i.m(o,a),Oe(o,e,a),s&&s.m(o,a),Oe(o,t,a),n=!0},p(o,[a]){o[0]?i?(i.p(o,a),a&1&&_e(i,1)):(i=pl(o),i.c(),_e(i,1),i.m(e.parentNode,e)):i&&(Wn(),Se(i,1,1,()=>{i=null}),jn()),o[1]&&o[0]?s?(s.p(o,a),a&3&&_e(s,1)):(s=ml(o),s.c(),_e(s,1),s.m(t.parentNode,t)):s&&(Wn(),Se(s,1,1,()=>{s=null}),jn())},i(o){n||(_e(i),_e(s),n=!0)},o(o){Se(i),Se(s),n=!1},d(o){i&&i.d(o),o&&Ne(e),s&&s.d(o),o&&Ne(t)}}}function Ng(r,e,t){let n,i;Ee(r,Cn,f=>t(6,n=f)),Ee(r,zt,f=>t(7,i=f));let{$$slots:s={},$$scope:o}=e,a;ji.subscribe(f=>{t(0,a=f)}),an("setVisible",f=>{ji.set(f),f&&Ie(zt,i=!1,i)});let l=!1;or(()=>{const f=h=>{a&&["Escape"].includes(h.code)&&(n.length>0?t(1,l=!0):(at("hoverOut"),at("hideUI"),t(1,l=!1),ji.set(!1),_n.show.set(!1),vn.set(null)))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)});const c=()=>{t(1,l=!1)},u=()=>{at("hideUI"),t(1,l=!1),ji.set(!1),_n.show.set(!1)};return r.$$set=f=>{"$$scope"in f&&t(5,o=f.$$scope)},[a,l,s,c,u,o]}class Og extends gt{constructor(e){super(),mt(this,e,Ng,Ug,ft,{})}}const Fg=()=>!window.invokeNative,Ao=(r,e=0)=>{if(Fg())for(const t of r)setTimeout(()=>{window.dispatchEvent(new MessageEvent("message",{data:{action:t.action,data:t.data}}))},e)};function gl(r,e,t){const n=r.slice();return n[6]=e[t],n}function _l(r,e,t){const n=r.slice();return n[9]=e[t],n}function vl(r){let e,t=r[1],n=[];for(let i=0;i{t(0,n=!n)},c=>{if(c.custom==!0){c.customFunction();return}Ao([{action:c.action,data:c.data}])}]}class Bg extends gt{constructor(e){super(),mt(this,e,kg,zg,ft,{})}}function bl(r,e,t){const n=r.slice();return n[15]=e[t],n[17]=t,n}function Sl(r){let e,t,n,i=r[15].label+"",s,o,a,l,c,u,f,h=r[15].price+"",p,_,v,m,d,g;function x(){return r[8](r[15])}function M(){return r[10](r[15])}return{c(){e=q("button"),t=q("div"),n=q("p"),s=rt(i),o=le(),a=q("div"),l=q("p"),l.textContent="Price:",c=le(),u=q("p"),f=rt("$"),p=rt(h),_=le(),v=q("div"),v.innerHTML='',m=le(),V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(l,"class","text-[color:var(--color-text)] text-[1.2rem]"),V(u,"class","text-[color:var(--color-accent)] ml-2 font-bold text-[1.2rem]"),V(a,"class","flex"),V(t,"class","w-full h-full flex flex-col justify-center items-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] aspect-square h-full grid place-items-center justify-center items-center"),V(e,"class","h-full w-[30rem] bg-[color:var(--color-secondary)] flex flex-row items-center hover:cursor-pointer")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"mouseenter",x),Le(v,"mouseleave",r[9]),Le(e,"click",M),Le(e,"mouseleave",r[11])],d=!0)},p(y,w){r=y,w&8&&i!==(i=r[15].label+"")&&At(s,i),w&8&&h!==(h=r[15].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,qt(g)}}}function yl(r){let e,t;return e=new Yc({props:{$$slots:{default:[Gg]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&262246&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function Gg(r){let e,t,n,i,s,o,a,l,c,u;return{c(){e=q("div"),t=q("div"),n=q("p"),n.textContent=`Are you sure you want to stop placing this current\r - furniture?`,i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[13]),Le(l,"click",r[14])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,qt(u)}}}function Hg(r){let e,t,n,i,s,o,a,l=r[3].items,c=[];for(let f=0;f{u=null}),jn())},i(f){s||(_e(u),s=!0)},o(f){Se(u),s=!1},d(f){f&&Ne(e),rr(c,f),r[12](null),f&&Ne(n),u&&u.d(f),f&&Ne(i),o=!1,a()}}}function Vg(r,e,t){let n,i,s,o;Ee(r,$n,g=>t(3,n=g)),Ee(r,Zi,g=>t(4,i=g)),Ee(r,vn,g=>t(5,s=g)),Ee(r,zt,g=>t(6,o=g));let a;function l(g){g=window.event||g;var x=Math.max(-1,Math.min(1,g.wheelDelta||-g.detail));t(0,a.scrollLeft-=x*50,a),g.preventDefault()}let c=!1,u=null;const f=g=>{at("hoverIn",g)},h=()=>{at("hoverOut")},p=g=>{if(at("hoverOut"),g.type){const x=i.filter(y=>y.type===g.type);let M=g.max||1;if(x.length>=M){at("showNotification",{type:"error",message:`You can only have ${M} of this item!`});return}}s!=null?(t(1,c=!0),t(2,u=g)):(at("previewFurniture",g),Ie(vn,s=g,s),Ie(zt,o=!0,o))},_=()=>{at("hoverOut")};function v(g){Vn[g?"unshift":"push"](()=>{a=g,t(0,a)})}return[a,c,u,n,i,s,o,l,f,h,p,_,v,()=>{t(1,c=!1),t(2,u=null)},()=>{at("previewFurniture",u),Ie(vn,s=u,s),Ie(zt,o=!0,o),t(1,c=!1),t(2,u=null)}]}class Wg extends gt{constructor(e){super(),mt(this,e,Vg,Hg,ft,{})}}function jg(r,e,t){let n,i,s,o,a,l;Ee(r,Zi,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),Ee(r,zt,u=>t(3,o=u)),Ee(r,ms,u=>t(4,a=u)),Ee(r,ji,u=>t(5,l=u)),Ao([{action:"setVisible",data:!0}]),Ao([{action:"setBrowserMode",data:!0}]);function c(u){u.key==="="&&Ie(ji,l=!0,l)}return an("setBrowserMode",u=>{Ms.set(u),console.log("browser mode enabled"),u?window.addEventListener("keydown",c):window.removeEventListener("keydown",c)}),an("setupModel",u=>{_n.show.set(!0),_n.setupModel(u)}),an("updateCamera",u=>{_n.updateCamera(u)}),an("setFurnituresData",u=>{ms.set(u),$n.set(a[0])}),an("addToCart",u=>{Ie(Cn,i=[...i,u],i),_n.show.set(!1),Ie(zt,o=!1,o)}),an("removeFromCart",u=>{Ie(Cn,i=i.filter(f=>f.entity!=u.entity),i),Ie(Cn,i=[...i],i),Ie(vn,s=null,s),_n.show.set(!1)}),an("clearCart",()=>{Ie(Cn,i=[],i)}),an("setOwnedItems",u=>{Ie(Zi,n=u,n)}),an("removeOwnedItem",u=>{let f=n.filter(h=>h.id!=u.id);Ie(Zi,n=[...f],n)}),[]}class Xg extends gt{constructor(e){super(),mt(this,e,jg,null,ft,{})}}function wl(r,e,t){const n=r.slice();return n[20]=e[t],n[22]=t,n}function El(r){let e,t,n;return{c(){e=q("input"),e.autofocus=!0,V(e,"class","min-w-[10rem] h-[4.5rem] px-[1rem] text-[1.6rem] bg-[color:var(--color-tertiary)]"),V(e,"type","text"),V(e,"placeholder","Search")},m(i,s){Oe(i,e,s),Tn(e,r[1]),e.focus(),t||(n=Le(e,"input",r[13]),t=!0)},p(i,s){s&2&&e.value!==i[1]&&Tn(e,i[1])},d(i){i&&Ne(e),t=!1,n()}}}function Tl(r){let e,t=r[20].category+"",n,i,s;function o(){return r[15](r[22])}return{c(){e=q("button"),n=rt(t),V(e,"class","whitespace-nowrap w-fit px-10 h-[4.5rem] text-[1.6rem] bg-[color:var(--color-secondary)] grid place-items-center transition-all duration-200 ease-in-out svelte-vkl3yg"),ps(e,"selected",r[0]===r[22])},m(a,l){Oe(a,e,l),D(e,n),i||(s=Le(e,"click",o),i=!0)},p(a,l){r=a,l&4&&t!==(t=r[20].category+"")&&At(n,t),l&1&&ps(e,"selected",r[0]===r[22])},d(a){a&&Ne(e),i=!1,s()}}}function qg(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m=r[9].length+"",d,g,x,M,y,w,C=r[10].length+"",T,b,S,F,k,L,O,B=r[4]&&El(r),J=r[2],R=[];for(let H=0;H',i=le(),B&&B.c(),o=le(),a=q("div"),l=q("button"),l.textContent="All Objects",c=le();for(let H=0;Ht(2,n=C)),Ee(r,$n,C=>t(5,i=C)),Ee(r,zt,C=>t(6,s=C)),Ee(r,Er,C=>t(7,o=C)),Ee(r,Tr,C=>t(8,a=C)),Ee(r,Zi,C=>t(9,l=C)),Ee(r,Cn,C=>t(10,c=C));let u=-1,f;function h(C){C=window.event||C;var T=Math.max(-1,Math.min(1,C.wheelDelta||-C.detail));t(3,f.scrollLeft-=T*50,f),C.preventDefault()}let p=!1,_="";const v=()=>{t(4,p=!p),s&&Ie(zt,s=!1,s)};function m(){_=this.value,t(1,_)}const d=()=>{t(0,u=-1);const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i),s&&Ie(zt,s=!1,s)},g=C=>{t(0,u=C),Ie($n,i=n[C],i),s&&Ie(zt,s=!1,s)};function x(C){Vn[C?"unshift":"push"](()=>{f=C,t(3,f)})}const M=()=>{Ie(Er,o=!1,o),Ie(Tr,a=!a,a)},y=()=>{Ie(Tr,a=!1,a),Ie(Er,o=!o,o)},w=()=>{Ie(zt,s=!s,s)};return r.$$.update=()=>{if(r.$$.dirty&7)if(_.length>0){let C=null;u==-1?C=n.flatMap(b=>b.items):C=n[u].items;const T=C.filter(b=>b.label.toLowerCase().includes(_.toLowerCase()));Ie($n,i={category:"Search Results",items:T},i)}else if(u===-1){const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i)}else Ie($n,i=n[u],i)},[u,_,n,f,p,i,s,o,a,l,c,h,v,m,d,g,x,M,y,w]}class Zg extends gt{constructor(e){super(),mt(this,e,Yg,qg,ft,{})}}function Al(r,e,t){const n=r.slice();return n[7]=e[t],n[9]=t,n}function Cl(r){let e,t,n,i,s,o,a,l,c,u,f,h=r[1].reduce(Ll,0)+"",p,_,v,m,d,g,x,M,y=r[1],w=[];for(let C=0;CYOUR SHOPPING CART

",n=le(),i=q("div");for(let C=0;C
',d=le(),g=q("button"),g.innerHTML="

Purchase

",V(t,"class","font-medium"),V(i,"class","flex flex-col gap-2 overflow-scroll h-[73%] scroll-style scroll-style-vertical"),V(a,"class","text-[1.6rem] w-full h-full flex items-center justify-between"),V(m,"class","bg-[color:var(--color-secondary)] mt-2 font-medium h-full w-[20%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(g,"class","bg-[color:var(--color-accent)] text-[2rem] mt-2 font-medium h-full w-[79%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(v,"class","flex w-full h-full justify-between"),V(o,"class","flex flex-col gap-2 items-center justify-center h-[5rem] mt-10"),V(e,"class","w-[40rem] h-[60rem] bg-[color:var(--color-primary)] absolute right-0 -top-[65rem] flex flex-col gap-[1rem] p-12")},m(C,T){Oe(C,e,T),D(e,t),D(e,n),D(e,i);for(let b=0;b
',m=le(),V(n,"class","text-[2rem]"),V(u,"class","text-[color:var(--color-accent)] font-bold ml-2"),V(a,"class","flex text-[1.5rem]"),V(t,"class","flex flex-col gap-2 w-full text-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square"),V(e,"class","flex flex-row gap-2 w-full min-h-[8rem] justify-between bg-[color:var(--color-secondary)] items-center")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"click",x),Le(e,"click",M)],d=!0)},p(y,w){r=y,w&2&&i!==(i=r[7].label+"")&&At(s,i),w&2&&h!==(h=r[7].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,qt(g)}}}function Qg(r){let e,t=r[0]&&Cl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Cl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}const Ll=(r,e)=>r+e.price;function Kg(r,e,t){let n,i,s;return Ee(r,Er,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),[n,i,s,u=>{at("removeCartItem",u)},u=>{at("selectCartItem",u)},()=>Ie(Er,n=!1,n),()=>{Ie(vn,s=null,s),at("buyCartItems")}]}class Jg extends gt{constructor(e){super(),mt(this,e,Kg,Qg,ft,{})}}function Rl(r,e,t){const n=r.slice();return n[5]=e[t],n[7]=t,n}function Dl(r){let e,t,n,i,s,o,a,l,c,u=r[1],f=[];for(let h=0;h',o=le(),a=q("div");for(let h=0;h',V(e,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square")},m(s,o){Oe(s,e,o),t||(n=Le(e,"click",i),t=!0)},p(s,o){r=s},d(s){s&&Ne(e),t=!1,n()}}}function Ul(r){let e,t,n,i,s,o=r[5].label+"",a,l,c,u,f;function h(){return r[3](r[5])}let p=r[5].type!="storage"&&r[5].type!="clothing"&&Il(r);return{c(){e=q("div"),t=q("button"),t.innerHTML='',n=le(),i=q("div"),s=q("h1"),a=rt(o),l=le(),p&&p.c(),c=le(),V(t,"class","bg-[color:var(--color-tertiary)] text-[2rem] w-[4rem] h-[4rem] text-center aspect-square"),V(s,"class","text-[2rem]"),V(i,"class","flex flex-col gap-2 w-full"),V(e,"class","flex flex-row gap-2 w-full justify-between bg-[color:var(--color-secondary)] p-4 items-center")},m(_,v){Oe(_,e,v),D(e,t),D(e,n),D(e,i),D(i,s),D(s,a),D(e,l),p&&p.m(e,null),D(e,c),u||(f=Le(t,"click",h),u=!0)},p(_,v){r=_,v&2&&o!==(o=r[5].label+"")&&At(a,o),r[5].type!="storage"&&r[5].type!="clothing"?p?p.p(r,v):(p=Il(r),p.c(),p.m(e,c)):p&&(p.d(1),p=null)},d(_){_&&Ne(e),p&&p.d(),u=!1,f()}}}function $g(r){let e,t=r[0]&&Dl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Dl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}function e_(r,e,t){let n,i;return Ee(r,Tr,l=>t(0,n=l)),Ee(r,Zi,l=>t(1,i=l)),[n,i,()=>Ie(Tr,n=!1,n),l=>{at("selectOwnedItem",l),console.log(l.type)},l=>{at("removeOwnedItem",l)}]}class t_ extends gt{constructor(e){super(),mt(this,e,e_,$g,ft,{})}}function n_(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m,d,g,x=r[1].toFixed(1)+"",M,y,w,C,T,b,S;return t=new Zg({}),i=new Wg({}),o=new Jg({}),l=new t_({}),{c(){e=q("div"),nt(t.$$.fragment),n=le(),nt(i.$$.fragment),s=le(),nt(o.$$.fragment),a=le(),nt(l.$$.fragment),c=le(),u=q("div"),f=q("i"),h=le(),p=q("p"),p.textContent="C",_=le(),v=q("div"),m=q("i"),d=le(),g=q("p"),M=rt(x),y=le(),w=q("input"),V(f,"class","fa-solid fa-video text-[white]"),V(p,"class","font-semibold"),jo(u,"border-color",r[0]?"white":"var(--color-tertiary)"),V(u,"class","absolute -top-[5rem] text-[2rem] right-0 w-[8rem] border-[0.3rem] h-[4rem] bg-[color:var(--color-primary)] flex flex-row gap-[1rem] items-center justify-center"),V(m,"class","fa-solid fa-eye text-[white]"),V(g,"class","font-semibold text-center w-[4rem]"),V(w,"id","slider"),V(w,"type","range"),V(w,"min","1.0"),V(w,"max","12.5"),V(w,"step","0.5"),V(w,"class","w-full"),V(v,"class","flex flex-row gap-[1rem] items-center absolute left-0 -top-[5rem] w-[30rem] h-fit p-4 bg-[color:var(--color-primary)]"),V(e,"class",C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(r[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all")},m(F,k){Oe(F,e,k),$e(t,e,null),D(e,n),$e(i,e,null),D(e,s),$e(o,e,null),D(e,a),$e(l,e,null),D(e,c),D(e,u),D(u,f),D(u,h),D(u,p),D(e,_),D(e,v),D(v,m),D(v,d),D(v,g),D(g,M),D(v,y),D(v,w),Tn(w,r[1]),T=!0,b||(S=[Le(w,"change",r[3]),Le(w,"input",r[3]),Le(w,"change",r[4])],b=!0)},p(F,[k]){(!T||k&1)&&jo(u,"border-color",F[0]?"white":"var(--color-tertiary)"),(!T||k&2)&&x!==(x=F[1].toFixed(1)+"")&&At(M,x),k&2&&Tn(w,F[1]),(!T||k&4&&C!==(C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(F[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all"))&&V(e,"class",C)},i(F){T||(_e(t.$$.fragment,F),_e(i.$$.fragment,F),_e(o.$$.fragment,F),_e(l.$$.fragment,F),T=!0)},o(F){Se(t.$$.fragment,F),Se(i.$$.fragment,F),Se(o.$$.fragment,F),Se(l.$$.fragment,F),T=!1},d(F){F&&Ne(e),et(t),et(i),et(o),et(l),b=!1,qt(S)}}}function i_(r,e,t){let n;Ee(r,zt,c=>t(2,n=c));let i=!1,s=5;function o(c){c.target instanceof HTMLInputElement||c.target instanceof HTMLTextAreaElement||c.key==="c"&&(at("freecamMode",!0),Ie(zt,n=!0,n),t(0,i=!0))}an("freecamMode",c=>{c==!1&&(Ie(zt,n=!1,n),t(0,i=!1))}),or(()=>{window.addEventListener("keypress",o),at("freecamMode",!1),at("setHoverDistance",s),Ie(zt,n=!1,n),t(0,i=!1)});function a(){s=cs(this.value),t(1,s)}return[i,s,n,a,()=>{at("setHoverDistance",s)}]}class r_ extends gt{constructor(e){super(),mt(this,e,i_,n_,ft,{})}}const s_={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` + furniture?`,i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[13]),Le(l,"click",r[14])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,qt(u)}}}function Hg(r){let e,t,n,i,s,o,a,l=r[3].items,c=[];for(let f=0;f{u=null}),jn())},i(f){s||(_e(u),s=!0)},o(f){Se(u),s=!1},d(f){f&&Ne(e),rr(c,f),r[12](null),f&&Ne(n),u&&u.d(f),f&&Ne(i),o=!1,a()}}}function Vg(r,e,t){let n,i,s,o;Ee(r,$n,g=>t(3,n=g)),Ee(r,Zi,g=>t(4,i=g)),Ee(r,vn,g=>t(5,s=g)),Ee(r,zt,g=>t(6,o=g));let a;function l(g){g=window.event||g;var x=Math.max(-1,Math.min(1,g.wheelDelta||-g.detail));t(0,a.scrollLeft-=x*50,a),g.preventDefault()}let c=!1,u=null;const f=g=>{at("hoverIn",g)},h=()=>{at("hoverOut")},p=g=>{if(at("hoverOut"),g.type){const x=i.filter(y=>y.type===g.type);let M=g.max||1;if(x.length>=M){at("showNotification",{type:"error",message:`You can only have ${M} of this item!`});return}}s!=null?(t(1,c=!0),t(2,u=g)):(at("previewFurniture",g),Ie(vn,s=g,s),Ie(zt,o=!0,o))},_=()=>{at("hoverOut")};function v(g){Vn[g?"unshift":"push"](()=>{a=g,t(0,a)})}return[a,c,u,n,i,s,o,l,f,h,p,_,v,()=>{t(1,c=!1),t(2,u=null)},()=>{at("previewFurniture",u),Ie(vn,s=u,s),Ie(zt,o=!0,o),t(1,c=!1),t(2,u=null)}]}class Wg extends gt{constructor(e){super(),mt(this,e,Vg,Hg,ft,{})}}function jg(r,e,t){let n,i,s,o,a,l;Ee(r,Zi,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),Ee(r,zt,u=>t(3,o=u)),Ee(r,ms,u=>t(4,a=u)),Ee(r,ji,u=>t(5,l=u)),Ao([{action:"setVisible",data:!0}]),Ao([{action:"setBrowserMode",data:!0}]);function c(u){u.key==="="&&Ie(ji,l=!0,l)}return an("setBrowserMode",u=>{Ms.set(u),console.log("browser mode enabled"),u?window.addEventListener("keydown",c):window.removeEventListener("keydown",c)}),an("setupModel",u=>{_n.show.set(!0),_n.setupModel(u)}),an("updateCamera",u=>{_n.updateCamera(u)}),an("setFurnituresData",u=>{ms.set(u),$n.set(a[0])}),an("addToCart",u=>{Ie(Cn,i=[...i,u],i),_n.show.set(!1),Ie(zt,o=!1,o)}),an("removeFromCart",u=>{Ie(Cn,i=i.filter(f=>f.entity!=u.entity),i),Ie(Cn,i=[...i],i),Ie(vn,s=null,s),_n.show.set(!1)}),an("clearCart",()=>{Ie(Cn,i=[],i)}),an("setOwnedItems",u=>{Ie(Zi,n=u,n)}),an("removeOwnedItem",u=>{let f=n.filter(h=>h.id!=u.id);Ie(Zi,n=[...f],n)}),[]}class Xg extends gt{constructor(e){super(),mt(this,e,jg,null,ft,{})}}function wl(r,e,t){const n=r.slice();return n[20]=e[t],n[22]=t,n}function El(r){let e,t,n;return{c(){e=q("input"),e.autofocus=!0,V(e,"class","min-w-[10rem] h-[4.5rem] px-[1rem] text-[1.6rem] bg-[color:var(--color-tertiary)]"),V(e,"type","text"),V(e,"placeholder","Search")},m(i,s){Oe(i,e,s),Tn(e,r[1]),e.focus(),t||(n=Le(e,"input",r[13]),t=!0)},p(i,s){s&2&&e.value!==i[1]&&Tn(e,i[1])},d(i){i&&Ne(e),t=!1,n()}}}function Tl(r){let e,t=r[20].category+"",n,i,s;function o(){return r[15](r[22])}return{c(){e=q("button"),n=rt(t),V(e,"class","whitespace-nowrap w-fit px-10 h-[4.5rem] text-[1.6rem] bg-[color:var(--color-secondary)] grid place-items-center transition-all duration-200 ease-in-out svelte-vkl3yg"),ps(e,"selected",r[0]===r[22])},m(a,l){Oe(a,e,l),D(e,n),i||(s=Le(e,"click",o),i=!0)},p(a,l){r=a,l&4&&t!==(t=r[20].category+"")&&At(n,t),l&1&&ps(e,"selected",r[0]===r[22])},d(a){a&&Ne(e),i=!1,s()}}}function qg(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m=r[9].length+"",d,g,x,M,y,w,C=r[10].length+"",T,b,S,F,k,L,O,B=r[4]&&El(r),J=r[2],R=[];for(let H=0;H',i=le(),B&&B.c(),o=le(),a=q("div"),l=q("button"),l.textContent="All Objects",c=le();for(let H=0;Ht(2,n=C)),Ee(r,$n,C=>t(5,i=C)),Ee(r,zt,C=>t(6,s=C)),Ee(r,Er,C=>t(7,o=C)),Ee(r,Tr,C=>t(8,a=C)),Ee(r,Zi,C=>t(9,l=C)),Ee(r,Cn,C=>t(10,c=C));let u=-1,f;function h(C){C=window.event||C;var T=Math.max(-1,Math.min(1,C.wheelDelta||-C.detail));t(3,f.scrollLeft-=T*50,f),C.preventDefault()}let p=!1,_="";const v=()=>{t(4,p=!p),s&&Ie(zt,s=!1,s)};function m(){_=this.value,t(1,_)}const d=()=>{t(0,u=-1);const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i),s&&Ie(zt,s=!1,s)},g=C=>{t(0,u=C),Ie($n,i=n[C],i),s&&Ie(zt,s=!1,s)};function x(C){Vn[C?"unshift":"push"](()=>{f=C,t(3,f)})}const M=()=>{Ie(Er,o=!1,o),Ie(Tr,a=!a,a)},y=()=>{Ie(Tr,a=!1,a),Ie(Er,o=!o,o)},w=()=>{Ie(zt,s=!s,s)};return r.$$.update=()=>{if(r.$$.dirty&7)if(_.length>0){let C=null;u==-1?C=n.flatMap(b=>b.items):C=n[u].items;const T=C.filter(b=>b.label.toLowerCase().includes(_.toLowerCase()));Ie($n,i={category:"Search Results",items:T},i)}else if(u===-1){const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i)}else Ie($n,i=n[u],i)},[u,_,n,f,p,i,s,o,a,l,c,h,v,m,d,g,x,M,y,w]}class Zg extends gt{constructor(e){super(),mt(this,e,Yg,qg,ft,{})}}function Al(r,e,t){const n=r.slice();return n[7]=e[t],n[9]=t,n}function Cl(r){let e,t,n,i,s,o,a,l,c,u,f,h=r[1].reduce(Ll,0)+"",p,_,v,m,d,g,x,M,y=r[1],w=[];for(let C=0;CYOUR SHOPPING CART

",n=le(),i=q("div");for(let C=0;C',d=le(),g=q("button"),g.innerHTML="

Purchase

",V(t,"class","font-medium"),V(i,"class","flex flex-col gap-2 overflow-scroll h-[73%] scroll-style scroll-style-vertical"),V(a,"class","text-[1.6rem] w-full h-full flex items-center justify-between"),V(m,"class","bg-[color:var(--color-secondary)] mt-2 font-medium h-full w-[20%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(g,"class","bg-[color:var(--color-accent)] text-[2rem] mt-2 font-medium h-full w-[79%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(v,"class","flex w-full h-full justify-between"),V(o,"class","flex flex-col gap-2 items-center justify-center h-[5rem] mt-10"),V(e,"class","w-[40rem] h-[60rem] bg-[color:var(--color-primary)] absolute right-0 -top-[65rem] flex flex-col gap-[1rem] p-12")},m(C,T){Oe(C,e,T),D(e,t),D(e,n),D(e,i);for(let b=0;b',m=le(),V(n,"class","text-[2rem]"),V(u,"class","text-[color:var(--color-accent)] font-bold ml-2"),V(a,"class","flex text-[1.5rem]"),V(t,"class","flex flex-col gap-2 w-full text-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square"),V(e,"class","flex flex-row gap-2 w-full min-h-[8rem] justify-between bg-[color:var(--color-secondary)] items-center")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"click",x),Le(e,"click",M)],d=!0)},p(y,w){r=y,w&2&&i!==(i=r[7].label+"")&&At(s,i),w&2&&h!==(h=r[7].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,qt(g)}}}function Qg(r){let e,t=r[0]&&Cl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Cl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}const Ll=(r,e)=>r+e.price;function Kg(r,e,t){let n,i,s;return Ee(r,Er,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),[n,i,s,u=>{at("removeCartItem",u)},u=>{at("selectCartItem",u)},()=>Ie(Er,n=!1,n),()=>{Ie(vn,s=null,s),at("buyCartItems")}]}class Jg extends gt{constructor(e){super(),mt(this,e,Kg,Qg,ft,{})}}function Rl(r,e,t){const n=r.slice();return n[5]=e[t],n[7]=t,n}function Dl(r){let e,t,n,i,s,o,a,l,c,u=r[1],f=[];for(let h=0;h',o=le(),a=q("div");for(let h=0;h',V(e,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square")},m(s,o){Oe(s,e,o),t||(n=Le(e,"click",i),t=!0)},p(s,o){r=s},d(s){s&&Ne(e),t=!1,n()}}}function Ul(r){let e,t,n,i,s,o=r[5].label+"",a,l,c,u,f;function h(){return r[3](r[5])}let p=r[5].type!="storage"&&r[5].type!="clothing"&&Il(r);return{c(){e=q("div"),t=q("button"),t.innerHTML='',n=le(),i=q("div"),s=q("h1"),a=rt(o),l=le(),p&&p.c(),c=le(),V(t,"class","bg-[color:var(--color-tertiary)] text-[2rem] w-[4rem] h-[4rem] text-center aspect-square"),V(s,"class","text-[2rem]"),V(i,"class","flex flex-col gap-2 w-full"),V(e,"class","flex flex-row gap-2 w-full justify-between bg-[color:var(--color-secondary)] p-4 items-center")},m(_,v){Oe(_,e,v),D(e,t),D(e,n),D(e,i),D(i,s),D(s,a),D(e,l),p&&p.m(e,null),D(e,c),u||(f=Le(t,"click",h),u=!0)},p(_,v){r=_,v&2&&o!==(o=r[5].label+"")&&At(a,o),r[5].type!="storage"&&r[5].type!="clothing"?p?p.p(r,v):(p=Il(r),p.c(),p.m(e,c)):p&&(p.d(1),p=null)},d(_){_&&Ne(e),p&&p.d(),u=!1,f()}}}function $g(r){let e,t=r[0]&&Dl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Dl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}function e_(r,e,t){let n,i;return Ee(r,Tr,l=>t(0,n=l)),Ee(r,Zi,l=>t(1,i=l)),[n,i,()=>Ie(Tr,n=!1,n),l=>{at("selectOwnedItem",l)},l=>{at("removeOwnedItem",l)}]}class t_ extends gt{constructor(e){super(),mt(this,e,e_,$g,ft,{})}}function n_(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m,d,g,x=r[1].toFixed(1)+"",M,y,w,C,T,b,S;return t=new Zg({}),i=new Wg({}),o=new Jg({}),l=new t_({}),{c(){e=q("div"),nt(t.$$.fragment),n=le(),nt(i.$$.fragment),s=le(),nt(o.$$.fragment),a=le(),nt(l.$$.fragment),c=le(),u=q("div"),f=q("i"),h=le(),p=q("p"),p.textContent="C",_=le(),v=q("div"),m=q("i"),d=le(),g=q("p"),M=rt(x),y=le(),w=q("input"),V(f,"class","fa-solid fa-video text-[white]"),V(p,"class","font-semibold"),jo(u,"border-color",r[0]?"white":"var(--color-tertiary)"),V(u,"class","absolute -top-[5rem] text-[2rem] right-0 w-[8rem] border-[0.3rem] h-[4rem] bg-[color:var(--color-primary)] flex flex-row gap-[1rem] items-center justify-center"),V(m,"class","fa-solid fa-eye text-[white]"),V(g,"class","font-semibold text-center w-[4rem]"),V(w,"id","slider"),V(w,"type","range"),V(w,"min","1.0"),V(w,"max","12.5"),V(w,"step","0.5"),V(w,"class","w-full"),V(v,"class","flex flex-row gap-[1rem] items-center absolute left-0 -top-[5rem] w-[30rem] h-fit p-4 bg-[color:var(--color-primary)]"),V(e,"class",C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(r[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all")},m(F,k){Oe(F,e,k),$e(t,e,null),D(e,n),$e(i,e,null),D(e,s),$e(o,e,null),D(e,a),$e(l,e,null),D(e,c),D(e,u),D(u,f),D(u,h),D(u,p),D(e,_),D(e,v),D(v,m),D(v,d),D(v,g),D(g,M),D(v,y),D(v,w),Tn(w,r[1]),T=!0,b||(S=[Le(w,"change",r[3]),Le(w,"input",r[3]),Le(w,"change",r[4])],b=!0)},p(F,[k]){(!T||k&1)&&jo(u,"border-color",F[0]?"white":"var(--color-tertiary)"),(!T||k&2)&&x!==(x=F[1].toFixed(1)+"")&&At(M,x),k&2&&Tn(w,F[1]),(!T||k&4&&C!==(C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(F[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all"))&&V(e,"class",C)},i(F){T||(_e(t.$$.fragment,F),_e(i.$$.fragment,F),_e(o.$$.fragment,F),_e(l.$$.fragment,F),T=!0)},o(F){Se(t.$$.fragment,F),Se(i.$$.fragment,F),Se(o.$$.fragment,F),Se(l.$$.fragment,F),T=!1},d(F){F&&Ne(e),et(t),et(i),et(o),et(l),b=!1,qt(S)}}}function i_(r,e,t){let n;Ee(r,zt,c=>t(2,n=c));let i=!1,s=5;function o(c){c.target instanceof HTMLInputElement||c.target instanceof HTMLTextAreaElement||c.key==="c"&&(at("freecamMode",!0),Ie(zt,n=!0,n),t(0,i=!0))}an("freecamMode",c=>{c==!1&&(Ie(zt,n=!1,n),t(0,i=!1))}),or(()=>{window.addEventListener("keypress",o),at("freecamMode",!1),at("setHoverDistance",s),Ie(zt,n=!1,n),t(0,i=!1)});function a(){s=cs(this.value),t(1,s)}return[i,s,n,a,()=>{at("setHoverDistance",s)}]}class r_ extends gt{constructor(e){super(),mt(this,e,i_,n_,ft,{})}}const s_={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; diff --git a/ui/src/components/OwnedItems.svelte b/ui/src/components/OwnedItems.svelte index bcd4060..e1e7559 100644 --- a/ui/src/components/OwnedItems.svelte +++ b/ui/src/components/OwnedItems.svelte @@ -34,7 +34,6 @@ class="bg-[color:var(--color-tertiary)] text-[2rem] w-[4rem] h-[4rem] text-center aspect-square" on:click={() => { SendNUI('selectOwnedItem', item) - console.log(item.type) }} > From 0c638340f77f1932e9e641fa4884a34caf4a1932 Mon Sep 17 00:00:00 2001 From: Complex Date: Sun, 30 Jul 2023 02:28:14 +0200 Subject: [PATCH 10/10] Removed the Check --- html/index.js | 306 ++++++++++++++-------------- ui/src/components/OwnedItems.svelte | 18 +- 2 files changed, 161 insertions(+), 163 deletions(-) diff --git a/html/index.js b/html/index.js index c214e36..21eeb7f 100644 --- a/html/index.js +++ b/html/index.js @@ -1,12 +1,12 @@ -const au=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerpolicy&&(s.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?s.credentials="include":i.crossorigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}};au();function St(){}function ho(r,e){for(const t in e)r[t]=e[t];return r}function sc(r){return r()}function Vo(){return Object.create(null)}function qt(r){r.forEach(sc)}function gs(r){return typeof r=="function"}function ft(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function lu(r){return Object.keys(r).length===0}function Co(r,...e){if(r==null)return St;const t=r.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Po(r){let e;return Co(r,t=>e=t)(),e}function Ee(r,e,t){r.$$.on_destroy.push(Co(e,t))}function xn(r,e,t,n){if(r){const i=oc(r,e,t,n);return r[0](i)}}function oc(r,e,t,n){return r[1]&&n?ho(t.ctx.slice(),r[1](n(e))):t.ctx}function Mn(r,e,t,n){if(r[2]&&n){const i=r[2](n(t));if(e.dirty===void 0)return i;if(typeof i=="object"){const s=[],o=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],t=r.ctx.length/32;for(let n=0;nr.removeEventListener(e,t,n)}function V(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function cs(r){return r===""?null:+r}function uu(r){return Array.from(r.childNodes)}function At(r,e){e=""+e,r.data!==e&&(r.data=e)}function Tn(r,e){r.value=e==null?"":e}function jo(r,e,t,n){t===null?r.style.removeProperty(e):r.style.setProperty(e,t,n?"important":"")}function ps(r,e,t){r.classList[t?"add":"remove"](e)}function fu(r,e,{bubbles:t=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(r,t,n,e),i}let Pr;function wr(r){Pr=r}function sr(){if(!Pr)throw new Error("Function called outside component initialization");return Pr}function or(r){sr().$$.on_mount.push(r)}function ut(r){sr().$$.on_destroy.push(r)}function _s(){const r=sr();return(e,t,{cancelable:n=!1}={})=>{const i=r.$$.callbacks[e];if(i){const s=fu(e,t,{cancelable:n});return i.slice().forEach(o=>{o.call(r,s)}),!s.defaultPrevented}return!0}}function pn(r,e){return sr().$$.context.set(r,e),e}function In(r){return sr().$$.context.get(r)}function $i(r,e){const t=r.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const Hi=[],Vn=[];let Yi=[];const po=[],lc=Promise.resolve();let mo=!1;function cc(){mo||(mo=!0,lc.then(uc))}function Lr(){return cc(),lc}function go(r){Yi.push(r)}function vs(r){po.push(r)}const Is=new Set;let wi=0;function uc(){if(wi!==0)return;const r=Pr;do{try{for(;wir.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Yi=e}const us=new Set;let vi;function Wn(){vi={r:0,c:[],p:vi}}function jn(){vi.r||qt(vi.c),vi=vi.p}function _e(r,e){r&&r.i&&(us.delete(r),r.i(e))}function Se(r,e,t,n){if(r&&r.o){if(us.has(r))return;us.add(r),vi.c.push(()=>{us.delete(r),n&&(t&&r.d(1),n())}),r.o(e)}else n&&n()}function xs(r,e,t){const n=r.$$.props[e];n!==void 0&&(r.$$.bound[n]=t,t(r.$$.ctx[n]))}function nt(r){r&&r.c()}function $e(r,e,t,n){const{fragment:i,after_update:s}=r.$$;i&&i.m(e,t),n||go(()=>{const o=r.$$.on_mount.map(sc).filter(gs);r.$$.on_destroy?r.$$.on_destroy.push(...o):qt(o),r.$$.on_mount=[]}),s.forEach(go)}function et(r,e){const t=r.$$;t.fragment!==null&&(du(t.after_update),qt(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function pu(r,e){r.$$.dirty[0]===-1&&(Hi.push(r),cc(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<{const _=p.length?p[0]:h;return c.ctx&&i(c.ctx[f],c.ctx[f]=_)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](_),u&&pu(r,f)),h}):[],c.update(),u=!0,qt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const f=uu(e.target);c.fragment&&c.fragment.l(f),f.forEach(Ne)}else c.fragment&&c.fragment.c();e.intro&&_e(r.$$.fragment),$e(r,e.target,e.anchor,e.customElement),uc()}wr(l)}class gt{$destroy(){et(this,1),this.$destroy=St}$on(e,t){if(!gs(t))return St;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!lu(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function an(r,e){const t=n=>{const{action:i,data:s}=n.data;i===r&&e(s)};or(()=>window.addEventListener("message",t)),ut(()=>window.removeEventListener("message",t))}const Ei=[];function fc(r,e){return{subscribe:Ye(r,e).subscribe}}function Ye(r,e=St){let t;const n=new Set;function i(a){if(ft(r,a)&&(r=a,t)){const l=!Ei.length;for(const c of n)c[1](),Ei.push(c,r);if(l){for(let c=0;c{n.delete(c),n.size===0&&t&&(t(),t=null)}}return{set:i,update:s,subscribe:o}}function mu(r,e,t){const n=!Array.isArray(r),i=n?[r]:r,s=e.length<2;return fc(t,o=>{let a=!1;const l=[];let c=0,u=St;const f=()=>{if(c)return;u();const p=e(n?l[0]:l,o);s?o(p):u=gs(p)?p:St},h=i.map((p,_)=>Co(p,v=>{l[_]=v,c&=~(1<<_),a&&f()},()=>{c|=1<<_}));return a=!0,f(),function(){qt(h),u(),a=!1}})}const ji=Ye(!1),Ms=Ye(!1),_o=Ye(""),ms=Ye(null),$n=Ye(null),vn=Ye(null),zt=Ye(!1),Er=Ye(!1),Tr=Ye(!1),Zi=Ye([]),Cn=Ye([]);let hc=!1;Ms.subscribe(r=>{hc=r});let dc="";_o.subscribe(r=>{dc=r});async function at(r,e={},t){if(hc==!0&&t)return Promise.resolve(t||{});const n={method:"post",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(e)},i=window.GetParentResourceName?window.GetParentResourceName():dc;return await(await fetch(`https://${i}/${r}`,n)).json()}function Vi(r){return{x:r.x,y:r.z,z:-r.y}}function fs(r){return{x:r.x,y:-r.z,z:r.y}}/** +const ou=function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerpolicy&&(s.referrerPolicy=i.referrerpolicy),i.crossorigin==="use-credentials"?s.credentials="include":i.crossorigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function n(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}};ou();function St(){}function ho(r,e){for(const t in e)r[t]=e[t];return r}function rc(r){return r()}function Vo(){return Object.create(null)}function kt(r){r.forEach(rc)}function gs(r){return typeof r=="function"}function ft(r,e){return r!=r?e==e:r!==e||r&&typeof r=="object"||typeof r=="function"}function au(r){return Object.keys(r).length===0}function Co(r,...e){if(r==null)return St;const t=r.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function Po(r){let e;return Co(r,t=>e=t)(),e}function Ee(r,e,t){r.$$.on_destroy.push(Co(e,t))}function xn(r,e,t,n){if(r){const i=sc(r,e,t,n);return r[0](i)}}function sc(r,e,t,n){return r[1]&&n?ho(t.ctx.slice(),r[1](n(e))):t.ctx}function Mn(r,e,t,n){if(r[2]&&n){const i=r[2](n(t));if(e.dirty===void 0)return i;if(typeof i=="object"){const s=[],o=Math.max(e.dirty.length,i.length);for(let a=0;a32){const e=[],t=r.ctx.length/32;for(let n=0;nr.removeEventListener(e,t,n)}function V(r,e,t){t==null?r.removeAttribute(e):r.getAttribute(e)!==t&&r.setAttribute(e,t)}function cs(r){return r===""?null:+r}function cu(r){return Array.from(r.childNodes)}function At(r,e){e=""+e,r.data!==e&&(r.data=e)}function Tn(r,e){r.value=e==null?"":e}function jo(r,e,t,n){t===null?r.style.removeProperty(e):r.style.setProperty(e,t,n?"important":"")}function ps(r,e,t){r.classList[t?"add":"remove"](e)}function uu(r,e,{bubbles:t=!1,cancelable:n=!1}={}){const i=document.createEvent("CustomEvent");return i.initCustomEvent(r,t,n,e),i}let Pr;function wr(r){Pr=r}function sr(){if(!Pr)throw new Error("Function called outside component initialization");return Pr}function or(r){sr().$$.on_mount.push(r)}function ut(r){sr().$$.on_destroy.push(r)}function _s(){const r=sr();return(e,t,{cancelable:n=!1}={})=>{const i=r.$$.callbacks[e];if(i){const s=uu(e,t,{cancelable:n});return i.slice().forEach(o=>{o.call(r,s)}),!s.defaultPrevented}return!0}}function pn(r,e){return sr().$$.context.set(r,e),e}function In(r){return sr().$$.context.get(r)}function $i(r,e){const t=r.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const Hi=[],Vn=[];let Yi=[];const po=[],ac=Promise.resolve();let mo=!1;function lc(){mo||(mo=!0,ac.then(cc))}function Lr(){return lc(),ac}function go(r){Yi.push(r)}function vs(r){po.push(r)}const Is=new Set;let wi=0;function cc(){if(wi!==0)return;const r=Pr;do{try{for(;wir.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),Yi=e}const us=new Set;let vi;function Wn(){vi={r:0,c:[],p:vi}}function jn(){vi.r||kt(vi.c),vi=vi.p}function _e(r,e){r&&r.i&&(us.delete(r),r.i(e))}function Se(r,e,t,n){if(r&&r.o){if(us.has(r))return;us.add(r),vi.c.push(()=>{us.delete(r),n&&(t&&r.d(1),n())}),r.o(e)}else n&&n()}function xs(r,e,t){const n=r.$$.props[e];n!==void 0&&(r.$$.bound[n]=t,t(r.$$.ctx[n]))}function nt(r){r&&r.c()}function $e(r,e,t,n){const{fragment:i,after_update:s}=r.$$;i&&i.m(e,t),n||go(()=>{const o=r.$$.on_mount.map(rc).filter(gs);r.$$.on_destroy?r.$$.on_destroy.push(...o):kt(o),r.$$.on_mount=[]}),s.forEach(go)}function et(r,e){const t=r.$$;t.fragment!==null&&(hu(t.after_update),kt(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function du(r,e){r.$$.dirty[0]===-1&&(Hi.push(r),lc(),r.$$.dirty.fill(0)),r.$$.dirty[e/31|0]|=1<{const _=p.length?p[0]:h;return c.ctx&&i(c.ctx[f],c.ctx[f]=_)&&(!c.skip_bound&&c.bound[f]&&c.bound[f](_),u&&du(r,f)),h}):[],c.update(),u=!0,kt(c.before_update),c.fragment=n?n(c.ctx):!1,e.target){if(e.hydrate){const f=cu(e.target);c.fragment&&c.fragment.l(f),f.forEach(Ne)}else c.fragment&&c.fragment.c();e.intro&&_e(r.$$.fragment),$e(r,e.target,e.anchor,e.customElement),cc()}wr(l)}class gt{$destroy(){et(this,1),this.$destroy=St}$on(e,t){if(!gs(t))return St;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const i=n.indexOf(t);i!==-1&&n.splice(i,1)}}$set(e){this.$$set&&!au(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function an(r,e){const t=n=>{const{action:i,data:s}=n.data;i===r&&e(s)};or(()=>window.addEventListener("message",t)),ut(()=>window.removeEventListener("message",t))}const Ei=[];function uc(r,e){return{subscribe:Ye(r,e).subscribe}}function Ye(r,e=St){let t;const n=new Set;function i(a){if(ft(r,a)&&(r=a,t)){const l=!Ei.length;for(const c of n)c[1](),Ei.push(c,r);if(l){for(let c=0;c{n.delete(c),n.size===0&&t&&(t(),t=null)}}return{set:i,update:s,subscribe:o}}function pu(r,e,t){const n=!Array.isArray(r),i=n?[r]:r,s=e.length<2;return uc(t,o=>{let a=!1;const l=[];let c=0,u=St;const f=()=>{if(c)return;u();const p=e(n?l[0]:l,o);s?o(p):u=gs(p)?p:St},h=i.map((p,_)=>Co(p,v=>{l[_]=v,c&=~(1<<_),a&&f()},()=>{c|=1<<_}));return a=!0,f(),function(){kt(h),u(),a=!1}})}const ji=Ye(!1),Ms=Ye(!1),_o=Ye(""),ms=Ye(null),$n=Ye(null),vn=Ye(null),zt=Ye(!1),Er=Ye(!1),Tr=Ye(!1),Zi=Ye([]),Cn=Ye([]);let fc=!1;Ms.subscribe(r=>{fc=r});let hc="";_o.subscribe(r=>{hc=r});async function at(r,e={},t){if(fc==!0&&t)return Promise.resolve(t||{});const n={method:"post",headers:{"Content-Type":"application/json; charset=UTF-8"},body:JSON.stringify(e)},i=window.GetParentResourceName?window.GetParentResourceName():hc;return await(await fetch(`https://${i}/${r}`,n)).json()}function Vi(r){return{x:r.x,y:r.z,z:-r.y}}function fs(r){return{x:r.x,y:-r.z,z:r.y}}/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const Lo="151",gu=0,Xo=1,_u=2,pc=1,mc=2,xr=3,ti=0,Jt=1,Pn=2,ei=0,Qi=1,qo=2,Yo=3,Zo=4,vu=5,Wi=100,xu=101,Mu=102,Qo=103,Ko=104,bu=200,Su=201,yu=202,wu=203,gc=204,_c=205,Eu=206,Tu=207,Au=208,Cu=209,Pu=210,Lu=0,Ru=1,Du=2,vo=3,Iu=4,Uu=5,Nu=6,Ou=7,vc=0,Fu=1,zu=2,Rn=0,ku=1,Bu=2,Gu=3,xc=4,Hu=5,Mc=300,er=301,tr=302,xo=303,Mo=304,bs=306,bo=1e3,mn=1001,So=1002,Vt=1003,Jo=1004,Us=1005,ln=1006,Vu=1007,Rr=1008,Si=1009,Wu=1010,ju=1011,bc=1012,Xu=1013,xi=1014,Mi=1015,Dr=1016,qu=1017,Yu=1018,Ki=1020,Zu=1021,gn=1023,Qu=1024,Ku=1025,bi=1026,nr=1027,Ju=1028,$u=1029,ef=1030,tf=1031,nf=1033,Ns=33776,Os=33777,Fs=33778,zs=33779,$o=35840,ea=35841,ta=35842,na=35843,rf=36196,ia=37492,ra=37496,sa=37808,oa=37809,aa=37810,la=37811,ca=37812,ua=37813,fa=37814,ha=37815,da=37816,pa=37817,ma=37818,ga=37819,_a=37820,va=37821,ks=36492,sf=36283,xa=36284,Ma=36285,ba=36286,ni=3e3,ot=3001,of=3200,af=3201,Sc=0,lf=1,En="srgb",Ir="srgb-linear",yc="display-p3",Bs=7680,cf=519,Sa=35044,ya="300 es",yo=1035;class ar{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const n=this._listeners[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,o=i.length;s>8&255]+Nt[r>>16&255]+Nt[r>>24&255]+"-"+Nt[e&255]+Nt[e>>8&255]+"-"+Nt[e>>16&15|64]+Nt[e>>24&255]+"-"+Nt[t&63|128]+Nt[t>>8&255]+"-"+Nt[t>>16&255]+Nt[t>>24&255]+Nt[n&255]+Nt[n>>8&255]+Nt[n>>16&255]+Nt[n>>24&255]).toLowerCase()}function jt(r,e,t){return Math.max(e,Math.min(t,r))}function Ro(r,e){return(r%e+e)%e}function uf(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function ff(r,e,t){return r!==e?(t-r)/(e-r):0}function Cr(r,e,t){return(1-t)*r+t*e}function hf(r,e,t,n){return Cr(r,e,1-Math.exp(-t*n))}function df(r,e=1){return e-Math.abs(Ro(r,e*2)-e)}function pf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function mf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function gf(r,e){return r+Math.floor(Math.random()*(e-r+1))}function _f(r,e){return r+Math.random()*(e-r)}function vf(r){return r*(.5-Math.random())}function xf(r){r!==void 0&&(wa=r);let e=wa+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Mf(r){return r*Ar}function bf(r){return r*Ur}function wo(r){return(r&r-1)===0&&r!==0}function Sf(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function wc(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function yf(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),h=o((e-n)/2),p=s((n-e)/2),_=o((n-e)/2);switch(i){case"XYX":r.set(a*u,l*f,l*h,a*c);break;case"YZY":r.set(l*h,a*u,l*f,a*c);break;case"ZXZ":r.set(l*f,l*h,a*u,a*c);break;case"XZX":r.set(a*u,l*_,l*p,a*c);break;case"YXY":r.set(l*p,a*u,l*_,a*c);break;case"ZYZ":r.set(l*_,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Mr(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function Zt(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const Kt={DEG2RAD:Ar,RAD2DEG:Ur,generateUUID:lr,clamp:jt,euclideanModulo:Ro,mapLinear:uf,inverseLerp:ff,lerp:Cr,damp:hf,pingpong:df,smoothstep:pf,smootherstep:mf,randInt:gf,randFloat:_f,randFloatSpread:vf,seededRandom:xf,degToRad:Mf,radToDeg:bf,isPowerOfTwo:wo,ceilPowerOfTwo:Sf,floorPowerOfTwo:wc,setQuaternionFromProperEuler:yf,normalize:Zt,denormalize:Mr};class Qe{constructor(e=0,t=0){Qe.prototype.isVector2=!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){return 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){return 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}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(n,-1,1))}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){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class We{constructor(){We.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,n,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[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,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],h=n[2],p=n[5],_=n[8],v=i[0],m=i[3],d=i[6],g=i[1],x=i[4],M=i[7],y=i[2],w=i[5],C=i[8];return s[0]=o*v+a*g+l*y,s[3]=o*m+a*x+l*w,s[6]=o*d+a*M+l*C,s[1]=c*v+u*g+f*y,s[4]=c*m+u*x+f*w,s[7]=c*d+u*M+f*C,s[2]=h*v+p*g+_*y,s[5]=h*m+p*x+_*w,s[8]=h*d+p*M+_*C,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],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,h=a*l-u*s,p=c*s-o*l,_=t*f+n*h+i*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/_;return e[0]=f*v,e[1]=(i*c-u*n)*v,e[2]=(a*n-i*o)*v,e[3]=h*v,e[4]=(u*t-i*l)*v,e[5]=(i*s-a*t)*v,e[6]=p*v,e[7]=(n*l-c*t)*v,e[8]=(o*t-n*s)*v,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,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Gs.makeScale(e,t)),this}rotate(e){return this.premultiply(Gs.makeRotation(-e)),this}translate(e,t){return this.premultiply(Gs.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])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)}}const Gs=new We;function Ec(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function Nr(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Ji(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Hs(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}const wf=new We().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),Ef=new We().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function Tf(r){return r.convertSRGBToLinear().applyMatrix3(Ef)}function Af(r){return r.applyMatrix3(wf).convertLinearToSRGB()}const Cf={[Ir]:r=>r,[En]:r=>r.convertSRGBToLinear(),[yc]:Tf},Pf={[Ir]:r=>r,[En]:r=>r.convertLinearToSRGB(),[yc]:Af},tn={enabled:!1,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return Ir},set workingColorSpace(r){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=Cf[e],i=Pf[t];if(n===void 0||i===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this.workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this.workingColorSpace)}};let Ti;class Tc{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ti===void 0&&(Ti=Nr("canvas")),Ti.width=e.width,Ti.height=e.height;const n=Ti.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ti}return t.width>2048||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(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const t=Nr("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),s=i.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Mc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case bo:e.x=e.x-Math.floor(e.x);break;case mn:e.x=e.x<0?0:1;break;case So:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case bo:e.y=e.y-Math.floor(e.y);break;case mn:e.y=e.y<0?0:1;break;case So:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}$t.DEFAULT_IMAGE=null;$t.DEFAULT_MAPPING=Mc;$t.DEFAULT_ANISOTROPY=1;class Ut{constructor(e=0,t=0,n=0,i=1){Ut.prototype.isVector4=!0,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=e.w!==void 0?e.w:1,this}add(e){return 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){return 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,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,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,s;const l=e.elements,c=l[0],u=l[4],f=l[8],h=l[1],p=l[5],_=l[9],v=l[2],m=l[6],d=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-v)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+v)<.1&&Math.abs(_+m)<.1&&Math.abs(c+p+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,M=(p+1)/2,y=(d+1)/2,w=(u+h)/4,C=(f+v)/4,T=(_+m)/4;return x>M&&x>y?x<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(x),i=w/n,s=C/n):M>y?M<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(M),n=w/i,s=T/i):y<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(y),n=C/s,i=T/s),this.set(n,i,s,t),this}let g=Math.sqrt((m-_)*(m-_)+(f-v)*(f-v)+(h-u)*(h-u));return Math.abs(g)<.001&&(g=1),this.x=(m-_)/g,this.y=(f-v)/g,this.z=(h-u)/g,this.w=Math.acos((c+p+d-1)/2),this}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.w=Math.min(this.w,e.w),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.w=Math.max(this.w,e.w),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.w=Math.max(e.w,Math.min(t.w,this.w)),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.w=Math.max(e,Math.min(t,this.w)),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.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),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.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}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.w+=(e.w-this.w)*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.w=e.w+(t.w-e.w)*n,this}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}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ii extends ar{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ut(0,0,e,t),this.scissorTest=!1,this.viewport=new Ut(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new $t(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:ln,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Ac(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Cc extends $t{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Vt,this.minFilter=Vt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Rf extends $t{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Vt,this.minFilter=Vt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Wt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,o,a){let l=n[i+0],c=n[i+1],u=n[i+2],f=n[i+3];const h=s[o+0],p=s[o+1],_=s[o+2],v=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f;return}if(a===1){e[t+0]=h,e[t+1]=p,e[t+2]=_,e[t+3]=v;return}if(f!==v||l!==h||c!==p||u!==_){let m=1-a;const d=l*h+c*p+u*_+f*v,g=d>=0?1:-1,x=1-d*d;if(x>Number.EPSILON){const y=Math.sqrt(x),w=Math.atan2(y,d*g);m=Math.sin(m*w)/y,a=Math.sin(a*w)/y}const M=a*g;if(l=l*m+h*M,c=c*m+p*M,u=u*m+_*M,f=f*m+v*M,m===1-a){const y=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=y,c*=y,u*=y,f*=y}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],f=s[o],h=s[o+1],p=s[o+2],_=s[o+3];return e[t]=a*_+u*f+l*p-c*h,e[t+1]=l*_+u*h+c*f-a*p,e[t+2]=c*_+u*p+a*h-l*f,e[t+3]=u*_-a*f-l*h-c*p,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){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),f=a(s/2),h=l(n/2),p=l(i/2),_=l(s/2);switch(o){case"XYZ":this._x=h*u*f+c*p*_,this._y=c*p*f-h*u*_,this._z=c*u*_+h*p*f,this._w=c*u*f-h*p*_;break;case"YXZ":this._x=h*u*f+c*p*_,this._y=c*p*f-h*u*_,this._z=c*u*_-h*p*f,this._w=c*u*f+h*p*_;break;case"ZXY":this._x=h*u*f-c*p*_,this._y=c*p*f+h*u*_,this._z=c*u*_+h*p*f,this._w=c*u*f-h*p*_;break;case"ZYX":this._x=h*u*f-c*p*_,this._y=c*p*f+h*u*_,this._z=c*u*_-h*p*f,this._w=c*u*f+h*p*_;break;case"YZX":this._x=h*u*f+c*p*_,this._y=c*p*f+h*u*_,this._z=c*u*_-h*p*f,this._w=c*u*f-h*p*_;break;case"XZY":this._x=h*u*f-c*p*_,this._y=c*p*f-h*u*_,this._z=c*u*_+h*p*f,this._w=c*u*f+h*p*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&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],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],h=n+a+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-i)*p}else if(n>a&&n>f){const p=2*Math.sqrt(1+n-a-f);this._w=(u-l)/p,this._x=.25*p,this._y=(i+o)/p,this._z=(s+c)/p}else if(a>f){const p=2*Math.sqrt(1+a-n-f);this._w=(s-c)/p,this._x=(i+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+f-n-a);this._w=(o-i)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}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(jt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)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 e===0?(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){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+i*e._y+s*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=o,this._x=n,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*f+this._w*h,this._x=n*f+this._x*h,this._y=i*f+this._y*h,this._z=s*f+this._z*h,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(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),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}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class I{constructor(e=0,t=0,n=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(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){return 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){return 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){return 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 this.applyQuaternion(Ea.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ea.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*i-a*n,u=l*n+a*t-s*i,f=l*i+s*n-o*t,h=-s*t-o*n-a*i;return this.x=c*l+h*-s+u*-a-f*-o,this.y=u*l+h*-o+f*-s-c*-a,this.z=f*l+h*-a+c*-o-u*-s,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,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[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){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-n*l,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ws.copy(this).projectOnVector(e),this.sub(Ws)}reflect(e){return this.sub(Ws.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(jt(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,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}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){return 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=(Math.random()-.5)*2,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}}const Ws=new I,Ea=new Wt;class Or{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(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,zn),zn.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(dr),zr.subVectors(this.max,dr),Ci.subVectors(e.a,dr),Pi.subVectors(e.b,dr),Li.subVectors(e.c,dr),qn.subVectors(Pi,Ci),Yn.subVectors(Li,Pi),ci.subVectors(Ci,Li);let t=[0,-qn.z,qn.y,0,-Yn.z,Yn.y,0,-ci.z,ci.y,qn.z,0,-qn.x,Yn.z,0,-Yn.x,ci.z,0,-ci.x,-qn.y,qn.x,0,-Yn.y,Yn.x,0,-ci.y,ci.x,0];return!js(t,Ci,Pi,Li,zr)||(t=[1,0,0,0,1,0,0,0,1],!js(t,Ci,Pi,Li,zr))?!1:(kr.crossVectors(qn,Yn),t=[kr.x,kr.y,kr.z],js(t,Ci,Pi,Li,zr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(zn).length()*.5),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()?this:(Fn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Fn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Fn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Fn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Fn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Fn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Fn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Fn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Fn),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)}}const Fn=[new I,new I,new I,new I,new I,new I,new I,new I],zn=new I,Ai=new Or,Ci=new I,Pi=new I,Li=new I,qn=new I,Yn=new I,ci=new I,dr=new I,zr=new I,kr=new I,ui=new I;function js(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){ui.fromArray(r,s);const a=i.x*Math.abs(ui.x)+i.y*Math.abs(ui.y)+i.z*Math.abs(ui.z),l=e.dot(ui),c=t.dot(ui),u=n.dot(ui);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Df=new Or,pr=new I,Xs=new I;class Ss{constructor(e=new I,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;t!==void 0?n.copy(t):Df.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;sthis.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){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;pr.subVectors(e,this.center);const t=pr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(pr,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Xs.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(pr.copy(e.center).add(Xs)),this.expandByPoint(pr.copy(e.center).sub(Xs))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const kn=new I,qs=new I,Br=new I,Zn=new I,Ys=new I,Gr=new I,Zs=new I;class Do{constructor(e=new I,t=new I(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.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,kn)),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.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=kn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(kn.copy(this.origin).addScaledVector(this.direction,t),kn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){qs.copy(e).add(t).multiplyScalar(.5),Br.copy(t).sub(e).normalize(),Zn.copy(this.origin).sub(qs);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Br),a=Zn.dot(this.direction),l=-Zn.dot(Br),c=Zn.lengthSq(),u=Math.abs(1-o*o);let f,h,p,_;if(u>0)if(f=o*l-a,h=o*a-l,_=s*u,f>=0)if(h>=-_)if(h<=_){const v=1/u;f*=v,h*=v,p=f*(f+o*h+2*a)+h*(o*f+h+2*l)+c}else h=s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h<=-_?(f=Math.max(0,-(-o*s+a)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=_?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(o*s+a)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=o>0?-s:s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(qs).addScaledVector(Br,h),p}intersectSphere(e,t){kn.subVectors(e.center,this.origin);const n=kn.dot(this.direction),i=kn.dot(kn)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,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(t===0)return e.distanceToPoint(this.origin)===0?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 n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),n>l||a>i)||((a>n||n!==n)&&(n=a),(l=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,kn)!==null}intersectTriangle(e,t,n,i,s){Ys.subVectors(t,e),Gr.subVectors(n,e),Zs.crossVectors(Ys,Gr);let o=this.direction.dot(Zs),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Zn.subVectors(this.origin,e);const l=a*this.direction.dot(Gr.crossVectors(Zn,Gr));if(l<0)return null;const c=a*this.direction.dot(Ys.cross(Zn));if(c<0||l+c>o)return null;const u=-a*Zn.dot(Zs);return u<0?null:this.at(u/o,s)}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 vt{constructor(){vt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=n,d[12]=i,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=h,d[3]=p,d[7]=_,d[11]=v,d[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 vt().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/Ri.setFromMatrixColumn(e,0).length(),s=1/Ri.setFromMatrixColumn(e,1).length(),o=1/Ri.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]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=o*u,p=o*f,_=a*u,v=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=p+_*c,t[5]=h-v*c,t[9]=-a*l,t[2]=v-h*c,t[6]=_+p*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,p=l*f,_=c*u,v=c*f;t[0]=h+v*a,t[4]=_*a-p,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=p*a-_,t[6]=v+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,p=l*f,_=c*u,v=c*f;t[0]=h-v*a,t[4]=-o*f,t[8]=_+p*a,t[1]=p+_*a,t[5]=o*u,t[9]=v-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,p=o*f,_=a*u,v=a*f;t[0]=l*u,t[4]=_*c-p,t[8]=h*c+v,t[1]=l*f,t[5]=v*c+h,t[9]=p*c-_,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,p=o*c,_=a*l,v=a*c;t[0]=l*u,t[4]=v-h*f,t[8]=_*f+p,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*f+_,t[10]=h-v*f}else if(e.order==="XZY"){const h=o*l,p=o*c,_=a*l,v=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=h*f+v,t[5]=o*u,t[9]=p*f-_,t[2]=_*f-p,t[6]=a*u,t[10]=v*f+h}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(If,e,Uf)}lookAt(e,t,n){const i=this.elements;return nn.subVectors(e,t),nn.lengthSq()===0&&(nn.z=1),nn.normalize(),Qn.crossVectors(n,nn),Qn.lengthSq()===0&&(Math.abs(n.z)===1?nn.x+=1e-4:nn.z+=1e-4,nn.normalize(),Qn.crossVectors(n,nn)),Qn.normalize(),Hr.crossVectors(nn,Qn),i[0]=Qn.x,i[4]=Hr.x,i[8]=nn.x,i[1]=Qn.y,i[5]=Hr.y,i[9]=nn.y,i[2]=Qn.z,i[6]=Hr.z,i[10]=nn.z,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,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],h=n[9],p=n[13],_=n[2],v=n[6],m=n[10],d=n[14],g=n[3],x=n[7],M=n[11],y=n[15],w=i[0],C=i[4],T=i[8],b=i[12],S=i[1],F=i[5],k=i[9],L=i[13],O=i[2],B=i[6],J=i[10],R=i[14],H=i[3],Q=i[7],K=i[11],ve=i[15];return s[0]=o*w+a*S+l*O+c*H,s[4]=o*C+a*F+l*B+c*Q,s[8]=o*T+a*k+l*J+c*K,s[12]=o*b+a*L+l*R+c*ve,s[1]=u*w+f*S+h*O+p*H,s[5]=u*C+f*F+h*B+p*Q,s[9]=u*T+f*k+h*J+p*K,s[13]=u*b+f*L+h*R+p*ve,s[2]=_*w+v*S+m*O+d*H,s[6]=_*C+v*F+m*B+d*Q,s[10]=_*T+v*k+m*J+d*K,s[14]=_*b+v*L+m*R+d*ve,s[3]=g*w+x*S+M*O+y*H,s[7]=g*C+x*F+M*B+y*Q,s[11]=g*T+x*k+M*J+y*K,s[15]=g*b+x*L+M*R+y*ve,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],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],h=e[10],p=e[14],_=e[3],v=e[7],m=e[11],d=e[15];return _*(+s*l*f-i*c*f-s*a*h+n*c*h+i*a*p-n*l*p)+v*(+t*l*p-t*c*h+s*o*h-i*o*p+i*c*u-s*l*u)+m*(+t*c*f-t*a*p-s*o*f+n*o*p+s*a*u-n*c*u)+d*(-i*a*u-t*l*f+t*a*h+i*o*f-n*o*h+n*l*u)}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],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],p=e[11],_=e[12],v=e[13],m=e[14],d=e[15],g=f*m*c-v*h*c+v*l*p-a*m*p-f*l*d+a*h*d,x=_*h*c-u*m*c-_*l*p+o*m*p+u*l*d-o*h*d,M=u*v*c-_*f*c+_*a*p-o*v*p-u*a*d+o*f*d,y=_*f*l-u*v*l-_*a*h+o*v*h+u*a*m-o*f*m,w=t*g+n*x+i*M+s*y;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/w;return e[0]=g*C,e[1]=(v*h*s-f*m*s-v*i*p+n*m*p+f*i*d-n*h*d)*C,e[2]=(a*m*s-v*l*s+v*i*c-n*m*c-a*i*d+n*l*d)*C,e[3]=(f*l*s-a*h*s-f*i*c+n*h*c+a*i*p-n*l*p)*C,e[4]=x*C,e[5]=(u*m*s-_*h*s+_*i*p-t*m*p-u*i*d+t*h*d)*C,e[6]=(_*l*s-o*m*s-_*i*c+t*m*c+o*i*d-t*l*d)*C,e[7]=(o*h*s-u*l*s+u*i*c-t*h*c-o*i*p+t*l*p)*C,e[8]=M*C,e[9]=(_*f*s-u*v*s-_*n*p+t*v*p+u*n*d-t*f*d)*C,e[10]=(o*v*s-_*a*s+_*n*c-t*v*c-o*n*d+t*a*d)*C,e[11]=(u*a*s-o*f*s-u*n*c+t*f*c+o*n*p-t*a*p)*C,e[12]=y*C,e[13]=(u*v*i-_*f*i+_*n*h-t*v*h-u*n*m+t*f*m)*C,e[14]=(_*a*i-o*v*i-_*n*l+t*v*l+o*n*m-t*a*m)*C,e[15]=(o*f*i-u*a*i+u*n*l-t*f*l-o*n*h+t*a*h)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,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),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*o,s*l*l+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,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,h=s*c,p=s*u,_=s*f,v=o*u,m=o*f,d=a*f,g=l*c,x=l*u,M=l*f,y=n.x,w=n.y,C=n.z;return i[0]=(1-(v+d))*y,i[1]=(p+M)*y,i[2]=(_-x)*y,i[3]=0,i[4]=(p-M)*w,i[5]=(1-(h+d))*w,i[6]=(m+g)*w,i[7]=0,i[8]=(_+x)*C,i[9]=(m-g)*C,i[10]=(1-(h+v))*C,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 s=Ri.set(i[0],i[1],i[2]).length();const o=Ri.set(i[4],i[5],i[6]).length(),a=Ri.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],un.copy(this);const c=1/s,u=1/o,f=1/a;return un.elements[0]*=c,un.elements[1]*=c,un.elements[2]*=c,un.elements[4]*=u,un.elements[5]*=u,un.elements[6]*=u,un.elements[8]*=f,un.elements[9]*=f,un.elements[10]*=f,t.setFromRotationMatrix(un),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o){const a=this.elements,l=2*s/(t-e),c=2*s/(n-i),u=(t+e)/(t-e),f=(n+i)/(n-i),h=-(o+s)/(o-s),p=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=f,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,s,o){const a=this.elements,l=1/(t-e),c=1/(n-i),u=1/(o-s),f=(t+e)*l,h=(n+i)*c,p=(o+s)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-f,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])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}}const Ri=new I,un=new vt,If=new I(0,0,0),Uf=new I(1,1,1),Qn=new I,Hr=new I,nn=new I,Ta=new vt,Aa=new Wt;class yi{constructor(e=0,t=0,n=0,i=yi.DEFAULT_ORDER){this.isEuler=!0,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,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],f=i[2],h=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(jt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-jt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(jt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-jt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(jt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-jt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ta.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ta,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Aa.setFromEuler(this),this.setFromQuaternion(Aa,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],e[3]!==void 0&&(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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}yi.DEFAULT_ORDER="XYZ";class Io{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(n=n.concat(o))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mr,e,Of),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mr,Ff,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=i,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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)),t===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){fn.subVectors(i,t),Gn.subVectors(n,t),Qs.subVectors(e,t);const o=fn.dot(fn),a=fn.dot(Gn),l=fn.dot(Qs),c=Gn.dot(Gn),u=Gn.dot(Qs),f=o*c-a*a;if(f===0)return s.set(-2,-1,-1);const h=1/f,p=(c*l-a*u)*h,_=(o*u-a*l)*h;return s.set(1-p-_,_,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Hn),Hn.x>=0&&Hn.y>=0&&Hn.x+Hn.y<=1}static getUV(e,t,n,i,s,o,a,l){return Wr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Wr=!0),this.getInterpolation(e,t,n,i,s,o,a,l)}static getInterpolation(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,Hn),l.setScalar(0),l.addScaledVector(s,Hn.x),l.addScaledVector(o,Hn.y),l.addScaledVector(a,Hn.z),l}static isFrontFacing(e,t,n,i){return fn.subVectors(n,t),Gn.subVectors(e,t),fn.cross(Gn).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 fn.subVectors(this.c,this.b),Gn.subVectors(this.a,this.b),fn.cross(Gn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return dn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return dn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return Wr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Wr=!0),dn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return dn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return dn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return dn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,a;Ii.subVectors(i,n),Ui.subVectors(s,n),Ks.subVectors(e,n);const l=Ii.dot(Ks),c=Ui.dot(Ks);if(l<=0&&c<=0)return t.copy(n);Js.subVectors(e,i);const u=Ii.dot(Js),f=Ui.dot(Js);if(u>=0&&f<=u)return t.copy(i);const h=l*f-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Ii,o);$s.subVectors(e,s);const p=Ii.dot($s),_=Ui.dot($s);if(_>=0&&p<=_)return t.copy(s);const v=p*c-l*_;if(v<=0&&c>=0&&_<=0)return a=c/(c-_),t.copy(n).addScaledVector(Ui,a);const m=u*_-p*f;if(m<=0&&f-u>=0&&p-_>=0)return Ia.subVectors(s,i),a=(f-u)/(f-u+(p-_)),t.copy(i).addScaledVector(Ia,a);const d=1/(m+v+h);return o=v*d,a=h*d,t.copy(n).addScaledVector(Ii,o).addScaledVector(Ui,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let kf=0;class cr extends ar{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:kf++}),this.uuid=lr(),this.name="",this.type="Material",this.blending=Qi,this.side=ti,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=gc,this.blendDst=_c,this.blendEquation=Wi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=vo,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=cf,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Bs,this.stencilZFail=Bs,this.stencilZPass=Bs,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.forceSinglePass=!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(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(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.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),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,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Qi&&(n.blending=this.blending),this.side!==ti&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(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!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(n.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,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(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].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.forceSinglePass=e.forceSinglePass,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){e===!0&&this.version++}}const Pc={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},hn={h:0,s:0,l:0},jr={h:0,s:0,l:0};function eo(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Je{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=En){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,tn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=tn.workingColorSpace){return this.r=e,this.g=t,this.b=n,tn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=tn.workingColorSpace){if(e=Ro(e,1),t=jt(t,0,1),n=jt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=eo(o,s,e+1/3),this.g=eo(o,s,e),this.b=eo(o,s,e-1/3)}return tn.toWorkingColorSpace(this,i),this}setStyle(e,t=En){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,tn.toWorkingColorSpace(this,t),n(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,tn.toWorkingColorSpace(this,t),n(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const l=parseFloat(s[1])/360,c=parseFloat(s[2])/100,u=parseFloat(s[3])/100;return n(s[4]),this.setHSL(l,c,u,t)}break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=En){const n=Pc[e.toLowerCase()];return n!==void 0?this.setHex(n,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=Ji(e.r),this.g=Ji(e.g),this.b=Ji(e.b),this}copyLinearToSRGB(e){return this.r=Hs(e.r),this.g=Hs(e.g),this.b=Hs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=En){return tn.fromWorkingColorSpace(Ot.copy(this),e),jt(Ot.r*255,0,255)<<16^jt(Ot.g*255,0,255)<<8^jt(Ot.b*255,0,255)<<0}getHexString(e=En){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=tn.workingColorSpace){tn.fromWorkingColorSpace(Ot.copy(this),t);const n=Ot.r,i=Ot.g,s=Ot.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(i-s)/f+(i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,h=c.length;f0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(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;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],f=s[c];for(let h=0,p=f.length;h0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))||(Ua.copy(s).invert(),yn.copy(e.ray).applyMatrix4(Ua),n.boundingBox!==null&&yn.intersectsBox(n.boundingBox)===!1))return;let o;const a=n.index,l=n.attributes.position,c=n.attributes.uv,u=n.attributes.uv2,f=n.attributes.normal,h=n.groups,p=n.drawRange;if(a!==null)if(Array.isArray(i))for(let _=0,v=h.length;_t.far?null:{distance:c,point:$r.clone(),object:r}}function es(r,e,t,n,i,s,o,a,l,c){r.getVertexPosition(a,Oi),r.getVertexPosition(l,Fi),r.getVertexPosition(c,zi);const u=Gf(r,e,t,n,Oi,Fi,zi,Jr);if(u){i&&(Zr.fromBufferAttribute(i,a),Qr.fromBufferAttribute(i,l),Kr.fromBufferAttribute(i,c),u.uv=dn.getInterpolation(Jr,Oi,Fi,zi,Zr,Qr,Kr,new Qe)),s&&(Zr.fromBufferAttribute(s,a),Qr.fromBufferAttribute(s,l),Kr.fromBufferAttribute(s,c),u.uv2=dn.getInterpolation(Jr,Oi,Fi,zi,Zr,Qr,Kr,new Qe)),o&&(Oa.fromBufferAttribute(o,a),Fa.fromBufferAttribute(o,l),za.fromBufferAttribute(o,c),u.normal=dn.getInterpolation(Jr,Oi,Fi,zi,Oa,Fa,za,new I),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new I,materialIndex:0};dn.getNormal(Oi,Fi,zi,f.normal),u.face=f}return u}class bt extends Xt{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let h=0,p=0;_("z","y","x",-1,-1,n,t,e,o,s,0),_("z","y","x",1,-1,n,t,-e,o,s,1),_("x","z","y",1,1,e,n,t,i,o,2),_("x","z","y",1,-1,e,n,-t,i,o,3),_("x","y","z",1,-1,e,t,n,i,s,4),_("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new pt(c,3)),this.setAttribute("normal",new pt(u,3)),this.setAttribute("uv",new pt(f,2));function _(v,m,d,g,x,M,y,w,C,T,b){const S=M/C,F=y/T,k=M/2,L=y/2,O=w/2,B=C+1,J=T+1;let R=0,H=0;const Q=new I;for(let K=0;K0?1:-1,u.push(Q.x,Q.y,Q.z),f.push(se/C),f.push(1-K/T),R+=1}}for(let K=0;K>8&255]+Nt[r>>16&255]+Nt[r>>24&255]+"-"+Nt[e&255]+Nt[e>>8&255]+"-"+Nt[e>>16&15|64]+Nt[e>>24&255]+"-"+Nt[t&63|128]+Nt[t>>8&255]+"-"+Nt[t>>16&255]+Nt[t>>24&255]+Nt[n&255]+Nt[n>>8&255]+Nt[n>>16&255]+Nt[n>>24&255]).toLowerCase()}function Xt(r,e,t){return Math.max(e,Math.min(t,r))}function Ro(r,e){return(r%e+e)%e}function cf(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function uf(r,e,t){return r!==e?(t-r)/(e-r):0}function Cr(r,e,t){return(1-t)*r+t*e}function ff(r,e,t,n){return Cr(r,e,1-Math.exp(-t*n))}function hf(r,e=1){return e-Math.abs(Ro(r,e*2)-e)}function df(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function pf(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function mf(r,e){return r+Math.floor(Math.random()*(e-r+1))}function gf(r,e){return r+Math.random()*(e-r)}function _f(r){return r*(.5-Math.random())}function vf(r){r!==void 0&&(wa=r);let e=wa+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function xf(r){return r*Ar}function Mf(r){return r*Ur}function wo(r){return(r&r-1)===0&&r!==0}function bf(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function yc(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function Sf(r,e,t,n,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+n)/2),u=o((e+n)/2),f=s((e-n)/2),h=o((e-n)/2),p=s((n-e)/2),_=o((n-e)/2);switch(i){case"XYX":r.set(a*u,l*f,l*h,a*c);break;case"YZY":r.set(l*h,a*u,l*f,a*c);break;case"ZXZ":r.set(l*f,l*h,a*u,a*c);break;case"XZX":r.set(a*u,l*_,l*p,a*c);break;case"YXY":r.set(l*p,a*u,l*_,a*c);break;case"ZYZ":r.set(l*_,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Mr(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function Zt(r,e){switch(e.constructor){case Float32Array:return r;case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const Kt={DEG2RAD:Ar,RAD2DEG:Ur,generateUUID:lr,clamp:Xt,euclideanModulo:Ro,mapLinear:cf,inverseLerp:uf,lerp:Cr,damp:ff,pingpong:hf,smoothstep:df,smootherstep:pf,randInt:mf,randFloat:gf,randFloatSpread:_f,seededRandom:vf,degToRad:xf,radToDeg:Mf,isPowerOfTwo:wo,ceilPowerOfTwo:bf,floorPowerOfTwo:yc,setQuaternionFromProperEuler:Sf,normalize:Zt,denormalize:Mr};class Qe{constructor(e=0,t=0){Qe.prototype.isVector2=!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){return 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){return 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}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Xt(n,-1,1))}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){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*n-o*i+e.x,this.y=s*i+o*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class We{constructor(){We.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,n,i,s,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=i,u[2]=a,u[3]=t,u[4]=s,u[5]=l,u[6]=n,u[7]=o,u[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,s=this.elements,o=n[0],a=n[3],l=n[6],c=n[1],u=n[4],f=n[7],h=n[2],p=n[5],_=n[8],v=i[0],m=i[3],d=i[6],g=i[1],x=i[4],M=i[7],y=i[2],w=i[5],C=i[8];return s[0]=o*v+a*g+l*y,s[3]=o*m+a*x+l*w,s[6]=o*d+a*M+l*C,s[1]=c*v+u*g+f*y,s[4]=c*m+u*x+f*w,s[7]=c*d+u*M+f*C,s[2]=h*v+p*g+_*y,s[5]=h*m+p*x+_*w,s[8]=h*d+p*M+_*C,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],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-n*s*u+n*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=u*o-a*c,h=a*l-u*s,p=c*s-o*l,_=t*f+n*h+i*p;if(_===0)return this.set(0,0,0,0,0,0,0,0,0);const v=1/_;return e[0]=f*v,e[1]=(i*c-u*n)*v,e[2]=(a*n-i*o)*v,e[3]=h*v,e[4]=(u*t-i*l)*v,e[5]=(i*s-a*t)*v,e[6]=p*v,e[7]=(n*l-c*t)*v,e[8]=(o*t-n*s)*v,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,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(n*l,n*c,-n*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(Gs.makeScale(e,t)),this}rotate(e){return this.premultiply(Gs.makeRotation(-e)),this}translate(e,t){return this.premultiply(Gs.makeTranslation(e,t)),this}makeTranslation(e,t){return this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])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)}}const Gs=new We;function wc(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function Nr(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function Ji(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Hs(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}const yf=new We().fromArray([.8224621,.0331941,.0170827,.177538,.9668058,.0723974,-1e-7,1e-7,.9105199]),wf=new We().fromArray([1.2249401,-.0420569,-.0196376,-.2249404,1.0420571,-.0786361,1e-7,0,1.0982735]);function Ef(r){return r.convertSRGBToLinear().applyMatrix3(wf)}function Tf(r){return r.applyMatrix3(yf).convertLinearToSRGB()}const Af={[Ir]:r=>r,[En]:r=>r.convertSRGBToLinear(),[Sc]:Ef},Cf={[Ir]:r=>r,[En]:r=>r.convertLinearToSRGB(),[Sc]:Tf},tn={enabled:!1,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(r){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!r},get workingColorSpace(){return Ir},set workingColorSpace(r){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(r,e,t){if(this.enabled===!1||e===t||!e||!t)return r;const n=Af[e],i=Cf[t];if(n===void 0||i===void 0)throw new Error(`Unsupported color space conversion, "${e}" to "${t}".`);return i(n(r))},fromWorkingColorSpace:function(r,e){return this.convert(r,this.workingColorSpace,e)},toWorkingColorSpace:function(r,e){return this.convert(r,e,this.workingColorSpace)}};let Ti;class Ec{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{Ti===void 0&&(Ti=Nr("canvas")),Ti.width=e.width,Ti.height=e.height;const n=Ti.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ti}return t.width>2048||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(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const t=Nr("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),s=i.data;for(let o=0;o0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==xc)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case bo:e.x=e.x-Math.floor(e.x);break;case mn:e.x=e.x<0?0:1;break;case So:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case bo:e.y=e.y-Math.floor(e.y);break;case mn:e.y=e.y<0?0:1;break;case So:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}$t.DEFAULT_IMAGE=null;$t.DEFAULT_MAPPING=xc;$t.DEFAULT_ANISOTROPY=1;class Ut{constructor(e=0,t=0,n=0,i=1){Ut.prototype.isVector4=!0,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=e.w!==void 0?e.w:1,this}add(e){return 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){return 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,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*n+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*n+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*n+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*n+o[11]*i+o[15]*s,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,s;const l=e.elements,c=l[0],u=l[4],f=l[8],h=l[1],p=l[5],_=l[9],v=l[2],m=l[6],d=l[10];if(Math.abs(u-h)<.01&&Math.abs(f-v)<.01&&Math.abs(_-m)<.01){if(Math.abs(u+h)<.1&&Math.abs(f+v)<.1&&Math.abs(_+m)<.1&&Math.abs(c+p+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(c+1)/2,M=(p+1)/2,y=(d+1)/2,w=(u+h)/4,C=(f+v)/4,T=(_+m)/4;return x>M&&x>y?x<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(x),i=w/n,s=C/n):M>y?M<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(M),n=w/i,s=T/i):y<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(y),n=C/s,i=T/s),this.set(n,i,s,t),this}let g=Math.sqrt((m-_)*(m-_)+(f-v)*(f-v)+(h-u)*(h-u));return Math.abs(g)<.001&&(g=1),this.x=(m-_)/g,this.y=(f-v)/g,this.z=(h-u)/g,this.w=Math.acos((c+p+d-1)/2),this}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.w=Math.min(this.w,e.w),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.w=Math.max(this.w,e.w),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.w=Math.max(e.w,Math.min(t.w,this.w)),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.w=Math.max(e,Math.min(t,this.w)),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.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),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.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}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.w+=(e.w-this.w)*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.w=e.w+(t.w-e.w)*n,this}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}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ii extends ar{constructor(e=1,t=1,n={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ut(0,0,e,t),this.scissorTest=!1,this.viewport=new Ut(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new $t(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.internalFormat=n.internalFormat!==void 0?n.internalFormat:null,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:ln,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!1,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null,this.samples=n.samples!==void 0?n.samples:0}setSize(e,t,n=1){(this.width!==e||this.height!==t||this.depth!==n)&&(this.width=e,this.height=t,this.depth=n,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=n,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new Tc(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ac extends $t{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Wt,this.minFilter=Wt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Lf extends $t{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Wt,this.minFilter=Wt,this.wrapR=mn,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class jt{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,o,a){let l=n[i+0],c=n[i+1],u=n[i+2],f=n[i+3];const h=s[o+0],p=s[o+1],_=s[o+2],v=s[o+3];if(a===0){e[t+0]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f;return}if(a===1){e[t+0]=h,e[t+1]=p,e[t+2]=_,e[t+3]=v;return}if(f!==v||l!==h||c!==p||u!==_){let m=1-a;const d=l*h+c*p+u*_+f*v,g=d>=0?1:-1,x=1-d*d;if(x>Number.EPSILON){const y=Math.sqrt(x),w=Math.atan2(y,d*g);m=Math.sin(m*w)/y,a=Math.sin(a*w)/y}const M=a*g;if(l=l*m+h*M,c=c*m+p*M,u=u*m+_*M,f=f*m+v*M,m===1-a){const y=1/Math.sqrt(l*l+c*c+u*u+f*f);l*=y,c*=y,u*=y,f*=y}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=f}static multiplyQuaternionsFlat(e,t,n,i,s,o){const a=n[i],l=n[i+1],c=n[i+2],u=n[i+3],f=s[o],h=s[o+1],p=s[o+2],_=s[o+3];return e[t]=a*_+u*f+l*p-c*h,e[t+1]=l*_+u*h+c*f-a*p,e[t+2]=c*_+u*p+a*h-l*f,e[t+3]=u*_-a*f-l*h-c*p,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){const n=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(n/2),u=a(i/2),f=a(s/2),h=l(n/2),p=l(i/2),_=l(s/2);switch(o){case"XYZ":this._x=h*u*f+c*p*_,this._y=c*p*f-h*u*_,this._z=c*u*_+h*p*f,this._w=c*u*f-h*p*_;break;case"YXZ":this._x=h*u*f+c*p*_,this._y=c*p*f-h*u*_,this._z=c*u*_-h*p*f,this._w=c*u*f+h*p*_;break;case"ZXY":this._x=h*u*f-c*p*_,this._y=c*p*f+h*u*_,this._z=c*u*_+h*p*f,this._w=c*u*f-h*p*_;break;case"ZYX":this._x=h*u*f-c*p*_,this._y=c*p*f+h*u*_,this._z=c*u*_-h*p*f,this._w=c*u*f+h*p*_;break;case"YZX":this._x=h*u*f+c*p*_,this._y=c*p*f+h*u*_,this._z=c*u*_-h*p*f,this._w=c*u*f-h*p*_;break;case"XZY":this._x=h*u*f-c*p*_,this._y=c*p*f-h*u*_,this._z=c*u*_+h*p*f,this._w=c*u*f+h*p*_;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&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],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],f=t[10],h=n+a+f;if(h>0){const p=.5/Math.sqrt(h+1);this._w=.25/p,this._x=(u-l)*p,this._y=(s-c)*p,this._z=(o-i)*p}else if(n>a&&n>f){const p=2*Math.sqrt(1+n-a-f);this._w=(u-l)/p,this._x=.25*p,this._y=(i+o)/p,this._z=(s+c)/p}else if(a>f){const p=2*Math.sqrt(1+a-n-f);this._w=(s-c)/p,this._x=(i+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+f-n-a);this._w=(o-i)/p,this._x=(s+c)/p,this._y=(l+u)/p,this._z=.25*p}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(Xt(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)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 e===0?(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){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=n*u+o*a+i*c-s*l,this._y=i*u+o*l+s*a-n*c,this._z=s*u+o*c+n*l-i*a,this._w=o*u-n*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const n=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+n*e._x+i*e._y+s*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=o,this._x=n,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*n+t*this._x,this._y=p*i+t*this._y,this._z=p*s+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),f=Math.sin((1-t)*u)/c,h=Math.sin(t*u)/c;return this._w=o*f+this._w*h,this._x=n*f+this._x*h,this._y=i*f+this._y*h,this._z=s*f+this._z*h,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(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),n*Math.sin(s),n*Math.cos(s),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}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class I{constructor(e=0,t=0,n=0){I.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(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){return 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){return 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){return 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 this.applyQuaternion(Ea.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Ea.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*i-a*n,u=l*n+a*t-s*i,f=l*i+s*n-o*t,h=-s*t-o*n-a*i;return this.x=c*l+h*-s+u*-a-f*-o,this.y=u*l+h*-o+f*-s-c*-a,this.z=f*l+h*-a+c*-o-u*-s,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,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[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){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-n*l,this.z=n*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Ws.copy(this).projectOnVector(e),this.sub(Ws)}reflect(e){return this.sub(Ws.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Xt(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,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}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){return 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=(Math.random()-.5)*2,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}}const Ws=new I,Ea=new jt;class Or{constructor(e=new I(1/0,1/0,1/0),t=new I(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(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,zn),zn.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(dr),zr.subVectors(this.max,dr),Ci.subVectors(e.a,dr),Pi.subVectors(e.b,dr),Li.subVectors(e.c,dr),qn.subVectors(Pi,Ci),Yn.subVectors(Li,Pi),ci.subVectors(Ci,Li);let t=[0,-qn.z,qn.y,0,-Yn.z,Yn.y,0,-ci.z,ci.y,qn.z,0,-qn.x,Yn.z,0,-Yn.x,ci.z,0,-ci.x,-qn.y,qn.x,0,-Yn.y,Yn.x,0,-ci.y,ci.x,0];return!js(t,Ci,Pi,Li,zr)||(t=[1,0,0,0,1,0,0,0,1],!js(t,Ci,Pi,Li,zr))?!1:(kr.crossVectors(qn,Yn),t=[kr.x,kr.y,kr.z],js(t,Ci,Pi,Li,zr))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,zn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(zn).length()*.5),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()?this:(Fn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Fn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Fn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Fn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Fn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Fn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Fn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Fn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Fn),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)}}const Fn=[new I,new I,new I,new I,new I,new I,new I,new I],zn=new I,Ai=new Or,Ci=new I,Pi=new I,Li=new I,qn=new I,Yn=new I,ci=new I,dr=new I,zr=new I,kr=new I,ui=new I;function js(r,e,t,n,i){for(let s=0,o=r.length-3;s<=o;s+=3){ui.fromArray(r,s);const a=i.x*Math.abs(ui.x)+i.y*Math.abs(ui.y)+i.z*Math.abs(ui.z),l=e.dot(ui),c=t.dot(ui),u=n.dot(ui);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const Rf=new Or,pr=new I,Xs=new I;class Ss{constructor(e=new I,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;t!==void 0?n.copy(t):Rf.setFromPoints(e).getCenter(n);let i=0;for(let s=0,o=e.length;sthis.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){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;pr.subVectors(e,this.center);const t=pr.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(pr,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Xs.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(pr.copy(e.center).add(Xs)),this.expandByPoint(pr.copy(e.center).sub(Xs))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const kn=new I,qs=new I,Br=new I,Zn=new I,Ys=new I,Gr=new I,Zs=new I;class Do{constructor(e=new I,t=new I(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.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,kn)),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.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=kn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(kn.copy(this.origin).addScaledVector(this.direction,t),kn.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){qs.copy(e).add(t).multiplyScalar(.5),Br.copy(t).sub(e).normalize(),Zn.copy(this.origin).sub(qs);const s=e.distanceTo(t)*.5,o=-this.direction.dot(Br),a=Zn.dot(this.direction),l=-Zn.dot(Br),c=Zn.lengthSq(),u=Math.abs(1-o*o);let f,h,p,_;if(u>0)if(f=o*l-a,h=o*a-l,_=s*u,f>=0)if(h>=-_)if(h<=_){const v=1/u;f*=v,h*=v,p=f*(f+o*h+2*a)+h*(o*f+h+2*l)+c}else h=s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h=-s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;else h<=-_?(f=Math.max(0,-(-o*s+a)),h=f>0?-s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c):h<=_?(f=0,h=Math.min(Math.max(-s,-l),s),p=h*(h+2*l)+c):(f=Math.max(0,-(o*s+a)),h=f>0?s:Math.min(Math.max(-s,-l),s),p=-f*f+h*(h+2*l)+c);else h=o>0?-s:s,f=Math.max(0,-(o*h+a)),p=-f*f+h*(h+2*l)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,f),i&&i.copy(qs).addScaledVector(Br,h),p}intersectSphere(e,t){kn.subVectors(e.center,this.origin);const n=kn.dot(this.direction),i=kn.dot(kn)-n*n,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=n-o,l=n+o;return l<0?null:a<0?this.at(l,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(t===0)return e.distanceToPoint(this.origin)===0?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 n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,f=1/this.direction.z,h=this.origin;return c>=0?(n=(e.min.x-h.x)*c,i=(e.max.x-h.x)*c):(n=(e.max.x-h.x)*c,i=(e.min.x-h.x)*c),u>=0?(s=(e.min.y-h.y)*u,o=(e.max.y-h.y)*u):(s=(e.max.y-h.y)*u,o=(e.min.y-h.y)*u),n>o||s>i||((s>n||isNaN(n))&&(n=s),(o=0?(a=(e.min.z-h.z)*f,l=(e.max.z-h.z)*f):(a=(e.max.z-h.z)*f,l=(e.min.z-h.z)*f),n>l||a>i)||((a>n||n!==n)&&(n=a),(l=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,kn)!==null}intersectTriangle(e,t,n,i,s){Ys.subVectors(t,e),Gr.subVectors(n,e),Zs.crossVectors(Ys,Gr);let o=this.direction.dot(Zs),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Zn.subVectors(this.origin,e);const l=a*this.direction.dot(Gr.crossVectors(Zn,Gr));if(l<0)return null;const c=a*this.direction.dot(Ys.cross(Zn));if(c<0||l+c>o)return null;const u=-a*Zn.dot(Zs);return u<0?null:this.at(u/o,s)}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 vt{constructor(){vt.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m){const d=this.elements;return d[0]=e,d[4]=t,d[8]=n,d[12]=i,d[1]=s,d[5]=o,d[9]=a,d[13]=l,d[2]=c,d[6]=u,d[10]=f,d[14]=h,d[3]=p,d[7]=_,d[11]=v,d[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 vt().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/Ri.setFromMatrixColumn(e,0).length(),s=1/Ri.setFromMatrixColumn(e,1).length(),o=1/Ri.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]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*o,t[9]=n[9]*o,t[10]=n[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,o=Math.cos(n),a=Math.sin(n),l=Math.cos(i),c=Math.sin(i),u=Math.cos(s),f=Math.sin(s);if(e.order==="XYZ"){const h=o*u,p=o*f,_=a*u,v=a*f;t[0]=l*u,t[4]=-l*f,t[8]=c,t[1]=p+_*c,t[5]=h-v*c,t[9]=-a*l,t[2]=v-h*c,t[6]=_+p*c,t[10]=o*l}else if(e.order==="YXZ"){const h=l*u,p=l*f,_=c*u,v=c*f;t[0]=h+v*a,t[4]=_*a-p,t[8]=o*c,t[1]=o*f,t[5]=o*u,t[9]=-a,t[2]=p*a-_,t[6]=v+h*a,t[10]=o*l}else if(e.order==="ZXY"){const h=l*u,p=l*f,_=c*u,v=c*f;t[0]=h-v*a,t[4]=-o*f,t[8]=_+p*a,t[1]=p+_*a,t[5]=o*u,t[9]=v-h*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const h=o*u,p=o*f,_=a*u,v=a*f;t[0]=l*u,t[4]=_*c-p,t[8]=h*c+v,t[1]=l*f,t[5]=v*c+h,t[9]=p*c-_,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const h=o*l,p=o*c,_=a*l,v=a*c;t[0]=l*u,t[4]=v-h*f,t[8]=_*f+p,t[1]=f,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*f+_,t[10]=h-v*f}else if(e.order==="XZY"){const h=o*l,p=o*c,_=a*l,v=a*c;t[0]=l*u,t[4]=-f,t[8]=c*u,t[1]=h*f+v,t[5]=o*u,t[9]=p*f-_,t[2]=_*f-p,t[6]=a*u,t[10]=v*f+h}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(Df,e,If)}lookAt(e,t,n){const i=this.elements;return nn.subVectors(e,t),nn.lengthSq()===0&&(nn.z=1),nn.normalize(),Qn.crossVectors(n,nn),Qn.lengthSq()===0&&(Math.abs(n.z)===1?nn.x+=1e-4:nn.z+=1e-4,nn.normalize(),Qn.crossVectors(n,nn)),Qn.normalize(),Hr.crossVectors(nn,Qn),i[0]=Qn.x,i[4]=Hr.x,i[8]=nn.x,i[1]=Qn.y,i[5]=Hr.y,i[9]=nn.y,i[2]=Qn.z,i[6]=Hr.z,i[10]=nn.z,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,s=this.elements,o=n[0],a=n[4],l=n[8],c=n[12],u=n[1],f=n[5],h=n[9],p=n[13],_=n[2],v=n[6],m=n[10],d=n[14],g=n[3],x=n[7],M=n[11],y=n[15],w=i[0],C=i[4],T=i[8],b=i[12],S=i[1],F=i[5],k=i[9],L=i[13],O=i[2],B=i[6],J=i[10],R=i[14],H=i[3],Q=i[7],K=i[11],ve=i[15];return s[0]=o*w+a*S+l*O+c*H,s[4]=o*C+a*F+l*B+c*Q,s[8]=o*T+a*k+l*J+c*K,s[12]=o*b+a*L+l*R+c*ve,s[1]=u*w+f*S+h*O+p*H,s[5]=u*C+f*F+h*B+p*Q,s[9]=u*T+f*k+h*J+p*K,s[13]=u*b+f*L+h*R+p*ve,s[2]=_*w+v*S+m*O+d*H,s[6]=_*C+v*F+m*B+d*Q,s[10]=_*T+v*k+m*J+d*K,s[14]=_*b+v*L+m*R+d*ve,s[3]=g*w+x*S+M*O+y*H,s[7]=g*C+x*F+M*B+y*Q,s[11]=g*T+x*k+M*J+y*K,s[15]=g*b+x*L+M*R+y*ve,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],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],f=e[6],h=e[10],p=e[14],_=e[3],v=e[7],m=e[11],d=e[15];return _*(+s*l*f-i*c*f-s*a*h+n*c*h+i*a*p-n*l*p)+v*(+t*l*p-t*c*h+s*o*h-i*o*p+i*c*u-s*l*u)+m*(+t*c*f-t*a*p-s*o*f+n*o*p+s*a*u-n*c*u)+d*(-i*a*u-t*l*f+t*a*h+i*o*f-n*o*h+n*l*u)}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],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],f=e[9],h=e[10],p=e[11],_=e[12],v=e[13],m=e[14],d=e[15],g=f*m*c-v*h*c+v*l*p-a*m*p-f*l*d+a*h*d,x=_*h*c-u*m*c-_*l*p+o*m*p+u*l*d-o*h*d,M=u*v*c-_*f*c+_*a*p-o*v*p-u*a*d+o*f*d,y=_*f*l-u*v*l-_*a*h+o*v*h+u*a*m-o*f*m,w=t*g+n*x+i*M+s*y;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const C=1/w;return e[0]=g*C,e[1]=(v*h*s-f*m*s-v*i*p+n*m*p+f*i*d-n*h*d)*C,e[2]=(a*m*s-v*l*s+v*i*c-n*m*c-a*i*d+n*l*d)*C,e[3]=(f*l*s-a*h*s-f*i*c+n*h*c+a*i*p-n*l*p)*C,e[4]=x*C,e[5]=(u*m*s-_*h*s+_*i*p-t*m*p-u*i*d+t*h*d)*C,e[6]=(_*l*s-o*m*s-_*i*c+t*m*c+o*i*d-t*l*d)*C,e[7]=(o*h*s-u*l*s+u*i*c-t*h*c-o*i*p+t*l*p)*C,e[8]=M*C,e[9]=(_*f*s-u*v*s-_*n*p+t*v*p+u*n*d-t*f*d)*C,e[10]=(o*v*s-_*a*s+_*n*c-t*v*c-o*n*d+t*a*d)*C,e[11]=(u*a*s-o*f*s-u*n*c+t*f*c+o*n*p-t*a*p)*C,e[12]=y*C,e[13]=(u*v*i-_*f*i+_*n*h-t*v*h-u*n*m+t*f*m)*C,e[14]=(_*a*i-o*v*i-_*n*l+t*v*l+o*n*m-t*a*m)*C,e[15]=(o*f*i-u*a*i+u*n*l-t*f*l-o*n*h+t*a*h)*C,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,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),s=1-n,o=e.x,a=e.y,l=e.z,c=s*o,u=s*a;return this.set(c*o+n,c*a-i*l,c*l+i*a,0,c*a+i*l,u*a+n,u*l-i*o,0,c*l-i*a,u*l+i*o,s*l*l+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,s,o){return this.set(1,n,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,u=o+o,f=a+a,h=s*c,p=s*u,_=s*f,v=o*u,m=o*f,d=a*f,g=l*c,x=l*u,M=l*f,y=n.x,w=n.y,C=n.z;return i[0]=(1-(v+d))*y,i[1]=(p+M)*y,i[2]=(_-x)*y,i[3]=0,i[4]=(p-M)*w,i[5]=(1-(h+d))*w,i[6]=(m+g)*w,i[7]=0,i[8]=(_+x)*C,i[9]=(m-g)*C,i[10]=(1-(h+v))*C,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 s=Ri.set(i[0],i[1],i[2]).length();const o=Ri.set(i[4],i[5],i[6]).length(),a=Ri.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],un.copy(this);const c=1/s,u=1/o,f=1/a;return un.elements[0]*=c,un.elements[1]*=c,un.elements[2]*=c,un.elements[4]*=u,un.elements[5]*=u,un.elements[6]*=u,un.elements[8]*=f,un.elements[9]*=f,un.elements[10]*=f,t.setFromRotationMatrix(un),n.x=s,n.y=o,n.z=a,this}makePerspective(e,t,n,i,s,o){const a=this.elements,l=2*s/(t-e),c=2*s/(n-i),u=(t+e)/(t-e),f=(n+i)/(n-i),h=-(o+s)/(o-s),p=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=f,a[13]=0,a[2]=0,a[6]=0,a[10]=h,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,n,i,s,o){const a=this.elements,l=1/(t-e),c=1/(n-i),u=1/(o-s),f=(t+e)*l,h=(n+i)*c,p=(o+s)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-f,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-h,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])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}}const Ri=new I,un=new vt,Df=new I(0,0,0),If=new I(1,1,1),Qn=new I,Hr=new I,nn=new I,Ta=new vt,Aa=new jt;class yi{constructor(e=0,t=0,n=0,i=yi.DEFAULT_ORDER){this.isEuler=!0,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,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],u=i[9],f=i[2],h=i[6],p=i[10];switch(t){case"XYZ":this._y=Math.asin(Xt(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(h,c),this._z=0);break;case"YXZ":this._x=Math.asin(-Xt(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-f,s),this._z=0);break;case"ZXY":this._x=Math.asin(Xt(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-f,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-Xt(f,-1,1)),Math.abs(f)<.9999999?(this._x=Math.atan2(h,p),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(Xt(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-f,s)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-Xt(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(h,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Ta.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ta,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Aa.setFromEuler(this),this.setFromQuaternion(Aa,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],e[3]!==void 0&&(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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}yi.DEFAULT_ORDER="XYZ";class Io{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let n=0;n0&&(n=n.concat(o))}return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mr,e,Nf),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(mr,Of,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON()));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,u=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(n.geometries=a),l.length>0&&(n.materials=l),c.length>0&&(n.textures=c),u.length>0&&(n.images=u),f.length>0&&(n.shapes=f),h.length>0&&(n.skeletons=h),p.length>0&&(n.animations=p),_.length>0&&(n.nodes=_)}return n.object=i,n;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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)),t===!0)for(let n=0;n0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){fn.subVectors(i,t),Gn.subVectors(n,t),Qs.subVectors(e,t);const o=fn.dot(fn),a=fn.dot(Gn),l=fn.dot(Qs),c=Gn.dot(Gn),u=Gn.dot(Qs),f=o*c-a*a;if(f===0)return s.set(-2,-1,-1);const h=1/f,p=(c*l-a*u)*h,_=(o*u-a*l)*h;return s.set(1-p-_,_,p)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Hn),Hn.x>=0&&Hn.y>=0&&Hn.x+Hn.y<=1}static getUV(e,t,n,i,s,o,a,l){return Wr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Wr=!0),this.getInterpolation(e,t,n,i,s,o,a,l)}static getInterpolation(e,t,n,i,s,o,a,l){return this.getBarycoord(e,t,n,i,Hn),l.setScalar(0),l.addScaledVector(s,Hn.x),l.addScaledVector(o,Hn.y),l.addScaledVector(a,Hn.z),l}static isFrontFacing(e,t,n,i){return fn.subVectors(n,t),Gn.subVectors(e,t),fn.cross(Gn).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 fn.subVectors(this.c,this.b),Gn.subVectors(this.a,this.b),fn.cross(Gn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return dn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return dn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,n,i,s){return Wr===!1&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),Wr=!0),dn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}getInterpolation(e,t,n,i,s){return dn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return dn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return dn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let o,a;Ii.subVectors(i,n),Ui.subVectors(s,n),Ks.subVectors(e,n);const l=Ii.dot(Ks),c=Ui.dot(Ks);if(l<=0&&c<=0)return t.copy(n);Js.subVectors(e,i);const u=Ii.dot(Js),f=Ui.dot(Js);if(u>=0&&f<=u)return t.copy(i);const h=l*f-u*c;if(h<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(n).addScaledVector(Ii,o);$s.subVectors(e,s);const p=Ii.dot($s),_=Ui.dot($s);if(_>=0&&p<=_)return t.copy(s);const v=p*c-l*_;if(v<=0&&c>=0&&_<=0)return a=c/(c-_),t.copy(n).addScaledVector(Ui,a);const m=u*_-p*f;if(m<=0&&f-u>=0&&p-_>=0)return Ia.subVectors(s,i),a=(f-u)/(f-u+(p-_)),t.copy(i).addScaledVector(Ia,a);const d=1/(m+v+h);return o=v*d,a=h*d,t.copy(n).addScaledVector(Ii,o).addScaledVector(Ui,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let zf=0;class cr extends ar{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:zf++}),this.uuid=lr(),this.name="",this.type="Material",this.blending=Qi,this.side=ti,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=mc,this.blendDst=gc,this.blendEquation=Wi,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=vo,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=lf,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Bs,this.stencilZFail=Bs,this.stencilZPass=Bs,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.forceSinglePass=!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(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(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.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),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,this.combine!==void 0&&(n.combine=this.combine)),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Qi&&(n.blending=this.blending),this.side!==ti&&(n.side=this.side),this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(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!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(n.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(n.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=this.flatShading),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(n.textures=s),o.length>0&&(n.images=o)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,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(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].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.forceSinglePass=e.forceSinglePass,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){e===!0&&this.version++}}const Cc={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},hn={h:0,s:0,l:0},jr={h:0,s:0,l:0};function eo(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Je{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=En){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,tn.toWorkingColorSpace(this,t),this}setRGB(e,t,n,i=tn.workingColorSpace){return this.r=e,this.g=t,this.b=n,tn.toWorkingColorSpace(this,i),this}setHSL(e,t,n,i=tn.workingColorSpace){if(e=Ro(e,1),t=Xt(t,0,1),n=Xt(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,o=2*n-s;this.r=eo(o,s,e+1/3),this.g=eo(o,s,e),this.b=eo(o,s,e-1/3)}return tn.toWorkingColorSpace(this,i),this}setStyle(e,t=En){function n(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,tn.toWorkingColorSpace(this,t),n(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,tn.toWorkingColorSpace(this,t),n(s[4]),this;break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const l=parseFloat(s[1])/360,c=parseFloat(s[2])/100,u=parseFloat(s[3])/100;return n(s[4]),this.setHSL(l,c,u,t)}break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=En){const n=Cc[e.toLowerCase()];return n!==void 0?this.setHex(n,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=Ji(e.r),this.g=Ji(e.g),this.b=Ji(e.b),this}copyLinearToSRGB(e){return this.r=Hs(e.r),this.g=Hs(e.g),this.b=Hs(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=En){return tn.fromWorkingColorSpace(Ot.copy(this),e),Xt(Ot.r*255,0,255)<<16^Xt(Ot.g*255,0,255)<<8^Xt(Ot.b*255,0,255)<<0}getHexString(e=En){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=tn.workingColorSpace){tn.fromWorkingColorSpace(Ot.copy(this),t);const n=Ot.r,i=Ot.g,s=Ot.b,o=Math.max(n,i,s),a=Math.min(n,i,s);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const f=o-a;switch(c=u<=.5?f/(o+a):f/(2-o-a),o){case n:l=(i-s)/f+(i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const l in n){const c=n[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let f=0,h=c.length;f0&&(i[l]=u,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(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;n!==null&&this.setIndex(n.clone(t));const i=e.attributes;for(const c in i){const u=i[c];this.setAttribute(c,u.clone(t))}const s=e.morphAttributes;for(const c in s){const u=[],f=s[c];for(let h=0,p=f.length;h0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))||(Ua.copy(s).invert(),yn.copy(e.ray).applyMatrix4(Ua),n.boundingBox!==null&&yn.intersectsBox(n.boundingBox)===!1))return;let o;const a=n.index,l=n.attributes.position,c=n.attributes.uv,u=n.attributes.uv2,f=n.attributes.normal,h=n.groups,p=n.drawRange;if(a!==null)if(Array.isArray(i))for(let _=0,v=h.length;_t.far?null:{distance:c,point:$r.clone(),object:r}}function es(r,e,t,n,i,s,o,a,l,c){r.getVertexPosition(a,Oi),r.getVertexPosition(l,Fi),r.getVertexPosition(c,zi);const u=Bf(r,e,t,n,Oi,Fi,zi,Jr);if(u){i&&(Zr.fromBufferAttribute(i,a),Qr.fromBufferAttribute(i,l),Kr.fromBufferAttribute(i,c),u.uv=dn.getInterpolation(Jr,Oi,Fi,zi,Zr,Qr,Kr,new Qe)),s&&(Zr.fromBufferAttribute(s,a),Qr.fromBufferAttribute(s,l),Kr.fromBufferAttribute(s,c),u.uv2=dn.getInterpolation(Jr,Oi,Fi,zi,Zr,Qr,Kr,new Qe)),o&&(Oa.fromBufferAttribute(o,a),Fa.fromBufferAttribute(o,l),za.fromBufferAttribute(o,c),u.normal=dn.getInterpolation(Jr,Oi,Fi,zi,Oa,Fa,za,new I),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new I,materialIndex:0};dn.getNormal(Oi,Fi,zi,f.normal),u.face=f}return u}class bt extends qt{constructor(e=1,t=1,n=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],u=[],f=[];let h=0,p=0;_("z","y","x",-1,-1,n,t,e,o,s,0),_("z","y","x",1,-1,n,t,-e,o,s,1),_("x","z","y",1,1,e,n,t,i,o,2),_("x","z","y",1,-1,e,n,-t,i,o,3),_("x","y","z",1,-1,e,t,n,i,s,4),_("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(l),this.setAttribute("position",new pt(c,3)),this.setAttribute("normal",new pt(u,3)),this.setAttribute("uv",new pt(f,2));function _(v,m,d,g,x,M,y,w,C,T,b){const S=M/C,F=y/T,k=M/2,L=y/2,O=w/2,B=C+1,J=T+1;let R=0,H=0;const Q=new I;for(let K=0;K0?1:-1,u.push(Q.x,Q.y,Q.z),f.push(se/C),f.push(1-K/T),R+=1}}for(let K=0;K0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Uc extends Et{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new vt,this.projectionMatrix=new vt,this.projectionMatrixInverse=new vt}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)}}class sn extends Uc{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,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=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ur*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ar*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ur*2*Math.atan(Math.tan(Ar*.5*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,s,o){this.aspect=e/t,this.view===null&&(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=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ar*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ki=-90,Bi=1;class jf extends Et{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n;const i=new sn(ki,Bi,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const s=new sn(ki,Bi,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const o=new sn(ki,Bi,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new sn(ki,Bi,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new sn(ki,Bi,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const c=new sn(ki,Bi,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[i,s,o,a,l,c]=this.children,u=e.getRenderTarget(),f=e.toneMapping,h=e.xr.enabled;e.toneMapping=Rn,e.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=p,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=f,e.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}class Nc extends $t{constructor(e,t,n,i,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:er,super(e,t,n,i,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Xf extends ii{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Nc(i,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=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:ln}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class Xn extends cr{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Hf,this.fragmentShader=Vf,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=ir(e.uniforms),this.uniformsGroups=Gf(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class Ic extends Et{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new vt,this.projectionMatrix=new vt,this.projectionMatrixInverse=new vt}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)}}class sn extends Ic{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,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=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ur*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Ar*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ur*2*Math.atan(Math.tan(Ar*.5*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,s,o){this.aspect=e/t,this.view===null&&(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=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Ar*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*n/c,i*=o.width/l,n*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const ki=-90,Bi=1;class Wf extends Et{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n;const i=new sn(ki,Bi,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const s=new sn(ki,Bi,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const o=new sn(ki,Bi,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new sn(ki,Bi,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new sn(ki,Bi,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const c=new sn(ki,Bi,e,t);c.layers=this.layers,c.up.set(0,1,0),c.lookAt(0,0,-1),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const n=this.renderTarget,[i,s,o,a,l,c]=this.children,u=e.getRenderTarget(),f=e.toneMapping,h=e.xr.enabled;e.toneMapping=Rn,e.xr.enabled=!1;const p=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0),e.render(t,i),e.setRenderTarget(n,1),e.render(t,s),e.setRenderTarget(n,2),e.render(t,o),e.setRenderTarget(n,3),e.render(t,a),e.setRenderTarget(n,4),e.render(t,l),n.texture.generateMipmaps=p,e.setRenderTarget(n,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=f,e.xr.enabled=h,n.texture.needsPMREMUpdate=!0}}class Uc extends $t{constructor(e,t,n,i,s,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:er,super(e,t,n,i,s,o,a,l,c,u),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class jf extends ii{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Uc(i,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=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:ln}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -41,28 +41,28 @@ const au=function(){const e=document.createElement("link").relList;if(e&&e.suppo gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},i=new bt(5,5,5),s=new Xn({name:"CubemapFromEquirect",uniforms:ir(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:Jt,blending:ei});s.uniforms.tEquirect.value=t;const o=new pe(i,s),a=t.minFilter;return t.minFilter===Rr&&(t.minFilter=ln),new jf(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,n,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,n,i);e.setRenderTarget(s)}}const io=new I,qf=new I,Yf=new We;class di{constructor(e=new I(1,0,0),t=0){this.isPlane=!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=io.subVectors(n,t).cross(qf.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(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(io),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}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||Yf.getNormalMatrix(e),i=this.coplanarPoint(io).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),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)}}const fi=new Ss,ts=new I;class Uo{constructor(e=new di,t=new di,n=new di,i=new di,s=new di,o=new di){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),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],s=n[1],o=n[2],a=n[3],l=n[4],c=n[5],u=n[6],f=n[7],h=n[8],p=n[9],_=n[10],v=n[11],m=n[12],d=n[13],g=n[14],x=n[15];return t[0].setComponents(a-i,f-l,v-h,x-m).normalize(),t[1].setComponents(a+i,f+l,v+h,x+m).normalize(),t[2].setComponents(a+s,f+c,v+p,x+d).normalize(),t[3].setComponents(a-s,f-c,v-p,x-d).normalize(),t[4].setComponents(a-o,f-u,v-_,x-g).normalize(),t[5].setComponents(a+o,f+u,v+_,x+g).normalize(),this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),fi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),fi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(fi)}intersectsSprite(e){return fi.center.set(0,0,0),fi.radius=.7071067811865476,fi.applyMatrix4(e.matrixWorld),this.intersectsSphere(fi)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,ts.y=i.normal.y>0?e.max.y:e.min.y,ts.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(ts)<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 Oc(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function Zf(r,e){const t=e.isWebGL2,n=new WeakMap;function i(c,u){const f=c.array,h=c.usage,p=r.createBuffer();r.bindBuffer(u,p),r.bufferData(u,f,h),c.onUploadCallback();let _;if(f instanceof Float32Array)_=5126;else if(f instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)_=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=5123;else if(f instanceof Int16Array)_=5122;else if(f instanceof Uint32Array)_=5125;else if(f instanceof Int32Array)_=5124;else if(f instanceof Int8Array)_=5120;else if(f instanceof Uint8Array)_=5121;else if(f instanceof Uint8ClampedArray)_=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:p,type:_,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,f){const h=u.array,p=u.updateRange;r.bindBuffer(f,c),p.count===-1?r.bufferSubData(f,0,h):(t?r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count):r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h.subarray(p.offset,p.offset+p.count)),p.count=-1),u.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=n.get(c);u&&(r.deleteBuffer(u.buffer),n.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const h=n.get(c);(!h||h.version1?null:t.copy(e.start).addScaledVector(n,s)}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||qf.getNormalMatrix(e),i=this.coplanarPoint(io).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),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)}}const fi=new Ss,ts=new I;class Uo{constructor(e=new di,t=new di,n=new di,i=new di,s=new di,o=new di){this.planes=[e,t,n,i,s,o]}set(e,t,n,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(n),a[3].copy(i),a[4].copy(s),a[5].copy(o),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],s=n[1],o=n[2],a=n[3],l=n[4],c=n[5],u=n[6],f=n[7],h=n[8],p=n[9],_=n[10],v=n[11],m=n[12],d=n[13],g=n[14],x=n[15];return t[0].setComponents(a-i,f-l,v-h,x-m).normalize(),t[1].setComponents(a+i,f+l,v+h,x+m).normalize(),t[2].setComponents(a+s,f+c,v+p,x+d).normalize(),t[3].setComponents(a-s,f-c,v-p,x-d).normalize(),t[4].setComponents(a-o,f-u,v-_,x-g).normalize(),t[5].setComponents(a+o,f+u,v+_,x+g).normalize(),this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),fi.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),fi.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(fi)}intersectsSprite(e){return fi.center.set(0,0,0),fi.radius=.7071067811865476,fi.applyMatrix4(e.matrixWorld),this.intersectsSphere(fi)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)0?e.max.x:e.min.x,ts.y=i.normal.y>0?e.max.y:e.min.y,ts.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(ts)<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 Nc(){let r=null,e=!1,t=null,n=null;function i(s,o){t(s,o),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function Yf(r,e){const t=e.isWebGL2,n=new WeakMap;function i(c,u){const f=c.array,h=c.usage,p=r.createBuffer();r.bindBuffer(u,p),r.bufferData(u,f,h),c.onUploadCallback();let _;if(f instanceof Float32Array)_=5126;else if(f instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)_=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else _=5123;else if(f instanceof Int16Array)_=5122;else if(f instanceof Uint32Array)_=5125;else if(f instanceof Int32Array)_=5124;else if(f instanceof Int8Array)_=5120;else if(f instanceof Uint8Array)_=5121;else if(f instanceof Uint8ClampedArray)_=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+f);return{buffer:p,type:_,bytesPerElement:f.BYTES_PER_ELEMENT,version:c.version}}function s(c,u,f){const h=u.array,p=u.updateRange;r.bindBuffer(f,c),p.count===-1?r.bufferSubData(f,0,h):(t?r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h,p.offset,p.count):r.bufferSubData(f,p.offset*h.BYTES_PER_ELEMENT,h.subarray(p.offset,p.offset+p.count)),p.count=-1),u.onUploadCallback()}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),n.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=n.get(c);u&&(r.deleteBuffer(u.buffer),n.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const h=n.get(c);(!h||h.version 0 +#endif`,oh=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { @@ -179,26 +179,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #pragma unroll_loop_end if ( clipped ) discard; #endif -#endif`,lh=`#if NUM_CLIPPING_PLANES > 0 +#endif`,ah=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,ch=`#if NUM_CLIPPING_PLANES > 0 +#endif`,lh=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,uh=`#if NUM_CLIPPING_PLANES > 0 +#endif`,ch=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,fh=`#if defined( USE_COLOR_ALPHA ) +#endif`,uh=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,hh=`#if defined( USE_COLOR_ALPHA ) +#endif`,fh=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,dh=`#if defined( USE_COLOR_ALPHA ) +#endif`,hh=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; -#endif`,ph=`#if defined( USE_COLOR_ALPHA ) +#endif`,dh=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); @@ -208,7 +208,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; -#endif`,mh=`#define PI 3.141592653589793 +#endif`,ph=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -291,7 +291,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,gh=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,mh=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -389,7 +389,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,_h=`vec3 transformedNormal = objectNormal; +#endif`,gh=`vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 m = mat3( instanceMatrix ); transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); @@ -404,23 +404,23 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,vh=`#ifdef USE_DISPLACEMENTMAP +#endif`,_h=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,xh=`#ifdef USE_DISPLACEMENTMAP +#endif`,vh=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,Mh=`#ifdef USE_EMISSIVEMAP +#endif`,xh=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,bh=`#ifdef USE_EMISSIVEMAP +#endif`,Mh=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,Sh="gl_FragColor = linearToOutputTexel( gl_FragColor );",yh=`vec4 LinearToLinear( in vec4 value ) { +#endif`,bh="gl_FragColor = linearToOutputTexel( gl_FragColor );",Sh=`vec4 LinearToLinear( in vec4 value ) { return value; } vec4 LinearTosRGB( in vec4 value ) { return 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 ); -}`,wh=`#ifdef USE_ENVMAP +}`,yh=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -449,7 +449,7 @@ vec4 LinearTosRGB( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,Eh=`#ifdef USE_ENVMAP +#endif`,wh=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE @@ -458,7 +458,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,Th=`#ifdef USE_ENVMAP +#endif`,Eh=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -469,7 +469,7 @@ vec4 LinearTosRGB( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,Ah=`#ifdef USE_ENVMAP +#endif`,Th=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -480,7 +480,7 @@ vec4 LinearTosRGB( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,Ch=`#ifdef USE_ENVMAP +#endif`,Ah=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -497,18 +497,18 @@ vec4 LinearTosRGB( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,Ph=`#ifdef USE_FOG +#endif`,Ch=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,Lh=`#ifdef USE_FOG +#endif`,Ph=`#ifdef USE_FOG varying float vFogDepth; -#endif`,Rh=`#ifdef USE_FOG +#endif`,Lh=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,Dh=`#ifdef USE_FOG +#endif`,Rh=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -517,7 +517,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,Ih=`#ifdef USE_GRADIENTMAP +#endif`,Dh=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -529,16 +529,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,Uh=`#ifdef USE_LIGHTMAP +}`,Ih=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,Nh=`#ifdef USE_LIGHTMAP +#endif`,Uh=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,Oh=`LambertMaterial material; +#endif`,Nh=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,Fh=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Oh=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -552,7 +552,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricCon reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,zh=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,Fh=`uniform bool receiveShadow; uniform vec3 ambientLightColor; uniform vec3 lightProbe[ 9 ]; vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { @@ -673,7 +673,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,kh=`#if defined( USE_ENVMAP ) +#endif`,zh=`#if defined( USE_ENVMAP ) vec3 getIBLIrradiance( const in vec3 normal ) { #if defined( ENVMAP_TYPE_CUBE_UV ) vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -694,8 +694,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi return vec3( 0.0 ); #endif } -#endif`,Bh=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,Gh=`varying vec3 vViewPosition; +#endif`,kh=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,Bh=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -707,11 +707,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContex reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Hh=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,Gh=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,Vh=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Hh=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -728,7 +728,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in Geometric reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Wh=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Vh=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -792,7 +792,7 @@ material.roughness = min( material.roughness, 1.0 ); #ifdef USE_SHEEN_ROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; #endif -#endif`,jh=`struct PhysicalMaterial { +#endif`,Wh=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1058,7 +1058,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,Xh=` +}`,jh=` GeometricContext geometry; geometry.position = - vViewPosition; geometry.normal = normal; @@ -1171,7 +1171,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,qh=`#if defined( RE_IndirectDiffuse ) +#endif`,Xh=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1186,25 +1186,25 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,Yh=`#if defined( RE_IndirectDiffuse ) +#endif`,qh=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); -#endif`,Zh=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,Yh=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,Qh=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) +#endif`,Zh=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,Kh=`#ifdef USE_LOGDEPTHBUF +#endif`,Qh=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif -#endif`,Jh=`#ifdef USE_LOGDEPTHBUF +#endif`,Kh=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); @@ -1214,15 +1214,15 @@ IncidentLight directLight; gl_Position.z *= gl_Position.w; } #endif -#endif`,$h=`#ifdef USE_MAP +#endif`,Jh=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE 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 ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,ed=`#ifdef USE_MAP +#endif`,$h=`#ifdef USE_MAP uniform sampler2D map; -#endif`,td=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,ed=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1234,7 +1234,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,nd=`#if defined( USE_POINTS_UV ) +#endif`,td=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1246,13 +1246,13 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,id=`float metalnessFactor = metalness; +#endif`,nd=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,rd=`#ifdef USE_METALNESSMAP +#endif`,id=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,sd=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) +#endif`,rd=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1261,7 +1261,7 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,od=`#ifdef USE_MORPHNORMALS +#endif`,sd=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1273,7 +1273,7 @@ IncidentLight directLight; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif -#endif`,ad=`#ifdef USE_MORPHTARGETS +#endif`,od=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1293,7 +1293,7 @@ IncidentLight directLight; uniform float morphTargetInfluences[ 4 ]; #endif #endif -#endif`,ld=`#ifdef USE_MORPHTARGETS +#endif`,ad=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1311,7 +1311,7 @@ IncidentLight directLight; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif -#endif`,cd=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,ld=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1344,7 +1344,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 geometryNormal = normal;`,ud=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 geometryNormal = normal;`,cd=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1359,25 +1359,25 @@ vec3 geometryNormal = normal;`,ud=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,fd=`#ifndef FLAT_SHADED +#endif`,ud=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,hd=`#ifndef FLAT_SHADED +#endif`,fd=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,dd=`#ifndef FLAT_SHADED +#endif`,hd=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,pd=`#ifdef USE_NORMALMAP +#endif`,dd=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1399,13 +1399,13 @@ vec3 geometryNormal = normal;`,ud=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,md=`#ifdef USE_CLEARCOAT +#endif`,pd=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; -#endif`,gd=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,md=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,_d=`#ifdef USE_CLEARCOATMAP +#endif`,gd=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1414,18 +1414,18 @@ vec3 geometryNormal = normal;`,ud=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,vd=`#ifdef USE_IRIDESCENCEMAP +#endif`,_d=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,xd=`#ifdef OPAQUE +#endif`,vd=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha + 0.1; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Md=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,xd=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1466,29 +1466,29 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,bd=`#ifdef PREMULTIPLIED_ALPHA +}`,Md=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,Sd=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,bd=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,yd=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,Sd=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,wd=`#ifdef DITHERING +#endif`,yd=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,Ed=`float roughnessFactor = roughness; +#endif`,wd=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,Td=`#ifdef USE_ROUGHNESSMAP +#endif`,Ed=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,Ad=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Td=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -1665,7 +1665,7 @@ gl_Position = projectionMatrix * mvPosition;`,yd=`#ifdef DITHERING return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } -#endif`,Cd=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Ad=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -1703,7 +1703,7 @@ gl_Position = projectionMatrix * mvPosition;`,yd=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,Pd=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,Cd=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -1735,7 +1735,7 @@ gl_Position = projectionMatrix * mvPosition;`,yd=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,Ld=`float getShadowMask() { +#endif`,Pd=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -1767,12 +1767,12 @@ gl_Position = projectionMatrix * mvPosition;`,yd=`#ifdef DITHERING #endif #endif return shadow; -}`,Rd=`#ifdef USE_SKINNING +}`,Ld=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,Dd=`#ifdef USE_SKINNING +#endif`,Rd=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -1791,7 +1791,7 @@ gl_Position = projectionMatrix * mvPosition;`,yd=`#ifdef DITHERING mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } -#endif`,Id=`#ifdef USE_SKINNING +#endif`,Dd=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -1799,7 +1799,7 @@ gl_Position = projectionMatrix * mvPosition;`,yd=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,Ud=`#ifdef USE_SKINNING +#endif`,Id=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -1810,17 +1810,17 @@ gl_Position = projectionMatrix * mvPosition;`,yd=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,Nd=`float specularStrength; +#endif`,Ud=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,Od=`#ifdef USE_SPECULARMAP +#endif`,Nd=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,Fd=`#if defined( TONE_MAPPING ) +#endif`,Od=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,zd=`#ifndef saturate +#endif`,Fd=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -1856,7 +1856,7 @@ vec3 ACESFilmicToneMapping( vec3 color ) { color = ACESOutputMat * color; return saturate( color ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,kd=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,zd=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -1877,7 +1877,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kd=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); -#endif`,Bd=`#ifdef USE_TRANSMISSION +#endif`,kd=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -1984,7 +1984,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kd=`#ifdef USE_TRANSMISS vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } -#endif`,Gd=`#ifdef USE_UV +#endif`,Bd=`#ifdef USE_UV varying vec2 vUv; #endif #ifdef USE_MAP @@ -2051,7 +2051,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kd=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,Hd=`#ifdef USE_UV +#endif`,Gd=`#ifdef USE_UV varying vec2 vUv; #endif #ifdef USE_UV2 @@ -2144,7 +2144,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kd=`#ifdef USE_TRANSMISS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,Vd=`#ifdef USE_UV +#endif`,Hd=`#ifdef USE_UV vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2212,18 +2212,18 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,kd=`#ifdef USE_TRANSMISS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,Wd=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Vd=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const jd=`varying vec2 vUv; +#endif`;const Wd=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,Xd=`uniform sampler2D t2D; +}`,jd=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2235,14 +2235,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,qd=`varying vec3 vWorldDirection; +}`,Xd=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Yd=`#ifdef ENVMAP_TYPE_CUBE +}`,qd=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2264,14 +2264,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Zd=`varying vec3 vWorldDirection; +}`,Yd=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Qd=`uniform samplerCube tCube; +}`,Zd=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2281,7 +2281,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,Kd=`#include +}`,Qd=`#include #include #include #include @@ -2305,7 +2305,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,Jd=`#if DEPTH_PACKING == 3200 +}`,Kd=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2333,7 +2333,7 @@ void main() { #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif -}`,$d=`#define DISTANCE +}`,Jd=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2357,7 +2357,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,ep=`#define DISTANCE +}`,$d=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2379,13 +2379,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,tp=`varying vec3 vWorldDirection; +}`,ep=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,np=`uniform sampler2D tEquirect; +}`,tp=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2394,7 +2394,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,ip=`uniform float scale; +}`,np=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2415,7 +2415,7 @@ void main() { #include #include #include -}`,rp=`uniform vec3 diffuse; +}`,ip=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2443,7 +2443,7 @@ void main() { #include #include #include -}`,sp=`#include +}`,rp=`#include #include #include #include @@ -2472,7 +2472,7 @@ void main() { #include #include #include -}`,op=`uniform vec3 diffuse; +}`,sp=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2518,7 +2518,7 @@ void main() { #include #include #include -}`,ap=`#define LAMBERT +}`,op=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2554,7 +2554,7 @@ void main() { #include #include #include -}`,lp=`#define LAMBERT +}`,ap=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -2609,7 +2609,7 @@ void main() { #include #include #include -}`,cp=`#define MATCAP +}`,lp=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -2640,7 +2640,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,up=`#define MATCAP +}`,cp=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -2684,7 +2684,7 @@ void main() { #include #include #include -}`,fp=`#define NORMAL +}`,up=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -2714,7 +2714,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,hp=`#define NORMAL +}`,fp=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -2735,7 +2735,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,dp=`#define PHONG +}`,hp=`#define PHONG varying vec3 vViewPosition; #include #include @@ -2771,7 +2771,7 @@ void main() { #include #include #include -}`,pp=`#define PHONG +}`,dp=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -2828,7 +2828,7 @@ void main() { #include #include #include -}`,mp=`#define STANDARD +}`,pp=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -2868,7 +2868,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,gp=`#define STANDARD +}`,mp=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -2982,7 +2982,7 @@ void main() { #include #include #include -}`,_p=`#define TOON +}`,gp=`#define TOON varying vec3 vViewPosition; #include #include @@ -3016,7 +3016,7 @@ void main() { #include #include #include -}`,vp=`#define TOON +}`,_p=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3067,7 +3067,7 @@ void main() { #include #include #include -}`,xp=`uniform float size; +}`,vp=`uniform float size; uniform float scale; #include #include @@ -3097,7 +3097,7 @@ void main() { #include #include #include -}`,Mp=`uniform vec3 diffuse; +}`,xp=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3120,7 +3120,7 @@ void main() { #include #include #include -}`,bp=`#include +}`,Mp=`#include #include #include #include @@ -3140,7 +3140,7 @@ void main() { #include #include #include -}`,Sp=`uniform vec3 color; +}`,bp=`uniform vec3 color; uniform float opacity; #include #include @@ -3156,7 +3156,7 @@ void main() { #include #include #include -}`,yp=`uniform float rotation; +}`,Sp=`uniform float rotation; uniform vec2 center; #include #include @@ -3182,7 +3182,7 @@ void main() { #include #include #include -}`,wp=`uniform vec3 diffuse; +}`,yp=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3205,7 +3205,7 @@ void main() { #include #include #include -}`,ke={alphamap_fragment:Qf,alphamap_pars_fragment:Kf,alphatest_fragment:Jf,alphatest_pars_fragment:$f,aomap_fragment:eh,aomap_pars_fragment:th,begin_vertex:nh,beginnormal_vertex:ih,bsdfs:rh,iridescence_fragment:sh,bumpmap_pars_fragment:oh,clipping_planes_fragment:ah,clipping_planes_pars_fragment:lh,clipping_planes_pars_vertex:ch,clipping_planes_vertex:uh,color_fragment:fh,color_pars_fragment:hh,color_pars_vertex:dh,color_vertex:ph,common:mh,cube_uv_reflection_fragment:gh,defaultnormal_vertex:_h,displacementmap_pars_vertex:vh,displacementmap_vertex:xh,emissivemap_fragment:Mh,emissivemap_pars_fragment:bh,encodings_fragment:Sh,encodings_pars_fragment:yh,envmap_fragment:wh,envmap_common_pars_fragment:Eh,envmap_pars_fragment:Th,envmap_pars_vertex:Ah,envmap_physical_pars_fragment:kh,envmap_vertex:Ch,fog_vertex:Ph,fog_pars_vertex:Lh,fog_fragment:Rh,fog_pars_fragment:Dh,gradientmap_pars_fragment:Ih,lightmap_fragment:Uh,lightmap_pars_fragment:Nh,lights_lambert_fragment:Oh,lights_lambert_pars_fragment:Fh,lights_pars_begin:zh,lights_toon_fragment:Bh,lights_toon_pars_fragment:Gh,lights_phong_fragment:Hh,lights_phong_pars_fragment:Vh,lights_physical_fragment:Wh,lights_physical_pars_fragment:jh,lights_fragment_begin:Xh,lights_fragment_maps:qh,lights_fragment_end:Yh,logdepthbuf_fragment:Zh,logdepthbuf_pars_fragment:Qh,logdepthbuf_pars_vertex:Kh,logdepthbuf_vertex:Jh,map_fragment:$h,map_pars_fragment:ed,map_particle_fragment:td,map_particle_pars_fragment:nd,metalnessmap_fragment:id,metalnessmap_pars_fragment:rd,morphcolor_vertex:sd,morphnormal_vertex:od,morphtarget_pars_vertex:ad,morphtarget_vertex:ld,normal_fragment_begin:cd,normal_fragment_maps:ud,normal_pars_fragment:fd,normal_pars_vertex:hd,normal_vertex:dd,normalmap_pars_fragment:pd,clearcoat_normal_fragment_begin:md,clearcoat_normal_fragment_maps:gd,clearcoat_pars_fragment:_d,iridescence_pars_fragment:vd,output_fragment:xd,packing:Md,premultiplied_alpha_fragment:bd,project_vertex:Sd,dithering_fragment:yd,dithering_pars_fragment:wd,roughnessmap_fragment:Ed,roughnessmap_pars_fragment:Td,shadowmap_pars_fragment:Ad,shadowmap_pars_vertex:Cd,shadowmap_vertex:Pd,shadowmask_pars_fragment:Ld,skinbase_vertex:Rd,skinning_pars_vertex:Dd,skinning_vertex:Id,skinnormal_vertex:Ud,specularmap_fragment:Nd,specularmap_pars_fragment:Od,tonemapping_fragment:Fd,tonemapping_pars_fragment:zd,transmission_fragment:kd,transmission_pars_fragment:Bd,uv_pars_fragment:Gd,uv_pars_vertex:Hd,uv_vertex:Vd,worldpos_vertex:Wd,background_vert:jd,background_frag:Xd,backgroundCube_vert:qd,backgroundCube_frag:Yd,cube_vert:Zd,cube_frag:Qd,depth_vert:Kd,depth_frag:Jd,distanceRGBA_vert:$d,distanceRGBA_frag:ep,equirect_vert:tp,equirect_frag:np,linedashed_vert:ip,linedashed_frag:rp,meshbasic_vert:sp,meshbasic_frag:op,meshlambert_vert:ap,meshlambert_frag:lp,meshmatcap_vert:cp,meshmatcap_frag:up,meshnormal_vert:fp,meshnormal_frag:hp,meshphong_vert:dp,meshphong_frag:pp,meshphysical_vert:mp,meshphysical_frag:gp,meshtoon_vert:_p,meshtoon_frag:vp,points_vert:xp,points_frag:Mp,shadow_vert:bp,shadow_frag:Sp,sprite_vert:yp,sprite_frag:wp},ce={common:{diffuse:{value:new Je(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new We},alphaMap:{value:null},alphaMapTransform:{value:new We},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new We}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new We}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new We}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new We},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new We},normalScale:{value:new Qe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new We},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new We}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new We}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new We}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Je(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:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{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 Je(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new We}},sprite:{diffuse:{value:new Je(16777215)},opacity:{value:1},center:{value:new Qe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new We},alphaMap:{value:null},alphaTest:{value:0}}},An={basic:{uniforms:Ht([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.fog]),vertexShader:ke.meshbasic_vert,fragmentShader:ke.meshbasic_frag},lambert:{uniforms:Ht([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Je(0)}}]),vertexShader:ke.meshlambert_vert,fragmentShader:ke.meshlambert_frag},phong:{uniforms:Ht([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Je(0)},specular:{value:new Je(1118481)},shininess:{value:30}}]),vertexShader:ke.meshphong_vert,fragmentShader:ke.meshphong_frag},standard:{uniforms:Ht([ce.common,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.roughnessmap,ce.metalnessmap,ce.fog,ce.lights,{emissive:{value:new Je(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag},toon:{uniforms:Ht([ce.common,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.gradientmap,ce.fog,ce.lights,{emissive:{value:new Je(0)}}]),vertexShader:ke.meshtoon_vert,fragmentShader:ke.meshtoon_frag},matcap:{uniforms:Ht([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,{matcap:{value:null}}]),vertexShader:ke.meshmatcap_vert,fragmentShader:ke.meshmatcap_frag},points:{uniforms:Ht([ce.points,ce.fog]),vertexShader:ke.points_vert,fragmentShader:ke.points_frag},dashed:{uniforms:Ht([ce.common,ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ke.linedashed_vert,fragmentShader:ke.linedashed_frag},depth:{uniforms:Ht([ce.common,ce.displacementmap]),vertexShader:ke.depth_vert,fragmentShader:ke.depth_frag},normal:{uniforms:Ht([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,{opacity:{value:1}}]),vertexShader:ke.meshnormal_vert,fragmentShader:ke.meshnormal_frag},sprite:{uniforms:Ht([ce.sprite,ce.fog]),vertexShader:ke.sprite_vert,fragmentShader:ke.sprite_frag},background:{uniforms:{uvTransform:{value:new We},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ke.background_vert,fragmentShader:ke.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ke.backgroundCube_vert,fragmentShader:ke.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ke.cube_vert,fragmentShader:ke.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ke.equirect_vert,fragmentShader:ke.equirect_frag},distanceRGBA:{uniforms:Ht([ce.common,ce.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ke.distanceRGBA_vert,fragmentShader:ke.distanceRGBA_frag},shadow:{uniforms:Ht([ce.lights,ce.fog,{color:{value:new Je(0)},opacity:{value:1}}]),vertexShader:ke.shadow_vert,fragmentShader:ke.shadow_frag}};An.physical={uniforms:Ht([An.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new We},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new We},clearcoatNormalScale:{value:new Qe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new We},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new We},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new We},sheen:{value:0},sheenColor:{value:new Je(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new We},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new We},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new We},transmissionSamplerSize:{value:new Qe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new We},attenuationDistance:{value:0},attenuationColor:{value:new Je(0)},specularColor:{value:new Je(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new We},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new We}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag};const ns={r:0,b:0,g:0};function Ep(r,e,t,n,i,s,o){const a=new Je(0);let l=s===!0?0:1,c,u,f=null,h=0,p=null;function _(m,d){let g=!1,x=d.isScene===!0?d.background:null;x&&x.isTexture&&(x=(d.backgroundBlurriness>0?t:e).get(x));const M=r.xr,y=M.getSession&&M.getSession();y&&y.environmentBlendMode==="additive"&&(x=null),x===null?v(a,l):x&&x.isColor&&(v(x,1),g=!0),(r.autoClear||g)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),x&&(x.isCubeTexture||x.mapping===bs)?(u===void 0&&(u=new pe(new bt(1,1,1),new Xn({name:"BackgroundCubeMaterial",uniforms:ir(An.backgroundCube.uniforms),vertexShader:An.backgroundCube.vertexShader,fragmentShader:An.backgroundCube.fragmentShader,side:Jt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(w,C,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=x,u.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=d.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=d.backgroundIntensity,u.material.toneMapped=x.encoding!==ot,(f!==x||h!==x.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,f=x,h=x.version,p=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new pe(new ws(2,2),new Xn({name:"BackgroundMaterial",uniforms:ir(An.background.uniforms),vertexShader:An.background.vertexShader,fragmentShader:An.background.fragmentShader,side:ti,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=x,c.material.uniforms.backgroundIntensity.value=d.backgroundIntensity,c.material.toneMapped=x.encoding!==ot,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(f!==x||h!==x.version||p!==r.toneMapping)&&(c.material.needsUpdate=!0,f=x,h=x.version,p=r.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function v(m,d){m.getRGB(ns,Dc(r)),n.buffers.color.setClear(ns.r,ns.g,ns.b,d,o)}return{getClearColor:function(){return a},setClearColor:function(m,d=1){a.set(m),l=d,v(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,v(a,l)},render:_}}function Tp(r,e,t,n){const i=r.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},l=m(null);let c=l,u=!1;function f(O,B,J,R,H){let Q=!1;if(o){const K=v(R,J,B);c!==K&&(c=K,p(c.object)),Q=d(O,R,J,H),Q&&g(O,R,J,H)}else{const K=B.wireframe===!0;(c.geometry!==R.id||c.program!==J.id||c.wireframe!==K)&&(c.geometry=R.id,c.program=J.id,c.wireframe=K,Q=!0)}H!==null&&t.update(H,34963),(Q||u)&&(u=!1,T(O,B,J,R),H!==null&&r.bindBuffer(34963,t.get(H).buffer))}function h(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function p(O){return n.isWebGL2?r.bindVertexArray(O):s.bindVertexArrayOES(O)}function _(O){return n.isWebGL2?r.deleteVertexArray(O):s.deleteVertexArrayOES(O)}function v(O,B,J){const R=J.wireframe===!0;let H=a[O.id];H===void 0&&(H={},a[O.id]=H);let Q=H[B.id];Q===void 0&&(Q={},H[B.id]=Q);let K=Q[R];return K===void 0&&(K=m(h()),Q[R]=K),K}function m(O){const B=[],J=[],R=[];for(let H=0;H=0){const ee=H[se];let te=Q[se];if(te===void 0&&(se==="instanceMatrix"&&O.instanceMatrix&&(te=O.instanceMatrix),se==="instanceColor"&&O.instanceColor&&(te=O.instanceColor)),ee===void 0||ee.attribute!==te||te&&ee.data!==te.data)return!0;K++}return c.attributesNum!==K||c.index!==R}function g(O,B,J,R){const H={},Q=B.attributes;let K=0;const ve=J.getAttributes();for(const se in ve)if(ve[se].location>=0){let ee=Q[se];ee===void 0&&(se==="instanceMatrix"&&O.instanceMatrix&&(ee=O.instanceMatrix),se==="instanceColor"&&O.instanceColor&&(ee=O.instanceColor));const te={};te.attribute=ee,ee&&ee.data&&(te.data=ee.data),H[se]=te,K++}c.attributes=H,c.attributesNum=K,c.index=R}function x(){const O=c.newAttributes;for(let B=0,J=O.length;B=0){let j=H[ve];if(j===void 0&&(ve==="instanceMatrix"&&O.instanceMatrix&&(j=O.instanceMatrix),ve==="instanceColor"&&O.instanceColor&&(j=O.instanceColor)),j!==void 0){const ee=j.normalized,te=j.itemSize,ue=t.get(j);if(ue===void 0)continue;const N=ue.buffer,Re=ue.type,Ce=ue.bytesPerElement;if(j.isInterleavedBufferAttribute){const oe=j.data,Te=oe.stride,je=j.offset;if(oe.isInstancedInterleavedBuffer){for(let ye=0;ye0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";C="mediump"}return C==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext!="undefined"&&r.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,f=r.getParameter(34930),h=r.getParameter(35660),p=r.getParameter(3379),_=r.getParameter(34076),v=r.getParameter(34921),m=r.getParameter(36347),d=r.getParameter(36348),g=r.getParameter(36349),x=h>0,M=o||e.has("OES_texture_float"),y=x&&M,w=o?r.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:f,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:_,maxAttributes:v,maxVertexUniforms:m,maxVaryings:d,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:M,floatVertexTextures:y,maxSamples:w}}function Pp(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new di,a=new We,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||n!==0||i;return i=h,n=f.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=u(f,h,0)},this.setState=function(f,h,p){const _=f.clippingPlanes,v=f.clipIntersection,m=f.clipShadows,d=r.get(f);if(!i||_===null||_.length===0||s&&!m)s?u(null):c();else{const g=s?0:n,x=g*4;let M=d.clippingState||null;l.value=M,M=u(_,h,x,p);for(let y=0;y!==x;++y)M[y]=t[y];d.clippingState=M,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=g}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,h,p,_){const v=f!==null?f.length:0;let m=null;if(v!==0){if(m=l.value,_!==!0||m===null){const d=p+v*4,g=h.matrixWorldInverse;a.getNormalMatrix(g),(m===null||m.length0){const c=new Xf(l.height/2);return c.fromEquirectangularTexture(r,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Fc extends Uc{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,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=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,o){this.view===null&&(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=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(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 s=n-e,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Xi=4,ka=[.125,.215,.35,.446,.526,.582],gi=20,ro=new Fc,Ba=new Je;let so=null;const pi=(1+Math.sqrt(5))/2,Gi=1/pi,Ga=[new I(1,1,1),new I(-1,1,1),new I(1,1,-1),new I(-1,1,-1),new I(0,pi,Gi),new I(0,pi,-Gi),new I(Gi,0,pi),new I(-Gi,0,pi),new I(pi,Gi,0),new I(-pi,Gi,0)];class Ha{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){so=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ja(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Wa(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?x:0,x,x),u.setRenderTarget(i),v&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===er||e.mapping===tr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=ja()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Wa());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new pe(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;is(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,ro)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;igi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${gi}`);const d=[];let g=0;for(let C=0;Cx-Xi?i-x+Xi:0),w=4*(this._cubeSize-M);is(t,y,w,3*M,2*M),l.setRenderTarget(t),l.render(f,ro)}}function Rp(r){const e=[],t=[],n=[];let i=r;const s=r-Xi+1+ka.length;for(let o=0;or-Xi?l=ka[o-r+Xi-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,f=1+c,h=[u,u,f,u,f,f,u,u,f,f,u,f],p=6,_=6,v=3,m=2,d=1,g=new Float32Array(v*_*p),x=new Float32Array(m*_*p),M=new Float32Array(d*_*p);for(let w=0;w2?0:-1,b=[C,T,0,C+2/3,T,0,C+2/3,T+1,0,C,T,0,C+2/3,T+1,0,C,T+1,0];g.set(b,v*_*w),x.set(h,m*_*w);const S=[w,w,w,w,w,w];M.set(S,d*_*w)}const y=new Xt;y.setAttribute("position",new Dn(g,v)),y.setAttribute("uv",new Dn(x,m)),y.setAttribute("faceIndex",new Dn(M,d)),e.push(y),i>Xi&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Va(r,e,t){const n=new ii(r,e,t);return n.texture.mapping=bs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function is(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function Dp(r,e,t){const n=new Float32Array(gi),i=new I(0,1,0);return new Xn({name:"SphericalGaussianBlur",defines:{n:gi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:No(),fragmentShader:` +}`,ke={alphamap_fragment:Zf,alphamap_pars_fragment:Qf,alphatest_fragment:Kf,alphatest_pars_fragment:Jf,aomap_fragment:$f,aomap_pars_fragment:eh,begin_vertex:th,beginnormal_vertex:nh,bsdfs:ih,iridescence_fragment:rh,bumpmap_pars_fragment:sh,clipping_planes_fragment:oh,clipping_planes_pars_fragment:ah,clipping_planes_pars_vertex:lh,clipping_planes_vertex:ch,color_fragment:uh,color_pars_fragment:fh,color_pars_vertex:hh,color_vertex:dh,common:ph,cube_uv_reflection_fragment:mh,defaultnormal_vertex:gh,displacementmap_pars_vertex:_h,displacementmap_vertex:vh,emissivemap_fragment:xh,emissivemap_pars_fragment:Mh,encodings_fragment:bh,encodings_pars_fragment:Sh,envmap_fragment:yh,envmap_common_pars_fragment:wh,envmap_pars_fragment:Eh,envmap_pars_vertex:Th,envmap_physical_pars_fragment:zh,envmap_vertex:Ah,fog_vertex:Ch,fog_pars_vertex:Ph,fog_fragment:Lh,fog_pars_fragment:Rh,gradientmap_pars_fragment:Dh,lightmap_fragment:Ih,lightmap_pars_fragment:Uh,lights_lambert_fragment:Nh,lights_lambert_pars_fragment:Oh,lights_pars_begin:Fh,lights_toon_fragment:kh,lights_toon_pars_fragment:Bh,lights_phong_fragment:Gh,lights_phong_pars_fragment:Hh,lights_physical_fragment:Vh,lights_physical_pars_fragment:Wh,lights_fragment_begin:jh,lights_fragment_maps:Xh,lights_fragment_end:qh,logdepthbuf_fragment:Yh,logdepthbuf_pars_fragment:Zh,logdepthbuf_pars_vertex:Qh,logdepthbuf_vertex:Kh,map_fragment:Jh,map_pars_fragment:$h,map_particle_fragment:ed,map_particle_pars_fragment:td,metalnessmap_fragment:nd,metalnessmap_pars_fragment:id,morphcolor_vertex:rd,morphnormal_vertex:sd,morphtarget_pars_vertex:od,morphtarget_vertex:ad,normal_fragment_begin:ld,normal_fragment_maps:cd,normal_pars_fragment:ud,normal_pars_vertex:fd,normal_vertex:hd,normalmap_pars_fragment:dd,clearcoat_normal_fragment_begin:pd,clearcoat_normal_fragment_maps:md,clearcoat_pars_fragment:gd,iridescence_pars_fragment:_d,output_fragment:vd,packing:xd,premultiplied_alpha_fragment:Md,project_vertex:bd,dithering_fragment:Sd,dithering_pars_fragment:yd,roughnessmap_fragment:wd,roughnessmap_pars_fragment:Ed,shadowmap_pars_fragment:Td,shadowmap_pars_vertex:Ad,shadowmap_vertex:Cd,shadowmask_pars_fragment:Pd,skinbase_vertex:Ld,skinning_pars_vertex:Rd,skinning_vertex:Dd,skinnormal_vertex:Id,specularmap_fragment:Ud,specularmap_pars_fragment:Nd,tonemapping_fragment:Od,tonemapping_pars_fragment:Fd,transmission_fragment:zd,transmission_pars_fragment:kd,uv_pars_fragment:Bd,uv_pars_vertex:Gd,uv_vertex:Hd,worldpos_vertex:Vd,background_vert:Wd,background_frag:jd,backgroundCube_vert:Xd,backgroundCube_frag:qd,cube_vert:Yd,cube_frag:Zd,depth_vert:Qd,depth_frag:Kd,distanceRGBA_vert:Jd,distanceRGBA_frag:$d,equirect_vert:ep,equirect_frag:tp,linedashed_vert:np,linedashed_frag:ip,meshbasic_vert:rp,meshbasic_frag:sp,meshlambert_vert:op,meshlambert_frag:ap,meshmatcap_vert:lp,meshmatcap_frag:cp,meshnormal_vert:up,meshnormal_frag:fp,meshphong_vert:hp,meshphong_frag:dp,meshphysical_vert:pp,meshphysical_frag:mp,meshtoon_vert:gp,meshtoon_frag:_p,points_vert:vp,points_frag:xp,shadow_vert:Mp,shadow_frag:bp,sprite_vert:Sp,sprite_frag:yp},ce={common:{diffuse:{value:new Je(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new We},alphaMap:{value:null},alphaMapTransform:{value:new We},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new We}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new We}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new We}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new We},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new We},normalScale:{value:new Qe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new We},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new We}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new We}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new We}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Je(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:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{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 Je(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new We}},sprite:{diffuse:{value:new Je(16777215)},opacity:{value:1},center:{value:new Qe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new We},alphaMap:{value:null},alphaTest:{value:0}}},An={basic:{uniforms:Vt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.fog]),vertexShader:ke.meshbasic_vert,fragmentShader:ke.meshbasic_frag},lambert:{uniforms:Vt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Je(0)}}]),vertexShader:ke.meshlambert_vert,fragmentShader:ke.meshlambert_frag},phong:{uniforms:Vt([ce.common,ce.specularmap,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,ce.lights,{emissive:{value:new Je(0)},specular:{value:new Je(1118481)},shininess:{value:30}}]),vertexShader:ke.meshphong_vert,fragmentShader:ke.meshphong_frag},standard:{uniforms:Vt([ce.common,ce.envmap,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.roughnessmap,ce.metalnessmap,ce.fog,ce.lights,{emissive:{value:new Je(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag},toon:{uniforms:Vt([ce.common,ce.aomap,ce.lightmap,ce.emissivemap,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.gradientmap,ce.fog,ce.lights,{emissive:{value:new Je(0)}}]),vertexShader:ke.meshtoon_vert,fragmentShader:ke.meshtoon_frag},matcap:{uniforms:Vt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,ce.fog,{matcap:{value:null}}]),vertexShader:ke.meshmatcap_vert,fragmentShader:ke.meshmatcap_frag},points:{uniforms:Vt([ce.points,ce.fog]),vertexShader:ke.points_vert,fragmentShader:ke.points_frag},dashed:{uniforms:Vt([ce.common,ce.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ke.linedashed_vert,fragmentShader:ke.linedashed_frag},depth:{uniforms:Vt([ce.common,ce.displacementmap]),vertexShader:ke.depth_vert,fragmentShader:ke.depth_frag},normal:{uniforms:Vt([ce.common,ce.bumpmap,ce.normalmap,ce.displacementmap,{opacity:{value:1}}]),vertexShader:ke.meshnormal_vert,fragmentShader:ke.meshnormal_frag},sprite:{uniforms:Vt([ce.sprite,ce.fog]),vertexShader:ke.sprite_vert,fragmentShader:ke.sprite_frag},background:{uniforms:{uvTransform:{value:new We},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:ke.background_vert,fragmentShader:ke.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:ke.backgroundCube_vert,fragmentShader:ke.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ke.cube_vert,fragmentShader:ke.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ke.equirect_vert,fragmentShader:ke.equirect_frag},distanceRGBA:{uniforms:Vt([ce.common,ce.displacementmap,{referencePosition:{value:new I},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ke.distanceRGBA_vert,fragmentShader:ke.distanceRGBA_frag},shadow:{uniforms:Vt([ce.lights,ce.fog,{color:{value:new Je(0)},opacity:{value:1}}]),vertexShader:ke.shadow_vert,fragmentShader:ke.shadow_frag}};An.physical={uniforms:Vt([An.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new We},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new We},clearcoatNormalScale:{value:new Qe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new We},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new We},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new We},sheen:{value:0},sheenColor:{value:new Je(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new We},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new We},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new We},transmissionSamplerSize:{value:new Qe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new We},attenuationDistance:{value:0},attenuationColor:{value:new Je(0)},specularColor:{value:new Je(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new We},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new We}}]),vertexShader:ke.meshphysical_vert,fragmentShader:ke.meshphysical_frag};const ns={r:0,b:0,g:0};function wp(r,e,t,n,i,s,o){const a=new Je(0);let l=s===!0?0:1,c,u,f=null,h=0,p=null;function _(m,d){let g=!1,x=d.isScene===!0?d.background:null;x&&x.isTexture&&(x=(d.backgroundBlurriness>0?t:e).get(x));const M=r.xr,y=M.getSession&&M.getSession();y&&y.environmentBlendMode==="additive"&&(x=null),x===null?v(a,l):x&&x.isColor&&(v(x,1),g=!0),(r.autoClear||g)&&r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil),x&&(x.isCubeTexture||x.mapping===bs)?(u===void 0&&(u=new pe(new bt(1,1,1),new Xn({name:"BackgroundCubeMaterial",uniforms:ir(An.backgroundCube.uniforms),vertexShader:An.backgroundCube.vertexShader,fragmentShader:An.backgroundCube.fragmentShader,side:Jt,depthTest:!1,depthWrite:!1,fog:!1})),u.geometry.deleteAttribute("normal"),u.geometry.deleteAttribute("uv"),u.onBeforeRender=function(w,C,T){this.matrixWorld.copyPosition(T.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),u.material.uniforms.envMap.value=x,u.material.uniforms.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=d.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=d.backgroundIntensity,u.material.toneMapped=x.encoding!==ot,(f!==x||h!==x.version||p!==r.toneMapping)&&(u.material.needsUpdate=!0,f=x,h=x.version,p=r.toneMapping),u.layers.enableAll(),m.unshift(u,u.geometry,u.material,0,0,null)):x&&x.isTexture&&(c===void 0&&(c=new pe(new ws(2,2),new Xn({name:"BackgroundMaterial",uniforms:ir(An.background.uniforms),vertexShader:An.background.vertexShader,fragmentShader:An.background.fragmentShader,side:ti,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=x,c.material.uniforms.backgroundIntensity.value=d.backgroundIntensity,c.material.toneMapped=x.encoding!==ot,x.matrixAutoUpdate===!0&&x.updateMatrix(),c.material.uniforms.uvTransform.value.copy(x.matrix),(f!==x||h!==x.version||p!==r.toneMapping)&&(c.material.needsUpdate=!0,f=x,h=x.version,p=r.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null))}function v(m,d){m.getRGB(ns,Rc(r)),n.buffers.color.setClear(ns.r,ns.g,ns.b,d,o)}return{getClearColor:function(){return a},setClearColor:function(m,d=1){a.set(m),l=d,v(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(m){l=m,v(a,l)},render:_}}function Ep(r,e,t,n){const i=r.getParameter(34921),s=n.isWebGL2?null:e.get("OES_vertex_array_object"),o=n.isWebGL2||s!==null,a={},l=m(null);let c=l,u=!1;function f(O,B,J,R,H){let Q=!1;if(o){const K=v(R,J,B);c!==K&&(c=K,p(c.object)),Q=d(O,R,J,H),Q&&g(O,R,J,H)}else{const K=B.wireframe===!0;(c.geometry!==R.id||c.program!==J.id||c.wireframe!==K)&&(c.geometry=R.id,c.program=J.id,c.wireframe=K,Q=!0)}H!==null&&t.update(H,34963),(Q||u)&&(u=!1,T(O,B,J,R),H!==null&&r.bindBuffer(34963,t.get(H).buffer))}function h(){return n.isWebGL2?r.createVertexArray():s.createVertexArrayOES()}function p(O){return n.isWebGL2?r.bindVertexArray(O):s.bindVertexArrayOES(O)}function _(O){return n.isWebGL2?r.deleteVertexArray(O):s.deleteVertexArrayOES(O)}function v(O,B,J){const R=J.wireframe===!0;let H=a[O.id];H===void 0&&(H={},a[O.id]=H);let Q=H[B.id];Q===void 0&&(Q={},H[B.id]=Q);let K=Q[R];return K===void 0&&(K=m(h()),Q[R]=K),K}function m(O){const B=[],J=[],R=[];for(let H=0;H=0){const ee=H[se];let te=Q[se];if(te===void 0&&(se==="instanceMatrix"&&O.instanceMatrix&&(te=O.instanceMatrix),se==="instanceColor"&&O.instanceColor&&(te=O.instanceColor)),ee===void 0||ee.attribute!==te||te&&ee.data!==te.data)return!0;K++}return c.attributesNum!==K||c.index!==R}function g(O,B,J,R){const H={},Q=B.attributes;let K=0;const ve=J.getAttributes();for(const se in ve)if(ve[se].location>=0){let ee=Q[se];ee===void 0&&(se==="instanceMatrix"&&O.instanceMatrix&&(ee=O.instanceMatrix),se==="instanceColor"&&O.instanceColor&&(ee=O.instanceColor));const te={};te.attribute=ee,ee&&ee.data&&(te.data=ee.data),H[se]=te,K++}c.attributes=H,c.attributesNum=K,c.index=R}function x(){const O=c.newAttributes;for(let B=0,J=O.length;B=0){let j=H[ve];if(j===void 0&&(ve==="instanceMatrix"&&O.instanceMatrix&&(j=O.instanceMatrix),ve==="instanceColor"&&O.instanceColor&&(j=O.instanceColor)),j!==void 0){const ee=j.normalized,te=j.itemSize,ue=t.get(j);if(ue===void 0)continue;const N=ue.buffer,Re=ue.type,Ce=ue.bytesPerElement;if(j.isInterleavedBufferAttribute){const oe=j.data,Te=oe.stride,je=j.offset;if(oe.isInstancedInterleavedBuffer){for(let ye=0;ye0&&r.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";C="mediump"}return C==="mediump"&&r.getShaderPrecisionFormat(35633,36337).precision>0&&r.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext!="undefined"&&r.constructor.name==="WebGL2RenderingContext";let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,f=r.getParameter(34930),h=r.getParameter(35660),p=r.getParameter(3379),_=r.getParameter(34076),v=r.getParameter(34921),m=r.getParameter(36347),d=r.getParameter(36348),g=r.getParameter(36349),x=h>0,M=o||e.has("OES_texture_float"),y=x&&M,w=o?r.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:u,maxTextures:f,maxVertexTextures:h,maxTextureSize:p,maxCubemapSize:_,maxAttributes:v,maxVertexUniforms:m,maxVaryings:d,maxFragmentUniforms:g,vertexTextures:x,floatFragmentTextures:M,floatVertexTextures:y,maxSamples:w}}function Cp(r){const e=this;let t=null,n=0,i=!1,s=!1;const o=new di,a=new We,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(f,h){const p=f.length!==0||h||n!==0||i;return i=h,n=f.length,p},this.beginShadows=function(){s=!0,u(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(f,h){t=u(f,h,0)},this.setState=function(f,h,p){const _=f.clippingPlanes,v=f.clipIntersection,m=f.clipShadows,d=r.get(f);if(!i||_===null||_.length===0||s&&!m)s?u(null):c();else{const g=s?0:n,x=g*4;let M=d.clippingState||null;l.value=M,M=u(_,h,x,p);for(let y=0;y!==x;++y)M[y]=t[y];d.clippingState=M,this.numIntersection=v?this.numPlanes:0,this.numPlanes+=g}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function u(f,h,p,_){const v=f!==null?f.length:0;let m=null;if(v!==0){if(m=l.value,_!==!0||m===null){const d=p+v*4,g=h.matrixWorldInverse;a.getNormalMatrix(g),(m===null||m.length0){const c=new jf(l.height/2);return c.fromEquirectangularTexture(r,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:n,dispose:s}}class Oc extends Ic{constructor(e=-1,t=1,n=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=o,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=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,o){this.view===null&&(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=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(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 s=n-e,o=n+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,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,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Xi=4,ka=[.125,.215,.35,.446,.526,.582],gi=20,ro=new Oc,Ba=new Je;let so=null;const pi=(1+Math.sqrt(5))/2,Gi=1/pi,Ga=[new I(1,1,1),new I(-1,1,1),new I(1,1,-1),new I(-1,1,-1),new I(0,pi,Gi),new I(0,pi,-Gi),new I(Gi,0,pi),new I(-Gi,0,pi),new I(pi,Gi,0),new I(-pi,Gi,0)];class Ha{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,i=100){so=this._renderer.getRenderTarget(),this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=ja(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=Wa(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?x:0,x,x),u.setRenderTarget(i),v&&u.render(_,a),u.render(e,a)}_.geometry.dispose(),_.material.dispose(),u.toneMapping=h,u.autoClear=f,e.background=m}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===er||e.mapping===tr;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=ja()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=Wa());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new pe(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;is(t,0,0,3*l,2*l),n.setRenderTarget(t),n.render(o,ro)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;for(let i=1;igi&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${gi}`);const d=[];let g=0;for(let C=0;Cx-Xi?i-x+Xi:0),w=4*(this._cubeSize-M);is(t,y,w,3*M,2*M),l.setRenderTarget(t),l.render(f,ro)}}function Lp(r){const e=[],t=[],n=[];let i=r;const s=r-Xi+1+ka.length;for(let o=0;or-Xi?l=ka[o-r+Xi-1]:o===0&&(l=0),n.push(l);const c=1/(a-2),u=-c,f=1+c,h=[u,u,f,u,f,f,u,u,f,f,u,f],p=6,_=6,v=3,m=2,d=1,g=new Float32Array(v*_*p),x=new Float32Array(m*_*p),M=new Float32Array(d*_*p);for(let w=0;w2?0:-1,b=[C,T,0,C+2/3,T,0,C+2/3,T+1,0,C,T,0,C+2/3,T+1,0,C,T+1,0];g.set(b,v*_*w),x.set(h,m*_*w);const S=[w,w,w,w,w,w];M.set(S,d*_*w)}const y=new qt;y.setAttribute("position",new Dn(g,v)),y.setAttribute("uv",new Dn(x,m)),y.setAttribute("faceIndex",new Dn(M,d)),e.push(y),i>Xi&&i--}return{lodPlanes:e,sizeLods:t,sigmas:n}}function Va(r,e,t){const n=new ii(r,e,t);return n.texture.mapping=bs,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function is(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function Rp(r,e,t){const n=new Float32Array(gi),i=new I(0,1,0);return new Xn({name:"SphericalGaussianBlur",defines:{n:gi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:No(),fragmentShader:` precision mediump float; precision mediump int; @@ -3355,26 +3355,26 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function Ip(r){let e=new WeakMap,t=null;function n(a){if(a&&a.isTexture){const l=a.mapping,c=l===xo||l===Mo,u=l===er||l===tr;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let f=e.get(a);return t===null&&(t=new Ha(r)),f=c?t.fromEquirectangular(a,f):t.fromCubemap(a,f),e.set(a,f),f.texture}else{if(e.has(a))return e.get(a).texture;{const f=a.image;if(c&&f&&f.height>0||u&&f&&i(f)){t===null&&(t=new Ha(r));const h=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,h),a.addEventListener("dispose",s),h.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(F=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const k=new Float32Array(S*F*4*v),L=new Cc(k,S,F,v);L.type=Mi,L.needsUpdate=!0;const O=b*4;for(let J=0;J0)return r;const i=e*t;let s=Xa[i];if(s===void 0&&(s=new Float32Array(i),Xa[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Ct(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t0||u&&f&&i(f)){t===null&&(t=new Ha(r));const h=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,h),a.addEventListener("dispose",s),h.texture}else return null}}}return a}function i(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(F=Math.ceil(S/e.maxTextureSize),S=e.maxTextureSize);const k=new Float32Array(S*F*4*v),L=new Ac(k,S,F,v);L.type=Mi,L.needsUpdate=!0;const O=b*4;for(let J=0;J0)return r;const i=e*t;let s=Xa[i];if(s===void 0&&(s=new Float32Array(i),Xa[i]=s),e!==0){n.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,r[o].toArray(s,a)}return s}function Ct(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t":" "} ${a}: ${t[o]}`)}return n.join(` -`)}function Um(r){switch(r){case ni:return["Linear","( value )"];case ot:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",r),["Linear","( value )"]}}function $a(r,e,t){const n=r.getShaderParameter(e,35713),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` +`)}function Im(r){switch(r){case ni:return["Linear","( value )"];case ot:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",r),["Linear","( value )"]}}function $a(r,e,t){const n=r.getShaderParameter(e,35713),i=r.getShaderInfoLog(e).trim();if(n&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` `+i+` -`+Im(r.getShaderSource(e),o)}else return i}function Nm(r,e){const t=Um(e);return"vec4 "+r+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function Om(r,e){let t;switch(e){case ku:t="Linear";break;case Bu:t="Reinhard";break;case Gu:t="OptimizedCineon";break;case xc:t="ACESFilmic";break;case Hu:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Fm(r){return[r.extensionDerivatives||!!r.envMapCubeUVHeight||r.bumpMap||r.normalMapTangentSpace||r.clearcoatNormalMap||r.flatShading||r.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(r.extensionFragDepth||r.logarithmicDepthBuffer)&&r.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",r.extensionDrawBuffers&&r.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(r.extensionShaderTextureLOD||r.envMap||r.transmission)&&r.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(br).join(` -`)}function zm(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(` -`)}function km(r,e){const t={},n=r.getProgramParameter(e,35721);for(let i=0;i/gm;function Eo(r){return r.replace(Bm,Gm)}function Gm(r,e){const t=ke[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Eo(t)}const Hm=/#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 nl(r){return r.replace(Hm,Vm)}function Vm(r,e,t,n){let i="";for(let s=parseInt(e);s/gm;function Eo(r){return r.replace(km,Bm)}function Bm(r,e){const t=ke[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return Eo(t)}const Gm=/#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 nl(r){return r.replace(Gm,Hm)}function Hm(r,e,t,n){let i="";for(let s=parseInt(e);s0&&(m+=` `),d=[p,_].filter(br).join(` `),d.length>0&&(d+=` `)):(m=[il(t),"#define SHADER_NAME "+t.shaderName,_,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs2?"#define USE_UV2":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.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"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` `].filter(br).join(` -`),d=[p,il(t),"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs2?"#define USE_UV2":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Rn?"#define TONE_MAPPING":"",t.toneMapping!==Rn?ke.tonemapping_pars_fragment:"",t.toneMapping!==Rn?Om("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ke.encodings_pars_fragment,Nm("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`),d=[p,il(t),"#define SHADER_NAME "+t.shaderName,_,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+f:"",h?"#define CUBEUV_TEXEL_WIDTH "+h.texelWidth:"",h?"#define CUBEUV_TEXEL_HEIGHT "+h.texelHeight:"",h?"#define CUBEUV_MAX_MIP "+h.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs2?"#define USE_UV2":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.useLegacyLights?"#define LEGACY_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Rn?"#define TONE_MAPPING":"",t.toneMapping!==Rn?ke.tonemapping_pars_fragment:"",t.toneMapping!==Rn?Nm("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",ke.encodings_pars_fragment,Um("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(br).join(` `)),o=Eo(o),o=el(o,t),o=tl(o,t),a=Eo(a),a=el(a,t),a=tl(a,t),o=nl(o),a=nl(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(g=`#version 300 es `,m=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` @@ -3385,9 +3385,9 @@ precision `+r.precision+" int;";return r.precision==="highp"?e+=` Program Info Log: `+b+` `+O+` -`+B)}else b!==""?console.warn("THREE.WebGLProgram: Program Info Log:",b):(S===""||F==="")&&(L=!1);L&&(this.diagnostics={runnable:k,programLog:b,vertexShader:{log:S,prefix:m},fragmentShader:{log:F,prefix:d}})}i.deleteShader(y),i.deleteShader(w);let C;this.getUniforms=function(){return C===void 0&&(C=new hs(i,v)),C};let T;return this.getAttributes=function(){return T===void 0&&(T=km(i,v)),T},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(v),this.program=void 0},this.name=t.shaderName,this.id=Dm++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=y,this.fragmentShader=w,this}let Qm=0;class Km{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Jm(e),t.set(e,n)),n}}class Jm{constructor(e){this.id=Qm++,this.code=e,this.usedTimes=0}}function $m(r,e,t,n,i,s,o){const a=new Io,l=new Km,c=[],u=i.isWebGL2,f=i.logarithmicDepthBuffer,h=i.vertexTextures;let p=i.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(b){return b===1?"uv2":"uv"}function m(b,S,F,k,L){const O=k.fog,B=L.geometry,J=b.isMeshStandardMaterial?k.environment:null,R=(b.isMeshStandardMaterial?t:e).get(b.envMap||J),H=!!R&&R.mapping===bs?R.image.height:null,Q=_[b.type];b.precision!==null&&(p=i.getMaxPrecision(b.precision),p!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",p,"instead."));const K=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,ve=K!==void 0?K.length:0;let se=0;B.morphAttributes.position!==void 0&&(se=1),B.morphAttributes.normal!==void 0&&(se=2),B.morphAttributes.color!==void 0&&(se=3);let j,ee,te,ue;if(Q){const he=An[Q];j=he.vertexShader,ee=he.fragmentShader}else j=b.vertexShader,ee=b.fragmentShader,l.update(b),te=l.getVertexShaderID(b),ue=l.getFragmentShaderID(b);const N=r.getRenderTarget(),Re=L.isInstancedMesh===!0,Ce=!!b.map,oe=!!b.matcap,Te=!!R,je=!!b.aoMap,ye=!!b.lightMap,Ue=!!b.bumpMap,lt=!!b.normalMap,xt=!!b.displacementMap,Mt=!!b.emissiveMap,_t=!!b.metalnessMap,Xe=!!b.roughnessMap,st=b.clearcoat>0,It=b.iridescence>0,P=b.sheen>0,E=b.transmission>0,Y=st&&!!b.clearcoatMap,ne=st&&!!b.clearcoatNormalMap,re=st&&!!b.clearcoatRoughnessMap,fe=It&&!!b.iridescenceMap,Pe=It&&!!b.iridescenceThicknessMap,de=P&&!!b.sheenColorMap,$=P&&!!b.sheenRoughnessMap,xe=!!b.specularMap,we=!!b.specularColorMap,Ae=!!b.specularIntensityMap,ge=E&&!!b.transmissionMap,Me=E&&!!b.thicknessMap,Fe=!!b.gradientMap,Ze=!!b.alphaMap,ct=b.alphaTest>0,U=!!b.extensions,W=!!B.attributes.uv2;return{isWebGL2:u,shaderID:Q,shaderName:b.type,vertexShader:j,fragmentShader:ee,defines:b.defines,customVertexShaderID:te,customFragmentShaderID:ue,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:p,instancing:Re,instancingColor:Re&&L.instanceColor!==null,supportsVertexTextures:h,outputEncoding:N===null?r.outputEncoding:N.isXRRenderTarget===!0?N.texture.encoding:ni,map:Ce,matcap:oe,envMap:Te,envMapMode:Te&&R.mapping,envMapCubeUVHeight:H,aoMap:je,lightMap:ye,bumpMap:Ue,normalMap:lt,displacementMap:h&&xt,emissiveMap:Mt,normalMapObjectSpace:lt&&b.normalMapType===lf,normalMapTangentSpace:lt&&b.normalMapType===Sc,decodeVideoTexture:Ce&&b.map.isVideoTexture===!0&&b.map.encoding===ot,metalnessMap:_t,roughnessMap:Xe,clearcoat:st,clearcoatMap:Y,clearcoatNormalMap:ne,clearcoatRoughnessMap:re,iridescence:It,iridescenceMap:fe,iridescenceThicknessMap:Pe,sheen:P,sheenColorMap:de,sheenRoughnessMap:$,specularMap:xe,specularColorMap:we,specularIntensityMap:Ae,transmission:E,transmissionMap:ge,thicknessMap:Me,gradientMap:Fe,opaque:b.transparent===!1&&b.blending===Qi,alphaMap:Ze,alphaTest:ct,combine:b.combine,mapUv:Ce&&v(b.map.channel),aoMapUv:je&&v(b.aoMap.channel),lightMapUv:ye&&v(b.lightMap.channel),bumpMapUv:Ue&&v(b.bumpMap.channel),normalMapUv:lt&&v(b.normalMap.channel),displacementMapUv:xt&&v(b.displacementMap.channel),emissiveMapUv:Mt&&v(b.emissiveMap.channel),metalnessMapUv:_t&&v(b.metalnessMap.channel),roughnessMapUv:Xe&&v(b.roughnessMap.channel),clearcoatMapUv:Y&&v(b.clearcoatMap.channel),clearcoatNormalMapUv:ne&&v(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:re&&v(b.clearcoatRoughnessMap.channel),iridescenceMapUv:fe&&v(b.iridescenceMap.channel),iridescenceThicknessMapUv:Pe&&v(b.iridescenceThicknessMap.channel),sheenColorMapUv:de&&v(b.sheenColorMap.channel),sheenRoughnessMapUv:$&&v(b.sheenRoughnessMap.channel),specularMapUv:xe&&v(b.specularMap.channel),specularColorMapUv:we&&v(b.specularColorMap.channel),specularIntensityMapUv:Ae&&v(b.specularIntensityMap.channel),transmissionMapUv:ge&&v(b.transmissionMap.channel),thicknessMapUv:Me&&v(b.thicknessMap.channel),alphaMapUv:Ze&&v(b.alphaMap.channel),vertexTangents:lt&&!!B.attributes.tangent,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,vertexUvs2:W,pointsUvs:L.isPoints===!0&&!!B.attributes.uv&&(Ce||Ze),fog:!!O,useFog:b.fog===!0,fogExp2:O&&O.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:L.isSkinnedMesh===!0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:ve,morphTextureStride:se,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&F.length>0,shadowMapType:r.shadowMap.type,toneMapping:b.toneMapped?r.toneMapping:Rn,useLegacyLights:r.useLegacyLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Pn,flipSided:b.side===Jt,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:U&&b.extensions.derivatives===!0,extensionFragDepth:U&&b.extensions.fragDepth===!0,extensionDrawBuffers:U&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:U&&b.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function d(b){const S=[];if(b.shaderID?S.push(b.shaderID):(S.push(b.customVertexShaderID),S.push(b.customFragmentShaderID)),b.defines!==void 0)for(const F in b.defines)S.push(F),S.push(b.defines[F]);return b.isRawShaderMaterial===!1&&(g(S,b),x(S,b),S.push(r.outputEncoding)),S.push(b.customProgramCacheKey),S.join()}function g(b,S){b.push(S.precision),b.push(S.outputEncoding),b.push(S.envMapMode),b.push(S.envMapCubeUVHeight),b.push(S.mapUv),b.push(S.alphaMapUv),b.push(S.lightMapUv),b.push(S.aoMapUv),b.push(S.bumpMapUv),b.push(S.normalMapUv),b.push(S.displacementMapUv),b.push(S.emissiveMapUv),b.push(S.metalnessMapUv),b.push(S.roughnessMapUv),b.push(S.clearcoatMapUv),b.push(S.clearcoatNormalMapUv),b.push(S.clearcoatRoughnessMapUv),b.push(S.iridescenceMapUv),b.push(S.iridescenceThicknessMapUv),b.push(S.sheenColorMapUv),b.push(S.sheenRoughnessMapUv),b.push(S.specularMapUv),b.push(S.specularColorMapUv),b.push(S.specularIntensityMapUv),b.push(S.transmissionMapUv),b.push(S.thicknessMapUv),b.push(S.combine),b.push(S.fogExp2),b.push(S.sizeAttenuation),b.push(S.morphTargetsCount),b.push(S.morphAttributeCount),b.push(S.numDirLights),b.push(S.numPointLights),b.push(S.numSpotLights),b.push(S.numSpotLightMaps),b.push(S.numHemiLights),b.push(S.numRectAreaLights),b.push(S.numDirLightShadows),b.push(S.numPointLightShadows),b.push(S.numSpotLightShadows),b.push(S.numSpotLightShadowsWithMaps),b.push(S.shadowMapType),b.push(S.toneMapping),b.push(S.numClippingPlanes),b.push(S.numClipIntersection),b.push(S.depthPacking)}function x(b,S){a.disableAll(),S.isWebGL2&&a.enable(0),S.supportsVertexTextures&&a.enable(1),S.instancing&&a.enable(2),S.instancingColor&&a.enable(3),S.matcap&&a.enable(4),S.envMap&&a.enable(5),S.normalMapObjectSpace&&a.enable(6),S.normalMapTangentSpace&&a.enable(7),S.clearcoat&&a.enable(8),S.iridescence&&a.enable(9),S.alphaTest&&a.enable(10),S.vertexColors&&a.enable(11),S.vertexAlphas&&a.enable(12),S.vertexUvs2&&a.enable(13),S.vertexTangents&&a.enable(14),b.push(a.mask),a.disableAll(),S.fog&&a.enable(0),S.useFog&&a.enable(1),S.flatShading&&a.enable(2),S.logarithmicDepthBuffer&&a.enable(3),S.skinning&&a.enable(4),S.morphTargets&&a.enable(5),S.morphNormals&&a.enable(6),S.morphColors&&a.enable(7),S.premultipliedAlpha&&a.enable(8),S.shadowMapEnabled&&a.enable(9),S.useLegacyLights&&a.enable(10),S.doubleSided&&a.enable(11),S.flipSided&&a.enable(12),S.useDepthPacking&&a.enable(13),S.dithering&&a.enable(14),S.transmission&&a.enable(15),S.sheen&&a.enable(16),S.decodeVideoTexture&&a.enable(17),S.opaque&&a.enable(18),S.pointsUvs&&a.enable(19),b.push(a.mask)}function M(b){const S=_[b.type];let F;if(S){const k=An[S];F=Ic.clone(k.uniforms)}else F=b.uniforms;return F}function y(b,S){let F;for(let k=0,L=c.length;k0?n.push(d):p.transparent===!0?i.push(d):t.push(d)}function l(f,h,p,_,v,m){const d=o(f,h,p,_,v,m);p.transmission>0?n.unshift(d):p.transparent===!0?i.unshift(d):t.unshift(d)}function c(f,h){t.length>1&&t.sort(f||tg),n.length>1&&n.sort(h||rl),i.length>1&&i.sort(h||rl)}function u(){for(let f=e,h=r.length;f=s.length?(o=new sl,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function ig(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new Je};break;case"SpotLight":t={position:new I,direction:new I,color:new Je,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new Je,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new Je,groundColor:new Je};break;case"RectAreaLight":t={color:new Je,position:new I,halfWidth:new I,halfHeight:new I};break}return r[e.id]=t,t}}}function rg(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qe};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qe};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qe,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let sg=0;function og(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function ag(r,e){const t=new ig,n=rg(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let u=0;u<9;u++)i.probe.push(new I);const s=new I,o=new vt,a=new vt;function l(u,f){let h=0,p=0,_=0;for(let F=0;F<9;F++)i.probe[F].set(0,0,0);let v=0,m=0,d=0,g=0,x=0,M=0,y=0,w=0,C=0,T=0;u.sort(og);const b=f===!0?Math.PI:1;for(let F=0,k=u.length;F0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ce.LTC_FLOAT_1,i.rectAreaLTC2=ce.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=ce.LTC_HALF_1,i.rectAreaLTC2=ce.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=h,i.ambient[1]=p,i.ambient[2]=_;const S=i.hash;(S.directionalLength!==v||S.pointLength!==m||S.spotLength!==d||S.rectAreaLength!==g||S.hemiLength!==x||S.numDirectionalShadows!==M||S.numPointShadows!==y||S.numSpotShadows!==w||S.numSpotMaps!==C)&&(i.directional.length=v,i.spot.length=d,i.rectArea.length=g,i.point.length=m,i.hemi.length=x,i.directionalShadow.length=M,i.directionalShadowMap.length=M,i.pointShadow.length=y,i.pointShadowMap.length=y,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=M,i.pointShadowMatrix.length=y,i.spotLightMatrix.length=w+C-T,i.spotLightMap.length=C,i.numSpotLightShadowsWithMaps=T,S.directionalLength=v,S.pointLength=m,S.spotLength=d,S.rectAreaLength=g,S.hemiLength=x,S.numDirectionalShadows=M,S.numPointShadows=y,S.numSpotShadows=w,S.numSpotMaps=C,i.version=sg++)}function c(u,f){let h=0,p=0,_=0,v=0,m=0;const d=f.matrixWorldInverse;for(let g=0,x=u.length;g=a.length?(l=new ol(r,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:n,dispose:i}}class cg extends cr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=of,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=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}}class ug extends cr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const fg=`void main() { +`+B)}else b!==""?console.warn("THREE.WebGLProgram: Program Info Log:",b):(S===""||F==="")&&(L=!1);L&&(this.diagnostics={runnable:k,programLog:b,vertexShader:{log:S,prefix:m},fragmentShader:{log:F,prefix:d}})}i.deleteShader(y),i.deleteShader(w);let C;this.getUniforms=function(){return C===void 0&&(C=new hs(i,v)),C};let T;return this.getAttributes=function(){return T===void 0&&(T=zm(i,v)),T},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(v),this.program=void 0},this.name=t.shaderName,this.id=Rm++,this.cacheKey=e,this.usedTimes=1,this.program=v,this.vertexShader=y,this.fragmentShader=w,this}let Zm=0;class Qm{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new Km(e),t.set(e,n)),n}}class Km{constructor(e){this.id=Zm++,this.code=e,this.usedTimes=0}}function Jm(r,e,t,n,i,s,o){const a=new Io,l=new Qm,c=[],u=i.isWebGL2,f=i.logarithmicDepthBuffer,h=i.vertexTextures;let p=i.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function v(b){return b===1?"uv2":"uv"}function m(b,S,F,k,L){const O=k.fog,B=L.geometry,J=b.isMeshStandardMaterial?k.environment:null,R=(b.isMeshStandardMaterial?t:e).get(b.envMap||J),H=!!R&&R.mapping===bs?R.image.height:null,Q=_[b.type];b.precision!==null&&(p=i.getMaxPrecision(b.precision),p!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",p,"instead."));const K=B.morphAttributes.position||B.morphAttributes.normal||B.morphAttributes.color,ve=K!==void 0?K.length:0;let se=0;B.morphAttributes.position!==void 0&&(se=1),B.morphAttributes.normal!==void 0&&(se=2),B.morphAttributes.color!==void 0&&(se=3);let j,ee,te,ue;if(Q){const he=An[Q];j=he.vertexShader,ee=he.fragmentShader}else j=b.vertexShader,ee=b.fragmentShader,l.update(b),te=l.getVertexShaderID(b),ue=l.getFragmentShaderID(b);const N=r.getRenderTarget(),Re=L.isInstancedMesh===!0,Ce=!!b.map,oe=!!b.matcap,Te=!!R,je=!!b.aoMap,ye=!!b.lightMap,Ue=!!b.bumpMap,lt=!!b.normalMap,xt=!!b.displacementMap,Mt=!!b.emissiveMap,_t=!!b.metalnessMap,Xe=!!b.roughnessMap,st=b.clearcoat>0,It=b.iridescence>0,P=b.sheen>0,E=b.transmission>0,Y=st&&!!b.clearcoatMap,ne=st&&!!b.clearcoatNormalMap,re=st&&!!b.clearcoatRoughnessMap,fe=It&&!!b.iridescenceMap,Pe=It&&!!b.iridescenceThicknessMap,de=P&&!!b.sheenColorMap,$=P&&!!b.sheenRoughnessMap,xe=!!b.specularMap,we=!!b.specularColorMap,Ae=!!b.specularIntensityMap,ge=E&&!!b.transmissionMap,Me=E&&!!b.thicknessMap,Fe=!!b.gradientMap,Ze=!!b.alphaMap,ct=b.alphaTest>0,U=!!b.extensions,W=!!B.attributes.uv2;return{isWebGL2:u,shaderID:Q,shaderName:b.type,vertexShader:j,fragmentShader:ee,defines:b.defines,customVertexShaderID:te,customFragmentShaderID:ue,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:p,instancing:Re,instancingColor:Re&&L.instanceColor!==null,supportsVertexTextures:h,outputEncoding:N===null?r.outputEncoding:N.isXRRenderTarget===!0?N.texture.encoding:ni,map:Ce,matcap:oe,envMap:Te,envMapMode:Te&&R.mapping,envMapCubeUVHeight:H,aoMap:je,lightMap:ye,bumpMap:Ue,normalMap:lt,displacementMap:h&&xt,emissiveMap:Mt,normalMapObjectSpace:lt&&b.normalMapType===af,normalMapTangentSpace:lt&&b.normalMapType===bc,decodeVideoTexture:Ce&&b.map.isVideoTexture===!0&&b.map.encoding===ot,metalnessMap:_t,roughnessMap:Xe,clearcoat:st,clearcoatMap:Y,clearcoatNormalMap:ne,clearcoatRoughnessMap:re,iridescence:It,iridescenceMap:fe,iridescenceThicknessMap:Pe,sheen:P,sheenColorMap:de,sheenRoughnessMap:$,specularMap:xe,specularColorMap:we,specularIntensityMap:Ae,transmission:E,transmissionMap:ge,thicknessMap:Me,gradientMap:Fe,opaque:b.transparent===!1&&b.blending===Qi,alphaMap:Ze,alphaTest:ct,combine:b.combine,mapUv:Ce&&v(b.map.channel),aoMapUv:je&&v(b.aoMap.channel),lightMapUv:ye&&v(b.lightMap.channel),bumpMapUv:Ue&&v(b.bumpMap.channel),normalMapUv:lt&&v(b.normalMap.channel),displacementMapUv:xt&&v(b.displacementMap.channel),emissiveMapUv:Mt&&v(b.emissiveMap.channel),metalnessMapUv:_t&&v(b.metalnessMap.channel),roughnessMapUv:Xe&&v(b.roughnessMap.channel),clearcoatMapUv:Y&&v(b.clearcoatMap.channel),clearcoatNormalMapUv:ne&&v(b.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:re&&v(b.clearcoatRoughnessMap.channel),iridescenceMapUv:fe&&v(b.iridescenceMap.channel),iridescenceThicknessMapUv:Pe&&v(b.iridescenceThicknessMap.channel),sheenColorMapUv:de&&v(b.sheenColorMap.channel),sheenRoughnessMapUv:$&&v(b.sheenRoughnessMap.channel),specularMapUv:xe&&v(b.specularMap.channel),specularColorMapUv:we&&v(b.specularColorMap.channel),specularIntensityMapUv:Ae&&v(b.specularIntensityMap.channel),transmissionMapUv:ge&&v(b.transmissionMap.channel),thicknessMapUv:Me&&v(b.thicknessMap.channel),alphaMapUv:Ze&&v(b.alphaMap.channel),vertexTangents:lt&&!!B.attributes.tangent,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!B.attributes.color&&B.attributes.color.itemSize===4,vertexUvs2:W,pointsUvs:L.isPoints===!0&&!!B.attributes.uv&&(Ce||Ze),fog:!!O,useFog:b.fog===!0,fogExp2:O&&O.isFogExp2,flatShading:b.flatShading===!0,sizeAttenuation:b.sizeAttenuation===!0,logarithmicDepthBuffer:f,skinning:L.isSkinnedMesh===!0,morphTargets:B.morphAttributes.position!==void 0,morphNormals:B.morphAttributes.normal!==void 0,morphColors:B.morphAttributes.color!==void 0,morphTargetsCount:ve,morphTextureStride:se,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:r.shadowMap.enabled&&F.length>0,shadowMapType:r.shadowMap.type,toneMapping:b.toneMapped?r.toneMapping:Rn,useLegacyLights:r.useLegacyLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===Pn,flipSided:b.side===Jt,useDepthPacking:b.depthPacking>=0,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:U&&b.extensions.derivatives===!0,extensionFragDepth:U&&b.extensions.fragDepth===!0,extensionDrawBuffers:U&&b.extensions.drawBuffers===!0,extensionShaderTextureLOD:U&&b.extensions.shaderTextureLOD===!0,rendererExtensionFragDepth:u||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||n.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function d(b){const S=[];if(b.shaderID?S.push(b.shaderID):(S.push(b.customVertexShaderID),S.push(b.customFragmentShaderID)),b.defines!==void 0)for(const F in b.defines)S.push(F),S.push(b.defines[F]);return b.isRawShaderMaterial===!1&&(g(S,b),x(S,b),S.push(r.outputEncoding)),S.push(b.customProgramCacheKey),S.join()}function g(b,S){b.push(S.precision),b.push(S.outputEncoding),b.push(S.envMapMode),b.push(S.envMapCubeUVHeight),b.push(S.mapUv),b.push(S.alphaMapUv),b.push(S.lightMapUv),b.push(S.aoMapUv),b.push(S.bumpMapUv),b.push(S.normalMapUv),b.push(S.displacementMapUv),b.push(S.emissiveMapUv),b.push(S.metalnessMapUv),b.push(S.roughnessMapUv),b.push(S.clearcoatMapUv),b.push(S.clearcoatNormalMapUv),b.push(S.clearcoatRoughnessMapUv),b.push(S.iridescenceMapUv),b.push(S.iridescenceThicknessMapUv),b.push(S.sheenColorMapUv),b.push(S.sheenRoughnessMapUv),b.push(S.specularMapUv),b.push(S.specularColorMapUv),b.push(S.specularIntensityMapUv),b.push(S.transmissionMapUv),b.push(S.thicknessMapUv),b.push(S.combine),b.push(S.fogExp2),b.push(S.sizeAttenuation),b.push(S.morphTargetsCount),b.push(S.morphAttributeCount),b.push(S.numDirLights),b.push(S.numPointLights),b.push(S.numSpotLights),b.push(S.numSpotLightMaps),b.push(S.numHemiLights),b.push(S.numRectAreaLights),b.push(S.numDirLightShadows),b.push(S.numPointLightShadows),b.push(S.numSpotLightShadows),b.push(S.numSpotLightShadowsWithMaps),b.push(S.shadowMapType),b.push(S.toneMapping),b.push(S.numClippingPlanes),b.push(S.numClipIntersection),b.push(S.depthPacking)}function x(b,S){a.disableAll(),S.isWebGL2&&a.enable(0),S.supportsVertexTextures&&a.enable(1),S.instancing&&a.enable(2),S.instancingColor&&a.enable(3),S.matcap&&a.enable(4),S.envMap&&a.enable(5),S.normalMapObjectSpace&&a.enable(6),S.normalMapTangentSpace&&a.enable(7),S.clearcoat&&a.enable(8),S.iridescence&&a.enable(9),S.alphaTest&&a.enable(10),S.vertexColors&&a.enable(11),S.vertexAlphas&&a.enable(12),S.vertexUvs2&&a.enable(13),S.vertexTangents&&a.enable(14),b.push(a.mask),a.disableAll(),S.fog&&a.enable(0),S.useFog&&a.enable(1),S.flatShading&&a.enable(2),S.logarithmicDepthBuffer&&a.enable(3),S.skinning&&a.enable(4),S.morphTargets&&a.enable(5),S.morphNormals&&a.enable(6),S.morphColors&&a.enable(7),S.premultipliedAlpha&&a.enable(8),S.shadowMapEnabled&&a.enable(9),S.useLegacyLights&&a.enable(10),S.doubleSided&&a.enable(11),S.flipSided&&a.enable(12),S.useDepthPacking&&a.enable(13),S.dithering&&a.enable(14),S.transmission&&a.enable(15),S.sheen&&a.enable(16),S.decodeVideoTexture&&a.enable(17),S.opaque&&a.enable(18),S.pointsUvs&&a.enable(19),b.push(a.mask)}function M(b){const S=_[b.type];let F;if(S){const k=An[S];F=Dc.clone(k.uniforms)}else F=b.uniforms;return F}function y(b,S){let F;for(let k=0,L=c.length;k0?n.push(d):p.transparent===!0?i.push(d):t.push(d)}function l(f,h,p,_,v,m){const d=o(f,h,p,_,v,m);p.transmission>0?n.unshift(d):p.transparent===!0?i.unshift(d):t.unshift(d)}function c(f,h){t.length>1&&t.sort(f||eg),n.length>1&&n.sort(h||rl),i.length>1&&i.sort(h||rl)}function u(){for(let f=e,h=r.length;f=s.length?(o=new sl,s.push(o)):o=s[i],o}function t(){r=new WeakMap}return{get:e,dispose:t}}function ng(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new I,color:new Je};break;case"SpotLight":t={position:new I,direction:new I,color:new Je,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new I,color:new Je,distance:0,decay:0};break;case"HemisphereLight":t={direction:new I,skyColor:new Je,groundColor:new Je};break;case"RectAreaLight":t={color:new Je,position:new I,halfWidth:new I,halfHeight:new I};break}return r[e.id]=t,t}}}function ig(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qe};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qe};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Qe,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let rg=0;function sg(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function og(r,e){const t=new ng,n=ig(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0};for(let u=0;u<9;u++)i.probe.push(new I);const s=new I,o=new vt,a=new vt;function l(u,f){let h=0,p=0,_=0;for(let F=0;F<9;F++)i.probe[F].set(0,0,0);let v=0,m=0,d=0,g=0,x=0,M=0,y=0,w=0,C=0,T=0;u.sort(sg);const b=f===!0?Math.PI:1;for(let F=0,k=u.length;F0&&(e.isWebGL2||r.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=ce.LTC_FLOAT_1,i.rectAreaLTC2=ce.LTC_FLOAT_2):r.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=ce.LTC_HALF_1,i.rectAreaLTC2=ce.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=h,i.ambient[1]=p,i.ambient[2]=_;const S=i.hash;(S.directionalLength!==v||S.pointLength!==m||S.spotLength!==d||S.rectAreaLength!==g||S.hemiLength!==x||S.numDirectionalShadows!==M||S.numPointShadows!==y||S.numSpotShadows!==w||S.numSpotMaps!==C)&&(i.directional.length=v,i.spot.length=d,i.rectArea.length=g,i.point.length=m,i.hemi.length=x,i.directionalShadow.length=M,i.directionalShadowMap.length=M,i.pointShadow.length=y,i.pointShadowMap.length=y,i.spotShadow.length=w,i.spotShadowMap.length=w,i.directionalShadowMatrix.length=M,i.pointShadowMatrix.length=y,i.spotLightMatrix.length=w+C-T,i.spotLightMap.length=C,i.numSpotLightShadowsWithMaps=T,S.directionalLength=v,S.pointLength=m,S.spotLength=d,S.rectAreaLength=g,S.hemiLength=x,S.numDirectionalShadows=M,S.numPointShadows=y,S.numSpotShadows=w,S.numSpotMaps=C,i.version=rg++)}function c(u,f){let h=0,p=0,_=0,v=0,m=0;const d=f.matrixWorldInverse;for(let g=0,x=u.length;g=a.length?(l=new ol(r,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:n,dispose:i}}class lg extends cr{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=sf,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=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}}class cg extends cr{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const ug=`void main() { gl_Position = vec4( position, 1.0 ); -}`,hg=`uniform sampler2D shadow_pass; +}`,fg=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3413,8 +3413,8 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function dg(r,e,t){let n=new Uo;const i=new Qe,s=new Qe,o=new Ut,a=new cg({depthPacking:af}),l=new ug,c={},u=t.maxTextureSize,f={[ti]:Jt,[Jt]:ti,[Pn]:Pn},h=new Xn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Qe},radius:{value:4}},vertexShader:fg,fragmentShader:hg}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const _=new Xt;_.setAttribute("position",new Dn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new pe(_,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=pc,this.render=function(M,y,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||M.length===0)return;const C=r.getRenderTarget(),T=r.getActiveCubeFace(),b=r.getActiveMipmapLevel(),S=r.state;S.setBlending(ei),S.buffers.color.setClear(1,1,1,1),S.buffers.depth.setTest(!0),S.setScissorTest(!1);for(let F=0,k=M.length;Fu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/B.x),i.x=s.x*B.x,O.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/B.y),i.y=s.y*B.y,O.mapSize.y=s.y)),O.map===null){const R=this.type!==xr?{minFilter:Vt,magFilter:Vt}:{};O.map=new ii(i.x,i.y,R),O.map.texture.name=L.name+".shadowMap",O.camera.updateProjectionMatrix()}r.setRenderTarget(O.map),r.clear();const J=O.getViewportCount();for(let R=0;R0||y.map&&y.alphaTest>0){const S=T.uuid,F=y.uuid;let k=c[S];k===void 0&&(k={},c[S]=k);let L=k[F];L===void 0&&(L=T.clone(),k[F]=L),T=L}if(T.visible=y.visible,T.wireframe=y.wireframe,C===xr?T.side=y.shadowSide!==null?y.shadowSide:y.side:T.side=y.shadowSide!==null?y.shadowSide:f[y.side],T.alphaMap=y.alphaMap,T.alphaTest=y.alphaTest,T.map=y.map,T.clipShadows=y.clipShadows,T.clippingPlanes=y.clippingPlanes,T.clipIntersection=y.clipIntersection,T.displacementMap=y.displacementMap,T.displacementScale=y.displacementScale,T.displacementBias=y.displacementBias,T.wireframeLinewidth=y.wireframeLinewidth,T.linewidth=y.linewidth,w.isPointLight===!0&&T.isMeshDistanceMaterial===!0){const S=r.properties.get(T);S.light=w}return T}function x(M,y,w,C,T){if(M.visible===!1)return;if(M.layers.test(y.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&T===xr)&&(!M.frustumCulled||n.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,M.matrixWorld);const F=e.update(M),k=M.material;if(Array.isArray(k)){const L=F.groups;for(let O=0,B=L.length;O=1):H.indexOf("OpenGL ES")!==-1&&(R=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),J=R>=2);let Q=null,K={};const ve=r.getParameter(3088),se=r.getParameter(2978),j=new Ut().fromArray(ve),ee=new Ut().fromArray(se);function te(U,W,ie){const he=new Uint8Array(4),be=r.createTexture();r.bindTexture(U,be),r.texParameteri(U,10241,9728),r.texParameteri(U,10240,9728);for(let Ke=0;Kene||P.height>ne)&&(re=ne/Math.max(P.width,P.height)),re<1||E===!0)if(typeof HTMLImageElement!="undefined"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&P instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&P instanceof ImageBitmap){const fe=E?wc:Math.floor,Pe=fe(re*P.width),de=fe(re*P.height);v===void 0&&(v=g(Pe,de));const $=Y?g(Pe,de):v;return $.width=Pe,$.height=de,$.getContext("2d").drawImage(P,0,0,Pe,de),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Pe+"x"+de+")."),$}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function M(P){return wo(P.width)&&wo(P.height)}function y(P){return a?!1:P.wrapS!==mn||P.wrapT!==mn||P.minFilter!==Vt&&P.minFilter!==ln}function w(P,E){return P.generateMipmaps&&E&&P.minFilter!==Vt&&P.minFilter!==ln}function C(P){r.generateMipmap(P)}function T(P,E,Y,ne,re=!1){if(a===!1)return E;if(P!==null){if(r[P]!==void 0)return r[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let fe=E;return E===6403&&(Y===5126&&(fe=33326),Y===5131&&(fe=33325),Y===5121&&(fe=33321)),E===33319&&(Y===5126&&(fe=33328),Y===5131&&(fe=33327),Y===5121&&(fe=33323)),E===6408&&(Y===5126&&(fe=34836),Y===5131&&(fe=34842),Y===5121&&(fe=ne===ot&&re===!1?35907:32856),Y===32819&&(fe=32854),Y===32820&&(fe=32855)),(fe===33325||fe===33326||fe===33327||fe===33328||fe===34842||fe===34836)&&e.get("EXT_color_buffer_float"),fe}function b(P,E,Y){return w(P,Y)===!0||P.isFramebufferTexture&&P.minFilter!==Vt&&P.minFilter!==ln?Math.log2(Math.max(E.width,E.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?E.mipmaps.length:1}function S(P){return P===Vt||P===Jo||P===Us?9728:9729}function F(P){const E=P.target;E.removeEventListener("dispose",F),L(E),E.isVideoTexture&&_.delete(E)}function k(P){const E=P.target;E.removeEventListener("dispose",k),B(E)}function L(P){const E=n.get(P);if(E.__webglInit===void 0)return;const Y=P.source,ne=m.get(Y);if(ne){const re=ne[E.__cacheKey];re.usedTimes--,re.usedTimes===0&&O(P),Object.keys(ne).length===0&&m.delete(Y)}n.remove(P)}function O(P){const E=n.get(P);r.deleteTexture(E.__webglTexture);const Y=P.source,ne=m.get(Y);delete ne[E.__cacheKey],o.memory.textures--}function B(P){const E=P.texture,Y=n.get(P),ne=n.get(E);if(ne.__webglTexture!==void 0&&(r.deleteTexture(ne.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let re=0;re<6;re++)r.deleteFramebuffer(Y.__webglFramebuffer[re]),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer[re]);else{if(r.deleteFramebuffer(Y.__webglFramebuffer),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer),Y.__webglMultisampledFramebuffer&&r.deleteFramebuffer(Y.__webglMultisampledFramebuffer),Y.__webglColorRenderbuffer)for(let re=0;re=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),J+=1,P}function Q(P){const E=[];return E.push(P.wrapS),E.push(P.wrapT),E.push(P.wrapR||0),E.push(P.magFilter),E.push(P.minFilter),E.push(P.anisotropy),E.push(P.internalFormat),E.push(P.format),E.push(P.type),E.push(P.generateMipmaps),E.push(P.premultiplyAlpha),E.push(P.flipY),E.push(P.unpackAlignment),E.push(P.encoding),E.join()}function K(P,E){const Y=n.get(P);if(P.isVideoTexture&&st(P),P.isRenderTargetTexture===!1&&P.version>0&&Y.__version!==P.version){const ne=P.image;if(ne===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ne.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Re(Y,P,E);return}}t.bindTexture(3553,Y.__webglTexture,33984+E)}function ve(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Re(Y,P,E);return}t.bindTexture(35866,Y.__webglTexture,33984+E)}function se(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Re(Y,P,E);return}t.bindTexture(32879,Y.__webglTexture,33984+E)}function j(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Ce(Y,P,E);return}t.bindTexture(34067,Y.__webglTexture,33984+E)}const ee={[bo]:10497,[mn]:33071,[So]:33648},te={[Vt]:9728,[Jo]:9984,[Us]:9986,[ln]:9729,[Vu]:9985,[Rr]:9987};function ue(P,E,Y){if(Y?(r.texParameteri(P,10242,ee[E.wrapS]),r.texParameteri(P,10243,ee[E.wrapT]),(P===32879||P===35866)&&r.texParameteri(P,32882,ee[E.wrapR]),r.texParameteri(P,10240,te[E.magFilter]),r.texParameteri(P,10241,te[E.minFilter])):(r.texParameteri(P,10242,33071),r.texParameteri(P,10243,33071),(P===32879||P===35866)&&r.texParameteri(P,32882,33071),(E.wrapS!==mn||E.wrapT!==mn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(P,10240,S(E.magFilter)),r.texParameteri(P,10241,S(E.minFilter)),E.minFilter!==Vt&&E.minFilter!==ln&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const ne=e.get("EXT_texture_filter_anisotropic");if(E.magFilter===Vt||E.minFilter!==Us&&E.minFilter!==Rr||E.type===Mi&&e.has("OES_texture_float_linear")===!1||a===!1&&E.type===Dr&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||n.get(E).__currentAnisotropy)&&(r.texParameterf(P,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,i.getMaxAnisotropy())),n.get(E).__currentAnisotropy=E.anisotropy)}}function N(P,E){let Y=!1;P.__webglInit===void 0&&(P.__webglInit=!0,E.addEventListener("dispose",F));const ne=E.source;let re=m.get(ne);re===void 0&&(re={},m.set(ne,re));const fe=Q(E);if(fe!==P.__cacheKey){re[fe]===void 0&&(re[fe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,Y=!0),re[fe].usedTimes++;const Pe=re[P.__cacheKey];Pe!==void 0&&(re[P.__cacheKey].usedTimes--,Pe.usedTimes===0&&O(E)),P.__cacheKey=fe,P.__webglTexture=re[fe].texture}return Y}function Re(P,E,Y){let ne=3553;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(ne=35866),E.isData3DTexture&&(ne=32879);const re=N(P,E),fe=E.source;t.bindTexture(ne,P.__webglTexture,33984+Y);const Pe=n.get(fe);if(fe.version!==Pe.__version||re===!0){t.activeTexture(33984+Y),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);const de=y(E)&&M(E.image)===!1;let $=x(E.image,de,!1,u);$=It(E,$);const xe=M($)||a,we=s.convert(E.format,E.encoding);let Ae=s.convert(E.type),ge=T(E.internalFormat,we,Ae,E.encoding,E.isVideoTexture);ue(ne,E,xe);let Me;const Fe=E.mipmaps,Ze=a&&E.isVideoTexture!==!0,ct=Pe.__version===void 0||re===!0,U=b(E,$,xe);if(E.isDepthTexture)ge=6402,a?E.type===Mi?ge=36012:E.type===xi?ge=33190:E.type===Ki?ge=35056:ge=33189:E.type===Mi&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===bi&&ge===6402&&E.type!==bc&&E.type!==xi&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=xi,Ae=s.convert(E.type)),E.format===nr&&ge===6402&&(ge=34041,E.type!==Ki&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=Ki,Ae=s.convert(E.type))),ct&&(Ze?t.texStorage2D(3553,1,ge,$.width,$.height):t.texImage2D(3553,0,ge,$.width,$.height,0,we,Ae,null));else if(E.isDataTexture)if(Fe.length>0&&xe){Ze&&ct&&t.texStorage2D(3553,U,ge,Fe[0].width,Fe[0].height);for(let W=0,ie=Fe.length;W>=1,ie>>=1}}else if(Fe.length>0&&xe){Ze&&ct&&t.texStorage2D(3553,U,ge,Fe[0].width,Fe[0].height);for(let W=0,ie=Fe.length;W0&&ct++,t.texStorage2D(34067,ct,Me,$[0].width,$[0].height));for(let W=0;W<6;W++)if(de){Fe?t.texSubImage2D(34069+W,0,0,0,$[W].width,$[W].height,Ae,ge,$[W].data):t.texImage2D(34069+W,0,Me,$[W].width,$[W].height,0,Ae,ge,$[W].data);for(let ie=0;ie=34069&&re<=34074)&&r.framebufferTexture2D(36160,ne,re,n.get(Y).__webglTexture,0),t.bindFramebuffer(36160,null)}function Te(P,E,Y){if(r.bindRenderbuffer(36161,P),E.depthBuffer&&!E.stencilBuffer){let ne=33189;if(Y||Xe(E)){const re=E.depthTexture;re&&re.isDepthTexture&&(re.type===Mi?ne=36012:re.type===xi&&(ne=33190));const fe=_t(E);Xe(E)?h.renderbufferStorageMultisampleEXT(36161,fe,ne,E.width,E.height):r.renderbufferStorageMultisample(36161,fe,ne,E.width,E.height)}else r.renderbufferStorage(36161,ne,E.width,E.height);r.framebufferRenderbuffer(36160,36096,36161,P)}else if(E.depthBuffer&&E.stencilBuffer){const ne=_t(E);Y&&Xe(E)===!1?r.renderbufferStorageMultisample(36161,ne,35056,E.width,E.height):Xe(E)?h.renderbufferStorageMultisampleEXT(36161,ne,35056,E.width,E.height):r.renderbufferStorage(36161,34041,E.width,E.height),r.framebufferRenderbuffer(36160,33306,36161,P)}else{const ne=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let re=0;re0&&Xe(P)===!1){const de=fe?E:[E];Y.__webglMultisampledFramebuffer=r.createFramebuffer(),Y.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,Y.__webglMultisampledFramebuffer);for(let $=0;$0&&Xe(P)===!1){const E=P.isWebGLMultipleRenderTargets?P.texture:[P.texture],Y=P.width,ne=P.height;let re=16384;const fe=[],Pe=P.stencilBuffer?33306:36096,de=n.get(P),$=P.isWebGLMultipleRenderTargets===!0;if($)for(let xe=0;xe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function st(P){const E=o.render.frame;_.get(P)!==E&&(_.set(P,E),P.update())}function It(P,E){const Y=P.encoding,ne=P.format,re=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||P.format===yo||Y!==ni&&(Y===ot?a===!1?e.has("EXT_sRGB")===!0&&ne===gn?(P.format=yo,P.minFilter=ln,P.generateMipmaps=!1):E=Tc.sRGBToLinear(E):(ne!==gn||re!==Si)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",Y)),E}this.allocateTextureUnit=H,this.resetTextureUnits=R,this.setTexture2D=K,this.setTexture2DArray=ve,this.setTexture3D=se,this.setTextureCube=j,this.rebindTextures=Ue,this.setupRenderTarget=lt,this.updateRenderTargetMipmap=xt,this.updateMultisampleRenderTarget=Mt,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Xe}function gg(r,e,t){const n=t.isWebGL2;function i(s,o=null){let a;if(s===Si)return 5121;if(s===qu)return 32819;if(s===Yu)return 32820;if(s===Wu)return 5120;if(s===ju)return 5122;if(s===bc)return 5123;if(s===Xu)return 5124;if(s===xi)return 5125;if(s===Mi)return 5126;if(s===Dr)return n?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Zu)return 6406;if(s===gn)return 6408;if(s===Qu)return 6409;if(s===Ku)return 6410;if(s===bi)return 6402;if(s===nr)return 34041;if(s===yo)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Ju)return 6403;if(s===$u)return 36244;if(s===ef)return 33319;if(s===tf)return 33320;if(s===nf)return 36249;if(s===Ns||s===Os||s===Fs||s===zs)if(o===ot)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===Ns)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Os)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Fs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===zs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Ns)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Os)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Fs)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===zs)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===$o||s===ea||s===ta||s===na)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===$o)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ea)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===ta)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===na)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===rf)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===ia||s===ra)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===ia)return o===ot?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===ra)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===sa||s===oa||s===aa||s===la||s===ca||s===ua||s===fa||s===ha||s===da||s===pa||s===ma||s===ga||s===_a||s===va)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===sa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===oa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===aa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===la)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===ca)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===ua)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===fa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===ha)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===da)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===pa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===ma)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===ga)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===_a)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===va)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===ks)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===ks)return o===ot?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===sf||s===xa||s===Ma||s===ba)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===ks)return a.COMPRESSED_RED_RGTC1_EXT;if(s===xa)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Ma)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===ba)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ki?n?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class _g extends sn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class rs extends Et{constructor(){super(),this.isGroup=!0,this.type="Group"}}const vg={type:"move"};class ao{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new rs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new rs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new rs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,n),d=this._getHandJoint(c,v);m!==null&&(d.matrix.fromArray(m.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.jointRadius=m.radius),d.visible=m!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),p=.02,_=.005;c.inputState.pinching&&h>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(vg)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new rs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class xg extends $t{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:bi,u!==bi&&u!==nr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===bi&&(n=xi),n===void 0&&u===nr&&(n=Ki),super(null,i,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Vt,this.minFilter=l!==void 0?l:Vt,this.flipY=!1,this.generateMipmaps=!1}}class Mg extends ar{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,h=null,p=null,_=null;const v=t.getContextAttributes();let m=null,d=null;const g=[],x=[],M=new Set,y=new Map,w=new sn;w.layers.enable(1),w.viewport=new Ut;const C=new sn;C.layers.enable(2),C.viewport=new Ut;const T=[w,C],b=new _g;b.layers.enable(1),b.layers.enable(2);let S=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getGripSpace()},this.getHand=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getHandSpace()};function k(j){const ee=x.indexOf(j.inputSource);if(ee===-1)return;const te=g[ee];te!==void 0&&te.dispatchEvent({type:j.type,data:j.inputSource})}function L(){i.removeEventListener("select",k),i.removeEventListener("selectstart",k),i.removeEventListener("selectend",k),i.removeEventListener("squeeze",k),i.removeEventListener("squeezestart",k),i.removeEventListener("squeezeend",k),i.removeEventListener("end",L),i.removeEventListener("inputsourceschange",O);for(let j=0;j=0&&(x[ue]=null,g[ue].disconnect(te))}for(let ee=0;ee=x.length){x.push(te),ue=Re;break}else if(x[Re]===null){x[Re]=te,ue=Re;break}if(ue===-1)break}const N=g[ue];N&&N.connect(te)}}const B=new I,J=new I;function R(j,ee,te){B.setFromMatrixPosition(ee.matrixWorld),J.setFromMatrixPosition(te.matrixWorld);const ue=B.distanceTo(J),N=ee.projectionMatrix.elements,Re=te.projectionMatrix.elements,Ce=N[14]/(N[10]-1),oe=N[14]/(N[10]+1),Te=(N[9]+1)/N[5],je=(N[9]-1)/N[5],ye=(N[8]-1)/N[0],Ue=(Re[8]+1)/Re[0],lt=Ce*ye,xt=Ce*Ue,Mt=ue/(-ye+Ue),_t=Mt*-ye;ee.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(_t),j.translateZ(Mt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert();const Xe=Ce+Mt,st=oe+Mt,It=lt-_t,P=xt+(ue-_t),E=Te*oe/st*Xe,Y=je*oe/st*Xe;j.projectionMatrix.makePerspective(It,P,E,Y,Xe,st),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}function H(j,ee){ee===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ee.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(i===null)return;b.near=C.near=w.near=j.near,b.far=C.far=w.far=j.far,(S!==b.near||F!==b.far)&&(i.updateRenderState({depthNear:b.near,depthFar:b.far}),S=b.near,F=b.far);const ee=j.parent,te=b.cameras;H(b,ee);for(let ue=0;ueN&&(y.set(ue,ue.lastChangedTime),n.dispatchEvent({type:"planechanged",data:ue}))}}_=null}const se=new Oc;se.setAnimationLoop(ve),this.setAnimationLoop=function(j){K=j},this.dispose=function(){}}}function bg(r,e){function t(m,d){m.matrixAutoUpdate===!0&&m.updateMatrix(),d.value.copy(m.matrix)}function n(m,d){d.color.getRGB(m.fogColor.value,Dc(r)),d.isFog?(m.fogNear.value=d.near,m.fogFar.value=d.far):d.isFogExp2&&(m.fogDensity.value=d.density)}function i(m,d,g,x,M){d.isMeshBasicMaterial||d.isMeshLambertMaterial?s(m,d):d.isMeshToonMaterial?(s(m,d),f(m,d)):d.isMeshPhongMaterial?(s(m,d),u(m,d)):d.isMeshStandardMaterial?(s(m,d),h(m,d),d.isMeshPhysicalMaterial&&p(m,d,M)):d.isMeshMatcapMaterial?(s(m,d),_(m,d)):d.isMeshDepthMaterial?s(m,d):d.isMeshDistanceMaterial?(s(m,d),v(m,d)):d.isMeshNormalMaterial?s(m,d):d.isLineBasicMaterial?(o(m,d),d.isLineDashedMaterial&&a(m,d)):d.isPointsMaterial?l(m,d,g,x):d.isSpriteMaterial?c(m,d):d.isShadowMaterial?(m.color.value.copy(d.color),m.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function s(m,d){m.opacity.value=d.opacity,d.color&&m.diffuse.value.copy(d.color),d.emissive&&m.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.bumpMap&&(m.bumpMap.value=d.bumpMap,t(d.bumpMap,m.bumpMapTransform),m.bumpScale.value=d.bumpScale,d.side===Jt&&(m.bumpScale.value*=-1)),d.normalMap&&(m.normalMap.value=d.normalMap,t(d.normalMap,m.normalMapTransform),m.normalScale.value.copy(d.normalScale),d.side===Jt&&m.normalScale.value.negate()),d.displacementMap&&(m.displacementMap.value=d.displacementMap,t(d.displacementMap,m.displacementMapTransform),m.displacementScale.value=d.displacementScale,m.displacementBias.value=d.displacementBias),d.emissiveMap&&(m.emissiveMap.value=d.emissiveMap,t(d.emissiveMap,m.emissiveMapTransform)),d.specularMap&&(m.specularMap.value=d.specularMap,t(d.specularMap,m.specularMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);const g=e.get(d).envMap;if(g&&(m.envMap.value=g,m.flipEnvMap.value=g.isCubeTexture&&g.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap){m.lightMap.value=d.lightMap;const x=r.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=d.lightMapIntensity*x,t(d.lightMap,m.lightMapTransform)}d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,m.aoMapTransform))}function o(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform))}function a(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,g,x){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*g,m.scale.value=x*.5,d.map&&(m.map.value=d.map,t(d.map,m.uvTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function c(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function u(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function f(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function h(m,d){m.metalness.value=d.metalness,d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,m.metalnessMapTransform)),m.roughness.value=d.roughness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,m.roughnessMapTransform)),e.get(d).envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function p(m,d,g){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,m.sheenColorMapTransform)),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,m.sheenRoughnessMapTransform))),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,m.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(m.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===Jt&&m.clearcoatNormalScale.value.negate())),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,m.iridescenceMapTransform)),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=g.texture,m.transmissionSamplerSize.value.set(g.width,g.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,m.transmissionMapTransform)),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,m.specularColorMapTransform)),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,d){d.matcap&&(m.matcap.value=d.matcap)}function v(m,d){const g=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(g.matrixWorld),m.nearDistance.value=g.shadow.camera.near,m.farDistance.value=g.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Sg(r,e,t,n){let i={},s={},o=[];const a=t.isWebGL2?r.getParameter(35375):0;function l(g,x){const M=x.program;n.uniformBlockBinding(g,M)}function c(g,x){let M=i[g.id];M===void 0&&(_(g),M=u(g),i[g.id]=M,g.addEventListener("dispose",m));const y=x.program;n.updateUBOMapping(g,y);const w=e.render.frame;s[g.id]!==w&&(h(g),s[g.id]=w)}function u(g){const x=f();g.__bindingPointIndex=x;const M=r.createBuffer(),y=g.__size,w=g.usage;return r.bindBuffer(35345,M),r.bufferData(35345,y,w),r.bindBuffer(35345,null),r.bindBufferBase(35345,x,M),M}function f(){for(let g=0;g0){w=M%y;const k=y-w;w!==0&&k-S.boundary<0&&(M+=y-w,b.__offset=M)}M+=S.storage}return w=M%y,w>0&&(M+=y-w),g.__size=M,g.__cache={},this}function v(g){const x={boundary:0,storage:0};return typeof g=="number"?(x.boundary=4,x.storage=4):g.isVector2?(x.boundary=8,x.storage=8):g.isVector3||g.isColor?(x.boundary=16,x.storage=12):g.isVector4?(x.boundary=16,x.storage=16):g.isMatrix3?(x.boundary=48,x.storage=48):g.isMatrix4?(x.boundary=64,x.storage=64):g.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",g),x}function m(g){const x=g.target;x.removeEventListener("dispose",m);const M=o.indexOf(x.__bindingPointIndex);o.splice(M,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function d(){for(const g in i)r.deleteBuffer(i[g]);o=[],i={},s={}}return{bind:l,update:c,dispose:d}}function yg(){const r=Nr("canvas");return r.style.display="block",r}class Hc{constructor(e={}){const{canvas:t=yg(),context:n=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;n!==null?h=n.getContextAttributes().alpha:h=o;let p=null,_=null;const v=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ni,this.useLegacyLights=!0,this.toneMapping=Rn,this.toneMappingExposure=1;const d=this;let g=!1,x=0,M=0,y=null,w=-1,C=null;const T=new Ut,b=new Ut;let S=null,F=t.width,k=t.height,L=1,O=null,B=null;const J=new Ut(0,0,F,k),R=new Ut(0,0,F,k);let H=!1;const Q=new Uo;let K=!1,ve=!1,se=null;const j=new vt,ee=new I,te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ue(){return y===null?L:1}let N=n;function Re(A,z){for(let Z=0;Z0?_=m[m.length-1]:_=null,v.pop(),v.length>0?p=v[v.length-1]:p=null};function Tt(A,z,Z,G){if(A.visible===!1)return;if(A.layers.test(z.layers)){if(A.isGroup)Z=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(z);else if(A.isLight)_.pushLight(A),A.castShadow&&_.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||Q.intersectsSprite(A)){G&&ee.setFromMatrixPosition(A.matrixWorld).applyMatrix4(j);const me=Xe.update(A),De=A.material;De.visible&&p.push(A,me,De,Z,ee.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(A.isSkinnedMesh&&A.skeleton.frame!==je.render.frame&&(A.skeleton.update(),A.skeleton.frame=je.render.frame),!A.frustumCulled||Q.intersectsObject(A))){G&&ee.setFromMatrixPosition(A.matrixWorld).applyMatrix4(j);const me=Xe.update(A),De=A.material;if(Array.isArray(De)){const ze=me.groups;for(let Be=0,Ge=ze.length;Be0&&ht(X,ae,z,Z),G&&Te.viewport(T.copy(G)),X.length>0&&Lt(X,z,Z),ae.length>0&&Lt(ae,z,Z),me.length>0&&Lt(me,z,Z),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function ht(A,z,Z,G){if(se===null){const De=oe.isWebGL2;se=new ii(1024,1024,{generateMipmaps:!0,type:Ce.has("EXT_color_buffer_half_float")?Dr:Si,minFilter:Rr,samples:De&&a===!0?4:0})}const X=d.getRenderTarget();d.setRenderTarget(se),d.clear();const ae=d.toneMapping;d.toneMapping=Rn,Lt(A,Z,G),Ue.updateMultisampleRenderTarget(se),Ue.updateRenderTargetMipmap(se);let me=!1;for(let De=0,ze=z.length;De0&&Ue.useMultisampledRTT(A)===!1?X=ye.get(A).__webglMultisampledFramebuffer:X=Ge,T.copy(A.viewport),b.copy(A.scissor),S=A.scissorTest}else T.copy(J).multiplyScalar(L).floor(),b.copy(R).multiplyScalar(L).floor(),S=H;if(Te.bindFramebuffer(36160,X)&&oe.drawBuffers&&G&&Te.drawBuffers(A,X),Te.viewport(T),Te.scissor(b),Te.setScissorTest(S),ae){const ze=ye.get(A.texture);N.framebufferTexture2D(36160,36064,34069+z,ze.__webglTexture,Z)}else if(me){const ze=ye.get(A.texture),Be=z||0;N.framebufferTextureLayer(36160,36064,ze.__webglTexture,Z||0,Be)}w=-1},this.readRenderTargetPixels=function(A,z,Z,G,X,ae,me){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let De=ye.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&me!==void 0&&(De=De[me]),De){Te.bindFramebuffer(36160,De);try{const ze=A.texture,Be=ze.format,Ge=ze.type;if(Be!==gn&&$.convert(Be)!==N.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ve=Ge===Dr&&(Ce.has("EXT_color_buffer_half_float")||oe.isWebGL2&&Ce.has("EXT_color_buffer_float"));if(Ge!==Si&&$.convert(Ge)!==N.getParameter(35738)&&!(Ge===Mi&&(oe.isWebGL2||Ce.has("OES_texture_float")||Ce.has("WEBGL_color_buffer_float")))&&!Ve){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}z>=0&&z<=A.width-G&&Z>=0&&Z<=A.height-X&&N.readPixels(z,Z,G,X,$.convert(Be),$.convert(Ge),ae)}finally{const ze=y!==null?ye.get(y).__webglFramebuffer:null;Te.bindFramebuffer(36160,ze)}}},this.copyFramebufferToTexture=function(A,z,Z=0){const G=Math.pow(2,-Z),X=Math.floor(z.image.width*G),ae=Math.floor(z.image.height*G);Ue.setTexture2D(z,0),N.copyTexSubImage2D(3553,Z,0,0,A.x,A.y,X,ae),Te.unbindTexture()},this.copyTextureToTexture=function(A,z,Z,G=0){const X=z.image.width,ae=z.image.height,me=$.convert(Z.format),De=$.convert(Z.type);Ue.setTexture2D(Z,0),N.pixelStorei(37440,Z.flipY),N.pixelStorei(37441,Z.premultiplyAlpha),N.pixelStorei(3317,Z.unpackAlignment),z.isDataTexture?N.texSubImage2D(3553,G,A.x,A.y,X,ae,me,De,z.image.data):z.isCompressedTexture?N.compressedTexSubImage2D(3553,G,A.x,A.y,z.mipmaps[0].width,z.mipmaps[0].height,me,z.mipmaps[0].data):N.texSubImage2D(3553,G,A.x,A.y,me,De,z.image),G===0&&Z.generateMipmaps&&N.generateMipmap(3553),Te.unbindTexture()},this.copyTextureToTexture3D=function(A,z,Z,G,X=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ae=A.max.x-A.min.x+1,me=A.max.y-A.min.y+1,De=A.max.z-A.min.z+1,ze=$.convert(G.format),Be=$.convert(G.type);let Ge;if(G.isData3DTexture)Ue.setTexture3D(G,0),Ge=32879;else if(G.isDataArrayTexture)Ue.setTexture2DArray(G,0),Ge=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}N.pixelStorei(37440,G.flipY),N.pixelStorei(37441,G.premultiplyAlpha),N.pixelStorei(3317,G.unpackAlignment);const Ve=N.getParameter(3314),tt=N.getParameter(32878),Bt=N.getParameter(3316),cn=N.getParameter(3315),oi=N.getParameter(32877),yt=Z.isCompressedTexture?Z.mipmaps[0]:Z.image;N.pixelStorei(3314,yt.width),N.pixelStorei(32878,yt.height),N.pixelStorei(3316,A.min.x),N.pixelStorei(3315,A.min.y),N.pixelStorei(32877,A.min.z),Z.isDataTexture||Z.isData3DTexture?N.texSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,Be,yt.data):Z.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),N.compressedTexSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,yt.data)):N.texSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,Be,yt),N.pixelStorei(3314,Ve),N.pixelStorei(32878,tt),N.pixelStorei(3316,Bt),N.pixelStorei(3315,cn),N.pixelStorei(32877,oi),X===0&&G.generateMipmaps&&N.generateMipmap(Ge),Te.unbindTexture()},this.initTexture=function(A){A.isCubeTexture?Ue.setTextureCube(A,0):A.isData3DTexture?Ue.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?Ue.setTexture2DArray(A,0):Ue.setTexture2D(A,0),Te.unbindTexture()},this.resetState=function(){x=0,M=0,y=null,Te.reset(),xe.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}}class wg extends Hc{}wg.prototype.isWebGL1Renderer=!0;class Eg extends Et{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Vc extends cr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Je(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const al=new I,ll=new I,cl=new vt,lo=new Do,ss=new Ss;class Kn extends Et{constructor(e=new Xt,t=new Vc){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;il)continue;h.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(h);Te.far||t.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const d=Math.max(0,o.start),g=Math.min(m.count,o.start+o.count);for(let x=d,M=g-1;xl)continue;h.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(h);we.far||t.push({distance:w,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new pt(f,3)),this.setAttribute("normal",new pt(h,3)),this.setAttribute("uv",new pt(p,2));function g(){const M=new I,y=new I;let w=0;const C=(t-e)/n;for(let T=0;T<=s;T++){const b=[],S=T/s,F=S*(t-e)+e;for(let k=0;k<=i;k++){const L=k/i,O=L*l+a,B=Math.sin(O),J=Math.cos(O);y.x=F*B,y.y=-S*n+m,y.z=F*J,f.push(y.x,y.y,y.z),M.set(B,C,J).normalize(),h.push(M.x,M.y,M.z),p.push(L,1-S),b.push(_++)}v.push(b)}for(let T=0;T.9&&C<.1&&(x<.2&&(o[g+0]+=1),M<.2&&(o[g+2]+=1),y<.2&&(o[g+4]+=1))}}function h(g){s.push(g.x,g.y,g.z)}function p(g,x){const M=g*3;x.x=e[M+0],x.y=e[M+1],x.z=e[M+2]}function _(){const g=new I,x=new I,M=new I,y=new I,w=new Qe,C=new Qe,T=new Qe;for(let b=0,S=0;b0)&&p.push(x,M,w),(d!==n-1||l{const r={show:Ye(!1),cameraPosition:Ye({x:0,y:0,z:1}),cameraLookAt:Ye({x:0,y:0,z:10}),objectPosition:Ye({x:0,y:0,z:10}),objectEuler:Ye(new yi(0,0,0,"ZXY")),entity:Ye(0)};return{...r,...{setupModel(t){r.cameraPosition.set(Vi(t.cameraPosition)),r.cameraLookAt.set(Vi(t.cameraLookAt)),r.objectPosition.set(Vi(t.objectPosition)),r.objectEuler.set(new yi(Kt.degToRad(t.objectRotation.x),Kt.degToRad(t.objectRotation.z),Kt.degToRad(t.objectRotation.y),"YZX")),r.show.set(!0),r.entity.set(t.entity)},updateCamera(t){r.cameraPosition.set(Vi(t.cameraPosition)),r.cameraLookAt.set(Vi(t.cameraLookAt))},updateCameraPosition(t){r.cameraPosition.set(t.cameraPosition)},updateCameraLookAt(t){r.cameraLookAt.set(t.cameraLookAt)},sendMovementUpdate(t){at("moveObject",t)},sendRotationUpdate(t){const n=fs(t);at("rotateObject",{x:Kt.radToDeg(n.x).toFixed(2),y:Kt.radToDeg(n.y).toFixed(2),z:Kt.radToDeg(n.z).toFixed(2)})}}}};var _n=Pg();function Lg(r){let e,t,n,i;const s=r[1].default,o=xn(s,r,r[0],null);return{c(){e=q("div"),o&&o.c(),V(e,"class","absolute")},m(a,l){Oe(a,e,l),o&&o.m(e,null),t=!0,n||(i=ac(Rg.call(null,e,{to:"body"})),n=!0)},p(a,[l]){o&&o.p&&(!t||l&1)&&bn(o,s,a,a[0],t?Mn(s,a[0],l,null):Sn(a[0]),null)},i(a){t||(_e(o,a),t=!0)},o(a){Se(o,a),t=!1},d(a){a&&Ne(e),o&&o.d(a),n=!1,i()}}}function Rg(r,{to:e}){const t=document.querySelector(e);return t&&t.appendChild(r),{}}function Dg(r,e,t){let{$$slots:n={},$$scope:i}=e;return r.$$set=s=>{"$$scope"in s&&t(0,i=s.$$scope)},[i,n]}class Yc extends gt{constructor(e){super(),mt(this,e,Dg,Lg,ft,{})}}function pl(r){let e,t;const n=r[2].default,i=xn(n,r,r[5],null);return{c(){e=q("main"),i&&i.c(),V(e,"class","svelte-1fnr7mh")},m(s,o){Oe(s,e,o),i&&i.m(e,null),t=!0},p(s,o){i&&i.p&&(!t||o&32)&&bn(i,n,s,s[5],t?Mn(n,s[5],o,null):Sn(s[5]),null)},i(s){t||(_e(i,s),t=!0)},o(s){Se(i,s),t=!1},d(s){s&&Ne(e),i&&i.d(s)}}}function ml(r){let e,t;return e=new Yc({props:{$$slots:{default:[Ig]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&34&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function Ig(r){let e,t,n,i,s,o,a,l,c,u;return{c(){e=q("div"),t=q("div"),n=q("p"),n.textContent="Are you sure you want to exit? You have items in your cart.",i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[3]),Le(l,"click",r[4])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,qt(u)}}}function Ug(r){let e,t,n,i=r[0]&&pl(r),s=r[1]&&r[0]&&ml(r);return{c(){i&&i.c(),e=le(),s&&s.c(),t=ri()},m(o,a){i&&i.m(o,a),Oe(o,e,a),s&&s.m(o,a),Oe(o,t,a),n=!0},p(o,[a]){o[0]?i?(i.p(o,a),a&1&&_e(i,1)):(i=pl(o),i.c(),_e(i,1),i.m(e.parentNode,e)):i&&(Wn(),Se(i,1,1,()=>{i=null}),jn()),o[1]&&o[0]?s?(s.p(o,a),a&3&&_e(s,1)):(s=ml(o),s.c(),_e(s,1),s.m(t.parentNode,t)):s&&(Wn(),Se(s,1,1,()=>{s=null}),jn())},i(o){n||(_e(i),_e(s),n=!0)},o(o){Se(i),Se(s),n=!1},d(o){i&&i.d(o),o&&Ne(e),s&&s.d(o),o&&Ne(t)}}}function Ng(r,e,t){let n,i;Ee(r,Cn,f=>t(6,n=f)),Ee(r,zt,f=>t(7,i=f));let{$$slots:s={},$$scope:o}=e,a;ji.subscribe(f=>{t(0,a=f)}),an("setVisible",f=>{ji.set(f),f&&Ie(zt,i=!1,i)});let l=!1;or(()=>{const f=h=>{a&&["Escape"].includes(h.code)&&(n.length>0?t(1,l=!0):(at("hoverOut"),at("hideUI"),t(1,l=!1),ji.set(!1),_n.show.set(!1),vn.set(null)))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)});const c=()=>{t(1,l=!1)},u=()=>{at("hideUI"),t(1,l=!1),ji.set(!1),_n.show.set(!1)};return r.$$set=f=>{"$$scope"in f&&t(5,o=f.$$scope)},[a,l,s,c,u,o]}class Og extends gt{constructor(e){super(),mt(this,e,Ng,Ug,ft,{})}}const Fg=()=>!window.invokeNative,Ao=(r,e=0)=>{if(Fg())for(const t of r)setTimeout(()=>{window.dispatchEvent(new MessageEvent("message",{data:{action:t.action,data:t.data}}))},e)};function gl(r,e,t){const n=r.slice();return n[6]=e[t],n}function _l(r,e,t){const n=r.slice();return n[9]=e[t],n}function vl(r){let e,t=r[1],n=[];for(let i=0;i{t(0,n=!n)},c=>{if(c.custom==!0){c.customFunction();return}Ao([{action:c.action,data:c.data}])}]}class Bg extends gt{constructor(e){super(),mt(this,e,kg,zg,ft,{})}}function bl(r,e,t){const n=r.slice();return n[15]=e[t],n[17]=t,n}function Sl(r){let e,t,n,i=r[15].label+"",s,o,a,l,c,u,f,h=r[15].price+"",p,_,v,m,d,g;function x(){return r[8](r[15])}function M(){return r[10](r[15])}return{c(){e=q("button"),t=q("div"),n=q("p"),s=rt(i),o=le(),a=q("div"),l=q("p"),l.textContent="Price:",c=le(),u=q("p"),f=rt("$"),p=rt(h),_=le(),v=q("div"),v.innerHTML='',m=le(),V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(l,"class","text-[color:var(--color-text)] text-[1.2rem]"),V(u,"class","text-[color:var(--color-accent)] ml-2 font-bold text-[1.2rem]"),V(a,"class","flex"),V(t,"class","w-full h-full flex flex-col justify-center items-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] aspect-square h-full grid place-items-center justify-center items-center"),V(e,"class","h-full w-[30rem] bg-[color:var(--color-secondary)] flex flex-row items-center hover:cursor-pointer")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"mouseenter",x),Le(v,"mouseleave",r[9]),Le(e,"click",M),Le(e,"mouseleave",r[11])],d=!0)},p(y,w){r=y,w&8&&i!==(i=r[15].label+"")&&At(s,i),w&8&&h!==(h=r[15].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,qt(g)}}}function yl(r){let e,t;return e=new Yc({props:{$$slots:{default:[Gg]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&262246&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function Gg(r){let e,t,n,i,s,o,a,l,c,u;return{c(){e=q("div"),t=q("div"),n=q("p"),n.textContent=`Are you sure you want to stop placing this current\r - furniture?`,i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[13]),Le(l,"click",r[14])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,qt(u)}}}function Hg(r){let e,t,n,i,s,o,a,l=r[3].items,c=[];for(let f=0;f{u=null}),jn())},i(f){s||(_e(u),s=!0)},o(f){Se(u),s=!1},d(f){f&&Ne(e),rr(c,f),r[12](null),f&&Ne(n),u&&u.d(f),f&&Ne(i),o=!1,a()}}}function Vg(r,e,t){let n,i,s,o;Ee(r,$n,g=>t(3,n=g)),Ee(r,Zi,g=>t(4,i=g)),Ee(r,vn,g=>t(5,s=g)),Ee(r,zt,g=>t(6,o=g));let a;function l(g){g=window.event||g;var x=Math.max(-1,Math.min(1,g.wheelDelta||-g.detail));t(0,a.scrollLeft-=x*50,a),g.preventDefault()}let c=!1,u=null;const f=g=>{at("hoverIn",g)},h=()=>{at("hoverOut")},p=g=>{if(at("hoverOut"),g.type){const x=i.filter(y=>y.type===g.type);let M=g.max||1;if(x.length>=M){at("showNotification",{type:"error",message:`You can only have ${M} of this item!`});return}}s!=null?(t(1,c=!0),t(2,u=g)):(at("previewFurniture",g),Ie(vn,s=g,s),Ie(zt,o=!0,o))},_=()=>{at("hoverOut")};function v(g){Vn[g?"unshift":"push"](()=>{a=g,t(0,a)})}return[a,c,u,n,i,s,o,l,f,h,p,_,v,()=>{t(1,c=!1),t(2,u=null)},()=>{at("previewFurniture",u),Ie(vn,s=u,s),Ie(zt,o=!0,o),t(1,c=!1),t(2,u=null)}]}class Wg extends gt{constructor(e){super(),mt(this,e,Vg,Hg,ft,{})}}function jg(r,e,t){let n,i,s,o,a,l;Ee(r,Zi,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),Ee(r,zt,u=>t(3,o=u)),Ee(r,ms,u=>t(4,a=u)),Ee(r,ji,u=>t(5,l=u)),Ao([{action:"setVisible",data:!0}]),Ao([{action:"setBrowserMode",data:!0}]);function c(u){u.key==="="&&Ie(ji,l=!0,l)}return an("setBrowserMode",u=>{Ms.set(u),console.log("browser mode enabled"),u?window.addEventListener("keydown",c):window.removeEventListener("keydown",c)}),an("setupModel",u=>{_n.show.set(!0),_n.setupModel(u)}),an("updateCamera",u=>{_n.updateCamera(u)}),an("setFurnituresData",u=>{ms.set(u),$n.set(a[0])}),an("addToCart",u=>{Ie(Cn,i=[...i,u],i),_n.show.set(!1),Ie(zt,o=!1,o)}),an("removeFromCart",u=>{Ie(Cn,i=i.filter(f=>f.entity!=u.entity),i),Ie(Cn,i=[...i],i),Ie(vn,s=null,s),_n.show.set(!1)}),an("clearCart",()=>{Ie(Cn,i=[],i)}),an("setOwnedItems",u=>{Ie(Zi,n=u,n)}),an("removeOwnedItem",u=>{let f=n.filter(h=>h.id!=u.id);Ie(Zi,n=[...f],n)}),[]}class Xg extends gt{constructor(e){super(),mt(this,e,jg,null,ft,{})}}function wl(r,e,t){const n=r.slice();return n[20]=e[t],n[22]=t,n}function El(r){let e,t,n;return{c(){e=q("input"),e.autofocus=!0,V(e,"class","min-w-[10rem] h-[4.5rem] px-[1rem] text-[1.6rem] bg-[color:var(--color-tertiary)]"),V(e,"type","text"),V(e,"placeholder","Search")},m(i,s){Oe(i,e,s),Tn(e,r[1]),e.focus(),t||(n=Le(e,"input",r[13]),t=!0)},p(i,s){s&2&&e.value!==i[1]&&Tn(e,i[1])},d(i){i&&Ne(e),t=!1,n()}}}function Tl(r){let e,t=r[20].category+"",n,i,s;function o(){return r[15](r[22])}return{c(){e=q("button"),n=rt(t),V(e,"class","whitespace-nowrap w-fit px-10 h-[4.5rem] text-[1.6rem] bg-[color:var(--color-secondary)] grid place-items-center transition-all duration-200 ease-in-out svelte-vkl3yg"),ps(e,"selected",r[0]===r[22])},m(a,l){Oe(a,e,l),D(e,n),i||(s=Le(e,"click",o),i=!0)},p(a,l){r=a,l&4&&t!==(t=r[20].category+"")&&At(n,t),l&1&&ps(e,"selected",r[0]===r[22])},d(a){a&&Ne(e),i=!1,s()}}}function qg(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m=r[9].length+"",d,g,x,M,y,w,C=r[10].length+"",T,b,S,F,k,L,O,B=r[4]&&El(r),J=r[2],R=[];for(let H=0;H',i=le(),B&&B.c(),o=le(),a=q("div"),l=q("button"),l.textContent="All Objects",c=le();for(let H=0;Ht(2,n=C)),Ee(r,$n,C=>t(5,i=C)),Ee(r,zt,C=>t(6,s=C)),Ee(r,Er,C=>t(7,o=C)),Ee(r,Tr,C=>t(8,a=C)),Ee(r,Zi,C=>t(9,l=C)),Ee(r,Cn,C=>t(10,c=C));let u=-1,f;function h(C){C=window.event||C;var T=Math.max(-1,Math.min(1,C.wheelDelta||-C.detail));t(3,f.scrollLeft-=T*50,f),C.preventDefault()}let p=!1,_="";const v=()=>{t(4,p=!p),s&&Ie(zt,s=!1,s)};function m(){_=this.value,t(1,_)}const d=()=>{t(0,u=-1);const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i),s&&Ie(zt,s=!1,s)},g=C=>{t(0,u=C),Ie($n,i=n[C],i),s&&Ie(zt,s=!1,s)};function x(C){Vn[C?"unshift":"push"](()=>{f=C,t(3,f)})}const M=()=>{Ie(Er,o=!1,o),Ie(Tr,a=!a,a)},y=()=>{Ie(Tr,a=!1,a),Ie(Er,o=!o,o)},w=()=>{Ie(zt,s=!s,s)};return r.$$.update=()=>{if(r.$$.dirty&7)if(_.length>0){let C=null;u==-1?C=n.flatMap(b=>b.items):C=n[u].items;const T=C.filter(b=>b.label.toLowerCase().includes(_.toLowerCase()));Ie($n,i={category:"Search Results",items:T},i)}else if(u===-1){const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i)}else Ie($n,i=n[u],i)},[u,_,n,f,p,i,s,o,a,l,c,h,v,m,d,g,x,M,y,w]}class Zg extends gt{constructor(e){super(),mt(this,e,Yg,qg,ft,{})}}function Al(r,e,t){const n=r.slice();return n[7]=e[t],n[9]=t,n}function Cl(r){let e,t,n,i,s,o,a,l,c,u,f,h=r[1].reduce(Ll,0)+"",p,_,v,m,d,g,x,M,y=r[1],w=[];for(let C=0;CYOUR SHOPPING CART

",n=le(),i=q("div");for(let C=0;C',d=le(),g=q("button"),g.innerHTML="

Purchase

",V(t,"class","font-medium"),V(i,"class","flex flex-col gap-2 overflow-scroll h-[73%] scroll-style scroll-style-vertical"),V(a,"class","text-[1.6rem] w-full h-full flex items-center justify-between"),V(m,"class","bg-[color:var(--color-secondary)] mt-2 font-medium h-full w-[20%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(g,"class","bg-[color:var(--color-accent)] text-[2rem] mt-2 font-medium h-full w-[79%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(v,"class","flex w-full h-full justify-between"),V(o,"class","flex flex-col gap-2 items-center justify-center h-[5rem] mt-10"),V(e,"class","w-[40rem] h-[60rem] bg-[color:var(--color-primary)] absolute right-0 -top-[65rem] flex flex-col gap-[1rem] p-12")},m(C,T){Oe(C,e,T),D(e,t),D(e,n),D(e,i);for(let b=0;b',m=le(),V(n,"class","text-[2rem]"),V(u,"class","text-[color:var(--color-accent)] font-bold ml-2"),V(a,"class","flex text-[1.5rem]"),V(t,"class","flex flex-col gap-2 w-full text-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square"),V(e,"class","flex flex-row gap-2 w-full min-h-[8rem] justify-between bg-[color:var(--color-secondary)] items-center")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"click",x),Le(e,"click",M)],d=!0)},p(y,w){r=y,w&2&&i!==(i=r[7].label+"")&&At(s,i),w&2&&h!==(h=r[7].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,qt(g)}}}function Qg(r){let e,t=r[0]&&Cl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Cl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}const Ll=(r,e)=>r+e.price;function Kg(r,e,t){let n,i,s;return Ee(r,Er,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),[n,i,s,u=>{at("removeCartItem",u)},u=>{at("selectCartItem",u)},()=>Ie(Er,n=!1,n),()=>{Ie(vn,s=null,s),at("buyCartItems")}]}class Jg extends gt{constructor(e){super(),mt(this,e,Kg,Qg,ft,{})}}function Rl(r,e,t){const n=r.slice();return n[5]=e[t],n[7]=t,n}function Dl(r){let e,t,n,i,s,o,a,l,c,u=r[1],f=[];for(let h=0;h',o=le(),a=q("div");for(let h=0;h',V(e,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square")},m(s,o){Oe(s,e,o),t||(n=Le(e,"click",i),t=!0)},p(s,o){r=s},d(s){s&&Ne(e),t=!1,n()}}}function Ul(r){let e,t,n,i,s,o=r[5].label+"",a,l,c,u,f;function h(){return r[3](r[5])}let p=r[5].type!="storage"&&r[5].type!="clothing"&&Il(r);return{c(){e=q("div"),t=q("button"),t.innerHTML='',n=le(),i=q("div"),s=q("h1"),a=rt(o),l=le(),p&&p.c(),c=le(),V(t,"class","bg-[color:var(--color-tertiary)] text-[2rem] w-[4rem] h-[4rem] text-center aspect-square"),V(s,"class","text-[2rem]"),V(i,"class","flex flex-col gap-2 w-full"),V(e,"class","flex flex-row gap-2 w-full justify-between bg-[color:var(--color-secondary)] p-4 items-center")},m(_,v){Oe(_,e,v),D(e,t),D(e,n),D(e,i),D(i,s),D(s,a),D(e,l),p&&p.m(e,null),D(e,c),u||(f=Le(t,"click",h),u=!0)},p(_,v){r=_,v&2&&o!==(o=r[5].label+"")&&At(a,o),r[5].type!="storage"&&r[5].type!="clothing"?p?p.p(r,v):(p=Il(r),p.c(),p.m(e,c)):p&&(p.d(1),p=null)},d(_){_&&Ne(e),p&&p.d(),u=!1,f()}}}function $g(r){let e,t=r[0]&&Dl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Dl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}function e_(r,e,t){let n,i;return Ee(r,Tr,l=>t(0,n=l)),Ee(r,Zi,l=>t(1,i=l)),[n,i,()=>Ie(Tr,n=!1,n),l=>{at("selectOwnedItem",l)},l=>{at("removeOwnedItem",l)}]}class t_ extends gt{constructor(e){super(),mt(this,e,e_,$g,ft,{})}}function n_(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m,d,g,x=r[1].toFixed(1)+"",M,y,w,C,T,b,S;return t=new Zg({}),i=new Wg({}),o=new Jg({}),l=new t_({}),{c(){e=q("div"),nt(t.$$.fragment),n=le(),nt(i.$$.fragment),s=le(),nt(o.$$.fragment),a=le(),nt(l.$$.fragment),c=le(),u=q("div"),f=q("i"),h=le(),p=q("p"),p.textContent="C",_=le(),v=q("div"),m=q("i"),d=le(),g=q("p"),M=rt(x),y=le(),w=q("input"),V(f,"class","fa-solid fa-video text-[white]"),V(p,"class","font-semibold"),jo(u,"border-color",r[0]?"white":"var(--color-tertiary)"),V(u,"class","absolute -top-[5rem] text-[2rem] right-0 w-[8rem] border-[0.3rem] h-[4rem] bg-[color:var(--color-primary)] flex flex-row gap-[1rem] items-center justify-center"),V(m,"class","fa-solid fa-eye text-[white]"),V(g,"class","font-semibold text-center w-[4rem]"),V(w,"id","slider"),V(w,"type","range"),V(w,"min","1.0"),V(w,"max","12.5"),V(w,"step","0.5"),V(w,"class","w-full"),V(v,"class","flex flex-row gap-[1rem] items-center absolute left-0 -top-[5rem] w-[30rem] h-fit p-4 bg-[color:var(--color-primary)]"),V(e,"class",C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(r[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all")},m(F,k){Oe(F,e,k),$e(t,e,null),D(e,n),$e(i,e,null),D(e,s),$e(o,e,null),D(e,a),$e(l,e,null),D(e,c),D(e,u),D(u,f),D(u,h),D(u,p),D(e,_),D(e,v),D(v,m),D(v,d),D(v,g),D(g,M),D(v,y),D(v,w),Tn(w,r[1]),T=!0,b||(S=[Le(w,"change",r[3]),Le(w,"input",r[3]),Le(w,"change",r[4])],b=!0)},p(F,[k]){(!T||k&1)&&jo(u,"border-color",F[0]?"white":"var(--color-tertiary)"),(!T||k&2)&&x!==(x=F[1].toFixed(1)+"")&&At(M,x),k&2&&Tn(w,F[1]),(!T||k&4&&C!==(C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(F[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all"))&&V(e,"class",C)},i(F){T||(_e(t.$$.fragment,F),_e(i.$$.fragment,F),_e(o.$$.fragment,F),_e(l.$$.fragment,F),T=!0)},o(F){Se(t.$$.fragment,F),Se(i.$$.fragment,F),Se(o.$$.fragment,F),Se(l.$$.fragment,F),T=!1},d(F){F&&Ne(e),et(t),et(i),et(o),et(l),b=!1,qt(S)}}}function i_(r,e,t){let n;Ee(r,zt,c=>t(2,n=c));let i=!1,s=5;function o(c){c.target instanceof HTMLInputElement||c.target instanceof HTMLTextAreaElement||c.key==="c"&&(at("freecamMode",!0),Ie(zt,n=!0,n),t(0,i=!0))}an("freecamMode",c=>{c==!1&&(Ie(zt,n=!1,n),t(0,i=!1))}),or(()=>{window.addEventListener("keypress",o),at("freecamMode",!1),at("setHoverDistance",s),Ie(zt,n=!1,n),t(0,i=!1)});function a(){s=cs(this.value),t(1,s)}return[i,s,n,a,()=>{at("setHoverDistance",s)}]}class r_ extends gt{constructor(e){super(),mt(this,e,i_,n_,ft,{})}}const s_={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` +}`;function hg(r,e,t){let n=new Uo;const i=new Qe,s=new Qe,o=new Ut,a=new lg({depthPacking:of}),l=new cg,c={},u=t.maxTextureSize,f={[ti]:Jt,[Jt]:ti,[Pn]:Pn},h=new Xn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Qe},radius:{value:4}},vertexShader:ug,fragmentShader:fg}),p=h.clone();p.defines.HORIZONTAL_PASS=1;const _=new qt;_.setAttribute("position",new Dn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new pe(_,h),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=dc,this.render=function(M,y,w){if(m.enabled===!1||m.autoUpdate===!1&&m.needsUpdate===!1||M.length===0)return;const C=r.getRenderTarget(),T=r.getActiveCubeFace(),b=r.getActiveMipmapLevel(),S=r.state;S.setBlending(ei),S.buffers.color.setClear(1,1,1,1),S.buffers.depth.setTest(!0),S.setScissorTest(!1);for(let F=0,k=M.length;Fu||i.y>u)&&(i.x>u&&(s.x=Math.floor(u/B.x),i.x=s.x*B.x,O.mapSize.x=s.x),i.y>u&&(s.y=Math.floor(u/B.y),i.y=s.y*B.y,O.mapSize.y=s.y)),O.map===null){const R=this.type!==xr?{minFilter:Wt,magFilter:Wt}:{};O.map=new ii(i.x,i.y,R),O.map.texture.name=L.name+".shadowMap",O.camera.updateProjectionMatrix()}r.setRenderTarget(O.map),r.clear();const J=O.getViewportCount();for(let R=0;R0||y.map&&y.alphaTest>0){const S=T.uuid,F=y.uuid;let k=c[S];k===void 0&&(k={},c[S]=k);let L=k[F];L===void 0&&(L=T.clone(),k[F]=L),T=L}if(T.visible=y.visible,T.wireframe=y.wireframe,C===xr?T.side=y.shadowSide!==null?y.shadowSide:y.side:T.side=y.shadowSide!==null?y.shadowSide:f[y.side],T.alphaMap=y.alphaMap,T.alphaTest=y.alphaTest,T.map=y.map,T.clipShadows=y.clipShadows,T.clippingPlanes=y.clippingPlanes,T.clipIntersection=y.clipIntersection,T.displacementMap=y.displacementMap,T.displacementScale=y.displacementScale,T.displacementBias=y.displacementBias,T.wireframeLinewidth=y.wireframeLinewidth,T.linewidth=y.linewidth,w.isPointLight===!0&&T.isMeshDistanceMaterial===!0){const S=r.properties.get(T);S.light=w}return T}function x(M,y,w,C,T){if(M.visible===!1)return;if(M.layers.test(y.layers)&&(M.isMesh||M.isLine||M.isPoints)&&(M.castShadow||M.receiveShadow&&T===xr)&&(!M.frustumCulled||n.intersectsObject(M))){M.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,M.matrixWorld);const F=e.update(M),k=M.material;if(Array.isArray(k)){const L=F.groups;for(let O=0,B=L.length;O=1):H.indexOf("OpenGL ES")!==-1&&(R=parseFloat(/^OpenGL ES (\d)/.exec(H)[1]),J=R>=2);let Q=null,K={};const ve=r.getParameter(3088),se=r.getParameter(2978),j=new Ut().fromArray(ve),ee=new Ut().fromArray(se);function te(U,W,ie){const he=new Uint8Array(4),be=r.createTexture();r.bindTexture(U,be),r.texParameteri(U,10241,9728),r.texParameteri(U,10240,9728);for(let Ke=0;Kene||P.height>ne)&&(re=ne/Math.max(P.width,P.height)),re<1||E===!0)if(typeof HTMLImageElement!="undefined"&&P instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&P instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&P instanceof ImageBitmap){const fe=E?yc:Math.floor,Pe=fe(re*P.width),de=fe(re*P.height);v===void 0&&(v=g(Pe,de));const $=Y?g(Pe,de):v;return $.width=Pe,$.height=de,$.getContext("2d").drawImage(P,0,0,Pe,de),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+P.width+"x"+P.height+") to ("+Pe+"x"+de+")."),$}else return"data"in P&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+P.width+"x"+P.height+")."),P;return P}function M(P){return wo(P.width)&&wo(P.height)}function y(P){return a?!1:P.wrapS!==mn||P.wrapT!==mn||P.minFilter!==Wt&&P.minFilter!==ln}function w(P,E){return P.generateMipmaps&&E&&P.minFilter!==Wt&&P.minFilter!==ln}function C(P){r.generateMipmap(P)}function T(P,E,Y,ne,re=!1){if(a===!1)return E;if(P!==null){if(r[P]!==void 0)return r[P];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+P+"'")}let fe=E;return E===6403&&(Y===5126&&(fe=33326),Y===5131&&(fe=33325),Y===5121&&(fe=33321)),E===33319&&(Y===5126&&(fe=33328),Y===5131&&(fe=33327),Y===5121&&(fe=33323)),E===6408&&(Y===5126&&(fe=34836),Y===5131&&(fe=34842),Y===5121&&(fe=ne===ot&&re===!1?35907:32856),Y===32819&&(fe=32854),Y===32820&&(fe=32855)),(fe===33325||fe===33326||fe===33327||fe===33328||fe===34842||fe===34836)&&e.get("EXT_color_buffer_float"),fe}function b(P,E,Y){return w(P,Y)===!0||P.isFramebufferTexture&&P.minFilter!==Wt&&P.minFilter!==ln?Math.log2(Math.max(E.width,E.height))+1:P.mipmaps!==void 0&&P.mipmaps.length>0?P.mipmaps.length:P.isCompressedTexture&&Array.isArray(P.image)?E.mipmaps.length:1}function S(P){return P===Wt||P===Jo||P===Us?9728:9729}function F(P){const E=P.target;E.removeEventListener("dispose",F),L(E),E.isVideoTexture&&_.delete(E)}function k(P){const E=P.target;E.removeEventListener("dispose",k),B(E)}function L(P){const E=n.get(P);if(E.__webglInit===void 0)return;const Y=P.source,ne=m.get(Y);if(ne){const re=ne[E.__cacheKey];re.usedTimes--,re.usedTimes===0&&O(P),Object.keys(ne).length===0&&m.delete(Y)}n.remove(P)}function O(P){const E=n.get(P);r.deleteTexture(E.__webglTexture);const Y=P.source,ne=m.get(Y);delete ne[E.__cacheKey],o.memory.textures--}function B(P){const E=P.texture,Y=n.get(P),ne=n.get(E);if(ne.__webglTexture!==void 0&&(r.deleteTexture(ne.__webglTexture),o.memory.textures--),P.depthTexture&&P.depthTexture.dispose(),P.isWebGLCubeRenderTarget)for(let re=0;re<6;re++)r.deleteFramebuffer(Y.__webglFramebuffer[re]),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer[re]);else{if(r.deleteFramebuffer(Y.__webglFramebuffer),Y.__webglDepthbuffer&&r.deleteRenderbuffer(Y.__webglDepthbuffer),Y.__webglMultisampledFramebuffer&&r.deleteFramebuffer(Y.__webglMultisampledFramebuffer),Y.__webglColorRenderbuffer)for(let re=0;re=l&&console.warn("THREE.WebGLTextures: Trying to use "+P+" texture units while this GPU supports only "+l),J+=1,P}function Q(P){const E=[];return E.push(P.wrapS),E.push(P.wrapT),E.push(P.wrapR||0),E.push(P.magFilter),E.push(P.minFilter),E.push(P.anisotropy),E.push(P.internalFormat),E.push(P.format),E.push(P.type),E.push(P.generateMipmaps),E.push(P.premultiplyAlpha),E.push(P.flipY),E.push(P.unpackAlignment),E.push(P.encoding),E.join()}function K(P,E){const Y=n.get(P);if(P.isVideoTexture&&st(P),P.isRenderTargetTexture===!1&&P.version>0&&Y.__version!==P.version){const ne=P.image;if(ne===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(ne.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Re(Y,P,E);return}}t.bindTexture(3553,Y.__webglTexture,33984+E)}function ve(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Re(Y,P,E);return}t.bindTexture(35866,Y.__webglTexture,33984+E)}function se(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Re(Y,P,E);return}t.bindTexture(32879,Y.__webglTexture,33984+E)}function j(P,E){const Y=n.get(P);if(P.version>0&&Y.__version!==P.version){Ce(Y,P,E);return}t.bindTexture(34067,Y.__webglTexture,33984+E)}const ee={[bo]:10497,[mn]:33071,[So]:33648},te={[Wt]:9728,[Jo]:9984,[Us]:9986,[ln]:9729,[Hu]:9985,[Rr]:9987};function ue(P,E,Y){if(Y?(r.texParameteri(P,10242,ee[E.wrapS]),r.texParameteri(P,10243,ee[E.wrapT]),(P===32879||P===35866)&&r.texParameteri(P,32882,ee[E.wrapR]),r.texParameteri(P,10240,te[E.magFilter]),r.texParameteri(P,10241,te[E.minFilter])):(r.texParameteri(P,10242,33071),r.texParameteri(P,10243,33071),(P===32879||P===35866)&&r.texParameteri(P,32882,33071),(E.wrapS!==mn||E.wrapT!==mn)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),r.texParameteri(P,10240,S(E.magFilter)),r.texParameteri(P,10241,S(E.minFilter)),E.minFilter!==Wt&&E.minFilter!==ln&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const ne=e.get("EXT_texture_filter_anisotropic");if(E.magFilter===Wt||E.minFilter!==Us&&E.minFilter!==Rr||E.type===Mi&&e.has("OES_texture_float_linear")===!1||a===!1&&E.type===Dr&&e.has("OES_texture_half_float_linear")===!1)return;(E.anisotropy>1||n.get(E).__currentAnisotropy)&&(r.texParameterf(P,ne.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(E.anisotropy,i.getMaxAnisotropy())),n.get(E).__currentAnisotropy=E.anisotropy)}}function N(P,E){let Y=!1;P.__webglInit===void 0&&(P.__webglInit=!0,E.addEventListener("dispose",F));const ne=E.source;let re=m.get(ne);re===void 0&&(re={},m.set(ne,re));const fe=Q(E);if(fe!==P.__cacheKey){re[fe]===void 0&&(re[fe]={texture:r.createTexture(),usedTimes:0},o.memory.textures++,Y=!0),re[fe].usedTimes++;const Pe=re[P.__cacheKey];Pe!==void 0&&(re[P.__cacheKey].usedTimes--,Pe.usedTimes===0&&O(E)),P.__cacheKey=fe,P.__webglTexture=re[fe].texture}return Y}function Re(P,E,Y){let ne=3553;(E.isDataArrayTexture||E.isCompressedArrayTexture)&&(ne=35866),E.isData3DTexture&&(ne=32879);const re=N(P,E),fe=E.source;t.bindTexture(ne,P.__webglTexture,33984+Y);const Pe=n.get(fe);if(fe.version!==Pe.__version||re===!0){t.activeTexture(33984+Y),r.pixelStorei(37440,E.flipY),r.pixelStorei(37441,E.premultiplyAlpha),r.pixelStorei(3317,E.unpackAlignment),r.pixelStorei(37443,0);const de=y(E)&&M(E.image)===!1;let $=x(E.image,de,!1,u);$=It(E,$);const xe=M($)||a,we=s.convert(E.format,E.encoding);let Ae=s.convert(E.type),ge=T(E.internalFormat,we,Ae,E.encoding,E.isVideoTexture);ue(ne,E,xe);let Me;const Fe=E.mipmaps,Ze=a&&E.isVideoTexture!==!0,ct=Pe.__version===void 0||re===!0,U=b(E,$,xe);if(E.isDepthTexture)ge=6402,a?E.type===Mi?ge=36012:E.type===xi?ge=33190:E.type===Ki?ge=35056:ge=33189:E.type===Mi&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),E.format===bi&&ge===6402&&E.type!==Mc&&E.type!==xi&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),E.type=xi,Ae=s.convert(E.type)),E.format===nr&&ge===6402&&(ge=34041,E.type!==Ki&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),E.type=Ki,Ae=s.convert(E.type))),ct&&(Ze?t.texStorage2D(3553,1,ge,$.width,$.height):t.texImage2D(3553,0,ge,$.width,$.height,0,we,Ae,null));else if(E.isDataTexture)if(Fe.length>0&&xe){Ze&&ct&&t.texStorage2D(3553,U,ge,Fe[0].width,Fe[0].height);for(let W=0,ie=Fe.length;W>=1,ie>>=1}}else if(Fe.length>0&&xe){Ze&&ct&&t.texStorage2D(3553,U,ge,Fe[0].width,Fe[0].height);for(let W=0,ie=Fe.length;W0&&ct++,t.texStorage2D(34067,ct,Me,$[0].width,$[0].height));for(let W=0;W<6;W++)if(de){Fe?t.texSubImage2D(34069+W,0,0,0,$[W].width,$[W].height,Ae,ge,$[W].data):t.texImage2D(34069+W,0,Me,$[W].width,$[W].height,0,Ae,ge,$[W].data);for(let ie=0;ie=34069&&re<=34074)&&r.framebufferTexture2D(36160,ne,re,n.get(Y).__webglTexture,0),t.bindFramebuffer(36160,null)}function Te(P,E,Y){if(r.bindRenderbuffer(36161,P),E.depthBuffer&&!E.stencilBuffer){let ne=33189;if(Y||Xe(E)){const re=E.depthTexture;re&&re.isDepthTexture&&(re.type===Mi?ne=36012:re.type===xi&&(ne=33190));const fe=_t(E);Xe(E)?h.renderbufferStorageMultisampleEXT(36161,fe,ne,E.width,E.height):r.renderbufferStorageMultisample(36161,fe,ne,E.width,E.height)}else r.renderbufferStorage(36161,ne,E.width,E.height);r.framebufferRenderbuffer(36160,36096,36161,P)}else if(E.depthBuffer&&E.stencilBuffer){const ne=_t(E);Y&&Xe(E)===!1?r.renderbufferStorageMultisample(36161,ne,35056,E.width,E.height):Xe(E)?h.renderbufferStorageMultisampleEXT(36161,ne,35056,E.width,E.height):r.renderbufferStorage(36161,34041,E.width,E.height),r.framebufferRenderbuffer(36160,33306,36161,P)}else{const ne=E.isWebGLMultipleRenderTargets===!0?E.texture:[E.texture];for(let re=0;re0&&Xe(P)===!1){const de=fe?E:[E];Y.__webglMultisampledFramebuffer=r.createFramebuffer(),Y.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,Y.__webglMultisampledFramebuffer);for(let $=0;$0&&Xe(P)===!1){const E=P.isWebGLMultipleRenderTargets?P.texture:[P.texture],Y=P.width,ne=P.height;let re=16384;const fe=[],Pe=P.stencilBuffer?33306:36096,de=n.get(P),$=P.isWebGLMultipleRenderTargets===!0;if($)for(let xe=0;xe0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&E.__useRenderToTexture!==!1}function st(P){const E=o.render.frame;_.get(P)!==E&&(_.set(P,E),P.update())}function It(P,E){const Y=P.encoding,ne=P.format,re=P.type;return P.isCompressedTexture===!0||P.isVideoTexture===!0||P.format===yo||Y!==ni&&(Y===ot?a===!1?e.has("EXT_sRGB")===!0&&ne===gn?(P.format=yo,P.minFilter=ln,P.generateMipmaps=!1):E=Ec.sRGBToLinear(E):(ne!==gn||re!==Si)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",Y)),E}this.allocateTextureUnit=H,this.resetTextureUnits=R,this.setTexture2D=K,this.setTexture2DArray=ve,this.setTexture3D=se,this.setTextureCube=j,this.rebindTextures=Ue,this.setupRenderTarget=lt,this.updateRenderTargetMipmap=xt,this.updateMultisampleRenderTarget=Mt,this.setupDepthRenderbuffer=ye,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=Xe}function mg(r,e,t){const n=t.isWebGL2;function i(s,o=null){let a;if(s===Si)return 5121;if(s===Xu)return 32819;if(s===qu)return 32820;if(s===Vu)return 5120;if(s===Wu)return 5122;if(s===Mc)return 5123;if(s===ju)return 5124;if(s===xi)return 5125;if(s===Mi)return 5126;if(s===Dr)return n?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===Yu)return 6406;if(s===gn)return 6408;if(s===Zu)return 6409;if(s===Qu)return 6410;if(s===bi)return 6402;if(s===nr)return 34041;if(s===yo)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===Ku)return 6403;if(s===Ju)return 36244;if(s===$u)return 33319;if(s===ef)return 33320;if(s===tf)return 36249;if(s===Ns||s===Os||s===Fs||s===zs)if(o===ot)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===Ns)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===Os)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===Fs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===zs)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===Ns)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===Os)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===Fs)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===zs)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===$o||s===ea||s===ta||s===na)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===$o)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===ea)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===ta)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===na)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===nf)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===ia||s===ra)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===ia)return o===ot?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===ra)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===sa||s===oa||s===aa||s===la||s===ca||s===ua||s===fa||s===ha||s===da||s===pa||s===ma||s===ga||s===_a||s===va)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===sa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===oa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===aa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===la)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===ca)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===ua)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===fa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===ha)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===da)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===pa)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===ma)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===ga)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===_a)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===va)return o===ot?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===ks)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===ks)return o===ot?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===rf||s===xa||s===Ma||s===ba)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===ks)return a.COMPRESSED_RED_RGTC1_EXT;if(s===xa)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===Ma)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===ba)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ki?n?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):r[s]!==void 0?r[s]:null}return{convert:i}}class gg extends sn{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class rs extends Et{constructor(){super(),this.isGroup=!0,this.type="Group"}}const _g={type:"move"};class ao{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new rs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new rs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new I,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new I),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new rs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new I,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new I),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const v of e.hand.values()){const m=t.getJointPose(v,n),d=this._getHandJoint(c,v);m!==null&&(d.matrix.fromArray(m.transform.matrix),d.matrix.decompose(d.position,d.rotation,d.scale),d.jointRadius=m.radius),d.visible=m!==null}const u=c.joints["index-finger-tip"],f=c.joints["thumb-tip"],h=u.position.distanceTo(f.position),p=.02,_=.005;c.inputState.pinching&&h>p+_?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&h<=p-_&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(_g)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new rs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}class vg extends $t{constructor(e,t,n,i,s,o,a,l,c,u){if(u=u!==void 0?u:bi,u!==bi&&u!==nr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&u===bi&&(n=xi),n===void 0&&u===nr&&(n=Ki),super(null,i,s,o,a,l,u,n,c),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:Wt,this.minFilter=l!==void 0?l:Wt,this.flipY=!1,this.generateMipmaps=!1}}class xg extends ar{constructor(e,t){super();const n=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,u=null,f=null,h=null,p=null,_=null;const v=t.getContextAttributes();let m=null,d=null;const g=[],x=[],M=new Set,y=new Map,w=new sn;w.layers.enable(1),w.viewport=new Ut;const C=new sn;C.layers.enable(2),C.viewport=new Ut;const T=[w,C],b=new gg;b.layers.enable(1),b.layers.enable(2);let S=null,F=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getTargetRaySpace()},this.getControllerGrip=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getGripSpace()},this.getHand=function(j){let ee=g[j];return ee===void 0&&(ee=new ao,g[j]=ee),ee.getHandSpace()};function k(j){const ee=x.indexOf(j.inputSource);if(ee===-1)return;const te=g[ee];te!==void 0&&te.dispatchEvent({type:j.type,data:j.inputSource})}function L(){i.removeEventListener("select",k),i.removeEventListener("selectstart",k),i.removeEventListener("selectend",k),i.removeEventListener("squeeze",k),i.removeEventListener("squeezestart",k),i.removeEventListener("squeezeend",k),i.removeEventListener("end",L),i.removeEventListener("inputsourceschange",O);for(let j=0;j=0&&(x[ue]=null,g[ue].disconnect(te))}for(let ee=0;ee=x.length){x.push(te),ue=Re;break}else if(x[Re]===null){x[Re]=te,ue=Re;break}if(ue===-1)break}const N=g[ue];N&&N.connect(te)}}const B=new I,J=new I;function R(j,ee,te){B.setFromMatrixPosition(ee.matrixWorld),J.setFromMatrixPosition(te.matrixWorld);const ue=B.distanceTo(J),N=ee.projectionMatrix.elements,Re=te.projectionMatrix.elements,Ce=N[14]/(N[10]-1),oe=N[14]/(N[10]+1),Te=(N[9]+1)/N[5],je=(N[9]-1)/N[5],ye=(N[8]-1)/N[0],Ue=(Re[8]+1)/Re[0],lt=Ce*ye,xt=Ce*Ue,Mt=ue/(-ye+Ue),_t=Mt*-ye;ee.matrixWorld.decompose(j.position,j.quaternion,j.scale),j.translateX(_t),j.translateZ(Mt),j.matrixWorld.compose(j.position,j.quaternion,j.scale),j.matrixWorldInverse.copy(j.matrixWorld).invert();const Xe=Ce+Mt,st=oe+Mt,It=lt-_t,P=xt+(ue-_t),E=Te*oe/st*Xe,Y=je*oe/st*Xe;j.projectionMatrix.makePerspective(It,P,E,Y,Xe,st),j.projectionMatrixInverse.copy(j.projectionMatrix).invert()}function H(j,ee){ee===null?j.matrixWorld.copy(j.matrix):j.matrixWorld.multiplyMatrices(ee.matrixWorld,j.matrix),j.matrixWorldInverse.copy(j.matrixWorld).invert()}this.updateCamera=function(j){if(i===null)return;b.near=C.near=w.near=j.near,b.far=C.far=w.far=j.far,(S!==b.near||F!==b.far)&&(i.updateRenderState({depthNear:b.near,depthFar:b.far}),S=b.near,F=b.far);const ee=j.parent,te=b.cameras;H(b,ee);for(let ue=0;ueN&&(y.set(ue,ue.lastChangedTime),n.dispatchEvent({type:"planechanged",data:ue}))}}_=null}const se=new Nc;se.setAnimationLoop(ve),this.setAnimationLoop=function(j){K=j},this.dispose=function(){}}}function Mg(r,e){function t(m,d){m.matrixAutoUpdate===!0&&m.updateMatrix(),d.value.copy(m.matrix)}function n(m,d){d.color.getRGB(m.fogColor.value,Rc(r)),d.isFog?(m.fogNear.value=d.near,m.fogFar.value=d.far):d.isFogExp2&&(m.fogDensity.value=d.density)}function i(m,d,g,x,M){d.isMeshBasicMaterial||d.isMeshLambertMaterial?s(m,d):d.isMeshToonMaterial?(s(m,d),f(m,d)):d.isMeshPhongMaterial?(s(m,d),u(m,d)):d.isMeshStandardMaterial?(s(m,d),h(m,d),d.isMeshPhysicalMaterial&&p(m,d,M)):d.isMeshMatcapMaterial?(s(m,d),_(m,d)):d.isMeshDepthMaterial?s(m,d):d.isMeshDistanceMaterial?(s(m,d),v(m,d)):d.isMeshNormalMaterial?s(m,d):d.isLineBasicMaterial?(o(m,d),d.isLineDashedMaterial&&a(m,d)):d.isPointsMaterial?l(m,d,g,x):d.isSpriteMaterial?c(m,d):d.isShadowMaterial?(m.color.value.copy(d.color),m.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function s(m,d){m.opacity.value=d.opacity,d.color&&m.diffuse.value.copy(d.color),d.emissive&&m.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap,t(d.alphaMap,m.alphaMapTransform)),d.bumpMap&&(m.bumpMap.value=d.bumpMap,t(d.bumpMap,m.bumpMapTransform),m.bumpScale.value=d.bumpScale,d.side===Jt&&(m.bumpScale.value*=-1)),d.normalMap&&(m.normalMap.value=d.normalMap,t(d.normalMap,m.normalMapTransform),m.normalScale.value.copy(d.normalScale),d.side===Jt&&m.normalScale.value.negate()),d.displacementMap&&(m.displacementMap.value=d.displacementMap,t(d.displacementMap,m.displacementMapTransform),m.displacementScale.value=d.displacementScale,m.displacementBias.value=d.displacementBias),d.emissiveMap&&(m.emissiveMap.value=d.emissiveMap,t(d.emissiveMap,m.emissiveMapTransform)),d.specularMap&&(m.specularMap.value=d.specularMap,t(d.specularMap,m.specularMapTransform)),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest);const g=e.get(d).envMap;if(g&&(m.envMap.value=g,m.flipEnvMap.value=g.isCubeTexture&&g.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=d.reflectivity,m.ior.value=d.ior,m.refractionRatio.value=d.refractionRatio),d.lightMap){m.lightMap.value=d.lightMap;const x=r.useLegacyLights===!0?Math.PI:1;m.lightMapIntensity.value=d.lightMapIntensity*x,t(d.lightMap,m.lightMapTransform)}d.aoMap&&(m.aoMap.value=d.aoMap,m.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,m.aoMapTransform))}function o(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform))}function a(m,d){m.dashSize.value=d.dashSize,m.totalSize.value=d.dashSize+d.gapSize,m.scale.value=d.scale}function l(m,d,g,x){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.size.value=d.size*g,m.scale.value=x*.5,d.map&&(m.map.value=d.map,t(d.map,m.uvTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function c(m,d){m.diffuse.value.copy(d.color),m.opacity.value=d.opacity,m.rotation.value=d.rotation,d.map&&(m.map.value=d.map,t(d.map,m.mapTransform)),d.alphaMap&&(m.alphaMap.value=d.alphaMap),d.alphaTest>0&&(m.alphaTest.value=d.alphaTest)}function u(m,d){m.specular.value.copy(d.specular),m.shininess.value=Math.max(d.shininess,1e-4)}function f(m,d){d.gradientMap&&(m.gradientMap.value=d.gradientMap)}function h(m,d){m.metalness.value=d.metalness,d.metalnessMap&&(m.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,m.metalnessMapTransform)),m.roughness.value=d.roughness,d.roughnessMap&&(m.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,m.roughnessMapTransform)),e.get(d).envMap&&(m.envMapIntensity.value=d.envMapIntensity)}function p(m,d,g){m.ior.value=d.ior,d.sheen>0&&(m.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),m.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(m.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,m.sheenColorMapTransform)),d.sheenRoughnessMap&&(m.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,m.sheenRoughnessMapTransform))),d.clearcoat>0&&(m.clearcoat.value=d.clearcoat,m.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(m.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,m.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,m.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(m.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,m.clearcoatNormalMapTransform),m.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===Jt&&m.clearcoatNormalScale.value.negate())),d.iridescence>0&&(m.iridescence.value=d.iridescence,m.iridescenceIOR.value=d.iridescenceIOR,m.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(m.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,m.iridescenceMapTransform)),d.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,m.iridescenceThicknessMapTransform))),d.transmission>0&&(m.transmission.value=d.transmission,m.transmissionSamplerMap.value=g.texture,m.transmissionSamplerSize.value.set(g.width,g.height),d.transmissionMap&&(m.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,m.transmissionMapTransform)),m.thickness.value=d.thickness,d.thicknessMap&&(m.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,m.thicknessMapTransform)),m.attenuationDistance.value=d.attenuationDistance,m.attenuationColor.value.copy(d.attenuationColor)),m.specularIntensity.value=d.specularIntensity,m.specularColor.value.copy(d.specularColor),d.specularColorMap&&(m.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,m.specularColorMapTransform)),d.specularIntensityMap&&(m.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,m.specularIntensityMapTransform))}function _(m,d){d.matcap&&(m.matcap.value=d.matcap)}function v(m,d){const g=e.get(d).light;m.referencePosition.value.setFromMatrixPosition(g.matrixWorld),m.nearDistance.value=g.shadow.camera.near,m.farDistance.value=g.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function bg(r,e,t,n){let i={},s={},o=[];const a=t.isWebGL2?r.getParameter(35375):0;function l(g,x){const M=x.program;n.uniformBlockBinding(g,M)}function c(g,x){let M=i[g.id];M===void 0&&(_(g),M=u(g),i[g.id]=M,g.addEventListener("dispose",m));const y=x.program;n.updateUBOMapping(g,y);const w=e.render.frame;s[g.id]!==w&&(h(g),s[g.id]=w)}function u(g){const x=f();g.__bindingPointIndex=x;const M=r.createBuffer(),y=g.__size,w=g.usage;return r.bindBuffer(35345,M),r.bufferData(35345,y,w),r.bindBuffer(35345,null),r.bindBufferBase(35345,x,M),M}function f(){for(let g=0;g0){w=M%y;const k=y-w;w!==0&&k-S.boundary<0&&(M+=y-w,b.__offset=M)}M+=S.storage}return w=M%y,w>0&&(M+=y-w),g.__size=M,g.__cache={},this}function v(g){const x={boundary:0,storage:0};return typeof g=="number"?(x.boundary=4,x.storage=4):g.isVector2?(x.boundary=8,x.storage=8):g.isVector3||g.isColor?(x.boundary=16,x.storage=12):g.isVector4?(x.boundary=16,x.storage=16):g.isMatrix3?(x.boundary=48,x.storage=48):g.isMatrix4?(x.boundary=64,x.storage=64):g.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",g),x}function m(g){const x=g.target;x.removeEventListener("dispose",m);const M=o.indexOf(x.__bindingPointIndex);o.splice(M,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function d(){for(const g in i)r.deleteBuffer(i[g]);o=[],i={},s={}}return{bind:l,update:c,dispose:d}}function Sg(){const r=Nr("canvas");return r.style.display="block",r}class Gc{constructor(e={}){const{canvas:t=Sg(),context:n=null,depth:i=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:f=!1}=e;this.isWebGLRenderer=!0;let h;n!==null?h=n.getContextAttributes().alpha:h=o;let p=null,_=null;const v=[],m=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=ni,this.useLegacyLights=!0,this.toneMapping=Rn,this.toneMappingExposure=1;const d=this;let g=!1,x=0,M=0,y=null,w=-1,C=null;const T=new Ut,b=new Ut;let S=null,F=t.width,k=t.height,L=1,O=null,B=null;const J=new Ut(0,0,F,k),R=new Ut(0,0,F,k);let H=!1;const Q=new Uo;let K=!1,ve=!1,se=null;const j=new vt,ee=new I,te={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function ue(){return y===null?L:1}let N=n;function Re(A,z){for(let Z=0;Z0?_=m[m.length-1]:_=null,v.pop(),v.length>0?p=v[v.length-1]:p=null};function Tt(A,z,Z,G){if(A.visible===!1)return;if(A.layers.test(z.layers)){if(A.isGroup)Z=A.renderOrder;else if(A.isLOD)A.autoUpdate===!0&&A.update(z);else if(A.isLight)_.pushLight(A),A.castShadow&&_.pushShadow(A);else if(A.isSprite){if(!A.frustumCulled||Q.intersectsSprite(A)){G&&ee.setFromMatrixPosition(A.matrixWorld).applyMatrix4(j);const me=Xe.update(A),De=A.material;De.visible&&p.push(A,me,De,Z,ee.z,null)}}else if((A.isMesh||A.isLine||A.isPoints)&&(A.isSkinnedMesh&&A.skeleton.frame!==je.render.frame&&(A.skeleton.update(),A.skeleton.frame=je.render.frame),!A.frustumCulled||Q.intersectsObject(A))){G&&ee.setFromMatrixPosition(A.matrixWorld).applyMatrix4(j);const me=Xe.update(A),De=A.material;if(Array.isArray(De)){const ze=me.groups;for(let Be=0,Ge=ze.length;Be0&&ht(X,ae,z,Z),G&&Te.viewport(T.copy(G)),X.length>0&&Lt(X,z,Z),ae.length>0&&Lt(ae,z,Z),me.length>0&&Lt(me,z,Z),Te.buffers.depth.setTest(!0),Te.buffers.depth.setMask(!0),Te.buffers.color.setMask(!0),Te.setPolygonOffset(!1)}function ht(A,z,Z,G){if(se===null){const De=oe.isWebGL2;se=new ii(1024,1024,{generateMipmaps:!0,type:Ce.has("EXT_color_buffer_half_float")?Dr:Si,minFilter:Rr,samples:De&&a===!0?4:0})}const X=d.getRenderTarget();d.setRenderTarget(se),d.clear();const ae=d.toneMapping;d.toneMapping=Rn,Lt(A,Z,G),Ue.updateMultisampleRenderTarget(se),Ue.updateRenderTargetMipmap(se);let me=!1;for(let De=0,ze=z.length;De0&&Ue.useMultisampledRTT(A)===!1?X=ye.get(A).__webglMultisampledFramebuffer:X=Ge,T.copy(A.viewport),b.copy(A.scissor),S=A.scissorTest}else T.copy(J).multiplyScalar(L).floor(),b.copy(R).multiplyScalar(L).floor(),S=H;if(Te.bindFramebuffer(36160,X)&&oe.drawBuffers&&G&&Te.drawBuffers(A,X),Te.viewport(T),Te.scissor(b),Te.setScissorTest(S),ae){const ze=ye.get(A.texture);N.framebufferTexture2D(36160,36064,34069+z,ze.__webglTexture,Z)}else if(me){const ze=ye.get(A.texture),Be=z||0;N.framebufferTextureLayer(36160,36064,ze.__webglTexture,Z||0,Be)}w=-1},this.readRenderTargetPixels=function(A,z,Z,G,X,ae,me){if(!(A&&A.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let De=ye.get(A).__webglFramebuffer;if(A.isWebGLCubeRenderTarget&&me!==void 0&&(De=De[me]),De){Te.bindFramebuffer(36160,De);try{const ze=A.texture,Be=ze.format,Ge=ze.type;if(Be!==gn&&$.convert(Be)!==N.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ve=Ge===Dr&&(Ce.has("EXT_color_buffer_half_float")||oe.isWebGL2&&Ce.has("EXT_color_buffer_float"));if(Ge!==Si&&$.convert(Ge)!==N.getParameter(35738)&&!(Ge===Mi&&(oe.isWebGL2||Ce.has("OES_texture_float")||Ce.has("WEBGL_color_buffer_float")))&&!Ve){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}z>=0&&z<=A.width-G&&Z>=0&&Z<=A.height-X&&N.readPixels(z,Z,G,X,$.convert(Be),$.convert(Ge),ae)}finally{const ze=y!==null?ye.get(y).__webglFramebuffer:null;Te.bindFramebuffer(36160,ze)}}},this.copyFramebufferToTexture=function(A,z,Z=0){const G=Math.pow(2,-Z),X=Math.floor(z.image.width*G),ae=Math.floor(z.image.height*G);Ue.setTexture2D(z,0),N.copyTexSubImage2D(3553,Z,0,0,A.x,A.y,X,ae),Te.unbindTexture()},this.copyTextureToTexture=function(A,z,Z,G=0){const X=z.image.width,ae=z.image.height,me=$.convert(Z.format),De=$.convert(Z.type);Ue.setTexture2D(Z,0),N.pixelStorei(37440,Z.flipY),N.pixelStorei(37441,Z.premultiplyAlpha),N.pixelStorei(3317,Z.unpackAlignment),z.isDataTexture?N.texSubImage2D(3553,G,A.x,A.y,X,ae,me,De,z.image.data):z.isCompressedTexture?N.compressedTexSubImage2D(3553,G,A.x,A.y,z.mipmaps[0].width,z.mipmaps[0].height,me,z.mipmaps[0].data):N.texSubImage2D(3553,G,A.x,A.y,me,De,z.image),G===0&&Z.generateMipmaps&&N.generateMipmap(3553),Te.unbindTexture()},this.copyTextureToTexture3D=function(A,z,Z,G,X=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ae=A.max.x-A.min.x+1,me=A.max.y-A.min.y+1,De=A.max.z-A.min.z+1,ze=$.convert(G.format),Be=$.convert(G.type);let Ge;if(G.isData3DTexture)Ue.setTexture3D(G,0),Ge=32879;else if(G.isDataArrayTexture)Ue.setTexture2DArray(G,0),Ge=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}N.pixelStorei(37440,G.flipY),N.pixelStorei(37441,G.premultiplyAlpha),N.pixelStorei(3317,G.unpackAlignment);const Ve=N.getParameter(3314),tt=N.getParameter(32878),Gt=N.getParameter(3316),cn=N.getParameter(3315),oi=N.getParameter(32877),yt=Z.isCompressedTexture?Z.mipmaps[0]:Z.image;N.pixelStorei(3314,yt.width),N.pixelStorei(32878,yt.height),N.pixelStorei(3316,A.min.x),N.pixelStorei(3315,A.min.y),N.pixelStorei(32877,A.min.z),Z.isDataTexture||Z.isData3DTexture?N.texSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,Be,yt.data):Z.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),N.compressedTexSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,yt.data)):N.texSubImage3D(Ge,X,z.x,z.y,z.z,ae,me,De,ze,Be,yt),N.pixelStorei(3314,Ve),N.pixelStorei(32878,tt),N.pixelStorei(3316,Gt),N.pixelStorei(3315,cn),N.pixelStorei(32877,oi),X===0&&G.generateMipmaps&&N.generateMipmap(Ge),Te.unbindTexture()},this.initTexture=function(A){A.isCubeTexture?Ue.setTextureCube(A,0):A.isData3DTexture?Ue.setTexture3D(A,0):A.isDataArrayTexture||A.isCompressedArrayTexture?Ue.setTexture2DArray(A,0):Ue.setTexture2D(A,0),Te.unbindTexture()},this.resetState=function(){x=0,M=0,y=null,Te.reset(),xe.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: the property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}}class yg extends Gc{}yg.prototype.isWebGL1Renderer=!0;class wg extends Et{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Hc extends cr{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Je(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const al=new I,ll=new I,cl=new vt,lo=new Do,ss=new Ss;class Kn extends Et{constructor(e=new qt,t=new Hc){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;il)continue;h.applyMatrix4(this.matrixWorld);const T=e.ray.origin.distanceTo(h);Te.far||t.push({distance:T,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}else{const d=Math.max(0,o.start),g=Math.min(m.count,o.start+o.count);for(let x=d,M=g-1;xl)continue;h.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(h);we.far||t.push({distance:w,point:f.clone().applyMatrix4(this.matrixWorld),index:x,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0&&x(!0),t>0&&x(!1)),this.setIndex(u),this.setAttribute("position",new pt(f,3)),this.setAttribute("normal",new pt(h,3)),this.setAttribute("uv",new pt(p,2));function g(){const M=new I,y=new I;let w=0;const C=(t-e)/n;for(let T=0;T<=s;T++){const b=[],S=T/s,F=S*(t-e)+e;for(let k=0;k<=i;k++){const L=k/i,O=L*l+a,B=Math.sin(O),J=Math.cos(O);y.x=F*B,y.y=-S*n+m,y.z=F*J,f.push(y.x,y.y,y.z),M.set(B,C,J).normalize(),h.push(M.x,M.y,M.z),p.push(L,1-S),b.push(_++)}v.push(b)}for(let T=0;T.9&&C<.1&&(x<.2&&(o[g+0]+=1),M<.2&&(o[g+2]+=1),y<.2&&(o[g+4]+=1))}}function h(g){s.push(g.x,g.y,g.z)}function p(g,x){const M=g*3;x.x=e[M+0],x.y=e[M+1],x.z=e[M+2]}function _(){const g=new I,x=new I,M=new I,y=new I,w=new Qe,C=new Qe,T=new Qe;for(let b=0,S=0;b0)&&p.push(x,M,w),(d!==n-1||l{const r={show:Ye(!1),cameraPosition:Ye({x:0,y:0,z:1}),cameraLookAt:Ye({x:0,y:0,z:10}),objectPosition:Ye({x:0,y:0,z:10}),objectEuler:Ye(new yi(0,0,0,"ZXY")),entity:Ye(0)};return{...r,...{setupModel(t){r.cameraPosition.set(Vi(t.cameraPosition)),r.cameraLookAt.set(Vi(t.cameraLookAt)),r.objectPosition.set(Vi(t.objectPosition)),r.objectEuler.set(new yi(Kt.degToRad(t.objectRotation.x),Kt.degToRad(t.objectRotation.z),Kt.degToRad(t.objectRotation.y),"YZX")),r.show.set(!0),r.entity.set(t.entity)},updateCamera(t){r.cameraPosition.set(Vi(t.cameraPosition)),r.cameraLookAt.set(Vi(t.cameraLookAt))},updateCameraPosition(t){r.cameraPosition.set(t.cameraPosition)},updateCameraLookAt(t){r.cameraLookAt.set(t.cameraLookAt)},sendMovementUpdate(t){at("moveObject",t)},sendRotationUpdate(t){const n=fs(t);at("rotateObject",{x:Kt.radToDeg(n.x).toFixed(2),y:Kt.radToDeg(n.y).toFixed(2),z:Kt.radToDeg(n.z).toFixed(2)})}}}};var _n=Cg();function Pg(r){let e,t,n,i;const s=r[1].default,o=xn(s,r,r[0],null);return{c(){e=q("div"),o&&o.c(),V(e,"class","absolute")},m(a,l){Oe(a,e,l),o&&o.m(e,null),t=!0,n||(i=oc(Lg.call(null,e,{to:"body"})),n=!0)},p(a,[l]){o&&o.p&&(!t||l&1)&&bn(o,s,a,a[0],t?Mn(s,a[0],l,null):Sn(a[0]),null)},i(a){t||(_e(o,a),t=!0)},o(a){Se(o,a),t=!1},d(a){a&&Ne(e),o&&o.d(a),n=!1,i()}}}function Lg(r,{to:e}){const t=document.querySelector(e);return t&&t.appendChild(r),{}}function Rg(r,e,t){let{$$slots:n={},$$scope:i}=e;return r.$$set=s=>{"$$scope"in s&&t(0,i=s.$$scope)},[i,n]}class qc extends gt{constructor(e){super(),mt(this,e,Rg,Pg,ft,{})}}function pl(r){let e,t;const n=r[2].default,i=xn(n,r,r[5],null);return{c(){e=q("main"),i&&i.c(),V(e,"class","svelte-1fnr7mh")},m(s,o){Oe(s,e,o),i&&i.m(e,null),t=!0},p(s,o){i&&i.p&&(!t||o&32)&&bn(i,n,s,s[5],t?Mn(n,s[5],o,null):Sn(s[5]),null)},i(s){t||(_e(i,s),t=!0)},o(s){Se(i,s),t=!1},d(s){s&&Ne(e),i&&i.d(s)}}}function ml(r){let e,t;return e=new qc({props:{$$slots:{default:[Dg]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&34&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function Dg(r){let e,t,n,i,s,o,a,l,c,u;return{c(){e=q("div"),t=q("div"),n=q("p"),n.textContent="Are you sure you want to exit? You have items in your cart.",i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[3]),Le(l,"click",r[4])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,kt(u)}}}function Ig(r){let e,t,n,i=r[0]&&pl(r),s=r[1]&&r[0]&&ml(r);return{c(){i&&i.c(),e=le(),s&&s.c(),t=ri()},m(o,a){i&&i.m(o,a),Oe(o,e,a),s&&s.m(o,a),Oe(o,t,a),n=!0},p(o,[a]){o[0]?i?(i.p(o,a),a&1&&_e(i,1)):(i=pl(o),i.c(),_e(i,1),i.m(e.parentNode,e)):i&&(Wn(),Se(i,1,1,()=>{i=null}),jn()),o[1]&&o[0]?s?(s.p(o,a),a&3&&_e(s,1)):(s=ml(o),s.c(),_e(s,1),s.m(t.parentNode,t)):s&&(Wn(),Se(s,1,1,()=>{s=null}),jn())},i(o){n||(_e(i),_e(s),n=!0)},o(o){Se(i),Se(s),n=!1},d(o){i&&i.d(o),o&&Ne(e),s&&s.d(o),o&&Ne(t)}}}function Ug(r,e,t){let n,i;Ee(r,Cn,f=>t(6,n=f)),Ee(r,zt,f=>t(7,i=f));let{$$slots:s={},$$scope:o}=e,a;ji.subscribe(f=>{t(0,a=f)}),an("setVisible",f=>{ji.set(f),f&&Ie(zt,i=!1,i)});let l=!1;or(()=>{const f=h=>{a&&["Escape"].includes(h.code)&&(n.length>0?t(1,l=!0):(at("hoverOut"),at("hideUI"),t(1,l=!1),ji.set(!1),_n.show.set(!1),vn.set(null)))};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)});const c=()=>{t(1,l=!1)},u=()=>{at("hideUI"),t(1,l=!1),ji.set(!1),_n.show.set(!1)};return r.$$set=f=>{"$$scope"in f&&t(5,o=f.$$scope)},[a,l,s,c,u,o]}class Ng extends gt{constructor(e){super(),mt(this,e,Ug,Ig,ft,{})}}const Og=()=>!window.invokeNative,Ao=(r,e=0)=>{if(Og())for(const t of r)setTimeout(()=>{window.dispatchEvent(new MessageEvent("message",{data:{action:t.action,data:t.data}}))},e)};function gl(r,e,t){const n=r.slice();return n[6]=e[t],n}function _l(r,e,t){const n=r.slice();return n[9]=e[t],n}function vl(r){let e,t=r[1],n=[];for(let i=0;i{t(0,n=!n)},c=>{if(c.custom==!0){c.customFunction();return}Ao([{action:c.action,data:c.data}])}]}class kg extends gt{constructor(e){super(),mt(this,e,zg,Fg,ft,{})}}function bl(r,e,t){const n=r.slice();return n[15]=e[t],n[17]=t,n}function Sl(r){let e,t,n,i=r[15].label+"",s,o,a,l,c,u,f,h=r[15].price+"",p,_,v,m,d,g;function x(){return r[8](r[15])}function M(){return r[10](r[15])}return{c(){e=q("button"),t=q("div"),n=q("p"),s=rt(i),o=le(),a=q("div"),l=q("p"),l.textContent="Price:",c=le(),u=q("p"),f=rt("$"),p=rt(h),_=le(),v=q("div"),v.innerHTML='',m=le(),V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(l,"class","text-[color:var(--color-text)] text-[1.2rem]"),V(u,"class","text-[color:var(--color-accent)] ml-2 font-bold text-[1.2rem]"),V(a,"class","flex"),V(t,"class","w-full h-full flex flex-col justify-center items-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] aspect-square h-full grid place-items-center justify-center items-center"),V(e,"class","h-full w-[30rem] bg-[color:var(--color-secondary)] flex flex-row items-center hover:cursor-pointer")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"mouseenter",x),Le(v,"mouseleave",r[9]),Le(e,"click",M),Le(e,"mouseleave",r[11])],d=!0)},p(y,w){r=y,w&8&&i!==(i=r[15].label+"")&&At(s,i),w&8&&h!==(h=r[15].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,kt(g)}}}function yl(r){let e,t;return e=new qc({props:{$$slots:{default:[Bg]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&262246&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function Bg(r){let e,t,n,i,s,o,a,l,c,u;return{c(){e=q("div"),t=q("div"),n=q("p"),n.textContent=`Are you sure you want to stop placing this current\r + furniture?`,i=le(),s=q("div"),o=q("button"),o.textContent="No",a=le(),l=q("button"),l.textContent="Yes",V(n,"class","text-[color:var(--color-text)] text-[2rem] font-bold text-start"),V(o,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(l,"class","bg-[color:var(--color-tertiary)] text-[color:var(--color-text)] text-[2rem] px-[1rem] py-[0.5rem] w-full hover:cursor-pointer"),V(s,"class","flex flex-row justify-between w-full gap-[2vw]"),V(t,"class","bg-[color:var(--color-secondary)] absolute w-[50rem] h-[fit] p-[1vw] flex flex-col gap-[1vw] justify-center items-center"),V(e,"class","z-[100] bg-black bg-opacity-50 w-screen h-screen absolute top-0 left-0 grid place-items-center")},m(f,h){Oe(f,e,h),D(e,t),D(t,n),D(t,i),D(t,s),D(s,o),D(s,a),D(s,l),c||(u=[Le(o,"click",r[13]),Le(l,"click",r[14])],c=!0)},p:St,d(f){f&&Ne(e),c=!1,kt(u)}}}function Gg(r){let e,t,n,i,s,o,a,l=r[3].items,c=[];for(let f=0;f{u=null}),jn())},i(f){s||(_e(u),s=!0)},o(f){Se(u),s=!1},d(f){f&&Ne(e),rr(c,f),r[12](null),f&&Ne(n),u&&u.d(f),f&&Ne(i),o=!1,a()}}}function Hg(r,e,t){let n,i,s,o;Ee(r,$n,g=>t(3,n=g)),Ee(r,Zi,g=>t(4,i=g)),Ee(r,vn,g=>t(5,s=g)),Ee(r,zt,g=>t(6,o=g));let a;function l(g){g=window.event||g;var x=Math.max(-1,Math.min(1,g.wheelDelta||-g.detail));t(0,a.scrollLeft-=x*50,a),g.preventDefault()}let c=!1,u=null;const f=g=>{at("hoverIn",g)},h=()=>{at("hoverOut")},p=g=>{if(at("hoverOut"),g.type){const x=i.filter(y=>y.type===g.type);let M=g.max||1;if(x.length>=M){at("showNotification",{type:"error",message:`You can only have ${M} of this item!`});return}}s!=null?(t(1,c=!0),t(2,u=g)):(at("previewFurniture",g),Ie(vn,s=g,s),Ie(zt,o=!0,o))},_=()=>{at("hoverOut")};function v(g){Vn[g?"unshift":"push"](()=>{a=g,t(0,a)})}return[a,c,u,n,i,s,o,l,f,h,p,_,v,()=>{t(1,c=!1),t(2,u=null)},()=>{at("previewFurniture",u),Ie(vn,s=u,s),Ie(zt,o=!0,o),t(1,c=!1),t(2,u=null)}]}class Vg extends gt{constructor(e){super(),mt(this,e,Hg,Gg,ft,{})}}function Wg(r,e,t){let n,i,s,o,a,l;Ee(r,Zi,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),Ee(r,zt,u=>t(3,o=u)),Ee(r,ms,u=>t(4,a=u)),Ee(r,ji,u=>t(5,l=u)),Ao([{action:"setVisible",data:!0}]),Ao([{action:"setBrowserMode",data:!0}]);function c(u){u.key==="="&&Ie(ji,l=!0,l)}return an("setBrowserMode",u=>{Ms.set(u),console.log("browser mode enabled"),u?window.addEventListener("keydown",c):window.removeEventListener("keydown",c)}),an("setupModel",u=>{_n.show.set(!0),_n.setupModel(u)}),an("updateCamera",u=>{_n.updateCamera(u)}),an("setFurnituresData",u=>{ms.set(u),$n.set(a[0])}),an("addToCart",u=>{Ie(Cn,i=[...i,u],i),_n.show.set(!1),Ie(zt,o=!1,o)}),an("removeFromCart",u=>{Ie(Cn,i=i.filter(f=>f.entity!=u.entity),i),Ie(Cn,i=[...i],i),Ie(vn,s=null,s),_n.show.set(!1)}),an("clearCart",()=>{Ie(Cn,i=[],i)}),an("setOwnedItems",u=>{Ie(Zi,n=u,n)}),an("removeOwnedItem",u=>{let f=n.filter(h=>h.id!=u.id);Ie(Zi,n=[...f],n)}),[]}class jg extends gt{constructor(e){super(),mt(this,e,Wg,null,ft,{})}}function wl(r,e,t){const n=r.slice();return n[20]=e[t],n[22]=t,n}function El(r){let e,t,n;return{c(){e=q("input"),e.autofocus=!0,V(e,"class","min-w-[10rem] h-[4.5rem] px-[1rem] text-[1.6rem] bg-[color:var(--color-tertiary)]"),V(e,"type","text"),V(e,"placeholder","Search")},m(i,s){Oe(i,e,s),Tn(e,r[1]),e.focus(),t||(n=Le(e,"input",r[13]),t=!0)},p(i,s){s&2&&e.value!==i[1]&&Tn(e,i[1])},d(i){i&&Ne(e),t=!1,n()}}}function Tl(r){let e,t=r[20].category+"",n,i,s;function o(){return r[15](r[22])}return{c(){e=q("button"),n=rt(t),V(e,"class","whitespace-nowrap w-fit px-10 h-[4.5rem] text-[1.6rem] bg-[color:var(--color-secondary)] grid place-items-center transition-all duration-200 ease-in-out svelte-vkl3yg"),ps(e,"selected",r[0]===r[22])},m(a,l){Oe(a,e,l),D(e,n),i||(s=Le(e,"click",o),i=!0)},p(a,l){r=a,l&4&&t!==(t=r[20].category+"")&&At(n,t),l&1&&ps(e,"selected",r[0]===r[22])},d(a){a&&Ne(e),i=!1,s()}}}function Xg(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m=r[9].length+"",d,g,x,M,y,w,C=r[10].length+"",T,b,S,F,k,L,O,B=r[4]&&El(r),J=r[2],R=[];for(let H=0;H',i=le(),B&&B.c(),o=le(),a=q("div"),l=q("button"),l.textContent="All Objects",c=le();for(let H=0;Ht(2,n=C)),Ee(r,$n,C=>t(5,i=C)),Ee(r,zt,C=>t(6,s=C)),Ee(r,Er,C=>t(7,o=C)),Ee(r,Tr,C=>t(8,a=C)),Ee(r,Zi,C=>t(9,l=C)),Ee(r,Cn,C=>t(10,c=C));let u=-1,f;function h(C){C=window.event||C;var T=Math.max(-1,Math.min(1,C.wheelDelta||-C.detail));t(3,f.scrollLeft-=T*50,f),C.preventDefault()}let p=!1,_="";const v=()=>{t(4,p=!p),s&&Ie(zt,s=!1,s)};function m(){_=this.value,t(1,_)}const d=()=>{t(0,u=-1);const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i),s&&Ie(zt,s=!1,s)},g=C=>{t(0,u=C),Ie($n,i=n[C],i),s&&Ie(zt,s=!1,s)};function x(C){Vn[C?"unshift":"push"](()=>{f=C,t(3,f)})}const M=()=>{Ie(Er,o=!1,o),Ie(Tr,a=!a,a)},y=()=>{Ie(Tr,a=!1,a),Ie(Er,o=!o,o)},w=()=>{Ie(zt,s=!s,s)};return r.$$.update=()=>{if(r.$$.dirty&7)if(_.length>0){let C=null;u==-1?C=n.flatMap(b=>b.items):C=n[u].items;const T=C.filter(b=>b.label.toLowerCase().includes(_.toLowerCase()));Ie($n,i={category:"Search Results",items:T},i)}else if(u===-1){const C=n.flatMap(T=>T.items);Ie($n,i={category:"All Objects",items:C},i)}else Ie($n,i=n[u],i)},[u,_,n,f,p,i,s,o,a,l,c,h,v,m,d,g,x,M,y,w]}class Yg extends gt{constructor(e){super(),mt(this,e,qg,Xg,ft,{})}}function Al(r,e,t){const n=r.slice();return n[7]=e[t],n[9]=t,n}function Cl(r){let e,t,n,i,s,o,a,l,c,u,f,h=r[1].reduce(Ll,0)+"",p,_,v,m,d,g,x,M,y=r[1],w=[];for(let C=0;CYOUR SHOPPING CART

",n=le(),i=q("div");for(let C=0;C',d=le(),g=q("button"),g.innerHTML="

Purchase

",V(t,"class","font-medium"),V(i,"class","flex flex-col gap-2 overflow-scroll h-[73%] scroll-style scroll-style-vertical"),V(a,"class","text-[1.6rem] w-full h-full flex items-center justify-between"),V(m,"class","bg-[color:var(--color-secondary)] mt-2 font-medium h-full w-[20%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(g,"class","bg-[color:var(--color-accent)] text-[2rem] mt-2 font-medium h-full w-[79%] py-14 gap-4 whitespace-nowrap flex flex-row items-center justify-center px-8 text-center"),V(v,"class","flex w-full h-full justify-between"),V(o,"class","flex flex-col gap-2 items-center justify-center h-[5rem] mt-10"),V(e,"class","w-[40rem] h-[60rem] bg-[color:var(--color-primary)] absolute right-0 -top-[65rem] flex flex-col gap-[1rem] p-12")},m(C,T){Oe(C,e,T),D(e,t),D(e,n),D(e,i);for(let b=0;b',m=le(),V(n,"class","text-[2rem]"),V(u,"class","text-[color:var(--color-accent)] font-bold ml-2"),V(a,"class","flex text-[1.5rem]"),V(t,"class","flex flex-col gap-2 w-full text-start ml-10"),V(v,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square"),V(e,"class","flex flex-row gap-2 w-full min-h-[8rem] justify-between bg-[color:var(--color-secondary)] items-center")},m(y,w){Oe(y,e,w),D(e,t),D(t,n),D(n,s),D(t,o),D(t,a),D(a,l),D(a,c),D(a,u),D(u,f),D(u,p),D(e,_),D(e,v),D(e,m),d||(g=[Le(v,"click",x),Le(e,"click",M)],d=!0)},p(y,w){r=y,w&2&&i!==(i=r[7].label+"")&&At(s,i),w&2&&h!==(h=r[7].price+"")&&At(p,h)},d(y){y&&Ne(e),d=!1,kt(g)}}}function Zg(r){let e,t=r[0]&&Cl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Cl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}const Ll=(r,e)=>r+e.price;function Qg(r,e,t){let n,i,s;return Ee(r,Er,u=>t(0,n=u)),Ee(r,Cn,u=>t(1,i=u)),Ee(r,vn,u=>t(2,s=u)),[n,i,s,u=>{at("removeCartItem",u)},u=>{at("selectCartItem",u)},()=>Ie(Er,n=!1,n),()=>{Ie(vn,s=null,s),at("buyCartItems")}]}class Kg extends gt{constructor(e){super(),mt(this,e,Qg,Zg,ft,{})}}function Rl(r,e,t){const n=r.slice();return n[5]=e[t],n[7]=t,n}function Dl(r){let e,t,n,i,s,o,a,l,c,u=r[1],f=[];for(let h=0;h',o=le(),a=q("div");for(let h=0;h',n=le(),i=q("div"),s=q("h1"),a=rt(o),l=le(),c=q("button"),c.innerHTML='',u=le(),V(t,"class","bg-[color:var(--color-tertiary)] text-[2rem] w-[4rem] h-[4rem] text-center aspect-square"),V(s,"class","text-[2rem]"),V(i,"class","flex flex-col gap-2 w-full"),V(c,"class","bg-[color:var(--color-tertiary)] text-[2rem] py-4 h-full text-center aspect-square"),V(e,"class","flex flex-row gap-2 w-full justify-between bg-[color:var(--color-secondary)] p-4 items-center")},m(v,m){Oe(v,e,m),D(e,t),D(e,n),D(e,i),D(i,s),D(s,a),D(e,l),D(e,c),D(e,u),f||(h=[Le(t,"click",p),Le(c,"click",_)],f=!0)},p(v,m){r=v,m&2&&o!==(o=r[5].label+"")&&At(a,o)},d(v){v&&Ne(e),f=!1,kt(h)}}}function Jg(r){let e,t=r[0]&&Dl(r);return{c(){t&&t.c(),e=ri()},m(n,i){t&&t.m(n,i),Oe(n,e,i)},p(n,[i]){n[0]?t?t.p(n,i):(t=Dl(n),t.c(),t.m(e.parentNode,e)):t&&(t.d(1),t=null)},i:St,o:St,d(n){t&&t.d(n),n&&Ne(e)}}}function $g(r,e,t){let n,i;return Ee(r,Tr,l=>t(0,n=l)),Ee(r,Zi,l=>t(1,i=l)),[n,i,()=>Ie(Tr,n=!1,n),l=>{at("selectOwnedItem",l)},l=>{at("removeOwnedItem",l)}]}class e_ extends gt{constructor(e){super(),mt(this,e,$g,Jg,ft,{})}}function t_(r){let e,t,n,i,s,o,a,l,c,u,f,h,p,_,v,m,d,g,x=r[1].toFixed(1)+"",M,y,w,C,T,b,S;return t=new Yg({}),i=new Vg({}),o=new Kg({}),l=new e_({}),{c(){e=q("div"),nt(t.$$.fragment),n=le(),nt(i.$$.fragment),s=le(),nt(o.$$.fragment),a=le(),nt(l.$$.fragment),c=le(),u=q("div"),f=q("i"),h=le(),p=q("p"),p.textContent="C",_=le(),v=q("div"),m=q("i"),d=le(),g=q("p"),M=rt(x),y=le(),w=q("input"),V(f,"class","fa-solid fa-video text-[white]"),V(p,"class","font-semibold"),jo(u,"border-color",r[0]?"white":"var(--color-tertiary)"),V(u,"class","absolute -top-[5rem] text-[2rem] right-0 w-[8rem] border-[0.3rem] h-[4rem] bg-[color:var(--color-primary)] flex flex-row gap-[1rem] items-center justify-center"),V(m,"class","fa-solid fa-eye text-[white]"),V(g,"class","font-semibold text-center w-[4rem]"),V(w,"id","slider"),V(w,"type","range"),V(w,"min","1.0"),V(w,"max","12.5"),V(w,"step","0.5"),V(w,"class","w-full"),V(v,"class","flex flex-row gap-[1rem] items-center absolute left-0 -top-[5rem] w-[30rem] h-fit p-4 bg-[color:var(--color-primary)]"),V(e,"class",C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(r[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all")},m(F,k){Oe(F,e,k),$e(t,e,null),D(e,n),$e(i,e,null),D(e,s),$e(o,e,null),D(e,a),$e(l,e,null),D(e,c),D(e,u),D(u,f),D(u,h),D(u,p),D(e,_),D(e,v),D(v,m),D(v,d),D(v,g),D(g,M),D(v,y),D(v,w),Tn(w,r[1]),T=!0,b||(S=[Le(w,"change",r[3]),Le(w,"input",r[3]),Le(w,"change",r[4])],b=!0)},p(F,[k]){(!T||k&1)&&jo(u,"border-color",F[0]?"white":"var(--color-tertiary)"),(!T||k&2)&&x!==(x=F[1].toFixed(1)+"")&&At(M,x),k&2&&Tn(w,F[1]),(!T||k&4&&C!==(C="w-[97%] h-fit flex flex-col absolute left-1/2 overflow-visible -translate-x-1/2 "+(F[2]?"-bottom-[24rem]":"bottom-[3rem]")+" z-[1] transition-all"))&&V(e,"class",C)},i(F){T||(_e(t.$$.fragment,F),_e(i.$$.fragment,F),_e(o.$$.fragment,F),_e(l.$$.fragment,F),T=!0)},o(F){Se(t.$$.fragment,F),Se(i.$$.fragment,F),Se(o.$$.fragment,F),Se(l.$$.fragment,F),T=!1},d(F){F&&Ne(e),et(t),et(i),et(o),et(l),b=!1,kt(S)}}}function n_(r,e,t){let n;Ee(r,zt,c=>t(2,n=c));let i=!1,s=5;function o(c){c.target instanceof HTMLInputElement||c.target instanceof HTMLTextAreaElement||c.key==="c"&&(at("freecamMode",!0),Ie(zt,n=!0,n),t(0,i=!0))}an("freecamMode",c=>{c==!1&&(Ie(zt,n=!1,n),t(0,i=!1))}),or(()=>{window.addEventListener("keypress",o),at("freecamMode",!1),at("setHoverDistance",s),Ie(zt,n=!1,n),t(0,i=!1)});function a(){s=cs(this.value),t(1,s)}return[i,s,n,a,()=>{at("setHoverDistance",s)}]}class i_ extends gt{constructor(e){super(),mt(this,e,n_,t_,ft,{})}}const r_={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; @@ -3437,5 +3437,5 @@ void main() { gl_FragColor.a *= opacity; - }`};class Ts{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const o_=new Fc(-1,1,1,-1,0,1),zo=new Xt;zo.setAttribute("position",new pt([-1,3,0,-1,-1,0,3,-1,0],3));zo.setAttribute("uv",new pt([0,2,0,0,2,0],2));class a_{constructor(e){this._mesh=new pe(zo,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,o_)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class l_ extends Ts{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Xn?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Ic.clone(e.uniforms),this.material=new Xn({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new a_(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class Nl extends Ts{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}class c_ extends Ts{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class u_{constructor(e,t){if(this.renderer=e,t===void 0){const n=e.getSize(new Qe);this._pixelRatio=e.getPixelRatio(),this._width=n.width,this._height=n.height,t=new ii(this._width*this._pixelRatio,this._height*this._pixelRatio),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new l_(s_),this.clock=new Xc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t{r.renderer=new Hc({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t}),r.composer=new u_(r.renderer),r.composer.addPass(new Zc(r.scene,Po(r.camera)))},Ol=(r,e,t)=>{!r.renderer||(e?r.renderer.outputEncoding=ni:r.renderer.outputEncoding=ot,t?r.renderer.toneMapping=Rn:r.renderer.toneMapping=xc)},Fl=(r,e,t)=>{var n,i,s,o,a,l,c,u;!r.renderer||!r.composer||((i=(n=r.renderer).setSize)==null||i.call(n,e.width,e.height),(o=(s=r.renderer).setPixelRatio)==null||o.call(s,t),(l=(a=r.composer).setSize)==null||l.call(a,e.width,e.height),(u=(c=r.composer).setPixelRatio)==null||u.call(c,t))},zl=(r,e,t)=>{!r.renderer||(r.renderer.shadowMap.enabled=e,r.renderer.shadowMap.type=t)},Ln=r=>r.userData,h_=(r,e)=>{r.pointer.update(t=>r.renderer?t.set(e.offsetX/r.renderer.domElement.clientWidth*2-1,-(e.offsetY/r.renderer.domElement.clientHeight)*2+1):t)},Qc=(r,e,t,n)=>(r.raycaster.setFromCamera(e,t),r.raycaster.intersectObjects(n,!1)),d_=(r,e)=>r.object.uuid!==e.object.uuid||r.instanceId!==e.instanceId,p_=(r,e,t)=>{let n;const i=r.camera.subscribe(c=>n=c);ut(i);let s;const o=r.pointer.subscribe(c=>s=c);ut(o);let a;const l=c=>{var h,p;c.preventDefault();const u=c.type;r.pointerOverCanvas.set(!0),t.pointerInvalidated=!0,h_(r,c);const f=m_(e,s,n);if(u==="pointerdown"&&(a=f?{object:f.object,instanceId:f.instanceId}:null),u==="click"){if(!g_(f,a)){a=null;return}a=null}!f||(p=(h=Ln(f.object)).eventDispatcher)==null||p.call(h,u,{...f,event:c})};return{onClick:l,onContextMenu:l,onPointerUp:l,onPointerDown:l,onPointerMove:l}};function m_(r,e,t){if(r.interactiveObjects.size===0||r.raycastableObjects.size===0)return null;const n=Qc(r,e,t,Array.from(r.raycastableObjects));return n.length===0||!r.interactiveObjects.has(n[0].object)?null:n[0]}function g_(r,e){return!r||!e?!1:r.object.uuid===e.object.uuid&&r.instanceId===e.instanceId}const __=(r,e)=>{let t;const n=r.pointerOverCanvas.subscribe(c=>t=c);ut(n);let i;const s=r.camera.subscribe(c=>i=c);ut(s);let o;const a=r.pointer.subscribe(c=>o=c);return ut(a),{raycast:()=>{var f,h,p,_,v,m,d,g;if(e.interactiveObjects.size===0||e.raycastableObjects.size===0)return;const c=t?Qc(e,o,i,Array.from(e.raycastableObjects)):[],u=c.length&&e.interactiveObjects.has(c[0].object)?c[0]:null;u?e.lastIntersection?e.lastIntersection&&d_(e.lastIntersection,u)&&((m=(v=Ln(e.lastIntersection.object)).eventDispatcher)==null||m.call(v,"pointerleave",e.lastIntersection),(g=(d=Ln(u.object)).eventDispatcher)==null||g.call(d,"pointerenter",u)):(_=(p=Ln(u.object)).eventDispatcher)==null||_.call(p,"pointerenter",u):e.lastIntersection&&((h=(f=Ln(e.lastIntersection.object)).eventDispatcher)==null||h.call(f,"pointerleave",e.lastIntersection)),e.lastIntersection=u}}},As=typeof window!="undefined",v_=r=>{if(!As)return;let e;const t=()=>{r(),e=requestAnimationFrame(t)};t(),ut(()=>{!e||cancelAnimationFrame(e)})},x_=(r,e)=>{if(e.frameHandlers.size===0)return;if(e.debugFrameloop){let i=0;e.frameHandlers.forEach(s=>{s.debugFrameloopMessage?e.invalidations[s.debugFrameloopMessage]=s.debugFrameloopMessage in e.invalidations?e.invalidations[s.debugFrameloopMessage]+1:1:++i}),i>0&&(e.invalidations.onFrame=e.frameHandlers.size)}const t=Array.from(e.frameHandlers).reduce((i,s)=>s.order?!0:i,!1),n=r.clock.getDelta();t?Array.from(e.frameHandlers).sort((i,s)=>{var o,a;return((o=i.order)!=null?o:0)>((a=s.order)!=null?a:0)?1:-1}).forEach(i=>i.fn(r,n)):e.frameHandlers.forEach(i=>i.fn(r,n))},M_=r=>{!r.debugFrameloop||(r.frame+=1,console.log(`frame: ${r.frame}${Object.keys(r.invalidations).length>0?", requested by \u21B4":""}`),Object.keys(r.invalidations).length>0&&console.table(r.invalidations),r.invalidations={})},b_=(r,e,t,n)=>{let i=Po(r.camera);const s=r.camera.subscribe(a=>i=a);ut(s);const{raycast:o}=__(r,e);v_(()=>{n.dispose();const a=t.frameloop==="always"||t.frameloop==="demand"&&(t.frameInvalidated||t.frameHandlers.size>0)||t.frameloop==="never"&&t.advance;(a||t.pointerInvalidated)&&(o(),t.pointerInvalidated=!1),a&&(!i||!r.composer||!r.renderer||(x_(r,t),r.composer.passes.length>1?r.composer.render():r.renderer.render(r.scene,i),M_(t),t.frameInvalidated=!1,t.advance=!1))})},S_=()=>{const r=new sn(75,0,.1,1e3);return Ln(r).threlteDefaultCamera=!0,r.position.z=5,r.lookAt(0,0,0),r},y_=r=>{const e=r.size.subscribe(t=>{Ln(Po(r.camera)).threlteDefaultCamera&&r.camera.update(n=>{const i=n;return i.aspect=t.width/t.height,i.updateProjectionMatrix(),r.invalidate("Default camera: aspect ratio changed"),i})});ut(e)},w_=(r,e,t,n,i,s,o)=>{const a={audioListeners:new Map,addAudioListener:(d,g)=>{if(g=g!=null?g:"default",a.audioListeners.has(g)){console.warn(`An AudioListener with the id "${g}" has already been added, aborting.`);return}a.audioListeners.set(g,d)},removeAudioListener:d=>{if(d=d!=null?d:"default",!a.audioListeners.has(d)){console.warn(`No AudioListener with the id "${d}" found, aborting.`);return}a.audioListeners.delete(d)},getAudioListener:d=>{if(d=d!=null?d:"default",!a.audioListeners.has(d)){console.warn(`No AudioListener with the id "${d}" found, aborting.`);return}return a.audioListeners.get(d)}},l={debugFrameloop:s,frameloop:o,frame:0,frameInvalidated:!0,pointerInvalidated:!0,invalidations:{},frameHandlers:new Set,advance:!1},c={size:mu([n,i],([d,g])=>d||g),pointer:Ye(new Qe),pointerOverCanvas:Ye(!1),clock:new Xc,camera:Ye(S_()),scene:new Eg,renderer:void 0,composer:void 0,invalidate:d=>{l.frameInvalidated=!0,l.debugFrameloop&&d&&(l.invalidations[d]=l.invalidations[d]?l.invalidations[d]+1:1)},advance:()=>{l.advance=!0}},u={flat:Ye(e),linear:Ye(r),dpr:Ye(t),setCamera:d=>{c.camera.set(d),c.composer&&(c.composer.passes.forEach(g=>{g instanceof Zc&&(g.camera=d)}),c.invalidate("Canvas: setting camera"))},raycastableObjects:new Set,interactiveObjects:new Set,raycaster:new qc,lastIntersection:null,addRaycastableObject:d=>{u.raycastableObjects.add(d)},removeRaycastableObject:d=>{u.raycastableObjects.delete(d)},addInteractiveObject:d=>{u.interactiveObjects.add(d)},removeInteractiveObject:d=>{u.interactiveObjects.delete(d)},addPass:d=>{!c.composer||(c.composer.addPass(d),c.invalidate("Canvas: adding pass"))},removePass:d=>{!c.composer||(c.composer.removePass(d),c.invalidate("Canvas: removing pass"))}},f={dispose:async(d=!1)=>{await Lr(),!(!f.shouldDispose&&!d)&&(f.disposableObjects.forEach((g,x)=>{var M;(g===0||d)&&((M=x==null?void 0:x.dispose)==null||M.call(x),f.disposableObjects.delete(x))}),f.shouldDispose=!1)},collectDisposableObjects:(d,g)=>{const x=g!=null?g:[];return d&&((d==null?void 0:d.dispose)&&typeof d.dispose=="function"&&d.type!=="Scene"&&x.push(d),Object.entries(d).forEach(([M,y])=>{if(M==="parent"||M==="children"||typeof y!="object")return;const w=y;w!=null&&w.dispose&&f.collectDisposableObjects(w,x)})),x},addDisposableObjects:d=>{d.forEach(g=>{const x=f.disposableObjects.get(g);x?f.disposableObjects.set(g,x+1):f.disposableObjects.set(g,1)})},removeDisposableObjects:d=>{d.length!==0&&(d.forEach(g=>{const x=f.disposableObjects.get(g);x&&x>0&&f.disposableObjects.set(g,x-1)}),f.shouldDispose=!0)},disposableObjects:new Map,shouldDispose:!1};return pn("threlte",c),pn("threlte-root",u),pn("threlte-render-context",l),pn("threlte-audio-context",a),pn("threlte-disposal-context",f),{ctx:c,rootCtx:u,renderCtx:l,audioCtx:a,disposalCtx:f,getCtx:()=>c,getRootCtx:()=>u,getRenderCtx:()=>l,getAudioCtx:()=>a,getDisposalCtx:()=>f}};function Cs(r,e){const t=Ye(r);let n=r;const i=t.subscribe(a=>n=a);return ut(i),{...t,set:a=>{if((a==null?void 0:a.uuid)===(n==null?void 0:n.uuid))return;const l=n;t.set(a),e==null||e(a,l)},update:a=>{const l=a(n);if((l==null?void 0:l.uuid)===(n==null?void 0:n.uuid))return;const c=n;t.set(l),e==null||e(l,c)}}}const Un=()=>In("threlte");function E_(r){let e;const t=r[8].default,n=xn(t,r,r[7],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,[s]){n&&n.p&&(!e||s&128)&&bn(n,t,i,i[7],e?Mn(t,i[7],s,null):Sn(i[7]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}const T_=()=>({onChildMount:In("threlte-hierarchical-object-on-mount"),onChildDestroy:In("threlte-hierarchical-object-on-destroy")}),Kc=()=>In("threlte-hierarchical-parent-context");function A_(r,e,t){var d;let n,{$$slots:i={},$$scope:s}=e,{object:o=void 0}=e,{children:a=[]}=e,{onChildMount:l=void 0}=e;const c=g=>{a.push(g),t(1,a),l==null||l(g)};let{onChildDestroy:u=void 0}=e;const f=g=>{const x=a.findIndex(M=>M.uuid===g.uuid);x!==-1&&a.splice(x,1),t(1,a),u==null||u(g)},{invalidate:h}=Un(),p=Kc();Ee(r,p,g=>t(6,n=g));let{parent:_=n}=e;const v=T_();o&&((d=v.onChildMount)==null||d.call(v,o),h("HierarchicalObject: object added"));const m=Cs(o,(g,x)=>{var M,y;x&&((M=v.onChildDestroy)==null||M.call(v,x),h("HierarchicalObject: object added")),g&&((y=v.onChildMount)==null||y.call(v,g),h("HierarchicalObject: object removed"))});return ut(()=>{var g;o&&((g=v.onChildDestroy)==null||g.call(v,o),h("HierarchicalObject: object removed"))}),pn("threlte-hierarchical-object-on-mount",c),pn("threlte-hierarchical-object-on-destroy",f),pn("threlte-hierarchical-parent-context",m),r.$$set=g=>{"object"in g&&t(3,o=g.object),"children"in g&&t(1,a=g.children),"onChildMount"in g&&t(4,l=g.onChildMount),"onChildDestroy"in g&&t(5,u=g.onChildDestroy),"parent"in g&&t(2,_=g.parent),"$$scope"in g&&t(7,s=g.$$scope)},r.$$.update=()=>{r.$$.dirty&64&&t(2,_=n),r.$$.dirty&8&&m.set(o)},[p,a,_,o,l,u,n,s,i]}class C_ extends gt{constructor(e){super(),mt(this,e,A_,E_,ft,{object:3,children:1,onChildMount:4,onChildDestroy:5,parent:2})}}function P_(r){let e;const t=r[1].default,n=xn(t,r,r[4],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&16)&&bn(n,t,i,i[4],e?Mn(t,i[4],s,null):Sn(i[4]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function L_(r){let e,t;return e=new C_({props:{object:r[0],onChildMount:r[2],onChildDestroy:r[3],$$slots:{default:[P_]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,[i]){const s={};i&1&&(s.object=n[0]),i&1&&(s.onChildMount=n[2]),i&1&&(s.onChildDestroy=n[3]),i&16&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function R_(r,e,t){let{$$slots:n={},$$scope:i}=e,{object:s}=e;const o=l=>s.add(l),a=l=>s.remove(l);return r.$$set=l=>{"object"in l&&t(0,s=l.object),"$$scope"in l&&t(4,i=l.$$scope)},[s,n,o,a,i]}class ko extends gt{constructor(e){super(),mt(this,e,R_,L_,ft,{object:0})}}const D_=()=>{const r=Ye({width:0,height:0});let e={width:0,height:0};const t=r.subscribe(o=>e=o);ut(t);let n;const i=()=>{const o=e;if(!n||!n.parentElement)return;const{clientWidth:a,clientHeight:l}=n.parentElement;(a!==o.width||l!==o.height)&&r.set({width:a,height:l})},s=o=>{n=o,i(),window.addEventListener("resize",i)};return As?(ut(()=>{window.removeEventListener("resize",i)}),{parentSizeAction:s,parentSize:r}):{parentSize:r,parentSizeAction:s}};function kl(r){let e,t;return e=new ko({props:{object:r[0].scene,$$slots:{default:[I_]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i[1]&4&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function I_(r){let e;const t=r[29].default,n=xn(t,r,r[33],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s[1]&4)&&bn(n,t,i,i[33],e?Mn(t,i[33],s,null):Sn(i[33]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function U_(r){let e,t,n,i,s=r[2]&&kl(r);return{c(){e=q("canvas"),s&&s.c(),V(e,"class","svelte-o3oskp")},m(o,a){Oe(o,e,a),s&&s.m(e,null),r[30](e),t=!0,n||(i=[ac(r[3].call(null,e)),Le(e,"click",r[9]),Le(e,"contextmenu",r[10]),Le(e,"pointerup",r[13]),Le(e,"pointerdown",r[11]),Le(e,"pointermove",r[12]),Le(e,"pointerenter",r[31]),Le(e,"pointerleave",r[32])],n=!0)},p(o,a){o[2]?s?(s.p(o,a),a[0]&4&&_e(s,1)):(s=kl(o),s.c(),_e(s,1),s.m(e,null)):s&&(Wn(),Se(s,1,1,()=>{s=null}),jn())},i(o){t||(_e(s),t=!0)},o(o){Se(s),t=!1},d(o){o&&Ne(e),s&&s.d(),r[30](null),n=!1,qt(i)}}}const Bl=new Set;function N_(r,e,t){let n,i,s,o,{$$slots:a={},$$scope:l}=e,{dpr:c=As?window.devicePixelRatio:1}=e,{flat:u=!1}=e,{linear:f=!1}=e,{frameloop:h="demand"}=e,{debugFrameloop:p=!1}=e,{shadows:_=!0}=e,{shadowMapType:v=mc}=e,{size:m=void 0}=e,{rendererParameters:d=void 0}=e,g,x=!1;const M=Ye(m),{parentSize:y,parentSizeAction:w}=D_(),C=w_(f,u,c,M,y,p,h),{getCtx:T,renderCtx:b,disposalCtx:S}=C,{ctx:F,rootCtx:k,audioCtx:L}=C;y_(F),Bl.add(F.invalidate),ut(()=>{Bl.delete(F.invalidate)});const{size:O,scene:B}=F;Ee(r,O,N=>t(26,i=N));const{flat:J,linear:R,dpr:H}=k;Ee(r,J,N=>t(27,s=N)),Ee(r,R,N=>t(28,o=N)),Ee(r,H,N=>t(25,n=N)),pn("threlte-parent",Ye(B)),or(()=>{!g||(f_(F,g,d),Ol(F,o,s),Fl(F,i,n),zl(F,_,v),t(2,x=!0))}),b_(F,k,b,S);const{onClick:Q,onContextMenu:K,onPointerDown:ve,onPointerMove:se,onPointerUp:j}=p_(F,k,b);ut(()=>{S.dispose(!0)});function ee(N){Vn[N?"unshift":"push"](()=>{g=N,t(1,g)})}const te=()=>T().pointerOverCanvas.set(!0),ue=()=>T().pointerOverCanvas.set(!1);return r.$$set=N=>{"dpr"in N&&t(14,c=N.dpr),"flat"in N&&t(15,u=N.flat),"linear"in N&&t(16,f=N.linear),"frameloop"in N&&t(17,h=N.frameloop),"debugFrameloop"in N&&t(18,p=N.debugFrameloop),"shadows"in N&&t(19,_=N.shadows),"shadowMapType"in N&&t(20,v=N.shadowMapType),"size"in N&&t(21,m=N.size),"rendererParameters"in N&&t(22,d=N.rendererParameters),"$$scope"in N&&t(33,l=N.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&2097152&&M.set(m),r.$$.dirty[0]&65536&&Ie(R,o=f,o),r.$$.dirty[0]&32768&&Ie(J,s=u,s),r.$$.dirty[0]&16384&&Ie(H,n=c,n),r.$$.dirty[0]&402653184&&Ol(T(),o,s),r.$$.dirty[0]&100663296&&Fl(T(),i,n),r.$$.dirty[0]&1572864&&zl(T(),_,v)},[F,g,x,w,T,O,J,R,H,Q,K,ve,se,j,c,u,f,h,p,_,v,m,d,k,L,n,i,s,o,a,ee,te,ue,l]}class O_ extends gt{constructor(e){super(),mt(this,e,N_,U_,ft,{dpr:14,flat:15,linear:16,frameloop:17,debugFrameloop:18,shadows:19,shadowMapType:20,size:21,rendererParameters:22,ctx:0,rootCtx:23,audioCtx:24},null,[-1,-1])}get ctx(){return this.$$.ctx[0]}get rootCtx(){return this.$$.ctx[23]}get audioCtx(){return this.$$.ctx[24]}}const Jc=()=>In("threlte-root"),F_=()=>In("threlte-disposal-context");function z_(r){let e;const t=r[9].default,n=xn(t,r,r[8],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,[s]){n&&n.p&&(!e||s&256)&&bn(n,t,i,i[8],e?Mn(t,i[8],s,null):Sn(i[8]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}const Gl="threlte-disposable-object-context";function k_(r,e,t){var m;let n,i,{$$slots:s={},$$scope:o}=e;const{collectDisposableObjects:a,addDisposableObjects:l,removeDisposableObjects:c}=F_();let{object:u=void 0}=e,f=u,{dispose:h=void 0}=e;const p=In(Gl);Ee(r,p,d=>t(7,i=d));const _=Ye((m=h!=null?h:i)!=null?m:!0);Ee(r,_,d=>t(6,n=d)),pn(Gl,_);let v=n?a(u):[];return l(v),ut(()=>{c(v)}),r.$$set=d=>{"object"in d&&t(2,u=d.object),"dispose"in d&&t(3,h=d.dispose),"$$scope"in d&&t(8,o=d.$$scope)},r.$$.update=()=>{var d;r.$$.dirty&136&&_.set((d=h!=null?h:i)!=null?d:!0),r.$$.dirty&116&&u!==f&&(c(v),t(5,v=n?a(u):[]),l(v),t(4,f=u))},[p,_,u,h,f,v,n,i,o,s]}class Bo extends gt{constructor(e){super(),mt(this,e,k_,z_,ft,{object:2,dispose:3})}}function B_(r,e,t){let n,i,{object:s}=e;const o=Cs(s);Ee(r,o,c=>t(4,i=c));const a=In("threlte-layers");Ee(r,a,c=>t(3,n=c));const{invalidate:l}=Un();return r.$$set=c=>{"object"in c&&t(2,s=c.object)},r.$$.update=()=>{if(r.$$.dirty&4&&o.set(s),r.$$.dirty&24){if(n==="all")i.layers.enableAll();else if(n==="none")i.layers.disableAll();else if(Array.isArray(n))for(let c=0;c<32;c+=1){const u=c;n.includes(u)?i.layers.enable(c):i.layers.disable(c)}else n!==void 0&&i.layers.set(n);l("LayerableObject")}},[o,a,s,n,i]}class $c extends gt{constructor(e){super(),mt(this,e,B_,null,ft,{object:2})}}const eu=(r,e)=>{var a;if(!As)return{start:()=>{},stop:()=>{},started:fc(!1)};const t=In("threlte-render-context"),n={fn:r,order:e==null?void 0:e.order,debugFrameloopMessage:e==null?void 0:e.debugFrameloopMessage},i=Ye(!1),s=()=>{t.frameHandlers.delete(n),i.set(!1)},o=()=>{t.frameHandlers.add(n),i.set(!0)};return((a=e==null?void 0:e.autostart)==null||a)&&o(),ut(()=>{s()}),{start:o,stop:s,started:{subscribe:i.subscribe}}},tu=()=>{const r=Ye(!1);return(async()=>{await Lr(),r.set(!0)})(),r};function G_(r,e,t){let n,i,{object:s}=e,{position:o=void 0}=e,{scale:a=void 0}=e,{rotation:l=void 0}=e,{lookAt:c=void 0}=e;const u=new I,f=_s(),{invalidate:h}=Un(),p=tu();Ee(r,p,x=>t(8,i=x));const _=async()=>{i||await Lr(),f("transform")},v=async()=>{h("TransformableObject: transformed"),await _()};Ln(s).onTransform=v;const{start:m,stop:d}=eu(async()=>{c&&!l&&c instanceof Et&&(c.getWorldPosition(u),s.lookAt(u),await _())},{autostart:!1,debugFrameloopMessage:"TransformableObject: tracking object"}),g=Cs(s);return Ee(r,g,x=>t(7,n=x)),r.$$set=x=>{"object"in x&&t(2,s=x.object),"position"in x&&t(3,o=x.position),"scale"in x&&t(4,a=x.scale),"rotation"in x&&t(5,l=x.rotation),"lookAt"in x&&t(6,c=x.lookAt)},r.$$.update=()=>{var x,M,y,w,C,T,b,S,F,k,L,O,B;r.$$.dirty&4&&g.set(s),r.$$.dirty&232&&(o&&(n.position.set((x=o.x)!=null?x:0,(M=o.y)!=null?M:0,(y=o.z)!=null?y:0),v()),c&&!l&&(c instanceof Et?m():(d(),n.lookAt((w=c.x)!=null?w:0,(C=c.y)!=null?C:0,(T=c.z)!=null?T:0),v())),c||d()),r.$$.dirty&144&&a&&(typeof a=="number"?n.scale.set(a,a,a):n.scale.set((b=a.x)!=null?b:1,(S=a.y)!=null?S:1,(F=a.z)!=null?F:1),v()),r.$$.dirty&160&&l&&(n.rotation.set((k=l.x)!=null?k:0,(L=l.y)!=null?L:0,(O=l.z)!=null?O:0,(B=l.order)!=null?B:"XYZ"),v())},[p,g,s,o,a,l,c,n]}class H_ extends gt{constructor(e){super(),mt(this,e,G_,null,ft,{object:2,position:3,scale:4,rotation:5,lookAt:6})}}function V_(r,e,t){let n,i,s,{object:o}=e,{viewportAware:a=!1}=e;const l=_s(),{camera:c,invalidate:u}=Un();Ee(r,c,w=>t(8,s=w));const f=new Uo,h=new vt,p=w=>w.type==="Mesh",_=new I,v=()=>s?(h.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),f.setFromProjectionMatrix(h),p(o)?f.intersectsObject(o):(o.getWorldPosition(_),f.containsPoint(_))):!0,m=tu();Ee(r,m,w=>t(7,i=w));let{inViewport:d=v()}=e;const g=async w=>{w?(i||await Lr(),l("viewportenter",o)):(i||await Lr(),l("viewportleave",o))},{start:x,stop:M,started:y}=eu(()=>{const w=v();d===void 0?(t(3,d=v()),g(d)):w!==d&&(g(w),t(3,d=w))},{autostart:a,debugFrameloopMessage:"ViewportAwareObject: tracking viewport visibility"});return Ee(r,y,w=>t(6,n=w)),u("ViewportAwareObject"),r.$$set=w=>{"object"in w&&t(4,o=w.object),"viewportAware"in w&&t(5,a=w.viewportAware),"inViewport"in w&&t(3,d=w.inViewport)},r.$$.update=()=>{r.$$.dirty&96&&(a&&!n?x():!a&&n&&M())},[c,m,y,d,o,a,n]}class W_ extends gt{constructor(e){super(),mt(this,e,V_,null,ft,{object:4,viewportAware:5,inViewport:3})}}function j_(r){let e;const t=r[14].default,n=xn(t,r,r[18],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&262144)&&bn(n,t,i,i[18],e?Mn(t,i[18],s,null):Sn(i[18]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function X_(r){let e,t;return e=new ko({props:{object:r[1],$$slots:{default:[j_]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&2&&(s.object=n[1]),i&262144&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function q_(r){let e,t,n,i,s,o,a,l,c;e=new $c({props:{object:r[1]}}),n=new H_({props:{object:r[1],position:r[2],rotation:r[4],scale:r[3],lookAt:r[5]}}),s=new Bo({props:{object:r[1],dispose:r[7],$$slots:{default:[X_]},$$scope:{ctx:r}}});function u(h){r[15](h)}let f={object:r[1],viewportAware:r[6]};return r[0]!==void 0&&(f.inViewport=r[0]),a=new W_({props:f}),Vn.push(()=>xs(a,"inViewport",u)),a.$on("viewportenter",r[16]),a.$on("viewportleave",r[17]),{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment),i=le(),nt(s.$$.fragment),o=le(),nt(a.$$.fragment)},m(h,p){$e(e,h,p),Oe(h,t,p),$e(n,h,p),Oe(h,i,p),$e(s,h,p),Oe(h,o,p),$e(a,h,p),c=!0},p(h,[p]){const _={};p&2&&(_.object=h[1]),e.$set(_);const v={};p&2&&(v.object=h[1]),p&4&&(v.position=h[2]),p&16&&(v.rotation=h[4]),p&8&&(v.scale=h[3]),p&32&&(v.lookAt=h[5]),n.$set(v);const m={};p&2&&(m.object=h[1]),p&128&&(m.dispose=h[7]),p&262146&&(m.$$scope={dirty:p,ctx:h}),s.$set(m);const d={};p&2&&(d.object=h[1]),p&64&&(d.viewportAware=h[6]),!l&&p&1&&(l=!0,d.inViewport=h[0],vs(()=>l=!1)),a.$set(d)},i(h){c||(_e(e.$$.fragment,h),_e(n.$$.fragment,h),_e(s.$$.fragment,h),_e(a.$$.fragment,h),c=!0)},o(h){Se(e.$$.fragment,h),Se(n.$$.fragment,h),Se(s.$$.fragment,h),Se(a.$$.fragment,h),c=!1},d(h){et(e,h),h&&Ne(t),et(n,h),h&&Ne(i),et(s,h),h&&Ne(o),et(a,h)}}}function Y_(r,e,t){let{$$slots:n={},$$scope:i}=e,{object:s}=e,{position:o=void 0}=e,{scale:a=void 0}=e,{rotation:l=void 0}=e,{lookAt:c=void 0}=e,{viewportAware:u=!1}=e,{inViewport:f=!1}=e,{castShadow:h=void 0}=e,{receiveShadow:p=void 0}=e,{frustumCulled:_=void 0}=e,{renderOrder:v=void 0}=e,{visible:m=void 0}=e,{dispose:d=void 0}=e,{userData:g=void 0}=e;const{invalidate:x}=Un(),M=()=>s;function y(T){f=T,t(0,f)}function w(T){$i.call(this,r,T)}function C(T){$i.call(this,r,T)}return r.$$set=T=>{"object"in T&&t(1,s=T.object),"position"in T&&t(2,o=T.position),"scale"in T&&t(3,a=T.scale),"rotation"in T&&t(4,l=T.rotation),"lookAt"in T&&t(5,c=T.lookAt),"viewportAware"in T&&t(6,u=T.viewportAware),"inViewport"in T&&t(0,f=T.inViewport),"castShadow"in T&&t(8,h=T.castShadow),"receiveShadow"in T&&t(9,p=T.receiveShadow),"frustumCulled"in T&&t(10,_=T.frustumCulled),"renderOrder"in T&&t(11,v=T.renderOrder),"visible"in T&&t(12,m=T.visible),"dispose"in T&&t(7,d=T.dispose),"userData"in T&&t(13,g=T.userData),"$$scope"in T&&t(18,i=T.$$scope)},r.$$.update=()=>{r.$$.dirty&16128&&(m!==void 0&&(M().visible=m),h!==void 0&&(M().castShadow=h),p!==void 0&&(M().receiveShadow=p),_!==void 0&&(M().frustumCulled=_),v!==void 0&&(M().renderOrder=v),g!==void 0&&(M().userData={...M().userData,...g}),x("Object3DInstance: props changed"))},[f,s,o,a,l,c,u,d,h,p,_,v,m,g,n,y,w,C,i]}class Z_ extends gt{constructor(e){super(),mt(this,e,Y_,q_,ft,{object:1,position:2,scale:3,rotation:4,lookAt:5,viewportAware:6,inViewport:0,castShadow:8,receiveShadow:9,frustumCulled:10,renderOrder:11,visible:12,dispose:7,userData:13})}}function Q_(r){let e;const t=r[17].default,n=xn(t,r,r[21],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&2097152)&&bn(n,t,i,i[21],e?Mn(t,i[21],s,null):Sn(i[21]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function K_(r){let e,t,n;function i(o){r[18](o)}let s={object:r[1],lookAt:r[5],castShadow:r[7],receiveShadow:r[8],frustumCulled:r[9],renderOrder:r[10],position:r[2],scale:r[3],rotation:r[4],viewportAware:r[6],visible:r[11],userData:r[12],dispose:r[13],$$slots:{default:[Q_]},$$scope:{ctx:r}};return r[0]!==void 0&&(s.inViewport=r[0]),e=new Z_({props:s}),Vn.push(()=>xs(e,"inViewport",i)),e.$on("viewportenter",r[19]),e.$on("viewportleave",r[20]),{c(){nt(e.$$.fragment)},m(o,a){$e(e,o,a),n=!0},p(o,[a]){const l={};a&2&&(l.object=o[1]),a&32&&(l.lookAt=o[5]),a&128&&(l.castShadow=o[7]),a&256&&(l.receiveShadow=o[8]),a&512&&(l.frustumCulled=o[9]),a&1024&&(l.renderOrder=o[10]),a&4&&(l.position=o[2]),a&8&&(l.scale=o[3]),a&16&&(l.rotation=o[4]),a&64&&(l.viewportAware=o[6]),a&2048&&(l.visible=o[11]),a&4096&&(l.userData=o[12]),a&8192&&(l.dispose=o[13]),a&2097152&&(l.$$scope={dirty:a,ctx:o}),!t&&a&1&&(t=!0,l.inViewport=o[0],vs(()=>t=!1)),e.$set(l)},i(o){n||(_e(e.$$.fragment,o),n=!0)},o(o){Se(e.$$.fragment,o),n=!1},d(o){et(e,o)}}}function J_(r,e,t){let n,{$$slots:i={},$$scope:s}=e,{camera:o}=e,{position:a=void 0}=e,{scale:l=void 0}=e,{rotation:c=void 0}=e,{lookAt:u=void 0}=e,{viewportAware:f=!1}=e,{inViewport:h=!1}=e,{castShadow:p=void 0}=e,{receiveShadow:_=void 0}=e,{frustumCulled:v=void 0}=e,{renderOrder:m=void 0}=e,{visible:d=void 0}=e,{userData:g=void 0}=e,{dispose:x=void 0}=e,{useCamera:M=!1}=e;const y=Cs(o);Ee(r,y,S=>t(16,n=S));const{setCamera:w}=Jc();function C(S){h=S,t(0,h)}function T(S){$i.call(this,r,S)}function b(S){$i.call(this,r,S)}return r.$$set=S=>{"camera"in S&&t(1,o=S.camera),"position"in S&&t(2,a=S.position),"scale"in S&&t(3,l=S.scale),"rotation"in S&&t(4,c=S.rotation),"lookAt"in S&&t(5,u=S.lookAt),"viewportAware"in S&&t(6,f=S.viewportAware),"inViewport"in S&&t(0,h=S.inViewport),"castShadow"in S&&t(7,p=S.castShadow),"receiveShadow"in S&&t(8,_=S.receiveShadow),"frustumCulled"in S&&t(9,v=S.frustumCulled),"renderOrder"in S&&t(10,m=S.renderOrder),"visible"in S&&t(11,d=S.visible),"userData"in S&&t(12,g=S.userData),"dispose"in S&&t(13,x=S.dispose),"useCamera"in S&&t(15,M=S.useCamera),"$$scope"in S&&t(21,s=S.$$scope)},r.$$.update=()=>{r.$$.dirty&2&&y.set(o),r.$$.dirty&98304&&M&&w(n)},[h,o,a,l,c,u,f,p,_,v,m,d,g,x,y,M,n,i,C,T,b,s]}class $_ extends gt{constructor(e){super(),mt(this,e,J_,K_,ft,{camera:1,position:2,scale:3,rotation:4,lookAt:5,viewportAware:6,inViewport:0,castShadow:7,receiveShadow:8,frustumCulled:9,renderOrder:10,visible:11,userData:12,dispose:13,useCamera:15})}}function e0(r){let e;const t=r[20].default,n=xn(t,r,r[24],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&16777216)&&bn(n,t,i,i[24],e?Mn(t,i[24],s,null):Sn(i[24]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function t0(r){let e,t,n;function i(o){r[21](o)}let s={camera:r[0],position:r[2],scale:r[3],rotation:r[4],castShadow:r[6],receiveShadow:r[7],frustumCulled:r[8],renderOrder:r[9],visible:r[10],userData:r[11],dispose:r[12],viewportAware:r[13],lookAt:r[5],useCamera:r[14],$$slots:{default:[e0]},$$scope:{ctx:r}};return r[1]!==void 0&&(s.inViewport=r[1]),e=new $_({props:s}),Vn.push(()=>xs(e,"inViewport",i)),e.$on("viewportenter",r[22]),e.$on("viewportleave",r[23]),{c(){nt(e.$$.fragment)},m(o,a){$e(e,o,a),n=!0},p(o,[a]){const l={};a&1&&(l.camera=o[0]),a&4&&(l.position=o[2]),a&8&&(l.scale=o[3]),a&16&&(l.rotation=o[4]),a&64&&(l.castShadow=o[6]),a&128&&(l.receiveShadow=o[7]),a&256&&(l.frustumCulled=o[8]),a&512&&(l.renderOrder=o[9]),a&1024&&(l.visible=o[10]),a&2048&&(l.userData=o[11]),a&4096&&(l.dispose=o[12]),a&8192&&(l.viewportAware=o[13]),a&32&&(l.lookAt=o[5]),a&16384&&(l.useCamera=o[14]),a&16777216&&(l.$$scope={dirty:a,ctx:o}),!t&&a&2&&(t=!0,l.inViewport=o[1],vs(()=>t=!1)),e.$set(l)},i(o){n||(_e(e.$$.fragment,o),n=!0)},o(o){Se(e.$$.fragment,o),n=!1},d(o){et(e,o)}}}function n0(r,e,t){let n,{$$slots:i={},$$scope:s}=e,{position:o=void 0}=e,{scale:a=void 0}=e,{rotation:l=void 0}=e,{lookAt:c=void 0}=e,{castShadow:u=void 0}=e,{receiveShadow:f=void 0}=e,{frustumCulled:h=void 0}=e,{renderOrder:p=void 0}=e,{visible:_=void 0}=e,{userData:v=void 0}=e,{dispose:m=void 0}=e,{viewportAware:d=!1}=e,{inViewport:g=!1}=e,{useCamera:x=!0}=e,{near:M=void 0}=e,{far:y=void 0}=e,{fov:w=void 0}=e;const{size:C,invalidate:T}=Un();Ee(r,C,L=>t(19,n=L));const b=new sn(w,n.width/n.height,M,y);function S(L){g=L,t(1,g)}function F(L){$i.call(this,r,L)}function k(L){$i.call(this,r,L)}return r.$$set=L=>{"position"in L&&t(2,o=L.position),"scale"in L&&t(3,a=L.scale),"rotation"in L&&t(4,l=L.rotation),"lookAt"in L&&t(5,c=L.lookAt),"castShadow"in L&&t(6,u=L.castShadow),"receiveShadow"in L&&t(7,f=L.receiveShadow),"frustumCulled"in L&&t(8,h=L.frustumCulled),"renderOrder"in L&&t(9,p=L.renderOrder),"visible"in L&&t(10,_=L.visible),"userData"in L&&t(11,v=L.userData),"dispose"in L&&t(12,m=L.dispose),"viewportAware"in L&&t(13,d=L.viewportAware),"inViewport"in L&&t(1,g=L.inViewport),"useCamera"in L&&t(14,x=L.useCamera),"near"in L&&t(16,M=L.near),"far"in L&&t(17,y=L.far),"fov"in L&&t(18,w=L.fov),"$$scope"in L&&t(24,s=L.$$scope)},r.$$.update=()=>{r.$$.dirty&524289&&(t(0,b.aspect=n.width/n.height,b),b.updateProjectionMatrix(),T("PerspectiveCamera: aspect changed")),r.$$.dirty&458753&&(M!==void 0&&t(0,b.near=M,b),y!==void 0&&t(0,b.far=y,b),w!==void 0&&t(0,b.fov=w,b),b.updateProjectionMatrix(),T("PerspectiveCamera: props changed"))},[b,g,o,a,l,c,u,f,h,p,_,v,m,d,x,C,M,y,w,n,i,S,F,k,s]}class i0 extends gt{constructor(e){super(),mt(this,e,n0,t0,ft,{position:2,scale:3,rotation:4,lookAt:5,castShadow:6,receiveShadow:7,frustumCulled:8,renderOrder:9,visible:10,userData:11,dispose:12,viewportAware:13,inViewport:1,useCamera:14,near:16,far:17,fov:18,camera:0})}get camera(){return this.$$.ctx[0]}}const Hl=[],r0=(r,e)=>{const t=Hl.find(i=>i instanceof r);if(t)return t;const n=e();return Hl.push(n),n},hi=new qc,Qt=new I,Jn=new I,dt=new Wt,Vl={X:new I(1,0,0),Y:new I(0,1,0),Z:new I(0,0,1)},co={type:"change"},Wl={type:"mouseDown"},jl={type:"mouseUp",mode:null},Xl={type:"objectChange"};class s0 extends Et{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const n=new f0;this._gizmo=n,this.add(n);const i=new h0;this._plane=i,this.add(i);const s=this;function o(g,x){let M=x;Object.defineProperty(s,g,{get:function(){return M!==void 0?M:x},set:function(y){M!==y&&(M=y,i[g]=y,n[g]=y,s.dispatchEvent({type:g+"-changed",value:y}),s.dispatchEvent(co))}}),s[g]=x,i[g]=x,n[g]=x}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new I,l=new I,c=new Wt,u=new Wt,f=new I,h=new Wt,p=new I,_=new I,v=new I,m=0,d=new I;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",c),o("worldQuaternionStart",u),o("cameraPosition",f),o("cameraQuaternion",h),o("pointStart",p),o("pointEnd",_),o("rotationAxis",v),o("rotationAngle",m),o("eye",d),this._offset=new I,this._startNorm=new I,this._endNorm=new I,this._cameraScale=new I,this._parentPosition=new I,this._parentQuaternion=new Wt,this._parentQuaternionInv=new Wt,this._parentScale=new I,this._worldScaleStart=new I,this._worldQuaternionInv=new Wt,this._worldScale=new I,this._positionStart=new I,this._quaternionStart=new Wt,this._scaleStart=new I,this._getPointer=o0.bind(this),this._onPointerDown=l0.bind(this),this._onPointerHover=a0.bind(this),this._onPointerMove=c0.bind(this),this._onPointerUp=u0.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;hi.setFromCamera(e,this.camera);const t=uo(this._gizmo.picker[this.mode],hi);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){hi.setFromCamera(e,this.camera);const t=uo(this._plane,hi,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,Wl.mode=this.mode,this.dispatchEvent(Wl)}}pointerMove(e){const t=this.axis,n=this.mode,i=this.object;let s=this.space;if(n==="scale"?s="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(s="world"),i===void 0||t===null||this.dragging===!1||e.button!==-1)return;hi.setFromCamera(e,this.camera);const o=uo(this._plane,hi,!0);if(!!o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),n==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),s==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),s==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(s==="local"&&(i.position.applyQuaternion(dt.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),s==="world"&&(i.parent&&i.position.add(Qt.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(Qt.setFromMatrixPosition(i.parent.matrixWorld))));else if(n==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Jn.set(a,a,a)}else Qt.copy(this.pointStart),Jn.copy(this.pointEnd),Qt.applyQuaternion(this._worldQuaternionInv),Jn.applyQuaternion(this._worldQuaternionInv),Jn.divide(Qt),t.search("X")===-1&&(Jn.x=1),t.search("Y")===-1&&(Jn.y=1),t.search("Z")===-1&&(Jn.z=1);i.scale.copy(this._scaleStart).multiply(Jn),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(n==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Qt.setFromMatrixPosition(this.camera.matrixWorld));t==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Qt.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Vl[t]),Qt.copy(Vl[t]),s==="local"&&Qt.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(Qt.cross(this.eye).normalize())*a),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),s==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(dt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(dt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(co),this.dispatchEvent(Xl)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(jl.mode=this.mode,this.dispatchEvent(jl)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){!this.enabled||this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(co),this.dispatchEvent(Xl),this.pointStart.copy(this.pointEnd))}getRaycaster(){return hi}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function o0(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const e=this.domElement.getBoundingClientRect();return{x:(r.clientX-e.left)/e.width*2-1,y:-(r.clientY-e.top)/e.height*2+1,button:r.button}}}function a0(r){if(!!this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function l0(r){!this.enabled||(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function c0(r){!this.enabled||this.pointerMove(this._getPointer(r))}function u0(r){!this.enabled||(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function uo(r,e,t){const n=e.intersectObject(r,!0);for(let i=0;i.9&&(o.visible=!1)),this.axis==="Y"&&(dt.setFromEuler(os.set(0,0,Math.PI/2)),o.quaternion.copy(n).multiply(dt),Math.abs(it.copy(mi).applyQuaternion(n).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(dt.setFromEuler(os.set(0,Math.PI/2,0)),o.quaternion.copy(n).multiply(dt),Math.abs(it.copy(yr).applyQuaternion(n).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(dt.setFromEuler(os.set(0,Math.PI/2,0)),it.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(Yl.lookAt(ql,it,mi)),o.quaternion.multiply(dt),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Qt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Qt.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Qt),o.visible=this.dragging):(o.quaternion.copy(n),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(n),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(it.copy(Sr).applyQuaternion(n).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(it.copy(mi).applyQuaternion(n).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(it.copy(yr).applyQuaternion(n).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(it.copy(yr).applyQuaternion(n).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(it.copy(Sr).applyQuaternion(n).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(it.copy(mi).applyQuaternion(n).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(as.copy(n),it.copy(this.eye).applyQuaternion(dt.copy(n).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(Yl.lookAt(this.eye,ql,mi)),o.name==="X"&&(dt.setFromAxisAngle(Sr,Math.atan2(-it.y,it.z)),dt.multiplyQuaternions(as,dt),o.quaternion.copy(dt)),o.name==="Y"&&(dt.setFromAxisAngle(mi,Math.atan2(it.x,it.z)),dt.multiplyQuaternions(as,dt),o.quaternion.copy(dt)),o.name==="Z"&&(dt.setFromAxisAngle(yr,Math.atan2(it.y,it.x)),dt.multiplyQuaternions(as,dt),o.quaternion.copy(dt))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(l){return o.name===l}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class h0 extends pe{constructor(){super(new ws(1e5,1e5,2,2),new ys({visible:!1,wireframe:!0,side:Pn,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),ls.copy(Sr).applyQuaternion(t==="local"?this.worldQuaternion:ds),_r.copy(mi).applyQuaternion(t==="local"?this.worldQuaternion:ds),vr.copy(yr).applyQuaternion(t==="local"?this.worldQuaternion:ds),it.copy(_r),this.mode){case"translate":case"scale":switch(this.axis){case"X":it.copy(this.eye).cross(ls),wn.copy(ls).cross(it);break;case"Y":it.copy(this.eye).cross(_r),wn.copy(_r).cross(it);break;case"Z":it.copy(this.eye).cross(vr),wn.copy(vr).cross(it);break;case"XY":wn.copy(vr);break;case"YZ":wn.copy(ls);break;case"XZ":it.copy(vr),wn.copy(_r);break;case"XYZ":case"E":wn.set(0,0,0);break}break;case"rotate":default:wn.set(0,0,0)}wn.length()===0?this.quaternion.copy(this.cameraQuaternion):(Zl.lookAt(Qt.set(0,0,0),wn,it),this.quaternion.setFromRotationMatrix(Zl)),super.updateMatrixWorld(e)}}function d0(r){let e,t,n,i;return e=new Bo({props:{dispose:r[0],object:r[1]}}),n=new $c({props:{object:r[1]}}),{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment)},m(s,o){$e(e,s,o),Oe(s,t,o),$e(n,s,o),i=!0},p(s,[o]){const a={};o&1&&(a.dispose=s[0]),o&2&&(a.object=s[1]),e.$set(a);const l={};o&2&&(l.object=s[1]),n.$set(l)},i(s){i||(_e(e.$$.fragment,s),_e(n.$$.fragment,s),i=!0)},o(s){Se(e.$$.fragment,s),Se(n.$$.fragment,s),i=!1},d(s){et(e,s),s&&Ne(t),et(n,s)}}}function p0(r,e,t){let n,i,{autoPauseOrbitControls:s=!0}=e,{mode:o=void 0}=e,{axis:a=null}=e,{dragging:l=!1}=e,{enabled:c=void 0}=e,{translationSnap:u=void 0}=e,{scaleSnap:f=void 0}=e,{rotationSnap:h=void 0}=e,{showX:p=void 0}=e,{showY:_=void 0}=e,{showZ:v=void 0}=e,{size:m=void 0}=e,{space:d=void 0}=e,{dispose:g=void 0}=e;const{camera:x,renderer:M,invalidate:y,scene:w}=Un();Ee(r,x,R=>t(20,i=R));const C=Kc();if(Ee(r,C,R=>t(19,n=R)),!n)throw new Error("TransformControls: parent not defined. Is this component a child of ?");const T=_s(),b=()=>{if(!!i)return Ln(i).orbitControls};let S;const F=()=>{if(S!==void 0){const R=b();R&&(R.enabled=S),S=void 0}};ut(F);const k={change:R=>{var H,Q;n&&((Q=(H=Ln(n)).onTransform)==null||Q.call(H)),y("TransformControls: change event"),T("change",R)},"camera-changed":R=>T("camera-changed",R),"object-changed":R=>T("object-changed",R),"enabled-changed":R=>T("enabled-changed",R),"axis-changed":R=>{t(4,a=R.value),T("axis-changed",R)},"mode-changed":R=>T("mode-changed",R),"translationSnap-changed":R=>T("translationSnap-changed",R),"rotationSnap-changed":R=>T("rotationSnap-changed",R),"scaleSnap-changed":R=>T("scaleSnap-changed",R),"space-changed":R=>T("space-changed",R),"size-changed":R=>T("size-changed",R),"dragging-changed":R=>{t(5,l=R.value);e:if(s){const H=b();if(!H)break e;const Q=!R.value;if(H.enabled===Q)break e;R.value&&(S=H.enabled),H.enabled=Q}T("dragging-changed",R)},"showX-changed":R=>T("showX-changed",R),"showY-changed":R=>T("showY-changed",R),"showZ-changed":R=>T("showZ-changed",R),"worldPosition-changed":R=>T("worldPosition-changed",R),"worldPositionStart-changed":R=>T("worldPositionStart-changed",R),"worldQuaternion-changed":R=>T("worldQuaternion-changed",R),"worldQuaternionStart-changed":R=>T("worldQuaternionStart-changed",R),"cameraPosition-changed":R=>T("cameraPosition-changed",R),"cameraQuaternion-changed":R=>T("cameraQuaternion-changed",R),"pointStart-changed":R=>T("pointStart-changed",R),"pointEnd-changed":R=>T("pointEnd-changed",R),"rotationAxis-changed":R=>T("rotationAxis-changed",R),"rotationAngle-changed":R=>T("rotationAngle-changed",R),"eye-changed":R=>T("eye-changed",R),mouseDown:()=>T("mouseDown"),mouseUp:()=>T("mouseUp"),objectChange:()=>T("objectChange")};if(!M)throw new Error("TransformControls: renderer is undefined, is this component a child of ?");const L=new s0(i,M.domElement),O=()=>L.reset();L.attach(n);const B=()=>{Object.entries(k).forEach(([R,H])=>{L.addEventListener(R,H)})},J=()=>{Object.entries(k).forEach(([R,H])=>{L.removeEventListener(R,H)})};return B(),w.add(L),ut(()=>{L.detach(),w.remove(L),J()}),r.$$set=R=>{"autoPauseOrbitControls"in R&&t(6,s=R.autoPauseOrbitControls),"mode"in R&&t(7,o=R.mode),"axis"in R&&t(4,a=R.axis),"dragging"in R&&t(5,l=R.dragging),"enabled"in R&&t(8,c=R.enabled),"translationSnap"in R&&t(9,u=R.translationSnap),"scaleSnap"in R&&t(10,f=R.scaleSnap),"rotationSnap"in R&&t(11,h=R.rotationSnap),"showX"in R&&t(12,p=R.showX),"showY"in R&&t(13,_=R.showY),"showZ"in R&&t(14,v=R.showZ),"size"in R&&t(15,m=R.size),"space"in R&&t(16,d=R.space),"dispose"in R&&t(0,g=R.dispose)},r.$$.update=()=>{r.$$.dirty&64&&(s||F()),r.$$.dirty&256&&c!==void 0&&t(1,L.enabled=c,L),r.$$.dirty&4096&&p!==void 0&&t(1,L.showX=p,L),r.$$.dirty&8192&&_!==void 0&&t(1,L.showY=_,L),r.$$.dirty&16384&&v!==void 0&&t(1,L.showZ=v,L),r.$$.dirty&130&&o!==void 0&&L.setMode(o),r.$$.dirty&514&&u!==void 0&&L.setTranslationSnap(u),r.$$.dirty&1026&&f!==void 0&&L.setScaleSnap(f),r.$$.dirty&2050&&h!==void 0&&L.setRotationSnap(h),r.$$.dirty&32770&&m!==void 0&&L.setSize(m),r.$$.dirty&65538&&d!==void 0&&L.setSpace(d)},[g,L,x,C,a,l,s,o,c,u,f,h,p,_,v,m,d,O]}class m0 extends gt{constructor(e){super(),mt(this,e,p0,d0,ft,{autoPauseOrbitControls:6,mode:7,axis:4,dragging:5,enabled:8,translationSnap:9,scaleSnap:10,rotationSnap:11,showX:12,showY:13,showZ:14,size:15,space:16,dispose:0,reset:17})}get reset(){return this.$$.ctx[17]}}const nu=new Et;nu.scale.set(0,0,0);nu.matrix;new vt().fromArray(new Array(16).fill(0));new Je(16777215);const iu=(r,e)=>{if(e.includes(".")){const t=e.split("."),n=t.pop();for(let i=0;i{const{invalidate:r}=Un();let e=!1,t=fo,n,i,s;const o=(l,c,u)=>{if(a(),!u){const f=l;((f==null?void 0:f.isMaterial)||!1)&&(u="material"),((f==null?void 0:f.isBufferGeometry)||(f==null?void 0:f.isGeometry)||!1)&&(u="geometry")}if(!!u){if(typeof u=="function")n=u(c,l);else{const{target:f,key:h}=iu(c,u);t=f[h],f[h]=l,i=f,s=h}e=!0,r()}},a=()=>{!e||(n?(n(),n=void 0):i&&s&&t!==fo&&(i[s]=t,t=fo,i=void 0,s=void 0),e=!1,r())};return ut(()=>{a()}),{update:o}},_0=r=>r&&r.isCamera,ru=r=>r&&r.isOrthographicCamera,su=r=>r&&r.isPerspectiveCamera,v0=r=>su(r)||ru(r),x0=()=>{const{invalidate:r,size:e}=Un(),{setCamera:t}=Jc();let n,i;ut(()=>{i==null||i()});const s=l=>{!n||(ru(n)?(n.left=l.width/-2,n.right=l.width/2,n.top=l.height/2,n.bottom=l.height/-2,n.updateProjectionMatrix(),n.updateMatrixWorld(),r()):su(n)&&(n.aspect=l.width/l.height,n.updateProjectionMatrix(),n.updateMatrixWorld(),r()))};return{update:(l,c)=>{if(i==null||i(),c||!v0(l)){n=void 0;return}n=l,i=e.subscribe(s)},makeDefaultCamera:(l,c)=>{!_0(l)||!c||(t(l),r())}}},Ql=r=>!!(r!=null&&r.addEventListener),M0=()=>{const r=_s(),e=sr(),t=h=>{h!=null&&h.type&&r(h.type,h)},n=(h,p)=>{Ql(h)&&p.forEach(_=>{h.removeEventListener(_,t)})},i=(h,p)=>{Ql(h)&&p.forEach(_=>{h.addEventListener(_,t)})};let s=[],o;const a=Ye([]),l=a.subscribe(h=>{n(o,s),i(o,h),s=h});ut(l);const c=Ye(),u=c.subscribe(h=>{n(o,s),i(h,s),o=h});return ut(u),ut(()=>{n(o,s)}),or(()=>{a.set(Object.keys(e.$$.callbacks))}),{updateRef:h=>{c.set(h)}}},b0=["$$scope","$$slots","type","args","attach","instance"],S0=["fov","aspect","near","far","left","right","top","bottom","zoom"],y0=r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r=="undefined"||r===null,w0=()=>{const{invalidate:r}=Un(),e=new Map,t=(i,s,o,a)=>{var u,f;if(y0(o)){const h=e.get(s);if(h&&h.instance===i&&h.value===o)return;e.set(s,{instance:i,value:o})}const{key:l,target:c}=iu(i,s);if(!Array.isArray(o)&&typeof o=="number"&&typeof((u=c[l])==null?void 0:u.setScalar)=="function")c[l].setScalar(o);else if(typeof((f=c[l])==null?void 0:f.set)=="function")Array.isArray(o)?c[l].set(...o):c[l].set(o);else{if(c[l]=o,a.manualCamera)return;S0.includes(l)&&(c.isPerspectiveCamera||c.isOrthographicCamera)&&c.updateProjectionMatrix()}};return{updateProps:(i,s,o)=>{for(const a in s)b0.includes(a)||t(i,a,s[a],o),r()}}},E0=r=>({ref:r&1}),Kl=r=>({ref:r[0]}),T0=r=>({ref:r&1}),Jl=r=>({ref:r[0]});function $l(r){let e,t;return e=new Bo({props:{object:r[0],dispose:r[1]}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&1&&(s.object=n[0]),i&2&&(s.dispose=n[1]),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function A0(r){let e;const t=r[12].default,n=xn(t,r,r[13],Kl);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&8193)&&bn(n,t,i,i[13],e?Mn(t,i[13],s,E0):Sn(i[13]),Kl)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function C0(r){let e,t;return e=new ko({props:{object:r[0],$$slots:{default:[P0]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&1&&(s.object=n[0]),i&8193&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function P0(r){let e;const t=r[12].default,n=xn(t,r,r[13],Jl);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&8193)&&bn(n,t,i,i[13],e?Mn(t,i[13],s,T0):Sn(i[13]),Jl)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function L0(r){let e=r[4](r[0]),t,n,i,s,o,a,l=e&&$l(r);const c=[C0,A0],u=[];function f(h,p){return p&1&&(n=null),n==null&&(n=!!h[3](h[0])),n?0:1}return i=f(r,-1),s=u[i]=c[i](r),{c(){l&&l.c(),t=le(),s.c(),o=ri()},m(h,p){l&&l.m(h,p),Oe(h,t,p),u[i].m(h,p),Oe(h,o,p),a=!0},p(h,[p]){p&1&&(e=h[4](h[0])),e?l?(l.p(h,p),p&1&&_e(l,1)):(l=$l(h),l.c(),_e(l,1),l.m(t.parentNode,t)):l&&(Wn(),Se(l,1,1,()=>{l=null}),jn());let _=i;i=f(h,p),i===_?u[i].p(h,p):(Wn(),Se(u[_],1,1,()=>{u[_]=null}),jn(),s=u[i],s?s.p(h,p):(s=u[i]=c[i](h),s.c()),_e(s,1),s.m(o.parentNode,o))},i(h){a||(_e(l),_e(s),a=!0)},o(h){Se(l),Se(s),a=!1},d(h){l&&l.d(h),h&&Ne(t),u[i].d(h),h&&Ne(o)}}}function R0(r,e,t){const n=["type","args","attach","manual","makeDefault","dispose","ref"];let i=Wo(e,n),s,{$$slots:o={},$$scope:a}=e,{type:l}=e,{args:c=void 0}=e,{attach:u=void 0}=e,{manual:f=void 0}=e,{makeDefault:h=void 0}=e,{dispose:p=void 0}=e;const _=In("threlte-hierarchical-parent-context");Ee(r,_,S=>t(11,s=S));const v=S=>typeof S=="function"&&/^\s*class\s+/.test(S.toString()),m=S=>Array.isArray(S);let{ref:d=v(l)&&m(c)?new l(...c):v(l)?new l:l}=e,g=!1;const x=Ye(d);pn("threlte-hierarchical-parent-context",x);const M=w0(),y=x0(),w=g0(),C=M0(),T=S=>!!S.isObject3D,b=S=>S.dispose!==void 0;return r.$$set=S=>{e=ho(ho({},e),cu(S)),t(21,i=Wo(e,n)),"type"in S&&t(5,l=S.type),"args"in S&&t(6,c=S.args),"attach"in S&&t(7,u=S.attach),"manual"in S&&t(8,f=S.manual),"makeDefault"in S&&t(9,h=S.makeDefault),"dispose"in S&&t(1,p=S.dispose),"ref"in S&&t(0,d=S.ref),"$$scope"in S&&t(13,a=S.$$scope)},r.$$.update=()=>{r.$$.dirty&1120&&(g?t(0,d=v(l)&&m(c)?new l(...c):v(l)?new l:l):t(10,g=!0)),r.$$.dirty&1&&x.set(d),M.updateProps(d,i,{manualCamera:f}),r.$$.dirty&257&&y.update(d,f),r.$$.dirty&513&&y.makeDefaultCamera(d,h),r.$$.dirty&2177&&w.update(d,s,u),r.$$.dirty&1&&C.updateRef(d)},[d,p,_,T,b,l,c,u,f,h,g,s,o,a]}class D0 extends gt{constructor(e){super(),mt(this,e,R0,L0,ft,{type:5,args:6,attach:7,manual:8,makeDefault:9,dispose:1,ref:0})}}function I0(r){return console.error("The component can only be used in conjunction with the custom preprocessor."),[]}class ec extends gt{constructor(e){super(),mt(this,e,I0,null,ft,{})}}new Proxy(ec,{get(r,e){return r[e]||ec}});r0(fl,()=>new fl(Wc));function tc(r){let e,t,n,i,s,o=r[4]=="translate"?"rotate":"translate",a,l,c,u,f,h,p,_,v,m,d,g,x,M,y,w=r[2].x.toFixed(2)+"",C,T,b,S,F,k,L=-r[2].z.toFixed(2)+"",O,B,J,R,H,Q,K=r[2].y.toFixed(2)+"",ve,se,j,ee,te,ue,N,Re,Ce,oe,Te,je,ye,Ue,lt,xt,Mt,_t,Xe=Kt.radToDeg(r[3].x).toFixed(2)+"",st,It,P,E,Y,ne,re=Kt.radToDeg(r[3].y).toFixed(2)+"",fe,Pe,de,$,xe,we,Ae=Kt.radToDeg(r[3].z).toFixed(2)+"",ge,Me,Fe,Ze,ct,U,W,ie,he,be,Ke,He,Tt,Yt,ht,Lt,kt,Nn,si,Fr,fr,On,A,z,Z,G,X=r[12]==null&&nc(r);return On=new O_({props:{$$slots:{default:[N0]},$$scope:{ctx:r}}}),{c(){e=q("div"),t=q("div"),n=q("div"),i=q("button"),s=rt("Change to "),a=rt(o),l=le(),c=q("div"),u=q("button"),u.textContent="Reset Rotation",f=le(),h=q("button"),h.textContent="Reset Position",p=le(),_=q("div"),v=q("p"),v.textContent="Translation Snap",m=le(),d=q("div"),g=q("div"),x=q("p"),x.textContent="x",M=le(),y=q("p"),C=rt(w),T=le(),b=q("div"),S=q("p"),S.textContent="y",F=le(),k=q("p"),O=rt(L),B=le(),J=q("div"),R=q("p"),R.textContent="z",H=le(),Q=q("p"),ve=rt(K),se=le(),j=q("div"),ee=q("div"),te=rt(r[5]),ue=le(),N=q("input"),Re=le(),Ce=q("button"),Ce.textContent="Place On Ground",oe=le(),Te=q("div"),je=q("p"),je.textContent="Rotation Snap",ye=le(),Ue=q("div"),lt=q("div"),xt=q("p"),xt.textContent="x",Mt=le(),_t=q("p"),st=rt(Xe),It=le(),P=q("div"),E=q("p"),E.textContent="y",Y=le(),ne=q("p"),fe=rt(re),Pe=le(),de=q("div"),$=q("p"),$.textContent="z",xe=le(),we=q("p"),ge=rt(Ae),Me=le(),Fe=q("div"),Ze=q("div"),ct=rt(r[6]),U=le(),W=q("input"),ie=le(),he=q("p"),he.textContent="Object Alpha",be=le(),Ke=q("div"),He=q("input"),Tt=le(),Yt=q("button"),Yt.textContent="Stop Placement",ht=le(),Lt=q("button"),kt=q("i"),Fr=le(),X&&X.c(),fr=le(),nt(On.$$.fragment),V(i,"class","bg-[color:var(--color-secondary)] text-white p-[1rem] w-full"),V(u,"class","bg-[color:var(--color-secondary)] text-white p-[0.5rem] w-full whitespace-nowrap"),V(h,"class","bg-[color:var(--color-secondary)] text-white p-[1rem] w-full"),V(c,"class","flex flex-row gap-[1rem]"),V(v,"class","h-fit"),V(g,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(b,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(J,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(d,"class","flex flex-row gap-[1rem] text-center"),V(_,"class","flex flex-col items-center"),V(ee,"class","w-[5rem] h-[3rem] items-center flex justify-center bg-[color:var(--color-secondary)]"),V(N,"id","slider"),V(N,"type","range"),V(N,"min","0.01"),V(N,"max","1"),V(N,"step","0.01"),V(N,"class","w-full"),V(j,"class","flex flex-row gap-[1rem] items-center"),V(Ce,"class","bg-[color:var(--color-secondary)] text-white p-[1rem] w-full"),V(je,"class","h-fit"),V(lt,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(P,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(de,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(Ue,"class","flex flex-row gap-[1rem] text-center"),V(Te,"class","flex flex-col items-center "),V(Ze,"class","w-[5rem] h-[3rem] items-center flex justify-center bg-[color:var(--color-secondary)]"),V(W,"id","slider"),V(W,"type","range"),V(W,"min","1"),V(W,"max","90"),V(W,"step","1"),V(W,"class","w-full"),V(Fe,"class","flex flex-row gap-[1rem] items-center"),V(he,"class",""),V(He,"id","slider"),V(He,"type","range"),V(He,"min","1"),V(He,"max","255"),V(He,"step","10"),V(He,"class","w-full"),V(Ke,"class","flex flex-row gap-[1rem] items-center"),V(Yt,"class","bg-[color:var(--color-secondary)] text-white p-[1rem] w-full"),V(n,"class","flex flex-col gap-[1rem] p-[2rem]"),V(kt,"class",Nn="fas text-[2rem] fa-chevron-"+(r[7]?"left":"right")),V(Lt,"class","h-full absolute -right-[4rem] w-[4rem] grid place-items-center bg-[color:var(--color-secondary)]"),V(t,"class",si="w-fit text-[1.5rem] bg-[color:var(--color-primary)] top-[4rem] origin-top absolute "+(r[7]?"left-[1.5rem]":"-left-[30rem]")+" flex flex-row gap-[1rem] items-center justify-between"),V(e,"class",A="modeler z-[0] absolute h-screen w-screen "+(r[9]?"bg-gray-800":""))},m(ae,me){Oe(ae,e,me),D(e,t),D(t,n),D(n,i),D(i,s),D(i,a),D(n,l),D(n,c),D(c,u),D(c,f),D(c,h),D(n,p),D(n,_),D(_,v),D(_,m),D(_,d),D(d,g),D(g,x),D(g,M),D(g,y),D(y,C),D(d,T),D(d,b),D(b,S),D(b,F),D(b,k),D(k,O),D(d,B),D(d,J),D(J,R),D(J,H),D(J,Q),D(Q,ve),D(n,se),D(n,j),D(j,ee),D(ee,te),D(j,ue),D(j,N),Tn(N,r[5]),D(n,Re),D(n,Ce),D(n,oe),D(n,Te),D(Te,je),D(Te,ye),D(Te,Ue),D(Ue,lt),D(lt,xt),D(lt,Mt),D(lt,_t),D(_t,st),D(Ue,It),D(Ue,P),D(P,E),D(P,Y),D(P,ne),D(ne,fe),D(Ue,Pe),D(Ue,de),D(de,$),D(de,xe),D(de,we),D(we,ge),D(n,Me),D(n,Fe),D(Fe,Ze),D(Ze,ct),D(Fe,U),D(Fe,W),Tn(W,r[6]),D(n,ie),D(n,he),D(n,be),D(n,Ke),D(Ke,He),Tn(He,r[1]),D(n,Tt),D(n,Yt),D(t,ht),D(t,Lt),D(Lt,kt),D(e,Fr),X&&X.m(e,null),D(e,fr),$e(On,e,null),z=!0,Z||(G=[Le(i,"click",r[22]),Le(u,"click",r[23]),Le(h,"click",r[24]),Le(N,"change",r[25]),Le(N,"input",r[25]),Le(Ce,"click",r[26]),Le(W,"change",r[27]),Le(W,"input",r[27]),Le(He,"change",r[28]),Le(He,"input",r[28]),Le(Yt,"click",r[29]),Le(Lt,"click",r[30])],Z=!0)},p(ae,me){(!z||me[0]&16)&&o!==(o=ae[4]=="translate"?"rotate":"translate")&&At(a,o),(!z||me[0]&4)&&w!==(w=ae[2].x.toFixed(2)+"")&&At(C,w),(!z||me[0]&4)&&L!==(L=-ae[2].z.toFixed(2)+"")&&At(O,L),(!z||me[0]&4)&&K!==(K=ae[2].y.toFixed(2)+"")&&At(ve,K),(!z||me[0]&32)&&At(te,ae[5]),me[0]&32&&Tn(N,ae[5]),(!z||me[0]&8)&&Xe!==(Xe=Kt.radToDeg(ae[3].x).toFixed(2)+"")&&At(st,Xe),(!z||me[0]&8)&&re!==(re=Kt.radToDeg(ae[3].y).toFixed(2)+"")&&At(fe,re),(!z||me[0]&8)&&Ae!==(Ae=Kt.radToDeg(ae[3].z).toFixed(2)+"")&&At(ge,Ae),(!z||me[0]&64)&&At(ct,ae[6]),me[0]&64&&Tn(W,ae[6]),me[0]&2&&Tn(He,ae[1]),(!z||me[0]&128&&Nn!==(Nn="fas text-[2rem] fa-chevron-"+(ae[7]?"left":"right")))&&V(kt,"class",Nn),(!z||me[0]&128&&si!==(si="w-fit text-[1.5rem] bg-[color:var(--color-primary)] top-[4rem] origin-top absolute "+(ae[7]?"left-[1.5rem]":"-left-[30rem]")+" flex flex-row gap-[1rem] items-center justify-between"))&&V(t,"class",si),ae[12]==null?X?X.p(ae,me):(X=nc(ae),X.c(),X.m(e,fr)):X&&(X.d(1),X=null);const De={};me[0]&29821|me[1]&128&&(De.$$scope={dirty:me,ctx:ae}),On.$set(De),(!z||me[0]&512&&A!==(A="modeler z-[0] absolute h-screen w-screen "+(ae[9]?"bg-gray-800":"")))&&V(e,"class",A)},i(ae){z||(_e(On.$$.fragment,ae),z=!0)},o(ae){Se(On.$$.fragment,ae),z=!1},d(ae){ae&&Ne(e),X&&X.d(),et(On),Z=!1,qt(G)}}}function nc(r){let e,t,n;return{c(){e=q("button"),e.innerHTML=` -

Add To Cart

`,V(e,"class","absolute text-[2rem] hover:brightness-110 top-1/2 -translate-y-1/2 right-[1rem] w-fit gap-[1rem] px-8 py-4 h-fit bg-[color:var(--color-secondary)] flex flex-row items-center justify-between")},m(i,s){Oe(i,e,s),t||(n=Le(e,"click",r[31]),t=!0)},p:St,d(i){i&&Ne(e),t=!1,n()}}}function U0(r){let e,t;return e=new m0({props:{mode:r[4],translationSnap:r[5],rotationSnap:Kt.degToRad(r[6]),size:.5,space:"local"}}),e.$on("objectChange",r[32]),e.$on("dragging-changed",r[33]),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i[0]&16&&(s.mode=n[4]),i[0]&32&&(s.translationSnap=n[5]),i[0]&64&&(s.rotationSnap=Kt.degToRad(n[6])),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function N0(r){let e,t,n,i,s;e=new i0({props:{position:r[13],lookAt:r[10],fov:45}});function o(l){r[34](l)}let a={type:pe,"position.x":r[2].x,"position.y":r[2].y,"position.z":r[2].z,quaternion:5,geometry:new bt(0,0,0),material:new Tg,"rotation.x":r[3].x,"rotation.y":r[3].y,"rotation.z":r[3].z,$$slots:{default:[U0]},$$scope:{ctx:r}};return r[0]!==void 0&&(a.ref=r[0]),n=new D0({props:a}),Vn.push(()=>xs(n,"ref",o)),{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment)},m(l,c){$e(e,l,c),Oe(l,t,c),$e(n,l,c),s=!0},p(l,c){const u={};c[0]&8192&&(u.position=l[13]),c[0]&1024&&(u.lookAt=l[10]),e.$set(u);const f={};c[0]&4&&(f["position.x"]=l[2].x),c[0]&4&&(f["position.y"]=l[2].y),c[0]&4&&(f["position.z"]=l[2].z),c[0]&8&&(f["rotation.x"]=l[3].x),c[0]&8&&(f["rotation.y"]=l[3].y),c[0]&8&&(f["rotation.z"]=l[3].z),c[0]&20604|c[1]&128&&(f.$$scope={dirty:c,ctx:l}),!i&&c[0]&1&&(i=!0,f.ref=l[0],vs(()=>i=!1)),n.$set(f)},i(l){s||(_e(e.$$.fragment,l),_e(n.$$.fragment,l),s=!0)},o(l){Se(e.$$.fragment,l),Se(n.$$.fragment,l),s=!1},d(l){et(e,l),l&&Ne(t),et(n,l)}}}function O0(r){let e,t,n=r[8]&&tc(r);return{c(){n&&n.c(),e=ri()},m(i,s){n&&n.m(i,s),Oe(i,e,s),t=!0},p(i,s){i[8]?n?(n.p(i,s),s[0]&256&&_e(n,1)):(n=tc(i),n.c(),_e(n,1),n.m(e.parentNode,e)):n&&(Wn(),Se(n,1,1,()=>{n=null}),jn())},i(i){t||(_e(n),t=!0)},o(i){Se(n),t=!1},d(i){n&&n.d(i),i&&Ne(e)}}}function F0(r,e,t){let n,i,s,o,a,l,c,u,f;Ee(r,Ms,te=>t(9,o=te)),Ee(r,vn,te=>t(11,l=te)),Ee(r,Cn,te=>t(14,f=te));const{show:h,cameraPosition:p,cameraLookAt:_,objectPosition:v,objectEuler:m,entity:d}=_n;Ee(r,h,te=>t(8,s=te)),Ee(r,p,te=>t(13,u=te)),Ee(r,_,te=>t(10,a=te)),Ee(r,v,te=>t(2,n=te)),Ee(r,m,te=>t(3,i=te)),Ee(r,d,te=>t(12,c=te));let g,x="translate",M=.01,y=1,w=!1,C=200;an("setObjectAlpha",te=>{t(1,C=te)});function T(te){te.button==2&&(x=="translate"?t(4,x="rotate"):t(4,x="translate"))}or(()=>{document.addEventListener("contextmenu",T)}),ut(()=>{document.removeEventListener("contextmenu",T)});function b(te){return te.x!=n.x||te.y!=n.y||te.z!=n.z}function S(te){return te.x!=i.x||te.y!=i.y||te.z!=i.z}function F(){g&&(b(g.position)&&(Ie(v,n.x=g.position.x,n),Ie(v,n.y=g.position.y,n),Ie(v,n.z=g.position.z,n),_n.sendMovementUpdate(fs(n))),S(g.rotation)&&(Ie(m,i.x=g.rotation.x,i),Ie(m,i.y=g.rotation.y,i),Ie(m,i.z=g.rotation.z,i),_n.sendRotationUpdate(i)))}const k=()=>{x=="translate"?t(4,x="rotate"):t(4,x="translate")},L=()=>{g.rotation.set(0,0,0,i.order),F()},O=()=>{g.position.set(a.x,a.y,a.z),F()};function B(){M=cs(this.value),t(5,M)}const J=()=>{at("placeOnGround").then(te=>{const ue=Vi(te);g.position.set(ue.x,ue.y,ue.z),F()})};function R(){y=cs(this.value),t(6,y)}function H(){C=cs(this.value),t(1,C)}const Q=()=>{at("stopPlacement"),_n.show.set(!1),Ie(vn,l=null,l)},K=()=>{t(7,w=!w)},ve=()=>{at("addToCart",l),Ie(vn,l=null,l)},se=te=>{F()},j=te=>{if(!te.detail.value&&c!=null){const N=f.find(oe=>oe.entity===c);if(N===void 0)return;const Re=fs(n);N.position=Re;const Ce=fs(i);N.rotation=Ce,Ie(Cn,f=[...f],f),at("updateCartItem",N)}};function ee(te){g=te,t(0,g)}return r.$$.update=()=>{r.$$.dirty[0]&2&&at("setObjectAlpha",{alpha:C}),r.$$.dirty[0]&13&&g&&(g.rotation.set(i.x,i.y,i.z,i.order),g.position.set(n.x,n.y,n.z))},[g,C,n,i,x,M,y,w,s,o,a,l,c,u,f,h,p,_,v,m,d,F,k,L,O,B,J,R,H,Q,K,ve,se,j,ee]}class z0 extends gt{constructor(e){super(),mt(this,e,F0,O0,ft,{},null,[-1,-1])}}function ic(r){let e,t,n,i;return e=new r_({}),n=new z0({}),{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment)},m(s,o){$e(e,s,o),Oe(s,t,o),$e(n,s,o),i=!0},i(s){i||(_e(e.$$.fragment,s),_e(n.$$.fragment,s),i=!0)},o(s){Se(e.$$.fragment,s),Se(n.$$.fragment,s),i=!1},d(s){et(e,s),s&&Ne(t),et(n,s)}}}function k0(r){let e,t,n=r[0]&&ic();return{c(){n&&n.c(),e=ri()},m(i,s){n&&n.m(i,s),Oe(i,e,s),t=!0},p(i,s){i[0]?n?s&1&&_e(n,1):(n=ic(),n.c(),_e(n,1),n.m(e.parentNode,e)):n&&(Wn(),Se(n,1,1,()=>{n=null}),jn())},i(i){t||(_e(n),t=!0)},o(i){Se(n),t=!1},d(i){n&&n.d(i),i&&Ne(e)}}}function rc(r){let e,t,n,i;return e=new Bg({}),{c(){nt(e.$$.fragment),t=le(),n=q("body"),V(n,"class","bg-neutral-700")},m(s,o){$e(e,s,o),Oe(s,t,o),Oe(s,n,o),i=!0},i(s){i||(_e(e.$$.fragment,s),i=!0)},o(s){Se(e.$$.fragment,s),i=!1},d(s){et(e,s),s&&Ne(t),s&&Ne(n)}}}function B0(r){let e,t,n,i,s,o;e=new Og({props:{$$slots:{default:[k0]},$$scope:{ctx:r}}}),n=new Xg({});let a=r[1]&&rc();return{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment),i=le(),a&&a.c(),s=ri()},m(l,c){$e(e,l,c),Oe(l,t,c),$e(n,l,c),Oe(l,i,c),a&&a.m(l,c),Oe(l,s,c),o=!0},p(l,[c]){const u={};c&17&&(u.$$scope={dirty:c,ctx:l}),e.$set(u),l[1]?a?c&2&&_e(a,1):(a=rc(),a.c(),_e(a,1),a.m(s.parentNode,s)):a&&(Wn(),Se(a,1,1,()=>{a=null}),jn())},i(l){o||(_e(e.$$.fragment,l),_e(n.$$.fragment,l),_e(a),o=!0)},o(l){Se(e.$$.fragment,l),Se(n.$$.fragment,l),Se(a),o=!1},d(l){et(e,l),l&&Ne(t),et(n,l),l&&Ne(i),a&&a.d(l),l&&Ne(s)}}}function G0(r,e,t){let n,i,s;return Ee(r,_o,o=>t(2,n=o)),Ee(r,ms,o=>t(0,i=o)),Ee(r,Ms,o=>t(1,s=o)),Ie(_o,n="ps-housing",n),[i,s]}class H0 extends gt{constructor(e){super(),mt(this,e,G0,B0,ft,{})}}new H0({target:document.getElementById("app")}); + }`};class Ts{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const s_=new Oc(-1,1,1,-1,0,1),zo=new qt;zo.setAttribute("position",new pt([-1,3,0,-1,-1,0,3,-1,0],3));zo.setAttribute("uv",new pt([0,2,0,0,2,0],2));class o_{constructor(e){this._mesh=new pe(zo,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,s_)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class a_ extends Ts{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Xn?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=Dc.clone(e.uniforms),this.material=new Xn({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new o_(this.material)}render(e,t,n){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=n.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class Ul extends Ts{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,n){const i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(n),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}class l_ extends Ts{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class c_{constructor(e,t){if(this.renderer=e,t===void 0){const n=e.getSize(new Qe);this._pixelRatio=e.getPixelRatio(),this._width=n.width,this._height=n.height,t=new ii(this._width*this._pixelRatio,this._height*this._pixelRatio),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new a_(r_),this.clock=new jc}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t{r.renderer=new Gc({powerPreference:"high-performance",canvas:e,antialias:!0,alpha:!0,...t}),r.composer=new c_(r.renderer),r.composer.addPass(new Yc(r.scene,Po(r.camera)))},Nl=(r,e,t)=>{!r.renderer||(e?r.renderer.outputEncoding=ni:r.renderer.outputEncoding=ot,t?r.renderer.toneMapping=Rn:r.renderer.toneMapping=vc)},Ol=(r,e,t)=>{var n,i,s,o,a,l,c,u;!r.renderer||!r.composer||((i=(n=r.renderer).setSize)==null||i.call(n,e.width,e.height),(o=(s=r.renderer).setPixelRatio)==null||o.call(s,t),(l=(a=r.composer).setSize)==null||l.call(a,e.width,e.height),(u=(c=r.composer).setPixelRatio)==null||u.call(c,t))},Fl=(r,e,t)=>{!r.renderer||(r.renderer.shadowMap.enabled=e,r.renderer.shadowMap.type=t)},Ln=r=>r.userData,f_=(r,e)=>{r.pointer.update(t=>r.renderer?t.set(e.offsetX/r.renderer.domElement.clientWidth*2-1,-(e.offsetY/r.renderer.domElement.clientHeight)*2+1):t)},Zc=(r,e,t,n)=>(r.raycaster.setFromCamera(e,t),r.raycaster.intersectObjects(n,!1)),h_=(r,e)=>r.object.uuid!==e.object.uuid||r.instanceId!==e.instanceId,d_=(r,e,t)=>{let n;const i=r.camera.subscribe(c=>n=c);ut(i);let s;const o=r.pointer.subscribe(c=>s=c);ut(o);let a;const l=c=>{var h,p;c.preventDefault();const u=c.type;r.pointerOverCanvas.set(!0),t.pointerInvalidated=!0,f_(r,c);const f=p_(e,s,n);if(u==="pointerdown"&&(a=f?{object:f.object,instanceId:f.instanceId}:null),u==="click"){if(!m_(f,a)){a=null;return}a=null}!f||(p=(h=Ln(f.object)).eventDispatcher)==null||p.call(h,u,{...f,event:c})};return{onClick:l,onContextMenu:l,onPointerUp:l,onPointerDown:l,onPointerMove:l}};function p_(r,e,t){if(r.interactiveObjects.size===0||r.raycastableObjects.size===0)return null;const n=Zc(r,e,t,Array.from(r.raycastableObjects));return n.length===0||!r.interactiveObjects.has(n[0].object)?null:n[0]}function m_(r,e){return!r||!e?!1:r.object.uuid===e.object.uuid&&r.instanceId===e.instanceId}const g_=(r,e)=>{let t;const n=r.pointerOverCanvas.subscribe(c=>t=c);ut(n);let i;const s=r.camera.subscribe(c=>i=c);ut(s);let o;const a=r.pointer.subscribe(c=>o=c);return ut(a),{raycast:()=>{var f,h,p,_,v,m,d,g;if(e.interactiveObjects.size===0||e.raycastableObjects.size===0)return;const c=t?Zc(e,o,i,Array.from(e.raycastableObjects)):[],u=c.length&&e.interactiveObjects.has(c[0].object)?c[0]:null;u?e.lastIntersection?e.lastIntersection&&h_(e.lastIntersection,u)&&((m=(v=Ln(e.lastIntersection.object)).eventDispatcher)==null||m.call(v,"pointerleave",e.lastIntersection),(g=(d=Ln(u.object)).eventDispatcher)==null||g.call(d,"pointerenter",u)):(_=(p=Ln(u.object)).eventDispatcher)==null||_.call(p,"pointerenter",u):e.lastIntersection&&((h=(f=Ln(e.lastIntersection.object)).eventDispatcher)==null||h.call(f,"pointerleave",e.lastIntersection)),e.lastIntersection=u}}},As=typeof window!="undefined",__=r=>{if(!As)return;let e;const t=()=>{r(),e=requestAnimationFrame(t)};t(),ut(()=>{!e||cancelAnimationFrame(e)})},v_=(r,e)=>{if(e.frameHandlers.size===0)return;if(e.debugFrameloop){let i=0;e.frameHandlers.forEach(s=>{s.debugFrameloopMessage?e.invalidations[s.debugFrameloopMessage]=s.debugFrameloopMessage in e.invalidations?e.invalidations[s.debugFrameloopMessage]+1:1:++i}),i>0&&(e.invalidations.onFrame=e.frameHandlers.size)}const t=Array.from(e.frameHandlers).reduce((i,s)=>s.order?!0:i,!1),n=r.clock.getDelta();t?Array.from(e.frameHandlers).sort((i,s)=>{var o,a;return((o=i.order)!=null?o:0)>((a=s.order)!=null?a:0)?1:-1}).forEach(i=>i.fn(r,n)):e.frameHandlers.forEach(i=>i.fn(r,n))},x_=r=>{!r.debugFrameloop||(r.frame+=1,console.log(`frame: ${r.frame}${Object.keys(r.invalidations).length>0?", requested by \u21B4":""}`),Object.keys(r.invalidations).length>0&&console.table(r.invalidations),r.invalidations={})},M_=(r,e,t,n)=>{let i=Po(r.camera);const s=r.camera.subscribe(a=>i=a);ut(s);const{raycast:o}=g_(r,e);__(()=>{n.dispose();const a=t.frameloop==="always"||t.frameloop==="demand"&&(t.frameInvalidated||t.frameHandlers.size>0)||t.frameloop==="never"&&t.advance;(a||t.pointerInvalidated)&&(o(),t.pointerInvalidated=!1),a&&(!i||!r.composer||!r.renderer||(v_(r,t),r.composer.passes.length>1?r.composer.render():r.renderer.render(r.scene,i),x_(t),t.frameInvalidated=!1,t.advance=!1))})},b_=()=>{const r=new sn(75,0,.1,1e3);return Ln(r).threlteDefaultCamera=!0,r.position.z=5,r.lookAt(0,0,0),r},S_=r=>{const e=r.size.subscribe(t=>{Ln(Po(r.camera)).threlteDefaultCamera&&r.camera.update(n=>{const i=n;return i.aspect=t.width/t.height,i.updateProjectionMatrix(),r.invalidate("Default camera: aspect ratio changed"),i})});ut(e)},y_=(r,e,t,n,i,s,o)=>{const a={audioListeners:new Map,addAudioListener:(d,g)=>{if(g=g!=null?g:"default",a.audioListeners.has(g)){console.warn(`An AudioListener with the id "${g}" has already been added, aborting.`);return}a.audioListeners.set(g,d)},removeAudioListener:d=>{if(d=d!=null?d:"default",!a.audioListeners.has(d)){console.warn(`No AudioListener with the id "${d}" found, aborting.`);return}a.audioListeners.delete(d)},getAudioListener:d=>{if(d=d!=null?d:"default",!a.audioListeners.has(d)){console.warn(`No AudioListener with the id "${d}" found, aborting.`);return}return a.audioListeners.get(d)}},l={debugFrameloop:s,frameloop:o,frame:0,frameInvalidated:!0,pointerInvalidated:!0,invalidations:{},frameHandlers:new Set,advance:!1},c={size:pu([n,i],([d,g])=>d||g),pointer:Ye(new Qe),pointerOverCanvas:Ye(!1),clock:new jc,camera:Ye(b_()),scene:new wg,renderer:void 0,composer:void 0,invalidate:d=>{l.frameInvalidated=!0,l.debugFrameloop&&d&&(l.invalidations[d]=l.invalidations[d]?l.invalidations[d]+1:1)},advance:()=>{l.advance=!0}},u={flat:Ye(e),linear:Ye(r),dpr:Ye(t),setCamera:d=>{c.camera.set(d),c.composer&&(c.composer.passes.forEach(g=>{g instanceof Yc&&(g.camera=d)}),c.invalidate("Canvas: setting camera"))},raycastableObjects:new Set,interactiveObjects:new Set,raycaster:new Xc,lastIntersection:null,addRaycastableObject:d=>{u.raycastableObjects.add(d)},removeRaycastableObject:d=>{u.raycastableObjects.delete(d)},addInteractiveObject:d=>{u.interactiveObjects.add(d)},removeInteractiveObject:d=>{u.interactiveObjects.delete(d)},addPass:d=>{!c.composer||(c.composer.addPass(d),c.invalidate("Canvas: adding pass"))},removePass:d=>{!c.composer||(c.composer.removePass(d),c.invalidate("Canvas: removing pass"))}},f={dispose:async(d=!1)=>{await Lr(),!(!f.shouldDispose&&!d)&&(f.disposableObjects.forEach((g,x)=>{var M;(g===0||d)&&((M=x==null?void 0:x.dispose)==null||M.call(x),f.disposableObjects.delete(x))}),f.shouldDispose=!1)},collectDisposableObjects:(d,g)=>{const x=g!=null?g:[];return d&&((d==null?void 0:d.dispose)&&typeof d.dispose=="function"&&d.type!=="Scene"&&x.push(d),Object.entries(d).forEach(([M,y])=>{if(M==="parent"||M==="children"||typeof y!="object")return;const w=y;w!=null&&w.dispose&&f.collectDisposableObjects(w,x)})),x},addDisposableObjects:d=>{d.forEach(g=>{const x=f.disposableObjects.get(g);x?f.disposableObjects.set(g,x+1):f.disposableObjects.set(g,1)})},removeDisposableObjects:d=>{d.length!==0&&(d.forEach(g=>{const x=f.disposableObjects.get(g);x&&x>0&&f.disposableObjects.set(g,x-1)}),f.shouldDispose=!0)},disposableObjects:new Map,shouldDispose:!1};return pn("threlte",c),pn("threlte-root",u),pn("threlte-render-context",l),pn("threlte-audio-context",a),pn("threlte-disposal-context",f),{ctx:c,rootCtx:u,renderCtx:l,audioCtx:a,disposalCtx:f,getCtx:()=>c,getRootCtx:()=>u,getRenderCtx:()=>l,getAudioCtx:()=>a,getDisposalCtx:()=>f}};function Cs(r,e){const t=Ye(r);let n=r;const i=t.subscribe(a=>n=a);return ut(i),{...t,set:a=>{if((a==null?void 0:a.uuid)===(n==null?void 0:n.uuid))return;const l=n;t.set(a),e==null||e(a,l)},update:a=>{const l=a(n);if((l==null?void 0:l.uuid)===(n==null?void 0:n.uuid))return;const c=n;t.set(l),e==null||e(l,c)}}}const Un=()=>In("threlte");function w_(r){let e;const t=r[8].default,n=xn(t,r,r[7],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,[s]){n&&n.p&&(!e||s&128)&&bn(n,t,i,i[7],e?Mn(t,i[7],s,null):Sn(i[7]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}const E_=()=>({onChildMount:In("threlte-hierarchical-object-on-mount"),onChildDestroy:In("threlte-hierarchical-object-on-destroy")}),Qc=()=>In("threlte-hierarchical-parent-context");function T_(r,e,t){var d;let n,{$$slots:i={},$$scope:s}=e,{object:o=void 0}=e,{children:a=[]}=e,{onChildMount:l=void 0}=e;const c=g=>{a.push(g),t(1,a),l==null||l(g)};let{onChildDestroy:u=void 0}=e;const f=g=>{const x=a.findIndex(M=>M.uuid===g.uuid);x!==-1&&a.splice(x,1),t(1,a),u==null||u(g)},{invalidate:h}=Un(),p=Qc();Ee(r,p,g=>t(6,n=g));let{parent:_=n}=e;const v=E_();o&&((d=v.onChildMount)==null||d.call(v,o),h("HierarchicalObject: object added"));const m=Cs(o,(g,x)=>{var M,y;x&&((M=v.onChildDestroy)==null||M.call(v,x),h("HierarchicalObject: object added")),g&&((y=v.onChildMount)==null||y.call(v,g),h("HierarchicalObject: object removed"))});return ut(()=>{var g;o&&((g=v.onChildDestroy)==null||g.call(v,o),h("HierarchicalObject: object removed"))}),pn("threlte-hierarchical-object-on-mount",c),pn("threlte-hierarchical-object-on-destroy",f),pn("threlte-hierarchical-parent-context",m),r.$$set=g=>{"object"in g&&t(3,o=g.object),"children"in g&&t(1,a=g.children),"onChildMount"in g&&t(4,l=g.onChildMount),"onChildDestroy"in g&&t(5,u=g.onChildDestroy),"parent"in g&&t(2,_=g.parent),"$$scope"in g&&t(7,s=g.$$scope)},r.$$.update=()=>{r.$$.dirty&64&&t(2,_=n),r.$$.dirty&8&&m.set(o)},[p,a,_,o,l,u,n,s,i]}class A_ extends gt{constructor(e){super(),mt(this,e,T_,w_,ft,{object:3,children:1,onChildMount:4,onChildDestroy:5,parent:2})}}function C_(r){let e;const t=r[1].default,n=xn(t,r,r[4],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&16)&&bn(n,t,i,i[4],e?Mn(t,i[4],s,null):Sn(i[4]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function P_(r){let e,t;return e=new A_({props:{object:r[0],onChildMount:r[2],onChildDestroy:r[3],$$slots:{default:[C_]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,[i]){const s={};i&1&&(s.object=n[0]),i&1&&(s.onChildMount=n[2]),i&1&&(s.onChildDestroy=n[3]),i&16&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function L_(r,e,t){let{$$slots:n={},$$scope:i}=e,{object:s}=e;const o=l=>s.add(l),a=l=>s.remove(l);return r.$$set=l=>{"object"in l&&t(0,s=l.object),"$$scope"in l&&t(4,i=l.$$scope)},[s,n,o,a,i]}class ko extends gt{constructor(e){super(),mt(this,e,L_,P_,ft,{object:0})}}const R_=()=>{const r=Ye({width:0,height:0});let e={width:0,height:0};const t=r.subscribe(o=>e=o);ut(t);let n;const i=()=>{const o=e;if(!n||!n.parentElement)return;const{clientWidth:a,clientHeight:l}=n.parentElement;(a!==o.width||l!==o.height)&&r.set({width:a,height:l})},s=o=>{n=o,i(),window.addEventListener("resize",i)};return As?(ut(()=>{window.removeEventListener("resize",i)}),{parentSizeAction:s,parentSize:r}):{parentSize:r,parentSizeAction:s}};function zl(r){let e,t;return e=new ko({props:{object:r[0].scene,$$slots:{default:[D_]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i[1]&4&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function D_(r){let e;const t=r[29].default,n=xn(t,r,r[33],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s[1]&4)&&bn(n,t,i,i[33],e?Mn(t,i[33],s,null):Sn(i[33]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function I_(r){let e,t,n,i,s=r[2]&&zl(r);return{c(){e=q("canvas"),s&&s.c(),V(e,"class","svelte-o3oskp")},m(o,a){Oe(o,e,a),s&&s.m(e,null),r[30](e),t=!0,n||(i=[oc(r[3].call(null,e)),Le(e,"click",r[9]),Le(e,"contextmenu",r[10]),Le(e,"pointerup",r[13]),Le(e,"pointerdown",r[11]),Le(e,"pointermove",r[12]),Le(e,"pointerenter",r[31]),Le(e,"pointerleave",r[32])],n=!0)},p(o,a){o[2]?s?(s.p(o,a),a[0]&4&&_e(s,1)):(s=zl(o),s.c(),_e(s,1),s.m(e,null)):s&&(Wn(),Se(s,1,1,()=>{s=null}),jn())},i(o){t||(_e(s),t=!0)},o(o){Se(s),t=!1},d(o){o&&Ne(e),s&&s.d(),r[30](null),n=!1,kt(i)}}}const kl=new Set;function U_(r,e,t){let n,i,s,o,{$$slots:a={},$$scope:l}=e,{dpr:c=As?window.devicePixelRatio:1}=e,{flat:u=!1}=e,{linear:f=!1}=e,{frameloop:h="demand"}=e,{debugFrameloop:p=!1}=e,{shadows:_=!0}=e,{shadowMapType:v=pc}=e,{size:m=void 0}=e,{rendererParameters:d=void 0}=e,g,x=!1;const M=Ye(m),{parentSize:y,parentSizeAction:w}=R_(),C=y_(f,u,c,M,y,p,h),{getCtx:T,renderCtx:b,disposalCtx:S}=C,{ctx:F,rootCtx:k,audioCtx:L}=C;S_(F),kl.add(F.invalidate),ut(()=>{kl.delete(F.invalidate)});const{size:O,scene:B}=F;Ee(r,O,N=>t(26,i=N));const{flat:J,linear:R,dpr:H}=k;Ee(r,J,N=>t(27,s=N)),Ee(r,R,N=>t(28,o=N)),Ee(r,H,N=>t(25,n=N)),pn("threlte-parent",Ye(B)),or(()=>{!g||(u_(F,g,d),Nl(F,o,s),Ol(F,i,n),Fl(F,_,v),t(2,x=!0))}),M_(F,k,b,S);const{onClick:Q,onContextMenu:K,onPointerDown:ve,onPointerMove:se,onPointerUp:j}=d_(F,k,b);ut(()=>{S.dispose(!0)});function ee(N){Vn[N?"unshift":"push"](()=>{g=N,t(1,g)})}const te=()=>T().pointerOverCanvas.set(!0),ue=()=>T().pointerOverCanvas.set(!1);return r.$$set=N=>{"dpr"in N&&t(14,c=N.dpr),"flat"in N&&t(15,u=N.flat),"linear"in N&&t(16,f=N.linear),"frameloop"in N&&t(17,h=N.frameloop),"debugFrameloop"in N&&t(18,p=N.debugFrameloop),"shadows"in N&&t(19,_=N.shadows),"shadowMapType"in N&&t(20,v=N.shadowMapType),"size"in N&&t(21,m=N.size),"rendererParameters"in N&&t(22,d=N.rendererParameters),"$$scope"in N&&t(33,l=N.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&2097152&&M.set(m),r.$$.dirty[0]&65536&&Ie(R,o=f,o),r.$$.dirty[0]&32768&&Ie(J,s=u,s),r.$$.dirty[0]&16384&&Ie(H,n=c,n),r.$$.dirty[0]&402653184&&Nl(T(),o,s),r.$$.dirty[0]&100663296&&Ol(T(),i,n),r.$$.dirty[0]&1572864&&Fl(T(),_,v)},[F,g,x,w,T,O,J,R,H,Q,K,ve,se,j,c,u,f,h,p,_,v,m,d,k,L,n,i,s,o,a,ee,te,ue,l]}class N_ extends gt{constructor(e){super(),mt(this,e,U_,I_,ft,{dpr:14,flat:15,linear:16,frameloop:17,debugFrameloop:18,shadows:19,shadowMapType:20,size:21,rendererParameters:22,ctx:0,rootCtx:23,audioCtx:24},null,[-1,-1])}get ctx(){return this.$$.ctx[0]}get rootCtx(){return this.$$.ctx[23]}get audioCtx(){return this.$$.ctx[24]}}const Kc=()=>In("threlte-root"),O_=()=>In("threlte-disposal-context");function F_(r){let e;const t=r[9].default,n=xn(t,r,r[8],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,[s]){n&&n.p&&(!e||s&256)&&bn(n,t,i,i[8],e?Mn(t,i[8],s,null):Sn(i[8]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}const Bl="threlte-disposable-object-context";function z_(r,e,t){var m;let n,i,{$$slots:s={},$$scope:o}=e;const{collectDisposableObjects:a,addDisposableObjects:l,removeDisposableObjects:c}=O_();let{object:u=void 0}=e,f=u,{dispose:h=void 0}=e;const p=In(Bl);Ee(r,p,d=>t(7,i=d));const _=Ye((m=h!=null?h:i)!=null?m:!0);Ee(r,_,d=>t(6,n=d)),pn(Bl,_);let v=n?a(u):[];return l(v),ut(()=>{c(v)}),r.$$set=d=>{"object"in d&&t(2,u=d.object),"dispose"in d&&t(3,h=d.dispose),"$$scope"in d&&t(8,o=d.$$scope)},r.$$.update=()=>{var d;r.$$.dirty&136&&_.set((d=h!=null?h:i)!=null?d:!0),r.$$.dirty&116&&u!==f&&(c(v),t(5,v=n?a(u):[]),l(v),t(4,f=u))},[p,_,u,h,f,v,n,i,o,s]}class Bo extends gt{constructor(e){super(),mt(this,e,z_,F_,ft,{object:2,dispose:3})}}function k_(r,e,t){let n,i,{object:s}=e;const o=Cs(s);Ee(r,o,c=>t(4,i=c));const a=In("threlte-layers");Ee(r,a,c=>t(3,n=c));const{invalidate:l}=Un();return r.$$set=c=>{"object"in c&&t(2,s=c.object)},r.$$.update=()=>{if(r.$$.dirty&4&&o.set(s),r.$$.dirty&24){if(n==="all")i.layers.enableAll();else if(n==="none")i.layers.disableAll();else if(Array.isArray(n))for(let c=0;c<32;c+=1){const u=c;n.includes(u)?i.layers.enable(c):i.layers.disable(c)}else n!==void 0&&i.layers.set(n);l("LayerableObject")}},[o,a,s,n,i]}class Jc extends gt{constructor(e){super(),mt(this,e,k_,null,ft,{object:2})}}const $c=(r,e)=>{var a;if(!As)return{start:()=>{},stop:()=>{},started:uc(!1)};const t=In("threlte-render-context"),n={fn:r,order:e==null?void 0:e.order,debugFrameloopMessage:e==null?void 0:e.debugFrameloopMessage},i=Ye(!1),s=()=>{t.frameHandlers.delete(n),i.set(!1)},o=()=>{t.frameHandlers.add(n),i.set(!0)};return((a=e==null?void 0:e.autostart)==null||a)&&o(),ut(()=>{s()}),{start:o,stop:s,started:{subscribe:i.subscribe}}},eu=()=>{const r=Ye(!1);return(async()=>{await Lr(),r.set(!0)})(),r};function B_(r,e,t){let n,i,{object:s}=e,{position:o=void 0}=e,{scale:a=void 0}=e,{rotation:l=void 0}=e,{lookAt:c=void 0}=e;const u=new I,f=_s(),{invalidate:h}=Un(),p=eu();Ee(r,p,x=>t(8,i=x));const _=async()=>{i||await Lr(),f("transform")},v=async()=>{h("TransformableObject: transformed"),await _()};Ln(s).onTransform=v;const{start:m,stop:d}=$c(async()=>{c&&!l&&c instanceof Et&&(c.getWorldPosition(u),s.lookAt(u),await _())},{autostart:!1,debugFrameloopMessage:"TransformableObject: tracking object"}),g=Cs(s);return Ee(r,g,x=>t(7,n=x)),r.$$set=x=>{"object"in x&&t(2,s=x.object),"position"in x&&t(3,o=x.position),"scale"in x&&t(4,a=x.scale),"rotation"in x&&t(5,l=x.rotation),"lookAt"in x&&t(6,c=x.lookAt)},r.$$.update=()=>{var x,M,y,w,C,T,b,S,F,k,L,O,B;r.$$.dirty&4&&g.set(s),r.$$.dirty&232&&(o&&(n.position.set((x=o.x)!=null?x:0,(M=o.y)!=null?M:0,(y=o.z)!=null?y:0),v()),c&&!l&&(c instanceof Et?m():(d(),n.lookAt((w=c.x)!=null?w:0,(C=c.y)!=null?C:0,(T=c.z)!=null?T:0),v())),c||d()),r.$$.dirty&144&&a&&(typeof a=="number"?n.scale.set(a,a,a):n.scale.set((b=a.x)!=null?b:1,(S=a.y)!=null?S:1,(F=a.z)!=null?F:1),v()),r.$$.dirty&160&&l&&(n.rotation.set((k=l.x)!=null?k:0,(L=l.y)!=null?L:0,(O=l.z)!=null?O:0,(B=l.order)!=null?B:"XYZ"),v())},[p,g,s,o,a,l,c,n]}class G_ extends gt{constructor(e){super(),mt(this,e,B_,null,ft,{object:2,position:3,scale:4,rotation:5,lookAt:6})}}function H_(r,e,t){let n,i,s,{object:o}=e,{viewportAware:a=!1}=e;const l=_s(),{camera:c,invalidate:u}=Un();Ee(r,c,w=>t(8,s=w));const f=new Uo,h=new vt,p=w=>w.type==="Mesh",_=new I,v=()=>s?(h.multiplyMatrices(s.projectionMatrix,s.matrixWorldInverse),f.setFromProjectionMatrix(h),p(o)?f.intersectsObject(o):(o.getWorldPosition(_),f.containsPoint(_))):!0,m=eu();Ee(r,m,w=>t(7,i=w));let{inViewport:d=v()}=e;const g=async w=>{w?(i||await Lr(),l("viewportenter",o)):(i||await Lr(),l("viewportleave",o))},{start:x,stop:M,started:y}=$c(()=>{const w=v();d===void 0?(t(3,d=v()),g(d)):w!==d&&(g(w),t(3,d=w))},{autostart:a,debugFrameloopMessage:"ViewportAwareObject: tracking viewport visibility"});return Ee(r,y,w=>t(6,n=w)),u("ViewportAwareObject"),r.$$set=w=>{"object"in w&&t(4,o=w.object),"viewportAware"in w&&t(5,a=w.viewportAware),"inViewport"in w&&t(3,d=w.inViewport)},r.$$.update=()=>{r.$$.dirty&96&&(a&&!n?x():!a&&n&&M())},[c,m,y,d,o,a,n]}class V_ extends gt{constructor(e){super(),mt(this,e,H_,null,ft,{object:4,viewportAware:5,inViewport:3})}}function W_(r){let e;const t=r[14].default,n=xn(t,r,r[18],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&262144)&&bn(n,t,i,i[18],e?Mn(t,i[18],s,null):Sn(i[18]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function j_(r){let e,t;return e=new ko({props:{object:r[1],$$slots:{default:[W_]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&2&&(s.object=n[1]),i&262144&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function X_(r){let e,t,n,i,s,o,a,l,c;e=new Jc({props:{object:r[1]}}),n=new G_({props:{object:r[1],position:r[2],rotation:r[4],scale:r[3],lookAt:r[5]}}),s=new Bo({props:{object:r[1],dispose:r[7],$$slots:{default:[j_]},$$scope:{ctx:r}}});function u(h){r[15](h)}let f={object:r[1],viewportAware:r[6]};return r[0]!==void 0&&(f.inViewport=r[0]),a=new V_({props:f}),Vn.push(()=>xs(a,"inViewport",u)),a.$on("viewportenter",r[16]),a.$on("viewportleave",r[17]),{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment),i=le(),nt(s.$$.fragment),o=le(),nt(a.$$.fragment)},m(h,p){$e(e,h,p),Oe(h,t,p),$e(n,h,p),Oe(h,i,p),$e(s,h,p),Oe(h,o,p),$e(a,h,p),c=!0},p(h,[p]){const _={};p&2&&(_.object=h[1]),e.$set(_);const v={};p&2&&(v.object=h[1]),p&4&&(v.position=h[2]),p&16&&(v.rotation=h[4]),p&8&&(v.scale=h[3]),p&32&&(v.lookAt=h[5]),n.$set(v);const m={};p&2&&(m.object=h[1]),p&128&&(m.dispose=h[7]),p&262146&&(m.$$scope={dirty:p,ctx:h}),s.$set(m);const d={};p&2&&(d.object=h[1]),p&64&&(d.viewportAware=h[6]),!l&&p&1&&(l=!0,d.inViewport=h[0],vs(()=>l=!1)),a.$set(d)},i(h){c||(_e(e.$$.fragment,h),_e(n.$$.fragment,h),_e(s.$$.fragment,h),_e(a.$$.fragment,h),c=!0)},o(h){Se(e.$$.fragment,h),Se(n.$$.fragment,h),Se(s.$$.fragment,h),Se(a.$$.fragment,h),c=!1},d(h){et(e,h),h&&Ne(t),et(n,h),h&&Ne(i),et(s,h),h&&Ne(o),et(a,h)}}}function q_(r,e,t){let{$$slots:n={},$$scope:i}=e,{object:s}=e,{position:o=void 0}=e,{scale:a=void 0}=e,{rotation:l=void 0}=e,{lookAt:c=void 0}=e,{viewportAware:u=!1}=e,{inViewport:f=!1}=e,{castShadow:h=void 0}=e,{receiveShadow:p=void 0}=e,{frustumCulled:_=void 0}=e,{renderOrder:v=void 0}=e,{visible:m=void 0}=e,{dispose:d=void 0}=e,{userData:g=void 0}=e;const{invalidate:x}=Un(),M=()=>s;function y(T){f=T,t(0,f)}function w(T){$i.call(this,r,T)}function C(T){$i.call(this,r,T)}return r.$$set=T=>{"object"in T&&t(1,s=T.object),"position"in T&&t(2,o=T.position),"scale"in T&&t(3,a=T.scale),"rotation"in T&&t(4,l=T.rotation),"lookAt"in T&&t(5,c=T.lookAt),"viewportAware"in T&&t(6,u=T.viewportAware),"inViewport"in T&&t(0,f=T.inViewport),"castShadow"in T&&t(8,h=T.castShadow),"receiveShadow"in T&&t(9,p=T.receiveShadow),"frustumCulled"in T&&t(10,_=T.frustumCulled),"renderOrder"in T&&t(11,v=T.renderOrder),"visible"in T&&t(12,m=T.visible),"dispose"in T&&t(7,d=T.dispose),"userData"in T&&t(13,g=T.userData),"$$scope"in T&&t(18,i=T.$$scope)},r.$$.update=()=>{r.$$.dirty&16128&&(m!==void 0&&(M().visible=m),h!==void 0&&(M().castShadow=h),p!==void 0&&(M().receiveShadow=p),_!==void 0&&(M().frustumCulled=_),v!==void 0&&(M().renderOrder=v),g!==void 0&&(M().userData={...M().userData,...g}),x("Object3DInstance: props changed"))},[f,s,o,a,l,c,u,d,h,p,_,v,m,g,n,y,w,C,i]}class Y_ extends gt{constructor(e){super(),mt(this,e,q_,X_,ft,{object:1,position:2,scale:3,rotation:4,lookAt:5,viewportAware:6,inViewport:0,castShadow:8,receiveShadow:9,frustumCulled:10,renderOrder:11,visible:12,dispose:7,userData:13})}}function Z_(r){let e;const t=r[17].default,n=xn(t,r,r[21],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&2097152)&&bn(n,t,i,i[21],e?Mn(t,i[21],s,null):Sn(i[21]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function Q_(r){let e,t,n;function i(o){r[18](o)}let s={object:r[1],lookAt:r[5],castShadow:r[7],receiveShadow:r[8],frustumCulled:r[9],renderOrder:r[10],position:r[2],scale:r[3],rotation:r[4],viewportAware:r[6],visible:r[11],userData:r[12],dispose:r[13],$$slots:{default:[Z_]},$$scope:{ctx:r}};return r[0]!==void 0&&(s.inViewport=r[0]),e=new Y_({props:s}),Vn.push(()=>xs(e,"inViewport",i)),e.$on("viewportenter",r[19]),e.$on("viewportleave",r[20]),{c(){nt(e.$$.fragment)},m(o,a){$e(e,o,a),n=!0},p(o,[a]){const l={};a&2&&(l.object=o[1]),a&32&&(l.lookAt=o[5]),a&128&&(l.castShadow=o[7]),a&256&&(l.receiveShadow=o[8]),a&512&&(l.frustumCulled=o[9]),a&1024&&(l.renderOrder=o[10]),a&4&&(l.position=o[2]),a&8&&(l.scale=o[3]),a&16&&(l.rotation=o[4]),a&64&&(l.viewportAware=o[6]),a&2048&&(l.visible=o[11]),a&4096&&(l.userData=o[12]),a&8192&&(l.dispose=o[13]),a&2097152&&(l.$$scope={dirty:a,ctx:o}),!t&&a&1&&(t=!0,l.inViewport=o[0],vs(()=>t=!1)),e.$set(l)},i(o){n||(_e(e.$$.fragment,o),n=!0)},o(o){Se(e.$$.fragment,o),n=!1},d(o){et(e,o)}}}function K_(r,e,t){let n,{$$slots:i={},$$scope:s}=e,{camera:o}=e,{position:a=void 0}=e,{scale:l=void 0}=e,{rotation:c=void 0}=e,{lookAt:u=void 0}=e,{viewportAware:f=!1}=e,{inViewport:h=!1}=e,{castShadow:p=void 0}=e,{receiveShadow:_=void 0}=e,{frustumCulled:v=void 0}=e,{renderOrder:m=void 0}=e,{visible:d=void 0}=e,{userData:g=void 0}=e,{dispose:x=void 0}=e,{useCamera:M=!1}=e;const y=Cs(o);Ee(r,y,S=>t(16,n=S));const{setCamera:w}=Kc();function C(S){h=S,t(0,h)}function T(S){$i.call(this,r,S)}function b(S){$i.call(this,r,S)}return r.$$set=S=>{"camera"in S&&t(1,o=S.camera),"position"in S&&t(2,a=S.position),"scale"in S&&t(3,l=S.scale),"rotation"in S&&t(4,c=S.rotation),"lookAt"in S&&t(5,u=S.lookAt),"viewportAware"in S&&t(6,f=S.viewportAware),"inViewport"in S&&t(0,h=S.inViewport),"castShadow"in S&&t(7,p=S.castShadow),"receiveShadow"in S&&t(8,_=S.receiveShadow),"frustumCulled"in S&&t(9,v=S.frustumCulled),"renderOrder"in S&&t(10,m=S.renderOrder),"visible"in S&&t(11,d=S.visible),"userData"in S&&t(12,g=S.userData),"dispose"in S&&t(13,x=S.dispose),"useCamera"in S&&t(15,M=S.useCamera),"$$scope"in S&&t(21,s=S.$$scope)},r.$$.update=()=>{r.$$.dirty&2&&y.set(o),r.$$.dirty&98304&&M&&w(n)},[h,o,a,l,c,u,f,p,_,v,m,d,g,x,y,M,n,i,C,T,b,s]}class J_ extends gt{constructor(e){super(),mt(this,e,K_,Q_,ft,{camera:1,position:2,scale:3,rotation:4,lookAt:5,viewportAware:6,inViewport:0,castShadow:7,receiveShadow:8,frustumCulled:9,renderOrder:10,visible:11,userData:12,dispose:13,useCamera:15})}}function $_(r){let e;const t=r[20].default,n=xn(t,r,r[24],null);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&16777216)&&bn(n,t,i,i[24],e?Mn(t,i[24],s,null):Sn(i[24]),null)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function e0(r){let e,t,n;function i(o){r[21](o)}let s={camera:r[0],position:r[2],scale:r[3],rotation:r[4],castShadow:r[6],receiveShadow:r[7],frustumCulled:r[8],renderOrder:r[9],visible:r[10],userData:r[11],dispose:r[12],viewportAware:r[13],lookAt:r[5],useCamera:r[14],$$slots:{default:[$_]},$$scope:{ctx:r}};return r[1]!==void 0&&(s.inViewport=r[1]),e=new J_({props:s}),Vn.push(()=>xs(e,"inViewport",i)),e.$on("viewportenter",r[22]),e.$on("viewportleave",r[23]),{c(){nt(e.$$.fragment)},m(o,a){$e(e,o,a),n=!0},p(o,[a]){const l={};a&1&&(l.camera=o[0]),a&4&&(l.position=o[2]),a&8&&(l.scale=o[3]),a&16&&(l.rotation=o[4]),a&64&&(l.castShadow=o[6]),a&128&&(l.receiveShadow=o[7]),a&256&&(l.frustumCulled=o[8]),a&512&&(l.renderOrder=o[9]),a&1024&&(l.visible=o[10]),a&2048&&(l.userData=o[11]),a&4096&&(l.dispose=o[12]),a&8192&&(l.viewportAware=o[13]),a&32&&(l.lookAt=o[5]),a&16384&&(l.useCamera=o[14]),a&16777216&&(l.$$scope={dirty:a,ctx:o}),!t&&a&2&&(t=!0,l.inViewport=o[1],vs(()=>t=!1)),e.$set(l)},i(o){n||(_e(e.$$.fragment,o),n=!0)},o(o){Se(e.$$.fragment,o),n=!1},d(o){et(e,o)}}}function t0(r,e,t){let n,{$$slots:i={},$$scope:s}=e,{position:o=void 0}=e,{scale:a=void 0}=e,{rotation:l=void 0}=e,{lookAt:c=void 0}=e,{castShadow:u=void 0}=e,{receiveShadow:f=void 0}=e,{frustumCulled:h=void 0}=e,{renderOrder:p=void 0}=e,{visible:_=void 0}=e,{userData:v=void 0}=e,{dispose:m=void 0}=e,{viewportAware:d=!1}=e,{inViewport:g=!1}=e,{useCamera:x=!0}=e,{near:M=void 0}=e,{far:y=void 0}=e,{fov:w=void 0}=e;const{size:C,invalidate:T}=Un();Ee(r,C,L=>t(19,n=L));const b=new sn(w,n.width/n.height,M,y);function S(L){g=L,t(1,g)}function F(L){$i.call(this,r,L)}function k(L){$i.call(this,r,L)}return r.$$set=L=>{"position"in L&&t(2,o=L.position),"scale"in L&&t(3,a=L.scale),"rotation"in L&&t(4,l=L.rotation),"lookAt"in L&&t(5,c=L.lookAt),"castShadow"in L&&t(6,u=L.castShadow),"receiveShadow"in L&&t(7,f=L.receiveShadow),"frustumCulled"in L&&t(8,h=L.frustumCulled),"renderOrder"in L&&t(9,p=L.renderOrder),"visible"in L&&t(10,_=L.visible),"userData"in L&&t(11,v=L.userData),"dispose"in L&&t(12,m=L.dispose),"viewportAware"in L&&t(13,d=L.viewportAware),"inViewport"in L&&t(1,g=L.inViewport),"useCamera"in L&&t(14,x=L.useCamera),"near"in L&&t(16,M=L.near),"far"in L&&t(17,y=L.far),"fov"in L&&t(18,w=L.fov),"$$scope"in L&&t(24,s=L.$$scope)},r.$$.update=()=>{r.$$.dirty&524289&&(t(0,b.aspect=n.width/n.height,b),b.updateProjectionMatrix(),T("PerspectiveCamera: aspect changed")),r.$$.dirty&458753&&(M!==void 0&&t(0,b.near=M,b),y!==void 0&&t(0,b.far=y,b),w!==void 0&&t(0,b.fov=w,b),b.updateProjectionMatrix(),T("PerspectiveCamera: props changed"))},[b,g,o,a,l,c,u,f,h,p,_,v,m,d,x,C,M,y,w,n,i,S,F,k,s]}class n0 extends gt{constructor(e){super(),mt(this,e,t0,e0,ft,{position:2,scale:3,rotation:4,lookAt:5,castShadow:6,receiveShadow:7,frustumCulled:8,renderOrder:9,visible:10,userData:11,dispose:12,viewportAware:13,inViewport:1,useCamera:14,near:16,far:17,fov:18,camera:0})}get camera(){return this.$$.ctx[0]}}const Gl=[],i0=(r,e)=>{const t=Gl.find(i=>i instanceof r);if(t)return t;const n=e();return Gl.push(n),n},hi=new Xc,Qt=new I,Jn=new I,dt=new jt,Hl={X:new I(1,0,0),Y:new I(0,1,0),Z:new I(0,0,1)},co={type:"change"},Vl={type:"mouseDown"},Wl={type:"mouseUp",mode:null},jl={type:"objectChange"};class r0 extends Et{constructor(e,t){super(),t===void 0&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),t=document),this.isTransformControls=!0,this.visible=!1,this.domElement=t,this.domElement.style.touchAction="none";const n=new u0;this._gizmo=n,this.add(n);const i=new f0;this._plane=i,this.add(i);const s=this;function o(g,x){let M=x;Object.defineProperty(s,g,{get:function(){return M!==void 0?M:x},set:function(y){M!==y&&(M=y,i[g]=y,n[g]=y,s.dispatchEvent({type:g+"-changed",value:y}),s.dispatchEvent(co))}}),s[g]=x,i[g]=x,n[g]=x}o("camera",e),o("object",void 0),o("enabled",!0),o("axis",null),o("mode","translate"),o("translationSnap",null),o("rotationSnap",null),o("scaleSnap",null),o("space","world"),o("size",1),o("dragging",!1),o("showX",!0),o("showY",!0),o("showZ",!0);const a=new I,l=new I,c=new jt,u=new jt,f=new I,h=new jt,p=new I,_=new I,v=new I,m=0,d=new I;o("worldPosition",a),o("worldPositionStart",l),o("worldQuaternion",c),o("worldQuaternionStart",u),o("cameraPosition",f),o("cameraQuaternion",h),o("pointStart",p),o("pointEnd",_),o("rotationAxis",v),o("rotationAngle",m),o("eye",d),this._offset=new I,this._startNorm=new I,this._endNorm=new I,this._cameraScale=new I,this._parentPosition=new I,this._parentQuaternion=new jt,this._parentQuaternionInv=new jt,this._parentScale=new I,this._worldScaleStart=new I,this._worldQuaternionInv=new jt,this._worldScale=new I,this._positionStart=new I,this._quaternionStart=new jt,this._scaleStart=new I,this._getPointer=s0.bind(this),this._onPointerDown=a0.bind(this),this._onPointerHover=o0.bind(this),this._onPointerMove=l0.bind(this),this._onPointerUp=c0.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){this.object!==void 0&&(this.object.updateMatrixWorld(),this.object.parent===null?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.camera.isOrthographicCamera?this.camera.getWorldDirection(this.eye).negate():this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;hi.setFromCamera(e,this.camera);const t=uo(this._gizmo.picker[this.mode],hi);t?this.axis=t.object.name:this.axis=null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e.button!==0)&&this.axis!==null){hi.setFromCamera(e,this.camera);const t=uo(this._plane,hi,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,Vl.mode=this.mode,this.dispatchEvent(Vl)}}pointerMove(e){const t=this.axis,n=this.mode,i=this.object;let s=this.space;if(n==="scale"?s="local":(t==="E"||t==="XYZE"||t==="XYZ")&&(s="world"),i===void 0||t===null||this.dragging===!1||e.button!==-1)return;hi.setFromCamera(e,this.camera);const o=uo(this._plane,hi,!0);if(!!o){if(this.pointEnd.copy(o.point).sub(this.worldPositionStart),n==="translate")this._offset.copy(this.pointEnd).sub(this.pointStart),s==="local"&&t!=="XYZ"&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf("X")===-1&&(this._offset.x=0),t.indexOf("Y")===-1&&(this._offset.y=0),t.indexOf("Z")===-1&&(this._offset.z=0),s==="local"&&t!=="XYZ"?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),i.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(s==="local"&&(i.position.applyQuaternion(dt.copy(this._quaternionStart).invert()),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.position.applyQuaternion(this._quaternionStart)),s==="world"&&(i.parent&&i.position.add(Qt.setFromMatrixPosition(i.parent.matrixWorld)),t.search("X")!==-1&&(i.position.x=Math.round(i.position.x/this.translationSnap)*this.translationSnap),t.search("Y")!==-1&&(i.position.y=Math.round(i.position.y/this.translationSnap)*this.translationSnap),t.search("Z")!==-1&&(i.position.z=Math.round(i.position.z/this.translationSnap)*this.translationSnap),i.parent&&i.position.sub(Qt.setFromMatrixPosition(i.parent.matrixWorld))));else if(n==="scale"){if(t.search("XYZ")!==-1){let a=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(a*=-1),Jn.set(a,a,a)}else Qt.copy(this.pointStart),Jn.copy(this.pointEnd),Qt.applyQuaternion(this._worldQuaternionInv),Jn.applyQuaternion(this._worldQuaternionInv),Jn.divide(Qt),t.search("X")===-1&&(Jn.x=1),t.search("Y")===-1&&(Jn.y=1),t.search("Z")===-1&&(Jn.z=1);i.scale.copy(this._scaleStart).multiply(Jn),this.scaleSnap&&(t.search("X")!==-1&&(i.scale.x=Math.round(i.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Y")!==-1&&(i.scale.y=Math.round(i.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search("Z")!==-1&&(i.scale.z=Math.round(i.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(n==="rotate"){this._offset.copy(this.pointEnd).sub(this.pointStart);const a=20/this.worldPosition.distanceTo(Qt.setFromMatrixPosition(this.camera.matrixWorld));t==="E"?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):t==="XYZE"?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(Qt.copy(this.rotationAxis).cross(this.eye))*a):(t==="X"||t==="Y"||t==="Z")&&(this.rotationAxis.copy(Hl[t]),Qt.copy(Hl[t]),s==="local"&&Qt.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(Qt.cross(this.eye).normalize())*a),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),s==="local"&&t!=="E"&&t!=="XYZE"?(i.quaternion.copy(this._quaternionStart),i.quaternion.multiply(dt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),i.quaternion.copy(dt.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),i.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(co),this.dispatchEvent(jl)}}pointerUp(e){e.button===0&&(this.dragging&&this.axis!==null&&(Wl.mode=this.mode,this.dispatchEvent(Wl)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}attach(e){return this.object=e,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){!this.enabled||this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(co),this.dispatchEvent(jl),this.pointStart.copy(this.pointEnd))}getRaycaster(){return hi}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}}function s0(r){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:r.button};{const e=this.domElement.getBoundingClientRect();return{x:(r.clientX-e.left)/e.width*2-1,y:-(r.clientY-e.top)/e.height*2+1,button:r.button}}}function o0(r){if(!!this.enabled)switch(r.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(r));break}}function a0(r){!this.enabled||(document.pointerLockElement||this.domElement.setPointerCapture(r.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(r)),this.pointerDown(this._getPointer(r)))}function l0(r){!this.enabled||this.pointerMove(this._getPointer(r))}function c0(r){!this.enabled||(this.domElement.releasePointerCapture(r.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(r)))}function uo(r,e,t){const n=e.intersectObject(r,!0);for(let i=0;i.9&&(o.visible=!1)),this.axis==="Y"&&(dt.setFromEuler(os.set(0,0,Math.PI/2)),o.quaternion.copy(n).multiply(dt),Math.abs(it.copy(mi).applyQuaternion(n).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="Z"&&(dt.setFromEuler(os.set(0,Math.PI/2,0)),o.quaternion.copy(n).multiply(dt),Math.abs(it.copy(yr).applyQuaternion(n).dot(this.eye))>.9&&(o.visible=!1)),this.axis==="XYZE"&&(dt.setFromEuler(os.set(0,Math.PI/2,0)),it.copy(this.rotationAxis),o.quaternion.setFromRotationMatrix(ql.lookAt(Xl,it,mi)),o.quaternion.multiply(dt),o.visible=this.dragging),this.axis==="E"&&(o.visible=!1)):o.name==="START"?(o.position.copy(this.worldPositionStart),o.visible=this.dragging):o.name==="END"?(o.position.copy(this.worldPosition),o.visible=this.dragging):o.name==="DELTA"?(o.position.copy(this.worldPositionStart),o.quaternion.copy(this.worldQuaternionStart),Qt.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),Qt.applyQuaternion(this.worldQuaternionStart.clone().invert()),o.scale.copy(Qt),o.visible=this.dragging):(o.quaternion.copy(n),this.dragging?o.position.copy(this.worldPositionStart):o.position.copy(this.worldPosition),this.axis&&(o.visible=this.axis.search(o.name)!==-1));continue}o.quaternion.copy(n),this.mode==="translate"||this.mode==="scale"?(o.name==="X"&&Math.abs(it.copy(Sr).applyQuaternion(n).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Y"&&Math.abs(it.copy(mi).applyQuaternion(n).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="Z"&&Math.abs(it.copy(yr).applyQuaternion(n).dot(this.eye))>.99&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XY"&&Math.abs(it.copy(yr).applyQuaternion(n).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="YZ"&&Math.abs(it.copy(Sr).applyQuaternion(n).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1),o.name==="XZ"&&Math.abs(it.copy(mi).applyQuaternion(n).dot(this.eye))<.2&&(o.scale.set(1e-10,1e-10,1e-10),o.visible=!1)):this.mode==="rotate"&&(as.copy(n),it.copy(this.eye).applyQuaternion(dt.copy(n).invert()),o.name.search("E")!==-1&&o.quaternion.setFromRotationMatrix(ql.lookAt(this.eye,Xl,mi)),o.name==="X"&&(dt.setFromAxisAngle(Sr,Math.atan2(-it.y,it.z)),dt.multiplyQuaternions(as,dt),o.quaternion.copy(dt)),o.name==="Y"&&(dt.setFromAxisAngle(mi,Math.atan2(it.x,it.z)),dt.multiplyQuaternions(as,dt),o.quaternion.copy(dt)),o.name==="Z"&&(dt.setFromAxisAngle(yr,Math.atan2(it.y,it.x)),dt.multiplyQuaternions(as,dt),o.quaternion.copy(dt))),o.visible=o.visible&&(o.name.indexOf("X")===-1||this.showX),o.visible=o.visible&&(o.name.indexOf("Y")===-1||this.showY),o.visible=o.visible&&(o.name.indexOf("Z")===-1||this.showZ),o.visible=o.visible&&(o.name.indexOf("E")===-1||this.showX&&this.showY&&this.showZ),o.material._color=o.material._color||o.material.color.clone(),o.material._opacity=o.material._opacity||o.material.opacity,o.material.color.copy(o.material._color),o.material.opacity=o.material._opacity,this.enabled&&this.axis&&(o.name===this.axis||this.axis.split("").some(function(l){return o.name===l}))&&(o.material.color.setHex(16776960),o.material.opacity=1)}super.updateMatrixWorld(e)}}class f0 extends pe{constructor(){super(new ws(1e5,1e5,2,2),new ys({visible:!1,wireframe:!0,side:Pn,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type="TransformControlsPlane"}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode==="scale"&&(t="local"),ls.copy(Sr).applyQuaternion(t==="local"?this.worldQuaternion:ds),_r.copy(mi).applyQuaternion(t==="local"?this.worldQuaternion:ds),vr.copy(yr).applyQuaternion(t==="local"?this.worldQuaternion:ds),it.copy(_r),this.mode){case"translate":case"scale":switch(this.axis){case"X":it.copy(this.eye).cross(ls),wn.copy(ls).cross(it);break;case"Y":it.copy(this.eye).cross(_r),wn.copy(_r).cross(it);break;case"Z":it.copy(this.eye).cross(vr),wn.copy(vr).cross(it);break;case"XY":wn.copy(vr);break;case"YZ":wn.copy(ls);break;case"XZ":it.copy(vr),wn.copy(_r);break;case"XYZ":case"E":wn.set(0,0,0);break}break;case"rotate":default:wn.set(0,0,0)}wn.length()===0?this.quaternion.copy(this.cameraQuaternion):(Yl.lookAt(Qt.set(0,0,0),wn,it),this.quaternion.setFromRotationMatrix(Yl)),super.updateMatrixWorld(e)}}function h0(r){let e,t,n,i;return e=new Bo({props:{dispose:r[0],object:r[1]}}),n=new Jc({props:{object:r[1]}}),{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment)},m(s,o){$e(e,s,o),Oe(s,t,o),$e(n,s,o),i=!0},p(s,[o]){const a={};o&1&&(a.dispose=s[0]),o&2&&(a.object=s[1]),e.$set(a);const l={};o&2&&(l.object=s[1]),n.$set(l)},i(s){i||(_e(e.$$.fragment,s),_e(n.$$.fragment,s),i=!0)},o(s){Se(e.$$.fragment,s),Se(n.$$.fragment,s),i=!1},d(s){et(e,s),s&&Ne(t),et(n,s)}}}function d0(r,e,t){let n,i,{autoPauseOrbitControls:s=!0}=e,{mode:o=void 0}=e,{axis:a=null}=e,{dragging:l=!1}=e,{enabled:c=void 0}=e,{translationSnap:u=void 0}=e,{scaleSnap:f=void 0}=e,{rotationSnap:h=void 0}=e,{showX:p=void 0}=e,{showY:_=void 0}=e,{showZ:v=void 0}=e,{size:m=void 0}=e,{space:d=void 0}=e,{dispose:g=void 0}=e;const{camera:x,renderer:M,invalidate:y,scene:w}=Un();Ee(r,x,R=>t(20,i=R));const C=Qc();if(Ee(r,C,R=>t(19,n=R)),!n)throw new Error("TransformControls: parent not defined. Is this component a child of ?");const T=_s(),b=()=>{if(!!i)return Ln(i).orbitControls};let S;const F=()=>{if(S!==void 0){const R=b();R&&(R.enabled=S),S=void 0}};ut(F);const k={change:R=>{var H,Q;n&&((Q=(H=Ln(n)).onTransform)==null||Q.call(H)),y("TransformControls: change event"),T("change",R)},"camera-changed":R=>T("camera-changed",R),"object-changed":R=>T("object-changed",R),"enabled-changed":R=>T("enabled-changed",R),"axis-changed":R=>{t(4,a=R.value),T("axis-changed",R)},"mode-changed":R=>T("mode-changed",R),"translationSnap-changed":R=>T("translationSnap-changed",R),"rotationSnap-changed":R=>T("rotationSnap-changed",R),"scaleSnap-changed":R=>T("scaleSnap-changed",R),"space-changed":R=>T("space-changed",R),"size-changed":R=>T("size-changed",R),"dragging-changed":R=>{t(5,l=R.value);e:if(s){const H=b();if(!H)break e;const Q=!R.value;if(H.enabled===Q)break e;R.value&&(S=H.enabled),H.enabled=Q}T("dragging-changed",R)},"showX-changed":R=>T("showX-changed",R),"showY-changed":R=>T("showY-changed",R),"showZ-changed":R=>T("showZ-changed",R),"worldPosition-changed":R=>T("worldPosition-changed",R),"worldPositionStart-changed":R=>T("worldPositionStart-changed",R),"worldQuaternion-changed":R=>T("worldQuaternion-changed",R),"worldQuaternionStart-changed":R=>T("worldQuaternionStart-changed",R),"cameraPosition-changed":R=>T("cameraPosition-changed",R),"cameraQuaternion-changed":R=>T("cameraQuaternion-changed",R),"pointStart-changed":R=>T("pointStart-changed",R),"pointEnd-changed":R=>T("pointEnd-changed",R),"rotationAxis-changed":R=>T("rotationAxis-changed",R),"rotationAngle-changed":R=>T("rotationAngle-changed",R),"eye-changed":R=>T("eye-changed",R),mouseDown:()=>T("mouseDown"),mouseUp:()=>T("mouseUp"),objectChange:()=>T("objectChange")};if(!M)throw new Error("TransformControls: renderer is undefined, is this component a child of ?");const L=new r0(i,M.domElement),O=()=>L.reset();L.attach(n);const B=()=>{Object.entries(k).forEach(([R,H])=>{L.addEventListener(R,H)})},J=()=>{Object.entries(k).forEach(([R,H])=>{L.removeEventListener(R,H)})};return B(),w.add(L),ut(()=>{L.detach(),w.remove(L),J()}),r.$$set=R=>{"autoPauseOrbitControls"in R&&t(6,s=R.autoPauseOrbitControls),"mode"in R&&t(7,o=R.mode),"axis"in R&&t(4,a=R.axis),"dragging"in R&&t(5,l=R.dragging),"enabled"in R&&t(8,c=R.enabled),"translationSnap"in R&&t(9,u=R.translationSnap),"scaleSnap"in R&&t(10,f=R.scaleSnap),"rotationSnap"in R&&t(11,h=R.rotationSnap),"showX"in R&&t(12,p=R.showX),"showY"in R&&t(13,_=R.showY),"showZ"in R&&t(14,v=R.showZ),"size"in R&&t(15,m=R.size),"space"in R&&t(16,d=R.space),"dispose"in R&&t(0,g=R.dispose)},r.$$.update=()=>{r.$$.dirty&64&&(s||F()),r.$$.dirty&256&&c!==void 0&&t(1,L.enabled=c,L),r.$$.dirty&4096&&p!==void 0&&t(1,L.showX=p,L),r.$$.dirty&8192&&_!==void 0&&t(1,L.showY=_,L),r.$$.dirty&16384&&v!==void 0&&t(1,L.showZ=v,L),r.$$.dirty&130&&o!==void 0&&L.setMode(o),r.$$.dirty&514&&u!==void 0&&L.setTranslationSnap(u),r.$$.dirty&1026&&f!==void 0&&L.setScaleSnap(f),r.$$.dirty&2050&&h!==void 0&&L.setRotationSnap(h),r.$$.dirty&32770&&m!==void 0&&L.setSize(m),r.$$.dirty&65538&&d!==void 0&&L.setSpace(d)},[g,L,x,C,a,l,s,o,c,u,f,h,p,_,v,m,d,O]}class p0 extends gt{constructor(e){super(),mt(this,e,d0,h0,ft,{autoPauseOrbitControls:6,mode:7,axis:4,dragging:5,enabled:8,translationSnap:9,scaleSnap:10,rotationSnap:11,showX:12,showY:13,showZ:14,size:15,space:16,dispose:0,reset:17})}get reset(){return this.$$.ctx[17]}}const tu=new Et;tu.scale.set(0,0,0);tu.matrix;new vt().fromArray(new Array(16).fill(0));new Je(16777215);const nu=(r,e)=>{if(e.includes(".")){const t=e.split("."),n=t.pop();for(let i=0;i{const{invalidate:r}=Un();let e=!1,t=fo,n,i,s;const o=(l,c,u)=>{if(a(),!u){const f=l;((f==null?void 0:f.isMaterial)||!1)&&(u="material"),((f==null?void 0:f.isBufferGeometry)||(f==null?void 0:f.isGeometry)||!1)&&(u="geometry")}if(!!u){if(typeof u=="function")n=u(c,l);else{const{target:f,key:h}=nu(c,u);t=f[h],f[h]=l,i=f,s=h}e=!0,r()}},a=()=>{!e||(n?(n(),n=void 0):i&&s&&t!==fo&&(i[s]=t,t=fo,i=void 0,s=void 0),e=!1,r())};return ut(()=>{a()}),{update:o}},g0=r=>r&&r.isCamera,iu=r=>r&&r.isOrthographicCamera,ru=r=>r&&r.isPerspectiveCamera,_0=r=>ru(r)||iu(r),v0=()=>{const{invalidate:r,size:e}=Un(),{setCamera:t}=Kc();let n,i;ut(()=>{i==null||i()});const s=l=>{!n||(iu(n)?(n.left=l.width/-2,n.right=l.width/2,n.top=l.height/2,n.bottom=l.height/-2,n.updateProjectionMatrix(),n.updateMatrixWorld(),r()):ru(n)&&(n.aspect=l.width/l.height,n.updateProjectionMatrix(),n.updateMatrixWorld(),r()))};return{update:(l,c)=>{if(i==null||i(),c||!_0(l)){n=void 0;return}n=l,i=e.subscribe(s)},makeDefaultCamera:(l,c)=>{!g0(l)||!c||(t(l),r())}}},Zl=r=>!!(r!=null&&r.addEventListener),x0=()=>{const r=_s(),e=sr(),t=h=>{h!=null&&h.type&&r(h.type,h)},n=(h,p)=>{Zl(h)&&p.forEach(_=>{h.removeEventListener(_,t)})},i=(h,p)=>{Zl(h)&&p.forEach(_=>{h.addEventListener(_,t)})};let s=[],o;const a=Ye([]),l=a.subscribe(h=>{n(o,s),i(o,h),s=h});ut(l);const c=Ye(),u=c.subscribe(h=>{n(o,s),i(h,s),o=h});return ut(u),ut(()=>{n(o,s)}),or(()=>{a.set(Object.keys(e.$$.callbacks))}),{updateRef:h=>{c.set(h)}}},M0=["$$scope","$$slots","type","args","attach","instance"],b0=["fov","aspect","near","far","left","right","top","bottom","zoom"],S0=r=>typeof r=="string"||typeof r=="number"||typeof r=="boolean"||typeof r=="undefined"||r===null,y0=()=>{const{invalidate:r}=Un(),e=new Map,t=(i,s,o,a)=>{var u,f;if(S0(o)){const h=e.get(s);if(h&&h.instance===i&&h.value===o)return;e.set(s,{instance:i,value:o})}const{key:l,target:c}=nu(i,s);if(!Array.isArray(o)&&typeof o=="number"&&typeof((u=c[l])==null?void 0:u.setScalar)=="function")c[l].setScalar(o);else if(typeof((f=c[l])==null?void 0:f.set)=="function")Array.isArray(o)?c[l].set(...o):c[l].set(o);else{if(c[l]=o,a.manualCamera)return;b0.includes(l)&&(c.isPerspectiveCamera||c.isOrthographicCamera)&&c.updateProjectionMatrix()}};return{updateProps:(i,s,o)=>{for(const a in s)M0.includes(a)||t(i,a,s[a],o),r()}}},w0=r=>({ref:r&1}),Ql=r=>({ref:r[0]}),E0=r=>({ref:r&1}),Kl=r=>({ref:r[0]});function Jl(r){let e,t;return e=new Bo({props:{object:r[0],dispose:r[1]}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&1&&(s.object=n[0]),i&2&&(s.dispose=n[1]),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function T0(r){let e;const t=r[12].default,n=xn(t,r,r[13],Ql);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&8193)&&bn(n,t,i,i[13],e?Mn(t,i[13],s,w0):Sn(i[13]),Ql)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function A0(r){let e,t;return e=new ko({props:{object:r[0],$$slots:{default:[C0]},$$scope:{ctx:r}}}),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i&1&&(s.object=n[0]),i&8193&&(s.$$scope={dirty:i,ctx:n}),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function C0(r){let e;const t=r[12].default,n=xn(t,r,r[13],Kl);return{c(){n&&n.c()},m(i,s){n&&n.m(i,s),e=!0},p(i,s){n&&n.p&&(!e||s&8193)&&bn(n,t,i,i[13],e?Mn(t,i[13],s,E0):Sn(i[13]),Kl)},i(i){e||(_e(n,i),e=!0)},o(i){Se(n,i),e=!1},d(i){n&&n.d(i)}}}function P0(r){let e=r[4](r[0]),t,n,i,s,o,a,l=e&&Jl(r);const c=[A0,T0],u=[];function f(h,p){return p&1&&(n=null),n==null&&(n=!!h[3](h[0])),n?0:1}return i=f(r,-1),s=u[i]=c[i](r),{c(){l&&l.c(),t=le(),s.c(),o=ri()},m(h,p){l&&l.m(h,p),Oe(h,t,p),u[i].m(h,p),Oe(h,o,p),a=!0},p(h,[p]){p&1&&(e=h[4](h[0])),e?l?(l.p(h,p),p&1&&_e(l,1)):(l=Jl(h),l.c(),_e(l,1),l.m(t.parentNode,t)):l&&(Wn(),Se(l,1,1,()=>{l=null}),jn());let _=i;i=f(h,p),i===_?u[i].p(h,p):(Wn(),Se(u[_],1,1,()=>{u[_]=null}),jn(),s=u[i],s?s.p(h,p):(s=u[i]=c[i](h),s.c()),_e(s,1),s.m(o.parentNode,o))},i(h){a||(_e(l),_e(s),a=!0)},o(h){Se(l),Se(s),a=!1},d(h){l&&l.d(h),h&&Ne(t),u[i].d(h),h&&Ne(o)}}}function L0(r,e,t){const n=["type","args","attach","manual","makeDefault","dispose","ref"];let i=Wo(e,n),s,{$$slots:o={},$$scope:a}=e,{type:l}=e,{args:c=void 0}=e,{attach:u=void 0}=e,{manual:f=void 0}=e,{makeDefault:h=void 0}=e,{dispose:p=void 0}=e;const _=In("threlte-hierarchical-parent-context");Ee(r,_,S=>t(11,s=S));const v=S=>typeof S=="function"&&/^\s*class\s+/.test(S.toString()),m=S=>Array.isArray(S);let{ref:d=v(l)&&m(c)?new l(...c):v(l)?new l:l}=e,g=!1;const x=Ye(d);pn("threlte-hierarchical-parent-context",x);const M=y0(),y=v0(),w=m0(),C=x0(),T=S=>!!S.isObject3D,b=S=>S.dispose!==void 0;return r.$$set=S=>{e=ho(ho({},e),lu(S)),t(21,i=Wo(e,n)),"type"in S&&t(5,l=S.type),"args"in S&&t(6,c=S.args),"attach"in S&&t(7,u=S.attach),"manual"in S&&t(8,f=S.manual),"makeDefault"in S&&t(9,h=S.makeDefault),"dispose"in S&&t(1,p=S.dispose),"ref"in S&&t(0,d=S.ref),"$$scope"in S&&t(13,a=S.$$scope)},r.$$.update=()=>{r.$$.dirty&1120&&(g?t(0,d=v(l)&&m(c)?new l(...c):v(l)?new l:l):t(10,g=!0)),r.$$.dirty&1&&x.set(d),M.updateProps(d,i,{manualCamera:f}),r.$$.dirty&257&&y.update(d,f),r.$$.dirty&513&&y.makeDefaultCamera(d,h),r.$$.dirty&2177&&w.update(d,s,u),r.$$.dirty&1&&C.updateRef(d)},[d,p,_,T,b,l,c,u,f,h,g,s,o,a]}class R0 extends gt{constructor(e){super(),mt(this,e,L0,P0,ft,{type:5,args:6,attach:7,manual:8,makeDefault:9,dispose:1,ref:0})}}function D0(r){return console.error("The component can only be used in conjunction with the custom preprocessor."),[]}class $l extends gt{constructor(e){super(),mt(this,e,D0,null,ft,{})}}new Proxy($l,{get(r,e){return r[e]||$l}});i0(fl,()=>new fl(Vc));function ec(r){let e,t,n,i,s,o=r[4]=="translate"?"rotate":"translate",a,l,c,u,f,h,p,_,v,m,d,g,x,M,y,w=r[2].x.toFixed(2)+"",C,T,b,S,F,k,L=-r[2].z.toFixed(2)+"",O,B,J,R,H,Q,K=r[2].y.toFixed(2)+"",ve,se,j,ee,te,ue,N,Re,Ce,oe,Te,je,ye,Ue,lt,xt,Mt,_t,Xe=Kt.radToDeg(r[3].x).toFixed(2)+"",st,It,P,E,Y,ne,re=Kt.radToDeg(r[3].y).toFixed(2)+"",fe,Pe,de,$,xe,we,Ae=Kt.radToDeg(r[3].z).toFixed(2)+"",ge,Me,Fe,Ze,ct,U,W,ie,he,be,Ke,He,Tt,Yt,ht,Lt,Bt,Nn,si,Fr,fr,On,A,z,Z,G,X=r[12]==null&&tc(r);return On=new N_({props:{$$slots:{default:[U0]},$$scope:{ctx:r}}}),{c(){e=q("div"),t=q("div"),n=q("div"),i=q("button"),s=rt("Change to "),a=rt(o),l=le(),c=q("div"),u=q("button"),u.textContent="Reset Rotation",f=le(),h=q("button"),h.textContent="Reset Position",p=le(),_=q("div"),v=q("p"),v.textContent="Translation Snap",m=le(),d=q("div"),g=q("div"),x=q("p"),x.textContent="x",M=le(),y=q("p"),C=rt(w),T=le(),b=q("div"),S=q("p"),S.textContent="y",F=le(),k=q("p"),O=rt(L),B=le(),J=q("div"),R=q("p"),R.textContent="z",H=le(),Q=q("p"),ve=rt(K),se=le(),j=q("div"),ee=q("div"),te=rt(r[5]),ue=le(),N=q("input"),Re=le(),Ce=q("button"),Ce.textContent="Place On Ground",oe=le(),Te=q("div"),je=q("p"),je.textContent="Rotation Snap",ye=le(),Ue=q("div"),lt=q("div"),xt=q("p"),xt.textContent="x",Mt=le(),_t=q("p"),st=rt(Xe),It=le(),P=q("div"),E=q("p"),E.textContent="y",Y=le(),ne=q("p"),fe=rt(re),Pe=le(),de=q("div"),$=q("p"),$.textContent="z",xe=le(),we=q("p"),ge=rt(Ae),Me=le(),Fe=q("div"),Ze=q("div"),ct=rt(r[6]),U=le(),W=q("input"),ie=le(),he=q("p"),he.textContent="Object Alpha",be=le(),Ke=q("div"),He=q("input"),Tt=le(),Yt=q("button"),Yt.textContent="Stop Placement",ht=le(),Lt=q("button"),Bt=q("i"),Fr=le(),X&&X.c(),fr=le(),nt(On.$$.fragment),V(i,"class","bg-[color:var(--color-secondary)] text-white p-[1rem] w-full"),V(u,"class","bg-[color:var(--color-secondary)] text-white p-[0.5rem] w-full whitespace-nowrap"),V(h,"class","bg-[color:var(--color-secondary)] text-white p-[1rem] w-full"),V(c,"class","flex flex-row gap-[1rem]"),V(v,"class","h-fit"),V(g,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(b,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(J,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(d,"class","flex flex-row gap-[1rem] text-center"),V(_,"class","flex flex-col items-center"),V(ee,"class","w-[5rem] h-[3rem] items-center flex justify-center bg-[color:var(--color-secondary)]"),V(N,"id","slider"),V(N,"type","range"),V(N,"min","0.01"),V(N,"max","1"),V(N,"step","0.01"),V(N,"class","w-full"),V(j,"class","flex flex-row gap-[1rem] items-center"),V(Ce,"class","bg-[color:var(--color-secondary)] text-white p-[1rem] w-full"),V(je,"class","h-fit"),V(lt,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(P,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(de,"class","bg-[color:var(--color-secondary)] relative flex flex-col w-[8rem] px-[0.1rem]"),V(Ue,"class","flex flex-row gap-[1rem] text-center"),V(Te,"class","flex flex-col items-center "),V(Ze,"class","w-[5rem] h-[3rem] items-center flex justify-center bg-[color:var(--color-secondary)]"),V(W,"id","slider"),V(W,"type","range"),V(W,"min","1"),V(W,"max","90"),V(W,"step","1"),V(W,"class","w-full"),V(Fe,"class","flex flex-row gap-[1rem] items-center"),V(he,"class",""),V(He,"id","slider"),V(He,"type","range"),V(He,"min","1"),V(He,"max","255"),V(He,"step","10"),V(He,"class","w-full"),V(Ke,"class","flex flex-row gap-[1rem] items-center"),V(Yt,"class","bg-[color:var(--color-secondary)] text-white p-[1rem] w-full"),V(n,"class","flex flex-col gap-[1rem] p-[2rem]"),V(Bt,"class",Nn="fas text-[2rem] fa-chevron-"+(r[7]?"left":"right")),V(Lt,"class","h-full absolute -right-[4rem] w-[4rem] grid place-items-center bg-[color:var(--color-secondary)]"),V(t,"class",si="w-fit text-[1.5rem] bg-[color:var(--color-primary)] top-[4rem] origin-top absolute "+(r[7]?"left-[1.5rem]":"-left-[30rem]")+" flex flex-row gap-[1rem] items-center justify-between"),V(e,"class",A="modeler z-[0] absolute h-screen w-screen "+(r[9]?"bg-gray-800":""))},m(ae,me){Oe(ae,e,me),D(e,t),D(t,n),D(n,i),D(i,s),D(i,a),D(n,l),D(n,c),D(c,u),D(c,f),D(c,h),D(n,p),D(n,_),D(_,v),D(_,m),D(_,d),D(d,g),D(g,x),D(g,M),D(g,y),D(y,C),D(d,T),D(d,b),D(b,S),D(b,F),D(b,k),D(k,O),D(d,B),D(d,J),D(J,R),D(J,H),D(J,Q),D(Q,ve),D(n,se),D(n,j),D(j,ee),D(ee,te),D(j,ue),D(j,N),Tn(N,r[5]),D(n,Re),D(n,Ce),D(n,oe),D(n,Te),D(Te,je),D(Te,ye),D(Te,Ue),D(Ue,lt),D(lt,xt),D(lt,Mt),D(lt,_t),D(_t,st),D(Ue,It),D(Ue,P),D(P,E),D(P,Y),D(P,ne),D(ne,fe),D(Ue,Pe),D(Ue,de),D(de,$),D(de,xe),D(de,we),D(we,ge),D(n,Me),D(n,Fe),D(Fe,Ze),D(Ze,ct),D(Fe,U),D(Fe,W),Tn(W,r[6]),D(n,ie),D(n,he),D(n,be),D(n,Ke),D(Ke,He),Tn(He,r[1]),D(n,Tt),D(n,Yt),D(t,ht),D(t,Lt),D(Lt,Bt),D(e,Fr),X&&X.m(e,null),D(e,fr),$e(On,e,null),z=!0,Z||(G=[Le(i,"click",r[22]),Le(u,"click",r[23]),Le(h,"click",r[24]),Le(N,"change",r[25]),Le(N,"input",r[25]),Le(Ce,"click",r[26]),Le(W,"change",r[27]),Le(W,"input",r[27]),Le(He,"change",r[28]),Le(He,"input",r[28]),Le(Yt,"click",r[29]),Le(Lt,"click",r[30])],Z=!0)},p(ae,me){(!z||me[0]&16)&&o!==(o=ae[4]=="translate"?"rotate":"translate")&&At(a,o),(!z||me[0]&4)&&w!==(w=ae[2].x.toFixed(2)+"")&&At(C,w),(!z||me[0]&4)&&L!==(L=-ae[2].z.toFixed(2)+"")&&At(O,L),(!z||me[0]&4)&&K!==(K=ae[2].y.toFixed(2)+"")&&At(ve,K),(!z||me[0]&32)&&At(te,ae[5]),me[0]&32&&Tn(N,ae[5]),(!z||me[0]&8)&&Xe!==(Xe=Kt.radToDeg(ae[3].x).toFixed(2)+"")&&At(st,Xe),(!z||me[0]&8)&&re!==(re=Kt.radToDeg(ae[3].y).toFixed(2)+"")&&At(fe,re),(!z||me[0]&8)&&Ae!==(Ae=Kt.radToDeg(ae[3].z).toFixed(2)+"")&&At(ge,Ae),(!z||me[0]&64)&&At(ct,ae[6]),me[0]&64&&Tn(W,ae[6]),me[0]&2&&Tn(He,ae[1]),(!z||me[0]&128&&Nn!==(Nn="fas text-[2rem] fa-chevron-"+(ae[7]?"left":"right")))&&V(Bt,"class",Nn),(!z||me[0]&128&&si!==(si="w-fit text-[1.5rem] bg-[color:var(--color-primary)] top-[4rem] origin-top absolute "+(ae[7]?"left-[1.5rem]":"-left-[30rem]")+" flex flex-row gap-[1rem] items-center justify-between"))&&V(t,"class",si),ae[12]==null?X?X.p(ae,me):(X=tc(ae),X.c(),X.m(e,fr)):X&&(X.d(1),X=null);const De={};me[0]&29821|me[1]&128&&(De.$$scope={dirty:me,ctx:ae}),On.$set(De),(!z||me[0]&512&&A!==(A="modeler z-[0] absolute h-screen w-screen "+(ae[9]?"bg-gray-800":"")))&&V(e,"class",A)},i(ae){z||(_e(On.$$.fragment,ae),z=!0)},o(ae){Se(On.$$.fragment,ae),z=!1},d(ae){ae&&Ne(e),X&&X.d(),et(On),Z=!1,kt(G)}}}function tc(r){let e,t,n;return{c(){e=q("button"),e.innerHTML=` +

Add To Cart

`,V(e,"class","absolute text-[2rem] hover:brightness-110 top-1/2 -translate-y-1/2 right-[1rem] w-fit gap-[1rem] px-8 py-4 h-fit bg-[color:var(--color-secondary)] flex flex-row items-center justify-between")},m(i,s){Oe(i,e,s),t||(n=Le(e,"click",r[31]),t=!0)},p:St,d(i){i&&Ne(e),t=!1,n()}}}function I0(r){let e,t;return e=new p0({props:{mode:r[4],translationSnap:r[5],rotationSnap:Kt.degToRad(r[6]),size:.5,space:"local"}}),e.$on("objectChange",r[32]),e.$on("dragging-changed",r[33]),{c(){nt(e.$$.fragment)},m(n,i){$e(e,n,i),t=!0},p(n,i){const s={};i[0]&16&&(s.mode=n[4]),i[0]&32&&(s.translationSnap=n[5]),i[0]&64&&(s.rotationSnap=Kt.degToRad(n[6])),e.$set(s)},i(n){t||(_e(e.$$.fragment,n),t=!0)},o(n){Se(e.$$.fragment,n),t=!1},d(n){et(e,n)}}}function U0(r){let e,t,n,i,s;e=new n0({props:{position:r[13],lookAt:r[10],fov:45}});function o(l){r[34](l)}let a={type:pe,"position.x":r[2].x,"position.y":r[2].y,"position.z":r[2].z,quaternion:5,geometry:new bt(0,0,0),material:new Eg,"rotation.x":r[3].x,"rotation.y":r[3].y,"rotation.z":r[3].z,$$slots:{default:[I0]},$$scope:{ctx:r}};return r[0]!==void 0&&(a.ref=r[0]),n=new R0({props:a}),Vn.push(()=>xs(n,"ref",o)),{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment)},m(l,c){$e(e,l,c),Oe(l,t,c),$e(n,l,c),s=!0},p(l,c){const u={};c[0]&8192&&(u.position=l[13]),c[0]&1024&&(u.lookAt=l[10]),e.$set(u);const f={};c[0]&4&&(f["position.x"]=l[2].x),c[0]&4&&(f["position.y"]=l[2].y),c[0]&4&&(f["position.z"]=l[2].z),c[0]&8&&(f["rotation.x"]=l[3].x),c[0]&8&&(f["rotation.y"]=l[3].y),c[0]&8&&(f["rotation.z"]=l[3].z),c[0]&20604|c[1]&128&&(f.$$scope={dirty:c,ctx:l}),!i&&c[0]&1&&(i=!0,f.ref=l[0],vs(()=>i=!1)),n.$set(f)},i(l){s||(_e(e.$$.fragment,l),_e(n.$$.fragment,l),s=!0)},o(l){Se(e.$$.fragment,l),Se(n.$$.fragment,l),s=!1},d(l){et(e,l),l&&Ne(t),et(n,l)}}}function N0(r){let e,t,n=r[8]&&ec(r);return{c(){n&&n.c(),e=ri()},m(i,s){n&&n.m(i,s),Oe(i,e,s),t=!0},p(i,s){i[8]?n?(n.p(i,s),s[0]&256&&_e(n,1)):(n=ec(i),n.c(),_e(n,1),n.m(e.parentNode,e)):n&&(Wn(),Se(n,1,1,()=>{n=null}),jn())},i(i){t||(_e(n),t=!0)},o(i){Se(n),t=!1},d(i){n&&n.d(i),i&&Ne(e)}}}function O0(r,e,t){let n,i,s,o,a,l,c,u,f;Ee(r,Ms,te=>t(9,o=te)),Ee(r,vn,te=>t(11,l=te)),Ee(r,Cn,te=>t(14,f=te));const{show:h,cameraPosition:p,cameraLookAt:_,objectPosition:v,objectEuler:m,entity:d}=_n;Ee(r,h,te=>t(8,s=te)),Ee(r,p,te=>t(13,u=te)),Ee(r,_,te=>t(10,a=te)),Ee(r,v,te=>t(2,n=te)),Ee(r,m,te=>t(3,i=te)),Ee(r,d,te=>t(12,c=te));let g,x="translate",M=.01,y=1,w=!1,C=200;an("setObjectAlpha",te=>{t(1,C=te)});function T(te){te.button==2&&(x=="translate"?t(4,x="rotate"):t(4,x="translate"))}or(()=>{document.addEventListener("contextmenu",T)}),ut(()=>{document.removeEventListener("contextmenu",T)});function b(te){return te.x!=n.x||te.y!=n.y||te.z!=n.z}function S(te){return te.x!=i.x||te.y!=i.y||te.z!=i.z}function F(){g&&(b(g.position)&&(Ie(v,n.x=g.position.x,n),Ie(v,n.y=g.position.y,n),Ie(v,n.z=g.position.z,n),_n.sendMovementUpdate(fs(n))),S(g.rotation)&&(Ie(m,i.x=g.rotation.x,i),Ie(m,i.y=g.rotation.y,i),Ie(m,i.z=g.rotation.z,i),_n.sendRotationUpdate(i)))}const k=()=>{x=="translate"?t(4,x="rotate"):t(4,x="translate")},L=()=>{g.rotation.set(0,0,0,i.order),F()},O=()=>{g.position.set(a.x,a.y,a.z),F()};function B(){M=cs(this.value),t(5,M)}const J=()=>{at("placeOnGround").then(te=>{const ue=Vi(te);g.position.set(ue.x,ue.y,ue.z),F()})};function R(){y=cs(this.value),t(6,y)}function H(){C=cs(this.value),t(1,C)}const Q=()=>{at("stopPlacement"),_n.show.set(!1),Ie(vn,l=null,l)},K=()=>{t(7,w=!w)},ve=()=>{at("addToCart",l),Ie(vn,l=null,l)},se=te=>{F()},j=te=>{if(!te.detail.value&&c!=null){const N=f.find(oe=>oe.entity===c);if(N===void 0)return;const Re=fs(n);N.position=Re;const Ce=fs(i);N.rotation=Ce,Ie(Cn,f=[...f],f),at("updateCartItem",N)}};function ee(te){g=te,t(0,g)}return r.$$.update=()=>{r.$$.dirty[0]&2&&at("setObjectAlpha",{alpha:C}),r.$$.dirty[0]&13&&g&&(g.rotation.set(i.x,i.y,i.z,i.order),g.position.set(n.x,n.y,n.z))},[g,C,n,i,x,M,y,w,s,o,a,l,c,u,f,h,p,_,v,m,d,F,k,L,O,B,J,R,H,Q,K,ve,se,j,ee]}class F0 extends gt{constructor(e){super(),mt(this,e,O0,N0,ft,{},null,[-1,-1])}}function nc(r){let e,t,n,i;return e=new i_({}),n=new F0({}),{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment)},m(s,o){$e(e,s,o),Oe(s,t,o),$e(n,s,o),i=!0},i(s){i||(_e(e.$$.fragment,s),_e(n.$$.fragment,s),i=!0)},o(s){Se(e.$$.fragment,s),Se(n.$$.fragment,s),i=!1},d(s){et(e,s),s&&Ne(t),et(n,s)}}}function z0(r){let e,t,n=r[0]&&nc();return{c(){n&&n.c(),e=ri()},m(i,s){n&&n.m(i,s),Oe(i,e,s),t=!0},p(i,s){i[0]?n?s&1&&_e(n,1):(n=nc(),n.c(),_e(n,1),n.m(e.parentNode,e)):n&&(Wn(),Se(n,1,1,()=>{n=null}),jn())},i(i){t||(_e(n),t=!0)},o(i){Se(n),t=!1},d(i){n&&n.d(i),i&&Ne(e)}}}function ic(r){let e,t,n,i;return e=new kg({}),{c(){nt(e.$$.fragment),t=le(),n=q("body"),V(n,"class","bg-neutral-700")},m(s,o){$e(e,s,o),Oe(s,t,o),Oe(s,n,o),i=!0},i(s){i||(_e(e.$$.fragment,s),i=!0)},o(s){Se(e.$$.fragment,s),i=!1},d(s){et(e,s),s&&Ne(t),s&&Ne(n)}}}function k0(r){let e,t,n,i,s,o;e=new Ng({props:{$$slots:{default:[z0]},$$scope:{ctx:r}}}),n=new jg({});let a=r[1]&&ic();return{c(){nt(e.$$.fragment),t=le(),nt(n.$$.fragment),i=le(),a&&a.c(),s=ri()},m(l,c){$e(e,l,c),Oe(l,t,c),$e(n,l,c),Oe(l,i,c),a&&a.m(l,c),Oe(l,s,c),o=!0},p(l,[c]){const u={};c&17&&(u.$$scope={dirty:c,ctx:l}),e.$set(u),l[1]?a?c&2&&_e(a,1):(a=ic(),a.c(),_e(a,1),a.m(s.parentNode,s)):a&&(Wn(),Se(a,1,1,()=>{a=null}),jn())},i(l){o||(_e(e.$$.fragment,l),_e(n.$$.fragment,l),_e(a),o=!0)},o(l){Se(e.$$.fragment,l),Se(n.$$.fragment,l),Se(a),o=!1},d(l){et(e,l),l&&Ne(t),et(n,l),l&&Ne(i),a&&a.d(l),l&&Ne(s)}}}function B0(r,e,t){let n,i,s;return Ee(r,_o,o=>t(2,n=o)),Ee(r,ms,o=>t(0,i=o)),Ee(r,Ms,o=>t(1,s=o)),Ie(_o,n="ps-housing",n),[i,s]}class G0 extends gt{constructor(e){super(),mt(this,e,B0,k0,ft,{})}}new G0({target:document.getElementById("app")}); diff --git a/ui/src/components/OwnedItems.svelte b/ui/src/components/OwnedItems.svelte index e1e7559..dc46115 100644 --- a/ui/src/components/OwnedItems.svelte +++ b/ui/src/components/OwnedItems.svelte @@ -41,16 +41,14 @@

{item.label}

- {#if item.type != 'storage' && item.type != 'clothing'} - - {/if} + {/each}