@splinetool/runtime 2.0.167 → 2.0.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/{runtime-bloom-D4SLCABF.js → runtime-bloom-NBQF7HB3.js} +1 -1
- package/build/runtime-bloom-NBQF7HB3.js.br +0 -0
- package/build/runtime-bloom-NBQF7HB3.js.gz +0 -0
- package/build/{runtime-brightnessContrast-WQZAVDYU.js → runtime-brightnessContrast-KIEJNK4N.js} +1 -1
- package/build/runtime-brightnessContrast-KIEJNK4N.js.br +0 -0
- package/build/runtime-brightnessContrast-KIEJNK4N.js.gz +0 -0
- package/build/{runtime-chromaticAberration-WHNKKNKR.js → runtime-chromaticAberration-F47AEQJL.js} +1 -1
- package/build/runtime-chromaticAberration-F47AEQJL.js.br +0 -0
- package/build/runtime-chromaticAberration-F47AEQJL.js.gz +0 -0
- package/build/{runtime-chunk-VFF3VHSW.js → runtime-chunk-3HARYNSZ.js} +1 -1
- package/build/runtime-chunk-3HARYNSZ.js.br +0 -0
- package/build/runtime-chunk-3HARYNSZ.js.gz +0 -0
- package/build/{runtime-chunk-QPF53NX3.js → runtime-chunk-5A4AR7QJ.js} +1 -1
- package/build/runtime-chunk-5A4AR7QJ.js.br +0 -0
- package/build/runtime-chunk-5A4AR7QJ.js.gz +0 -0
- package/build/{runtime-chunk-MM2JIVUP.js → runtime-chunk-5WHRN3KU.js} +1 -1
- package/build/runtime-chunk-5WHRN3KU.js.br +0 -0
- package/build/runtime-chunk-5WHRN3KU.js.gz +0 -0
- package/build/{runtime-chunk-NNNFDT3C.js → runtime-chunk-AFDUMNHD.js} +1 -1
- package/build/runtime-chunk-AFDUMNHD.js.br +0 -0
- package/build/runtime-chunk-AFDUMNHD.js.gz +0 -0
- package/build/{runtime-chunk-JFURJ5U4.js → runtime-chunk-AHGISLIW.js} +1 -1
- package/build/runtime-chunk-AHGISLIW.js.br +0 -0
- package/build/runtime-chunk-AHGISLIW.js.gz +0 -0
- package/build/{runtime-chunk-QMELF4YB.js → runtime-chunk-AJYRR665.js} +1 -1
- package/build/runtime-chunk-AJYRR665.js.br +0 -0
- package/build/runtime-chunk-AJYRR665.js.gz +0 -0
- package/build/{runtime-chunk-GZ5KECB4.js → runtime-chunk-ANGA7TLB.js} +1 -1
- package/build/runtime-chunk-ANGA7TLB.js.br +0 -0
- package/build/runtime-chunk-ANGA7TLB.js.gz +0 -0
- package/build/{runtime-chunk-GEB7WRKG.js → runtime-chunk-ATIHBDZ3.js} +1 -1
- package/build/runtime-chunk-ATIHBDZ3.js.br +0 -0
- package/build/runtime-chunk-ATIHBDZ3.js.gz +0 -0
- package/build/{runtime-chunk-73QURPPC.js → runtime-chunk-B67QULUB.js} +1 -1
- package/build/runtime-chunk-B67QULUB.js.br +0 -0
- package/build/runtime-chunk-B67QULUB.js.gz +0 -0
- package/build/{runtime-chunk-IZGNZT2Z.js → runtime-chunk-BJ2ZPAHA.js} +1 -1
- package/build/runtime-chunk-BJ2ZPAHA.js.br +0 -0
- package/build/runtime-chunk-BJ2ZPAHA.js.gz +0 -0
- package/build/{runtime-chunk-H2HL47RM.js → runtime-chunk-E67HCEL4.js} +1 -1
- package/build/runtime-chunk-E67HCEL4.js.br +0 -0
- package/build/runtime-chunk-E67HCEL4.js.gz +0 -0
- package/build/{runtime-chunk-HLEJ7WAV.js → runtime-chunk-F5ERIFRO.js} +1 -1
- package/build/runtime-chunk-F5ERIFRO.js.br +0 -0
- package/build/runtime-chunk-F5ERIFRO.js.gz +0 -0
- package/build/{runtime-chunk-UZJJQEWR.js → runtime-chunk-G3WQK7TY.js} +1 -1
- package/build/runtime-chunk-G3WQK7TY.js.br +0 -0
- package/build/runtime-chunk-G3WQK7TY.js.gz +0 -0
- package/build/{runtime-chunk-NYPEJFXJ.js → runtime-chunk-GUL6POC2.js} +1 -1
- package/build/runtime-chunk-GUL6POC2.js.br +0 -0
- package/build/runtime-chunk-GUL6POC2.js.gz +0 -0
- package/build/{runtime-chunk-5QZXL5OI.js → runtime-chunk-MVNFOVNG.js} +1 -1
- package/build/runtime-chunk-MVNFOVNG.js.br +0 -0
- package/build/runtime-chunk-MVNFOVNG.js.gz +0 -0
- package/build/{runtime-chunk-ZYMCD4BF.js → runtime-chunk-N7Z4GY4L.js} +1 -1
- package/build/runtime-chunk-N7Z4GY4L.js.br +0 -0
- package/build/runtime-chunk-N7Z4GY4L.js.gz +0 -0
- package/build/runtime-chunk-NTWWYXAS.js +1 -0
- package/build/runtime-chunk-NTWWYXAS.js.br +0 -0
- package/build/runtime-chunk-NTWWYXAS.js.gz +0 -0
- package/build/{runtime-chunk-Y6CNGHG5.js → runtime-chunk-PI6WPE77.js} +1 -1
- package/build/runtime-chunk-PI6WPE77.js.br +2 -0
- package/build/runtime-chunk-PI6WPE77.js.gz +0 -0
- package/build/{runtime-chunk-YT6GLJMC.js → runtime-chunk-PMDUTLDE.js} +1 -1
- package/build/{runtime-chunk-YT6GLJMC.js.br → runtime-chunk-PMDUTLDE.js.br} +0 -0
- package/build/runtime-chunk-PMDUTLDE.js.gz +0 -0
- package/build/{runtime-chunk-GTX3LDVL.js → runtime-chunk-QFOUCKBZ.js} +1 -1
- package/build/runtime-chunk-QFOUCKBZ.js.br +0 -0
- package/build/runtime-chunk-QFOUCKBZ.js.gz +0 -0
- package/build/{runtime-chunk-VY6SC4IC.js → runtime-chunk-QUTY45RI.js} +1 -1
- package/build/runtime-chunk-QUTY45RI.js.br +0 -0
- package/build/runtime-chunk-QUTY45RI.js.gz +0 -0
- package/build/{runtime-chunk-PYTOTOQG.js → runtime-chunk-RRLJYTYI.js} +1 -1
- package/build/runtime-chunk-RRLJYTYI.js.br +0 -0
- package/build/runtime-chunk-RRLJYTYI.js.gz +0 -0
- package/build/{runtime-chunk-BFUMQZ5V.js → runtime-chunk-RSGWMNDQ.js} +1 -1
- package/build/{runtime-chunk-BFUMQZ5V.js.br → runtime-chunk-RSGWMNDQ.js.br} +0 -0
- package/build/runtime-chunk-RSGWMNDQ.js.gz +0 -0
- package/build/{runtime-chunk-P7IBR4KV.js → runtime-chunk-S7G3MNJ3.js} +1 -1
- package/build/runtime-chunk-S7G3MNJ3.js.br +0 -0
- package/build/runtime-chunk-S7G3MNJ3.js.gz +0 -0
- package/build/{runtime-chunk-T6KZOJFT.js → runtime-chunk-TLPOKI2U.js} +1 -1
- package/build/runtime-chunk-TLPOKI2U.js.br +0 -0
- package/build/runtime-chunk-TLPOKI2U.js.gz +0 -0
- package/build/{runtime-chunk-UH5ODXID.js → runtime-chunk-VX5KWRPX.js} +1 -1
- package/build/{runtime-chunk-UH5ODXID.js.br → runtime-chunk-VX5KWRPX.js.br} +0 -0
- package/build/{runtime-chunk-UH5ODXID.js.gz → runtime-chunk-VX5KWRPX.js.gz} +0 -0
- package/build/{runtime-chunk-YPX3TS4M.js → runtime-chunk-WQGGIBPJ.js} +1 -1
- package/build/runtime-chunk-WQGGIBPJ.js.br +0 -0
- package/build/runtime-chunk-WQGGIBPJ.js.gz +0 -0
- package/build/{runtime-classicRuntime-H6CXM6JT.js → runtime-classicRuntime-A2RFQ7SR.js} +1 -1
- package/build/runtime-classicRuntime-A2RFQ7SR.js.br +0 -0
- package/build/runtime-classicRuntime-A2RFQ7SR.js.gz +0 -0
- package/build/{runtime-cloners-KMVMD5HQ.js → runtime-cloners-B3NTUYNS.js} +1 -1
- package/build/runtime-cloners-B3NTUYNS.js.br +0 -0
- package/build/runtime-cloners-B3NTUYNS.js.gz +0 -0
- package/build/{runtime-components-KNOJ3APN.js → runtime-components-CYLZHXFJ.js} +1 -1
- package/build/runtime-components-CYLZHXFJ.js.br +0 -0
- package/build/runtime-components-CYLZHXFJ.js.gz +0 -0
- package/build/{runtime-createDestroy-K54XR25L.js → runtime-createDestroy-GAA4E2YR.js} +1 -1
- package/build/runtime-createDestroy-GAA4E2YR.js.br +0 -0
- package/build/runtime-createDestroy-GAA4E2YR.js.gz +0 -0
- package/build/{runtime-depthOfField-7OSOF7EB.js → runtime-depthOfField-P23JPMWN.js} +1 -1
- package/build/runtime-depthOfField-P23JPMWN.js.br +0 -0
- package/build/runtime-depthOfField-P23JPMWN.js.gz +0 -0
- package/build/{runtime-dragDrop-OL2HS5LA.js → runtime-dragDrop-3DFAFPPZ.js} +1 -1
- package/build/runtime-dragDrop-3DFAFPPZ.js.br +0 -0
- package/build/runtime-dragDrop-3DFAFPPZ.js.gz +0 -0
- package/build/{runtime-gameControls-WXIKN3LX.js → runtime-gameControls-VDGDGY7S.js} +1 -1
- package/build/runtime-gameControls-VDGDGY7S.js.br +0 -0
- package/build/runtime-gameControls-VDGDGY7S.js.gz +0 -0
- package/build/{runtime-hair-B2WQTHEG.js → runtime-hair-RNYLWGEE.js} +1 -1
- package/build/runtime-hair-RNYLWGEE.js.br +2 -0
- package/build/runtime-hair-RNYLWGEE.js.gz +0 -0
- package/build/{runtime-hueSaturation-C43KL73N.js → runtime-hueSaturation-STFHCRRN.js} +1 -1
- package/build/runtime-hueSaturation-STFHCRRN.js.br +0 -0
- package/build/runtime-hueSaturation-STFHCRRN.js.gz +0 -0
- package/build/{runtime-mergeStaticGeometries-BFVV7XPB.js → runtime-mergeStaticGeometries-W4DKKHFG.js} +1 -1
- package/build/runtime-mergeStaticGeometries-W4DKKHFG.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-W4DKKHFG.js.gz +0 -0
- package/build/{runtime-miscActions-COMQEORS.js → runtime-miscActions-ZKQK5KS4.js} +1 -1
- package/build/runtime-miscActions-ZKQK5KS4.js.br +0 -0
- package/build/runtime-miscActions-ZKQK5KS4.js.gz +0 -0
- package/build/{runtime-mouseHover-KRN6U6FS.js → runtime-mouseHover-5JDWIRKR.js} +1 -1
- package/build/runtime-mouseHover-5JDWIRKR.js.br +0 -0
- package/build/runtime-mouseHover-5JDWIRKR.js.gz +0 -0
- package/build/{runtime-noise-3I5NC3AF.js → runtime-noise-PHJVNWDW.js} +1 -1
- package/build/runtime-noise-PHJVNWDW.js.br +0 -0
- package/build/runtime-noise-PHJVNWDW.js.gz +0 -0
- package/build/{runtime-particles-CBQPLZMG.js → runtime-particles-A6RPDEKQ.js} +1 -1
- package/build/runtime-particles-A6RPDEKQ.js.br +0 -0
- package/build/runtime-particles-A6RPDEKQ.js.gz +0 -0
- package/build/{runtime-paths-3J6FCKUL.js → runtime-paths-R4VSXFWQ.js} +1 -1
- package/build/runtime-paths-R4VSXFWQ.js.br +0 -0
- package/build/runtime-paths-R4VSXFWQ.js.gz +0 -0
- package/build/{runtime-pixelation-VWT4UGXR.js → runtime-pixelation-YSYTHXOR.js} +1 -1
- package/build/runtime-pixelation-YSYTHXOR.js.br +0 -0
- package/build/runtime-pixelation-YSYTHXOR.js.gz +0 -0
- package/build/{runtime-resize-E4HEZA4E.js → runtime-resize-PBXN3RWR.js} +1 -1
- package/build/runtime-resize-PBXN3RWR.js.br +0 -0
- package/build/runtime-resize-PBXN3RWR.js.gz +0 -0
- package/build/{runtime-sceneTransition-JD3VLBVU.js → runtime-sceneTransition-I75GLR4J.js} +1 -1
- package/build/runtime-sceneTransition-I75GLR4J.js.br +0 -0
- package/build/runtime-sceneTransition-I75GLR4J.js.gz +0 -0
- package/build/{runtime-scroll-QCT565DO.js → runtime-scroll-2YSIKZ2N.js} +1 -1
- package/build/runtime-scroll-2YSIKZ2N.js.br +0 -0
- package/build/runtime-scroll-2YSIKZ2N.js.gz +0 -0
- package/build/runtime-shapeBlends-5YGPEPG3.js +1 -0
- package/build/runtime-shapeBlends-5YGPEPG3.js.br +0 -0
- package/build/runtime-shapeBlends-5YGPEPG3.js.gz +0 -0
- package/build/{runtime-text-5LVNQH6K.js → runtime-text-SLP2HD4P.js} +1 -1
- package/build/runtime-text-SLP2HD4P.js.br +0 -0
- package/build/runtime-text-SLP2HD4P.js.gz +0 -0
- package/build/{runtime-textInputs-VMNVJYCR.js → runtime-textInputs-7EL2YM7X.js} +1 -1
- package/build/runtime-textInputs-7EL2YM7X.js.br +0 -0
- package/build/runtime-textInputs-7EL2YM7X.js.gz +0 -0
- package/build/{runtime-timeline-JI5XXGZN.js → runtime-timeline-H2BWQ77N.js} +1 -1
- package/build/runtime-timeline-H2BWQ77N.js.br +0 -0
- package/build/runtime-timeline-H2BWQ77N.js.gz +0 -0
- package/build/{runtime-tracking-5RFL4VUJ.js → runtime-tracking-J5AMSW3E.js} +1 -1
- package/build/runtime-tracking-J5AMSW3E.js.br +0 -0
- package/build/runtime-tracking-J5AMSW3E.js.gz +0 -0
- package/build/{runtime-transitions-GG7KDTQV.js → runtime-transitions-TC3Q5ZDY.js} +1 -1
- package/build/runtime-transitions-TC3Q5ZDY.js.br +0 -0
- package/build/runtime-transitions-TC3Q5ZDY.js.gz +0 -0
- package/build/{runtime-ui2d-VPSG3REG.js → runtime-ui2d-3FZV5H3P.js} +1 -1
- package/build/runtime-ui2d-3FZV5H3P.js.br +0 -0
- package/build/runtime-ui2d-3FZV5H3P.js.gz +0 -0
- package/build/{runtime-vectorShapes-MQJ7UHCH.js → runtime-vectorShapes-2S4ARXMP.js} +1 -1
- package/build/runtime-vectorShapes-2S4ARXMP.js.br +0 -0
- package/build/runtime-vectorShapes-2S4ARXMP.js.gz +0 -0
- package/build/{runtime-vignette-N3RTMCZE.js → runtime-vignette-QT6L4IIW.js} +1 -1
- package/build/runtime-vignette-QT6L4IIW.js.br +0 -0
- package/build/runtime-vignette-QT6L4IIW.js.gz +0 -0
- package/build/{runtime-webgpu-DGOU336Z.js → runtime-webgpu-CNDM2UUE.js} +1 -1
- package/build/runtime-webgpu-CNDM2UUE.js.br +0 -0
- package/build/runtime-webgpu-CNDM2UUE.js.gz +0 -0
- package/build/runtime.cjs +7 -7
- package/build/runtime.js +1 -1
- package/build/runtime.js.br +0 -0
- package/build/runtime.js.gz +0 -0
- package/build/runtime.standalone.js +1 -1
- package/build/runtime.standalone.js.br +0 -0
- package/build/runtime.standalone.js.gz +0 -0
- package/build/runtime.standalone.webgl.js +1 -1
- package/build/runtime.standalone.webgl.js.br +0 -0
- package/build/runtime.standalone.webgl.js.gz +0 -0
- package/build/runtime.standalone.webgpu.js +1 -1
- package/build/runtime.standalone.webgpu.js.br +0 -0
- package/build/runtime.standalone.webgpu.js.gz +0 -0
- package/build/runtime.standalone.webgpu.micro.js +1 -1
- package/build/runtime.standalone.webgpu.micro.js.br +0 -0
- package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
- package/build/runtime.standalone.webgpu.min.js +1 -1
- package/build/runtime.standalone.webgpu.min.js.br +0 -0
- package/build/runtime.standalone.webgpu.min.js.gz +0 -0
- package/package.json +1 -1
- package/build/runtime-bloom-D4SLCABF.js.br +0 -0
- package/build/runtime-bloom-D4SLCABF.js.gz +0 -0
- package/build/runtime-brightnessContrast-WQZAVDYU.js.br +0 -0
- package/build/runtime-brightnessContrast-WQZAVDYU.js.gz +0 -0
- package/build/runtime-chromaticAberration-WHNKKNKR.js.br +0 -0
- package/build/runtime-chromaticAberration-WHNKKNKR.js.gz +0 -0
- package/build/runtime-chunk-5QZXL5OI.js.br +0 -0
- package/build/runtime-chunk-5QZXL5OI.js.gz +0 -0
- package/build/runtime-chunk-6AMPYGWS.js +0 -1
- package/build/runtime-chunk-6AMPYGWS.js.br +0 -0
- package/build/runtime-chunk-6AMPYGWS.js.gz +0 -0
- package/build/runtime-chunk-73QURPPC.js.br +0 -0
- package/build/runtime-chunk-73QURPPC.js.gz +0 -0
- package/build/runtime-chunk-BFUMQZ5V.js.gz +0 -0
- package/build/runtime-chunk-GEB7WRKG.js.br +0 -0
- package/build/runtime-chunk-GEB7WRKG.js.gz +0 -0
- package/build/runtime-chunk-GTX3LDVL.js.br +0 -0
- package/build/runtime-chunk-GTX3LDVL.js.gz +0 -0
- package/build/runtime-chunk-GZ5KECB4.js.br +0 -0
- package/build/runtime-chunk-GZ5KECB4.js.gz +0 -0
- package/build/runtime-chunk-H2HL47RM.js.br +0 -0
- package/build/runtime-chunk-H2HL47RM.js.gz +0 -0
- package/build/runtime-chunk-HLEJ7WAV.js.br +0 -0
- package/build/runtime-chunk-HLEJ7WAV.js.gz +0 -0
- package/build/runtime-chunk-IZGNZT2Z.js.br +0 -0
- package/build/runtime-chunk-IZGNZT2Z.js.gz +0 -0
- package/build/runtime-chunk-JFURJ5U4.js.br +0 -0
- package/build/runtime-chunk-JFURJ5U4.js.gz +0 -0
- package/build/runtime-chunk-MM2JIVUP.js.br +0 -0
- package/build/runtime-chunk-MM2JIVUP.js.gz +0 -0
- package/build/runtime-chunk-NNNFDT3C.js.br +0 -0
- package/build/runtime-chunk-NNNFDT3C.js.gz +0 -0
- package/build/runtime-chunk-NYPEJFXJ.js.br +0 -0
- package/build/runtime-chunk-NYPEJFXJ.js.gz +0 -0
- package/build/runtime-chunk-P7IBR4KV.js.br +0 -0
- package/build/runtime-chunk-P7IBR4KV.js.gz +0 -0
- package/build/runtime-chunk-PYTOTOQG.js.br +0 -0
- package/build/runtime-chunk-PYTOTOQG.js.gz +0 -0
- package/build/runtime-chunk-QMELF4YB.js.br +0 -0
- package/build/runtime-chunk-QMELF4YB.js.gz +0 -0
- package/build/runtime-chunk-QPF53NX3.js.br +0 -0
- package/build/runtime-chunk-QPF53NX3.js.gz +0 -0
- package/build/runtime-chunk-T6KZOJFT.js.br +0 -0
- package/build/runtime-chunk-T6KZOJFT.js.gz +0 -0
- package/build/runtime-chunk-UZJJQEWR.js.br +0 -0
- package/build/runtime-chunk-UZJJQEWR.js.gz +0 -0
- package/build/runtime-chunk-VFF3VHSW.js.br +0 -0
- package/build/runtime-chunk-VFF3VHSW.js.gz +0 -0
- package/build/runtime-chunk-VY6SC4IC.js.br +0 -0
- package/build/runtime-chunk-VY6SC4IC.js.gz +0 -0
- package/build/runtime-chunk-Y6CNGHG5.js.br +0 -2
- package/build/runtime-chunk-Y6CNGHG5.js.gz +0 -0
- package/build/runtime-chunk-YPX3TS4M.js.br +0 -0
- package/build/runtime-chunk-YPX3TS4M.js.gz +0 -0
- package/build/runtime-chunk-YT6GLJMC.js.gz +0 -0
- package/build/runtime-chunk-ZYMCD4BF.js.br +0 -0
- package/build/runtime-chunk-ZYMCD4BF.js.gz +0 -0
- package/build/runtime-classicRuntime-H6CXM6JT.js.br +0 -0
- package/build/runtime-classicRuntime-H6CXM6JT.js.gz +0 -0
- package/build/runtime-cloners-KMVMD5HQ.js.br +0 -0
- package/build/runtime-cloners-KMVMD5HQ.js.gz +0 -0
- package/build/runtime-components-KNOJ3APN.js.br +0 -0
- package/build/runtime-components-KNOJ3APN.js.gz +0 -0
- package/build/runtime-createDestroy-K54XR25L.js.br +0 -0
- package/build/runtime-createDestroy-K54XR25L.js.gz +0 -0
- package/build/runtime-depthOfField-7OSOF7EB.js.br +0 -0
- package/build/runtime-depthOfField-7OSOF7EB.js.gz +0 -0
- package/build/runtime-dragDrop-OL2HS5LA.js.br +0 -0
- package/build/runtime-dragDrop-OL2HS5LA.js.gz +0 -0
- package/build/runtime-gameControls-WXIKN3LX.js.br +0 -0
- package/build/runtime-gameControls-WXIKN3LX.js.gz +0 -0
- package/build/runtime-hair-B2WQTHEG.js.br +0 -3
- package/build/runtime-hair-B2WQTHEG.js.gz +0 -0
- package/build/runtime-hueSaturation-C43KL73N.js.br +0 -0
- package/build/runtime-hueSaturation-C43KL73N.js.gz +0 -0
- package/build/runtime-mergeStaticGeometries-BFVV7XPB.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-BFVV7XPB.js.gz +0 -0
- package/build/runtime-miscActions-COMQEORS.js.br +0 -0
- package/build/runtime-miscActions-COMQEORS.js.gz +0 -0
- package/build/runtime-mouseHover-KRN6U6FS.js.br +0 -0
- package/build/runtime-mouseHover-KRN6U6FS.js.gz +0 -0
- package/build/runtime-noise-3I5NC3AF.js.br +0 -0
- package/build/runtime-noise-3I5NC3AF.js.gz +0 -0
- package/build/runtime-particles-CBQPLZMG.js.br +0 -0
- package/build/runtime-particles-CBQPLZMG.js.gz +0 -0
- package/build/runtime-paths-3J6FCKUL.js.br +0 -0
- package/build/runtime-paths-3J6FCKUL.js.gz +0 -0
- package/build/runtime-pixelation-VWT4UGXR.js.br +0 -0
- package/build/runtime-pixelation-VWT4UGXR.js.gz +0 -0
- package/build/runtime-resize-E4HEZA4E.js.br +0 -0
- package/build/runtime-resize-E4HEZA4E.js.gz +0 -0
- package/build/runtime-sceneTransition-JD3VLBVU.js.br +0 -0
- package/build/runtime-sceneTransition-JD3VLBVU.js.gz +0 -0
- package/build/runtime-scroll-QCT565DO.js.br +0 -0
- package/build/runtime-scroll-QCT565DO.js.gz +0 -0
- package/build/runtime-shapeBlends-L5JEEABI.js +0 -1
- package/build/runtime-shapeBlends-L5JEEABI.js.br +0 -0
- package/build/runtime-shapeBlends-L5JEEABI.js.gz +0 -0
- package/build/runtime-text-5LVNQH6K.js.br +0 -0
- package/build/runtime-text-5LVNQH6K.js.gz +0 -0
- package/build/runtime-textInputs-VMNVJYCR.js.br +0 -0
- package/build/runtime-textInputs-VMNVJYCR.js.gz +0 -0
- package/build/runtime-timeline-JI5XXGZN.js.br +0 -0
- package/build/runtime-timeline-JI5XXGZN.js.gz +0 -0
- package/build/runtime-tracking-5RFL4VUJ.js.br +0 -0
- package/build/runtime-tracking-5RFL4VUJ.js.gz +0 -0
- package/build/runtime-transitions-GG7KDTQV.js.br +0 -0
- package/build/runtime-transitions-GG7KDTQV.js.gz +0 -0
- package/build/runtime-ui2d-VPSG3REG.js.br +0 -0
- package/build/runtime-ui2d-VPSG3REG.js.gz +0 -0
- package/build/runtime-vectorShapes-MQJ7UHCH.js.br +0 -0
- package/build/runtime-vectorShapes-MQJ7UHCH.js.gz +0 -0
- package/build/runtime-vignette-N3RTMCZE.js.br +0 -0
- package/build/runtime-vignette-N3RTMCZE.js.gz +0 -0
- package/build/runtime-webgpu-DGOU336Z.js.br +0 -0
- package/build/runtime-webgpu-DGOU336Z.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./runtime-chunk-GZ5KECB4.js";import{a as e}from"./runtime-chunk-H2HL47RM.js";import{a as n}from"./runtime-chunk-HLEJ7WAV.js";import{d as s,e as i,f as r,g as a,h as o}from"./runtime-chunk-VFF3VHSW.js";import{a as l,b as d}from"./runtime-chunk-GTX3LDVL.js";import{a as c,c as h,g as p,h as u,i as m}from"./runtime-chunk-IZGNZT2Z.js";import{a as f}from"./runtime-chunk-P7IBR4KV.js";import{b as y}from"./runtime-chunk-YPX3TS4M.js";import{a as g,b as v}from"./runtime-chunk-JFURJ5U4.js";import{a as x}from"./runtime-chunk-YT6GLJMC.js";import{d as A}from"./runtime-chunk-73QURPPC.js";import{P as b,la as C,na as w,oa as I}from"./runtime-chunk-T6KZOJFT.js";import{b as M,c as P,e as S,h as B,v as D}from"./runtime-chunk-BFUMQZ5V.js";import{a as R,b as E,c as z,d as O,f as j,i as W,j as T}from"./runtime-chunk-2PT2WH66.js";import{c as _,e as k,g as U}from"./runtime-chunk-TZCHGFVF.js";import{Ea as N,J as V,Qa as F,a as G,b as q,m as L,n as Q,w as Y,ya as Z}from"./runtime-chunk-ADHKZQMB.js";import{$c as X,Aa as H,Ba as K,Fc as J,Gc as $,Hc as tt,Ic as et,Ie as nt,Ja as st,Oa as it,Qc as rt,Ra as at,Vc as ot,Xc as lt,Zc as dt,_c as ct,dd as ht,ed as pt,ee as ut,fd as mt,l as ft,mc as yt,md as gt,n as vt,nd as xt,od as At,pd as bt,qd as Ct,rd as wt,sd as It,za as Mt}from"./runtime-chunk-KPOUV3HD.js";import{c as Pt}from"./runtime-chunk-ML3Z74BL.js";var St=null;function Bt(t){St=t}var Dt=new WeakMap,Rt=1;function Et(t){let e=Dt.get(t);return void 0===e&&(e=Rt++,Dt.set(t,e)),e}function zt(t){let e=t.states;return void 0!==e&&Object.keys(e).length>0?e:void 0}function Ot(t,e,n){let s=W(t)?t.object:t;return s.builtSharedGeometry===e&&s.material===n}function jt(t,e,n,s){let i=t,r=e;return[Et(n),Et(s),i.layers?.mask??0,i.renderOrder??0,!0===(i.castShadow??r.castShadow)?1:0,!0===(i.receiveShadow??r.receiveShadow)?1:0].join(":")}var Wt=[8,32,128,512],Tt=Wt[Wt.length-1],_t=(new rt).makeScale(0,0,0),kt=class extends It{constructor(t,e,n,s){super(t,e,n),this.isInstanceGroup=!0,this.members=new Array(n).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(s);for(let t=0;t<n;t++)this.setMatrixAt(t,_t);this.instanceMatrix.needsUpdate=!0}adoptPassState(t){this.layers.mask=t.layers.mask,this.renderOrder=t.renderOrder,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow}assign(t,e){this.members[t]=e}writeSlot(t,e,n){return!1===n?(this.setMatrixAt(t,_t),!1):(this.setMatrixAt(t,e.matrixWorld),!0)}park(t){this.members[t]=null,this.setMatrixAt(t,_t)}get memberCount(){let t=0;for(let e of this.members)null!==e&&t++;return t}};function Ut(t,e,n){let s=n.get(t);if(void 0!==s)return s;let i=t.parent,r=null===i?1:Ut(i,e,n),a=t.visible?1&r:0;return(t===e||!!(2&r))&&(a|=2),n.set(t,a),a}var Nt=8,Vt=class{constructor(t=8){this.minGroupSize=t,this.groups=[],this.groupKeys=new WeakMap,this.placements=new Map,this.drawStateMemo=new Map,this.transparencyDissolves=new WeakMap,this.frame=0,this.mirrored=[],this.page=null,this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}},this.reconcileRequested=!1}update(t,e){this.frame++,this.page!==t&&(this.teardown(),this.page=t,e=!0),!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh(t);for(let t of this.mirrored)if(t.matrixWorld.determinant()>=0){this.reconcileRequested=!0;break}this.reconcileRequested&&(this.reconcileRequested=!1,this.reconcile(t),this.refresh(t),this.reconcileRequested=!1)}reconcile(t){let e,n={},s=new Map,i=[];for(let t of this.groups){let n=t.material;if(!0!==n.transparent||e?.has(n))continue;(e??(e=new Set)).add(n);let s=this.transparencyDissolves.get(n),i=void 0!==s&&this.frame-s.frame<=600;this.transparencyDissolves.set(n,{count:i?s.count+1:1,frame:this.frame})}t.traverse(t=>{if(!0===t.isInstanceGroup)return;let e=function(t){if(!0!==t.isMesh)return"not-a-mesh";if(z(t)||j(t)||E(t)||R(t))return"excluded-type";let e=function(t){let e=W(t)?t.object:t;return void 0!==e.geometry?e:void 0}(t);if(void 0===e)return"not-a-mesh";let n=e.material;if(void 0===n)return"not-a-mesh";if(Array.isArray(n))return"array-material";let s=e.builtSharedGeometry;if(void 0===s)return"unrealized-geometry";if(!function(t){return!0===t.isShared}(s))return"unshared-geometry";if(void 0===s.attributes.position)return"empty-geometry";if(void 0!==s.morphAttributes.position)return"morph";if(!0===e.isSkinnedMesh)return"skinned";let i=e.morphTargetInfluences;if(void 0!==i&&i.length>0)return"morph";if(0!==s.drawRange.start||s.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let r=n;if(null!=r.positionNode||null!=r.castShadowPositionNode)return"position-node";if(!0===r.transparent)return"transparent";if(void 0!==e.userData?.__splinePlanarMirror)return"reflection";let a=function(t){let e=t;if(void 0!==zt(e))return"interaction-states";for(let t=e.parent;null!==t;t=t.parent){let e=zt(t);if(void 0===e)continue;let n=t;for(let t of Object.values(e)){if(void 0!==n.cloner||null!=t.cloner&&!0!==t.cloner.disabled)return"interaction-states";let e=t.scale;if(void 0!==e&&((e.x??1)<0||(e.y??1)<0||(e.z??1)<0))return"mirrored"}}}(e);return void 0!==a?a:t.matrixWorld.determinant()<0?"mirrored":{object:t,owner:e,geometry:s,material:n,key:jt(t,e,s,n)}}(t);if("string"!=typeof e&&this.isChurning(e.material)&&(e="transparency-churn"),"string"==typeof e)return n[e]=(n[e]??0)+1,void("mirrored"===e&&t.matrixWorld.determinant()<0&&i.push(t));let r=s.get(e.key);void 0===r?s.set(e.key,[e]):r.push(e)});let r=new Map;for(let[t,e]of s)for(let n of e)r.set(n.object,t);let a=!1;for(let[t,e]of this.placements)r.get(t)!==this.groupKeys.get(e.group)&&this.parkPlacement(t,e);for(let t=this.groups.length-1;t>=0;t--){let e=this.groups[t];e.memberCount>=this.minGroupSize||(this.destroyGroup(e),this.groups.splice(t,1),a=!0)}for(let[e,n]of s){let s=n.filter(t=>!this.placements.has(t.object));if(0===s.length)continue;let i=0;for(let t of this.groups){if(i>=s.length)break;if(this.groupKeys.get(t)!==e)continue;let{members:n}=t;for(let e=0;e<n.length&&i<s.length;e++)null===n[e]&&this.place(t,e,s[i++].object)}for(;s.length-i>=this.minGroupSize;){let n=s.slice(i,i+Tt);this.groups.push(this.createGroup(t,e,n)),i+=n.length,a=!0}}a&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=n,this.mirrored=i}isChurning(t){let e=this.transparencyDissolves.get(t);return void 0!==e&&e.count>=2&&this.frame-e.frame<=600}createGroup(t,e,n){let s=n[0],i=new kt(s.geometry,s.material,function(t){for(let e of Wt)if(t<=e)return e;return Tt}(n.length),s.object);this.groupKeys.set(i,e);for(let t=0;t<n.length;t++)this.place(i,t,n[t].object);return t.add(i),i}destroyGroup(t){for(let e=0;e<t.members.length;e++){let n=t.members[e];null!==n&&this.parkPlacement(n,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,n){t.assign(e,n),this.placements.set(n,{group:t,slot:e}),n.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(t){this.drawStateMemo.clear();for(let e of this.groups){let{members:n}=e,s=e.material;(!0===s.transparent||null!=s.positionNode||null!=s.castShadowPositionNode)&&(this.reconcileRequested=!0);let i=null;for(let s=0;s<n.length;s++){let r=n[s];if(null===r)continue;null===i&&(i=r);let a=Ut(r,t,this.drawStateMemo),o=!!(1&a);(!(2&a)||r.matrixWorld.determinant()<0||!Ot(r,e.geometry,e.material))&&(o=!1,this.reconcileRequested=!0),e.writeSlot(s,r,o)}null!==i&&(e.adoptPassState(i),e.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null,this.mirrored=[]}publishGroupStats(){let t=0;for(let e of this.groups){let n=e.memberCount;n>0&&(t+=n-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}},Ft=function(){let t=new Float32Array(1),e=new Int32Array(t.buffer);return function(n){return t[0]=n,e[0]}}(),Gt=function(t,e,n,s){return t+(e<<8)+(n<<16)+(s<<24)},qt=new J;function Lt(t){let e=!1;return t.scene.objects.traverse((t,n)=>{if(!1===n.visible)return!0;"Splat"===n.type&&(e=!0)}),e}var Qt,Yt,Zt=class extends xt{constructor(t,e,n,s,i=!1,r=1,a,o){super(n,s),this.splatCount=e,this.meshIndexIntervals=a,this.meshMatrixWorlds=o,this.splatBuffers=t,this.geometry=n,this.material=s,this.splatDataTextures=null,this.halfPrecisionCovariancesOnGPU=i,this.devicePixelRatio=r,this.resetLocalSplatDataAndTexturesFromSplatBuffer()}static buildMesh(t,e,n=!1,s=1,i,r){let a=Zt.buildGeomtery(e),o=Zt.buildMaterial(i);return new Zt(t,e,a,o,n,s,i,r)}static buildMaterial(t){if("webgpu"===b()&&St)return St.createSplatMaterial(t);let e={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:t},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new J},viewport:{type:"v2",value:new J},basisViewport:{type:"v2",value:new J},debugColor:{type:"v3",value:new ot},covariancesTextureSize:{type:"v2",value:new J(1024,1024)},centersColorsTextureSize:{type:"v2",value:new J(1024,1024)},orthoZoom:{type:"f",value:-1}};return new ut({uniforms:e,vertexShader:"\n precision highp float;\n #include <common>\n\n attribute uint splatIndex;\n\n uniform highp sampler2D covariancesTexture;\n uniform highp usampler2D centersColorsTexture;\n uniform vec2 focal;\n uniform vec2 viewport;\n uniform vec2 basisViewport;\n uniform vec2 covariancesTextureSize;\n uniform vec2 centersColorsTextureSize;\n\t\t\t\t\t\tuniform highp sampler2D meshMatrixWorldsTexture;\n\t\t\t\t\t\tuniform uint meshIndexIntervals[257];\n\t\t\t\t\t\tuniform float orthoZoom;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\n const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));\n const uvec4 shift4 = uvec4(0, 8, 16, 24);\n vec4 uintToRGBAVec (uint u) {\n uvec4 urgba = mask4 & u;\n urgba = urgba >> shift4;\n vec4 rgba = vec4(urgba) * encodeNorm4;\n return rgba;\n }\n\n vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n void main () {\n uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));\n vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));\n vColor = uintToRGBAVec(sampledCenterColor.r);\n\n vPosition = position.xy * 2.0;\n\n\t\t\t\t\t\t\t\tuint meshIndex;\n\t\t\t\t\t\t\t\tfor (int i = 1; i < 257; i++) {\n\t\t\t\t\t\t\t\t\tif (splatIndex < meshIndexIntervals[i]) {\n\t\t\t\t\t\t\t\t\t\tmeshIndex = uint(i - 1);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tfloat strideMulmeshIndex = float(4u*meshIndex);\n\t\t\t\t\t\t\t\tfloat meshMatrixWorldsTextureLength = float(256*4);\n\n\t\t\t\t\t\t\t\tmat4 modelMat = mat4(\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0))\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tmat4 modelViewMat = viewMatrix * modelMat;\n\t\t\t\t\t\t\t\tvec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); \n vec4 clipCenter = projectionMatrix * viewCenter;\n\n vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg;\n vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg;\n vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg;\n\n vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r);\n vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg);\n\n \n mat3 Vrk = mat3(\n cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,\n cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,\n cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z\n );\n float s = 1.0 / (viewCenter.z * viewCenter.z);\n\n mat3 W = transpose(mat3(modelViewMat));\n mat3 T = orthoZoom > 0.0 ? W : W * mat3(\n\t\t\t\t\t\t\t\t\tfocal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,\n\t\t\t\t\t\t\t\t\t0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,\n\t\t\t\t\t\t\t\t\t0., 0., 0.\n\t\t\t\t\t\t\t\t);\n mat3 cov2Dm = transpose(T) * Vrk * T;\n cov2Dm[0][0] += 0.3;\n cov2Dm[1][1] += 0.3;\n\n \n \n \n \n vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);\n\n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n \n \n \n \n \n \n \n \n float a = cov2Dv.x;\n float d = cov2Dv.z;\n float b = cov2Dv.y;\n float D = a * d - b * b;\n float trace = a + d;\n float traceOver2 = 0.5 * trace;\n float term2 = sqrt(trace * trace / 4.0 - D);\n float eigenValue1 = traceOver2 + term2;\n\t\t\t\t\t\t\t\tfloat eigenValue2 = max(traceOver2 - term2, 0.00); \n\n const float maxSplatSize = 1024.0;\n vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));\n \n vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);\n vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize);\n vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize);\n\n vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport;\n\n\t\t\t\t\t\t\t\tif (orthoZoom > 0.0) {\n\t\t\t\t\t\t\t\t\tndcOffset *= orthoZoom;\n\t\t\t\t\t\t\t\t}\n\n gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);\n }",fragmentShader:"\n precision highp float;\n #include <common>\n\n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\t\t\t\t\t\tlayout(location = 1) out vec4 gVelocity; \n\n void main () {\n \n \n float A = -dot(vPosition, vPosition);\n if (A < -4.0) discard;\n vec3 color = vColor.rgb;\n A = exp(A) * vColor.a;\n gl_FragColor = vec4(color.rgb, A);\n\t\t\t\t\t\t\t\tgVelocity = vec4(0.0); \n }",transparent:!0,alphaTest:1,blending:vt,depthTest:!0,depthWrite:!1,side:ft})}static buildGeomtery(t){let e=new mt;e.setIndex([0,1,2,0,2,3]);let n=new Float32Array(12),s=new X(n,3);e.setAttribute("position",s),s.setXYZ(0,-1,-1,0),s.setXYZ(1,-1,1,0),s.setXYZ(2,1,1,0),s.setXYZ(3,1,-1,0),s.needsUpdate=!0;let i=(new nt).copy(e),r=new Uint32Array(t),a=new wt(r,1,!1);return a.setUsage(yt),i.setAttribute("splatIndex",a),i.instanceCount=t,i}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(t=>t.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let t=0,e=0,n=0;for(let s of this.splatBuffers){let i=s.nsplats;this.colors.subarray(t,t+4*i).set(s.colorsA),t+=4*i,this.centers.subarray(e,e+3*i).set(s.decoded.xyz.denormDequant().data),e+=3*i,this.covariances.subarray(n,n+6*i).set(new Float32Array(s.precomputedCovarianceBufferData)),n+=6*i}}allocateAndStoreLocalSplatDataInTextures(){let t=this.splatCount,e=new J(4096,1024);for(;e.x*e.y*2<6*t;)e.y*=2;let n,s,i=new J(4096,1024);for(;i.x*i.y*4<4*t;)i.y*=2;if(this.halfPrecisionCovariancesOnGPU){s=new Uint16Array(e.x*e.y*2);for(let t=0;t<this.covariances.length;t++)s[t]=ct.toHalfFloat(this.covariances[t]);n=new bt(s,e.x,e.y,it,K)}else s=new Float32Array(e.x*e.y*2),s.set(this.covariances),n=new bt(s,e.x,e.y,it,H);n.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=n,this.material.uniforms.covariancesTextureSize.value.copy(e);let r=new Uint32Array(i.x*i.y*4);for(let e=0;e<t;e++){let t=4*e,n=3*e,s=4*e;r[s]=Gt(this.colors[t],this.colors[t+1],this.colors[t+2],this.colors[t+3]),r[s+1]=Ft(this.centers[n]),r[s+2]=Ft(this.centers[n+1]),r[s+3]=Ft(this.centers[n+2])}let a=new bt(r,i.x,i.y,at,Mt);"webgpu"!==b()&&(a.internalFormat="RGBA32UI"),a.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=a,this.material.uniforms.centersColorsTextureSize.value.copy(i);let o=new Float32Array(4096);for(let t=0;t<this.meshMatrixWorlds.length;t++)o.set(this.meshMatrixWorlds[t].elements,16*t);let l=new bt(o,1024,1,st,H);l.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=l,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:s,texture:n,size:e},centerColors:{data:r,texture:a,size:i},meshMatrixWorlds:{data:o,texture:l}}}updateIndexes(t){let e=this.geometry;e.attributes.splatIndex.set(t),e.attributes.splatIndex.needsUpdate=!0,e.instanceCount=t.length}updateUniforms(t,e,n,s){this.splatCount>0&&(qt.set(t.x*this.devicePixelRatio,t.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(qt),this.material.uniforms.basisViewport.value.set(2/qt.x,2/qt.y),this.material.uniforms.focal.value.set(e,n),this.material.uniforms.orthoZoom.value=s,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}},Xt=new Promise(t=>{Qt=t}),Ht=!1;function Kt(){if(!Ht)return Yt||(Yt=async function(){let t=await import("./gaussian-splat-compression.js");Qt(t),Ht=!0}())}var Jt=new rt,$t=new et,te=new tt,ee=new tt,ne=new tt,se=new tt,ie=new tt,re=new tt;function ae(t,e,n){n.length=0;let{axis:s,sign:i,limit:r}=e;for(let e=0;e<t.length;e++){let a=t[e],o=t[(e+1)%t.length],l=(0===s?a.px:1===s?a.py:a.pz)*i-r,d=(0===s?o.px:1===s?o.py:o.pz)*i-r,c=l<=0,h=d<=0;if(c&&n.push(a),c!==h){let t=l/(l-d);n.push({px:a.px+(o.px-a.px)*t,py:a.py+(o.py-a.py)*t,pz:a.pz+(o.pz-a.pz)*t,nx:a.nx+(o.nx-a.nx)*t,ny:a.ny+(o.ny-a.ny)*t,nz:a.nz+(o.nz-a.nz)*t})}}return n}function oe(t,e,n,s,i,r,a,o,l){let d=t.geometry,c=d.getAttribute("position");if(void 0===c||0===c.count)return!0;let h=d.getAttribute("normal"),p=d.getIndex(),u=null!==p?p.count:c.count;if(u>15e5)return!0;let m=d.drawRange.start,f=m+(d.drawRange.count===1/0?u-m:Math.min(d.drawRange.count,u-m));Jt.copy(t.objectToDecal),$t.getNormalMatrix(Jt);let y=[],g=[];for(let t=m;t+2<f;t+=3){let d=null!==p?p.getX(t):t,u=null!==p?p.getX(t+1):t+1,m=null!==p?p.getX(t+2):t+2;if(te.fromBufferAttribute(c,d).applyMatrix4(Jt),ee.fromBufferAttribute(c,u).applyMatrix4(Jt),ne.fromBufferAttribute(c,m).applyMatrix4(Jt),te.z>n&&ee.z>n&&ne.z>n||te.z<-n&&ee.z<-n&&ne.z<-n)continue;se.subVectors(ee,te),ie.subVectors(ne,te),re.crossVectors(se,ie);let f=re.length();if(!(0===f||re.z/f<=.01)){if(y.length=0,void 0!==h)se.fromBufferAttribute(h,d).applyMatrix3($t),y.push({px:te.x,py:te.y,pz:te.z,nx:se.x,ny:se.y,nz:se.z}),se.fromBufferAttribute(h,u).applyMatrix3($t),y.push({px:ee.x,py:ee.y,pz:ee.z,nx:se.x,ny:se.y,nz:se.z}),se.fromBufferAttribute(h,m).applyMatrix3($t),y.push({px:ne.x,py:ne.y,pz:ne.z,nx:se.x,ny:se.y,nz:se.z});else{re.divideScalar(f);for(let t of[te,ee,ne])y.push({px:t.x,py:t.y,pz:t.z,nx:re.x,ny:re.y,nz:re.z})}for(let t of e){if(0===y.length)break;let e=ae(y,t,g);g=y,y=e}if(!(y.length<3)){if(a.length/3+3*(y.length-2)>3e5)return!1;for(let t=1;t+1<y.length;t++)for(let e of[y[0],y[t],y[t+1]]){l.push(e.px*s+.5,e.py*i+.5);let t=e.nx,n=e.ny,d=e.nz,c=Math.hypot(t,n,d);c>0?(t/=c,n/=c,d/=c):(t=0,n=0,d=1),a.push(e.px+t*r,e.py+n*r,e.pz+d*r),o.push(t,n,d)}}}}return!0}var le=new dt,de=new dt,ce=new rt,he=new tt,pe=class extends w{constructor(t,e,n){super(t,e),this.data=e,this.geometry=new mt,this.lastSignature=[],this.nextSignature=[],this.scanned=[],this.lastParams={width:0,height:0,depth:0,offset:0},this.targetFilter=new Set,this.context=n;let s=this.data.geometry;this.lastParams={width:this.resolveNumber(s.width,0),height:this.resolveNumber(s.height,0),depth:this.resolveNumber(s.depth,0),offset:s.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(t,e){if("number"==typeof t)return t;let n=Number(this.context.shared.getVariable(t));return Number.isFinite(n)?n:e}currentParams(){let t=this.dataPatched.geometry;return{width:this.resolveNumber(t.width,this.lastParams.width),height:this.resolveNumber(t.height,this.lastParams.height),depth:this.resolveNumber(t.depth,this.lastParams.depth),offset:t.offset??0}}projectionRoot(){let t=this.parent;for(;null!==t&&B.is(t);){if("Page"===t.data?.type)return t;t=t.parent}return this.context.scene}currentTargetFilter(){let t=this.dataPatched.geometry;if("select"!==t.projection)return null;let e=t.projectionTargets;if(e!==this.targetFilterSource&&(this.targetFilterSource=e,this.targetFilter.clear(),void 0!==e))for(let t of e)this.targetFilter.add(t);return this.targetFilter}static matchesTargetFilter(t,e,n){let s=t;for(;null!==s&&s!==n;){if(e.has(s.uuid))return!0;s=s.parent}return!1}scanTargets(t,e,n){let s=this.scanned;s.length=0;let i=this.projectionRoot();if(null===i)return s;let r=this.currentTargetFilter();if(null!==r&&0===r.size)return s;le.makeEmpty();for(let s=0;s<8;s++)he.set((1&s?.5:-.5)*t,(2&s?.5:-.5)*e,(4&s?.5:-.5)*n).applyMatrix4(this.matrixWorld),le.expandByPoint(he);return i.traverse(t=>{if(t===this||!B.is(t)||!(t instanceof D)||t instanceof pe||"Mesh"!==t.dataPatched?.type||!t.visible||t.destroyedInAction||512&t.layers.mask||null!==r&&!pe.matchesTargetFilter(t,r,i))return;let e=t.geometry,n=e?.getAttribute("position");void 0===n||0===n.count||0!==e.drawRange.count&&(null===e.boundingBox&&e.computeBoundingBox(),de.copy(e.boundingBox).applyMatrix4(t.matrixWorld),le.intersectsBox(de)&&s.push(t))}),s}collectSignature(t,e,n){t.length=0,t.push(n.width,n.height,n.depth,n.offset);for(let e of this.matrixWorld.elements)t.push(e);for(let n of e){t.push(n.id,n.geometry.id);let e=n.geometry.getAttribute("position");t.push(void 0===e?-1:"version"in e?e.version:e.data.version);let s=n.geometry.getIndex();t.push(null!==s?s.version:-1),t.push(n.geometry.drawRange.count===1/0?-1:n.geometry.drawRange.count);for(let e of n.matrixWorld.elements)t.push(e)}}signaturesEqual(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let t=this.currentParams(),e=this.scanTargets(t.width,t.height,t.depth);if(this.collectSignature(this.nextSignature,e,t),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let n=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=n,this.lastParams=t,ce.copy(this.matrixWorld).invert();let s=e.map(t=>({geometry:t.geometry,objectToDecal:(new rt).multiplyMatrices(ce,t.matrixWorld)}));return this.geometry.dispose(),this.geometry=function(t,e){let n=Math.max(Math.abs(e.width),1e-6),s=Math.max(Math.abs(e.height),1e-6),i=Math.max(Math.abs(e.depth),1e-6),r=[{axis:0,sign:1,limit:n/2},{axis:0,sign:-1,limit:n/2},{axis:1,sign:1,limit:s/2},{axis:1,sign:-1,limit:s/2},{axis:2,sign:1,limit:i/2},{axis:2,sign:-1,limit:i/2}],a=[],o=[],l=[];for(let d of t)if(!oe(d,r,i/2,1/n,1/s,e.offset,a,o,l))break;let d=new mt;return d.setAttribute("position",new ht(a,3)),d.setAttribute("normal",new ht(o,3)),d.setAttribute("uv",new ht(l,2)),0===a.length?(d.setDrawRange(0,0),d.boundingSphere=new pt):d.computeBoundingSphere(),d}(s,t),this.geometry.userData={type:"DecalGeometry",parameters:{width:t.width,height:t.height,depth:t.depth}},g(this),v(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(t,e,n){super.updateByPatchedOp(t,e,n),M(t.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(t,e){let n=this.currentParams();t.setScalar(0),e.set(n.width,n.height,n.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}},ue=class extends(A(At,x)){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}},me=function(){try{let t=window.location.href;if(t.includes("reducesubdiv=")){let e=t.indexOf("reducesubdiv=")+13;return parseInt(t.slice(e,e+1))}}catch{}}();function fe(n,s,i){if(console.assert(void 0!==s.type),"Mesh"===s.type)return function(t,e,n){let s;if(void 0!==me&&e?.geometry&&"subdivisions"in e.geometry&&(e.geometry.subdivisions??0)>me&&Object.assign(e.geometry,{subdivisions:me}),"TextGeometry"===e.geometry.type||"InputGeometry"===e.geometry.type){let s=U(e.geometry.type);return s?s(t,e,n):(_("InputGeometry"===e.geometry.type?"textinputs":"text",`a Mesh with ${e.geometry.type}`),new I(t,e,n))}if("SubdivGeometry"===e.geometry.type)s=new y(t,e,n);else if("PathGeometry"===e.geometry.type||"VectorGeometry"===e.geometry.type||"ShapeBlendGeometry"===e.geometry.type){let i=U(e.geometry.type);i?s=i(t,e,n):(_("ShapeBlendGeometry"===e.geometry.type?"shape-blends":"PathGeometry"===e.geometry.type?"3d-paths":"vector-shapes",`a Mesh with ${e.geometry.type}`),s=new I(t,e,n))}else if("BooleanGeometry"===e.geometry.type)s=new h(t,e,n);else if("DecalGeometry"===e.geometry.type)s=new pe(t,e,n);else if("UIGeometry"===e.geometry.type){let i=U("UIGeometry");i?s=i(t,e,n):(_("ui-2d","a Mesh with UIGeometry"),s=new I(t,e,n))}else s=new I(t,e,n);return s}(n,s,i);if("Empty"===s.type)return new e(n,s);if("Particle"===s.type){let t=k("Particle");return t?t(n,s,i):(_("particles","a Particle system"),new e(n,s))}if("ParticleCollider"===s.type)return new f(n,s,i);if("Hair"===s.type){let t=k("Hair");return t?t(n,s,i):(_("hair","a Hair System"),new e(n,s))}if("Splat"===s.type)return new e(n,s);if("Bone"===s.type)return new ue(n,s);if("Page"===s.type)return new o(n,s,i);if("PointLight"===s.type)return new t(n,s,i);if("SpotLight"===s.type)return new d(n,s,i);if("DirectionalLight"===s.type)return new l(n,s,i);if("Component"===s.type||"Instance"===s.type){let t=k(s.type);return t?t(n,s,i):(_("components",`a ${s.type}`),new e(n,s))}return V.is(s.type)?new c(n,s):(console.error(s),new e(n,s))}P.createEntity=fe,P.changeEntityProptotype=function(t,e,n){let s=fe(t.identity,e,n),i=t.children,r=t.attachedPaths,a=t.parent,o=t.component,l=t.instances,d=t.overrideData,c=t.uuid,h=t.stateSelection,p=function(t){if(!(t instanceof I&&t.isSkinnedMesh))return;let e=t.dataPatched.bones,n=t.skeleton.bones;return e&&e.length===n.length?new Map(e.map((t,e)=>[t,n[e]])):void 0}(t);t.dispose();for(let e of Object.keys(t))delete t[e];Object.setPrototypeOf(t,Object.getPrototypeOf(s));for(let e of Object.keys(s))t[e]=s[e];t.children=[...t.children,...i],t.attachedPaths=r,t.parent=a,t.component=o,t.instances=l,t.uuid=c,t.overrideData=d,t.updateState(t.data,n),h&&t.changeSelectedState(h,n),p&&t instanceof I&&t.rebindSkeleton(t=>p.get(t)??n.scene.find(t)??void 0),t.resetBBoxNeedsUpdate()};var ye,ge=class{constructor(){this._constraints=new Map}setConstraint(t,e){null===e?this._constraints.delete(t):this._constraints.set(t,e)}getConstraint(t){return this._constraints.get(t)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((n,s)=>{let i=[s,n],r=n;for(;this._constraints.has(r);){if(r=this._constraints.get(r),i.includes(r)){console.warn(`circular dependency detected: ${i.join(" -> ")}`);break}e.has(r)||i.push(r)}for(let n=i.length-2;n>=0;n--)if(!e.has(i[n])){let s=t.find(i[n]);s?s.applyPathSnapping(t):console.warn(`missing entity ${i[n]}`),e.add(i[n])}})}findDependency(t,e){let n=t;for(;this._constraints.has(n);)if(n=this._constraints.get(n),n===e)return!0;return!1}},ve=class{};Pt(ve,"DepthMapRange",65536),Pt(ve,"MemoryPageSize",65536),Pt(ve,"BytesPerFloat",4),Pt(ve,"BytesPerInt",4),Xt.then(t=>ye=t);var xe=class{constructor(t={}){Pt(this,"updateView",function(){let t=new rt,e=[],n=new tt(0,0,-1),s=new tt(0,0,-1),i=new tt,r=new tt;return function(a=!1,o){let l=this.updateMatrixWorldsInWorkerIfNeeded(),d=this.cropsChanged();if(!a){s.set(0,0,-1).applyQuaternion(o.quaternion);let t=!1,e=!1;if(s.dot(n)<=.95&&(t=!0),r.copy(o.position).sub(i).length()>=1&&(e=!0),!(t||e||l||d||this.needsInitialRender))return}this.needsInitialRender=!1,i.copy(o.position),n.copy(s),t.copy(o.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),e[0]=o.position.x,e[1]=o.position.y,e[2]=o.position.z;let c={sort:{view:t.elements,cameraPosition:e,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...l?{newMatrixWorlds:this.meshMatrixWorlds}:{},...d?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=c:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(c))}}()),this.scene=t.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=(new rt).makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(t,e){let n=new J;null!==this.splatMesh&&this.splatMesh.getSplatCount()>0&&(t.getSize(n),this.cameraFocalLengthX=e.projectionMatrix.elements[0]*this.devicePixelRatio*n.x*.45,this.cameraFocalLengthY=e.projectionMatrix.elements[5]*this.devicePixelRatio*n.y*.45,this.splatMesh.updateUniforms(n,this.cameraFocalLengthX,this.cameraFocalLengthY,e.isPerspectiveCamera?-1:e.zoom*this.devicePixelRatio))}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=(new tt).fromArray(t.position)),t.orientation&&(t.orientation=(new $).fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseVisibleEntity(t=>{"Splat"===t.data.type&&e.push(t)}),this.splatMesh&&this.splatMesh.dispose(),0===e.length)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(t=>t.matrixWorld),this.meshMatrixWorldsOld=e.map(t=>t.matrixWorld.clone()),this.cropsArray=e.map(t=>t.data.crops.map(t=>t.data)),this._splatBufferCache??(this._splatBufferCache=new WeakMap);let n=e.map(t=>{let e=this._splatBufferCache.get(t.data.buffer);return void 0===e&&(e=new ye.GSplineBuffer(new Uint8Array(t.data.buffer).buffer),this._splatBufferCache.set(t.data.buffer,e)),e}),s=0,i=[0];for(let t of n)s+=t.getSplatCount(),i.push(s);return this.setupSplatMesh(n,s,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,i,this.meshMatrixWorlds),this.setupSortWorker(s),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,16*e);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((t,e)=>t.equals(this.meshMatrixWorldsOld[e]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(t=>t.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,n)=>{e.data.crops.forEach((e,s)=>{void 0===this.cropsArray[n][s]?(t=!0,this.cropsArray[n][s]=e.data):Object.entries(e.data).forEach(([e,i])=>{(Array.isArray(i)&&i.some((t,i)=>t!==this.cropsArray[n][s][e][i])||i!==this.cropsArray[n][s]?.[e])&&(t=!0,this.cropsArray[n][s][e]=i)})}),e.data.crops.length!==this.cropsArray[n]?.length&&(this.cropsArray[n].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,n=new tt,s=new $,i=!1,r=1,a,o){this.splatMesh=Zt.buildMesh(t,e,i,r,a,o),this.splatMesh.position.copy(n),this.splatMesh.quaternion.copy(s),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=e,this.splatMesh.onBeforeRender=(t,e,n)=>this.update(t,n)}setupSortWorker(t){this.sortWorker=function(t){let e=new Worker(URL.createObjectURL(new Blob(["(","\nfunction sortWorker(self) {\n\tlet wasmInstance;\n\tlet splatCount;\n\tlet splatRC;\n\tlet indexesOffset;\n\tlet positionsOffset;\n\tlet viewProjOffset;\n\tlet frequenciesOffset;\n\tlet indexesOutOffset;\n\tlet sortBuffersOffset;\n\tlet wasmMemory;\n\tlet positions;\n\n\tlet Constants;\n\tlet floatPositions;\n\tlet meshIndexIntervals;\n\tlet meshMatrixWorlds;\n\tlet cropsArray;\n\n\tfunction sort(viewProj) {\n\t\t// console.time('WASM SORT');\n\t\tconst viewProjArray = new Float64Array(wasmMemory, viewProjOffset, 16);\n\t\tfor (let i = 0; i < 16; i++) {\n\t\t\tviewProjArray[i] = viewProj[i];\n\t\t}\n\t\tlet indexesBuffer;\n\t\t// console.timeEnd('WASM SORT');\n\t\tif (splatRC > 1) {\n\t\t\twasmInstance.exports.sortIndexes(\n\t\t\t\tindexesOffset,\n\t\t\t\tpositionsOffset,\n\t\t\t\tsortBuffersOffset,\n\t\t\t\tviewProjOffset,\n\t\t\t\tfrequenciesOffset,\n\t\t\t\tindexesOutOffset,\n\t\t\t\tConstants.DepthMapRange,\n\t\t\t\tsplatRC\n\t\t\t);\n\t\t\tconst indexes = new Uint32Array(splatRC);\n\t\t\tindexesBuffer = indexes.buffer;\n\t\t\tindexes.set(new Uint32Array(wasmMemory, indexesOutOffset, splatRC));\n\t\t} else if (splatRC === 1) {\n\t\t\tconst indexes = new Uint32Array(splatRC);\n\t\t\tindexes[0] = new Uint32Array(wasmMemory, indexesOffset, splatCount)[0];\n\t\t\tindexesBuffer = indexes.buffer;\n\t\t} else {\n\t\t\tindexesBuffer = new ArrayBuffer(0);\n\t\t}\n\n\t\tself.postMessage(\n\t\t\t{\n\t\t\t\tsortDone: true,\n\t\t\t\tindexesBuffer,\n\t\t\t},\n\t\t\t[indexesBuffer]\n\t\t);\n\t}\n\tfunction updateRenderedSplats(\n\t\tmeshMatrixWorlds,\n\t\tcropsArray,\n\t\tmeshIndexIntervals\n\t) {\n\t\tconst renderedPositions = new Float32Array(\n\t\t\twasmMemory,\n\t\t\tpositionsOffset,\n\t\t\tsplatCount * 3\n\t\t);\n\t\tsplatRC = 0;\n\t\tconst wasmMemoryIndexes = new Uint32Array(\n\t\t\twasmMemory,\n\t\t\tindexesOffset,\n\t\t\tsplatCount\n\t\t);\n\t\tfor (let i = 0; i < meshIndexIntervals.length - 1; i++) {\n\t\t\tconst crops = cropsArray[i];\n\t\t\tconst matrixWorld = meshMatrixWorlds[i].elements;\n\t\t\tconst paramsIn = crops\n\t\t\t\t.filter((a) => a.enabled && a.mode === 'Include')\n\t\t\t\t.map((c) =>\n\t\t\t\t\tc.type === 'Box'\n\t\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t\t);\n\t\t\tconst paramsOut = crops\n\t\t\t\t.filter((a) => a.enabled && a.mode === 'Exclude')\n\t\t\t\t.map((c) =>\n\t\t\t\t\tc.type === 'Box'\n\t\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t\t);\n\t\t\tfor (let j = meshIndexIntervals[i]; j < meshIndexIntervals[i + 1]; j++) {\n\t\t\t\tconst x = floatPositions[j * 3];\n\t\t\t\tconst y = floatPositions[j * 3 + 1];\n\t\t\t\tconst z = floatPositions[j * 3 + 2];\n\t\t\t\tif (\n\t\t\t\t\t(paramsIn.length === 0 || isInBounds(x, y, z, paramsIn)) &&\n\t\t\t\t\t(paramsOut.length === 0 || !isInBounds(x, y, z, paramsOut))\n\t\t\t\t) {\n\t\t\t\t\tconst w =\n\t\t\t\t\t\t1 /\n\t\t\t\t\t\t(matrixWorld[3] * x +\n\t\t\t\t\t\t\tmatrixWorld[7] * y +\n\t\t\t\t\t\t\tmatrixWorld[11] * z +\n\t\t\t\t\t\t\tmatrixWorld[15]);\n\t\t\t\t\trenderedPositions[splatRC * 3] =\n\t\t\t\t\t\t(matrixWorld[0] * x +\n\t\t\t\t\t\t\tmatrixWorld[4] * y +\n\t\t\t\t\t\t\tmatrixWorld[8] * z +\n\t\t\t\t\t\t\tmatrixWorld[12]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\trenderedPositions[splatRC * 3 + 1] =\n\t\t\t\t\t\t(matrixWorld[1] * x +\n\t\t\t\t\t\t\tmatrixWorld[5] * y +\n\t\t\t\t\t\t\tmatrixWorld[9] * z +\n\t\t\t\t\t\t\tmatrixWorld[13]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\trenderedPositions[splatRC * 3 + 2] =\n\t\t\t\t\t\t(matrixWorld[2] * x +\n\t\t\t\t\t\t\tmatrixWorld[6] * y +\n\t\t\t\t\t\t\tmatrixWorld[10] * z +\n\t\t\t\t\t\t\tmatrixWorld[14]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\twasmMemoryIndexes[splatRC] = j;\n\t\t\t\t\tsplatRC++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction getOutOfBoundsIndexes(floatPositions, crops) {\n\t\tconst outOfBoundsIndexes = [];\n\t\tconst paramsIn = crops\n\t\t\t.filter((a) => a.enabled && a.mode === 'Include')\n\t\t\t.map((c) =>\n\t\t\t\tc.type === 'Box'\n\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t);\n\t\tconst paramsOut = crops\n\t\t\t.filter((a) => a.enabled && a.mode === 'Exclude')\n\t\t\t.map((c) =>\n\t\t\t\tc.type === 'Box'\n\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t);\n\n\t\tconst len = floatPositions.length;\n\t\tfor (let j = 0; j < len; j += 3) {\n\t\t\tconst x = floatPositions[j];\n\t\t\tconst y = floatPositions[j + 1];\n\t\t\tconst z = floatPositions[j + 2];\n\t\t\tif (\n\t\t\t\t(paramsIn.length === 0 || isInBounds(x, y, z, paramsIn)) &&\n\t\t\t\t(paramsOut.length === 0 || !isInBounds(x, y, z, paramsOut))\n\t\t\t) {\n\t\t\t\t// in bounds: intentionally skip\n\t\t\t} else {\n\t\t\t\toutOfBoundsIndexes.push(j / 3);\n\t\t\t}\n\t\t}\n\t\t// console.log(outOfBoundsIndexes);\n\t\treturn outOfBoundsIndexes;\n\t}\n\n\tfunction isInBounds(x, y, z, params, mode) {\n\t\treturn params[mode === 'Intersect' ? 'every' : 'some']((param) => {\n\t\t\tconst t = applyRotationMatrix(\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\tz,\n\t\t\t\tparam.invRotationMatrix,\n\t\t\t\tparam.cropCenter\n\t\t\t);\n\t\t\treturn Array.isArray(param)\n\t\t\t\t? isVertexInsideBoundingBox(t.x, t.y, t.z, param)\n\t\t\t\t: isPointInsideEllipsoid(t.x, t.y, t.z, param);\n\t\t});\n\t}\n\tfunction applyRotationMatrix(_x, _y, _z, e, pivot) {\n\t\tconst x = _x - pivot[0];\n\t\tconst y = _y - pivot[1];\n\t\tconst z = _z - pivot[2];\n\t\tconst w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\n\t\treturn {\n\t\t\tx: (e[0] * x + e[4] * y + e[8] * z + e[12]) * w + pivot[0],\n\t\t\ty: (e[1] * x + e[5] * y + e[9] * z + e[13]) * w + pivot[1],\n\t\t\tz: (e[2] * x + e[6] * y + e[10] * z + e[14]) * w + pivot[2],\n\t\t};\n\t}\n\tfunction computeBoundingBoxVertices(box) {\n\t\tconst halfSizeX = box.cropSize[0] / 2;\n\t\tconst halfSizeY = box.cropSize[1] / 2;\n\t\tconst halfSizeZ = box.cropSize[2] / 2;\n\t\tconst bounds = [\n\t\t\tbox.cropCenter[0] - halfSizeX,\n\t\t\tbox.cropCenter[1] - halfSizeY,\n\t\t\tbox.cropCenter[2] - halfSizeZ,\n\t\t\tbox.cropCenter[0] + halfSizeX,\n\t\t\tbox.cropCenter[1] + halfSizeY,\n\t\t\tbox.cropCenter[2] + halfSizeZ,\n\t\t];\n\t\tconst invRotationMatrix = getInvRotationMatrix(box.cropRotation);\n\t\treturn Object.assign(bounds, {\n\t\t\tinvRotationMatrix,\n\t\t\tcropCenter: box.cropCenter,\n\t\t});\n\t}\n\tfunction getInvRotationMatrix(_rotation) {\n\t\tconst te = [];\n\t\tconst x = (_rotation[0] * Math.PI) / 180,\n\t\t\ty = (_rotation[1] * Math.PI) / 180,\n\t\t\tz = (_rotation[2] * Math.PI) / 180;\n\t\tconst a = Math.cos(x),\n\t\t\tb = Math.sin(x);\n\t\tconst c = Math.cos(y),\n\t\t\td = Math.sin(y);\n\t\tconst e = Math.cos(z),\n\t\t\tf = Math.sin(z);\n\t\tconst ae = a * e,\n\t\t\taf = a * f,\n\t\t\tbe = b * e,\n\t\t\tbf = b * f;\n\n\t\tte[0] = c * e;\n\t\tte[1] = -c * f;\n\t\tte[2] = d;\n\n\t\tte[4] = af + be * d;\n\t\tte[5] = ae - bf * d;\n\t\tte[6] = -b * c;\n\n\t\tte[8] = bf - ae * d;\n\t\tte[9] = be + af * d;\n\t\tte[10] = a * c;\n\n\t\tte[12] = 0;\n\t\tte[13] = 0;\n\t\tte[14] = 0;\n\n\t\tte[3] = 0;\n\t\tte[7] = 0;\n\t\tte[11] = 0;\n\t\tte[15] = 1;\n\n\t\treturn te;\n\t}\n\tfunction isVertexInsideBoundingBox(x, y, z, bounds) {\n\t\treturn (\n\t\t\tx >= bounds[0] &&\n\t\t\tx <= bounds[3] &&\n\t\t\ty >= bounds[1] &&\n\t\t\ty <= bounds[4] &&\n\t\t\tz >= bounds[2] &&\n\t\t\tz <= bounds[5]\n\t\t);\n\t}\n\tfunction computeEllipsoidParams(ellipsoid) {\n\t\t// Precompute the scaling factors\n\t\tconst invRadiusX = 2 / ellipsoid.cropSize[0];\n\t\tconst invRadiusY = 2 / ellipsoid.cropSize[1];\n\t\tconst invRadiusZ = 2 / ellipsoid.cropSize[2];\n\t\tconst invRotationMatrix = getInvRotationMatrix(ellipsoid.cropRotation);\n\t\treturn {\n\t\t\tinvRadiusX,\n\t\t\tinvRadiusY,\n\t\t\tinvRadiusZ,\n\t\t\tcropCenter: ellipsoid.cropCenter,\n\t\t\tinvRotationMatrix,\n\t\t};\n\t}\n\tfunction isPointInsideEllipsoid(x, y, z, ellipsoidParams) {\n\t\tconst _x = (x - ellipsoidParams.cropCenter[0]) * ellipsoidParams.invRadiusX;\n\t\tconst _y = (y - ellipsoidParams.cropCenter[1]) * ellipsoidParams.invRadiusY;\n\t\tconst _z = (z - ellipsoidParams.cropCenter[2]) * ellipsoidParams.invRadiusZ;\n\t\treturn _x * _x + _y * _y + _z * _z <= 1;\n\t}\n\n\tself.onmessage = (e) => {\n\t\tif (e.data.getCroppedIndexes) {\n\t\t\tconst outOfBoundsIndexes = new Uint32Array(\n\t\t\t\tgetOutOfBoundsIndexes(new Float32Array(e.data.positions), e.data.crops)\n\t\t\t).buffer;\n\t\t\tself.postMessage(\n\t\t\t\t{\n\t\t\t\t\toutOfBoundsIndexes,\n\t\t\t\t},\n\t\t\t\t[outOfBoundsIndexes]\n\t\t\t);\n\t\t} else if (e.data.positions) {\n\t\t\tpositions = e.data.positions;\n\t\t\tfloatPositions = new Float32Array(positions);\n\t\t\tmeshMatrixWorlds = e.data.meshMatrixWorlds;\n\t\t\tcropsArray = e.data.cropsArray;\n\t\t\tmeshIndexIntervals = e.data.meshIndexIntervals;\n\t\t\tupdateRenderedSplats(meshMatrixWorlds, cropsArray, meshIndexIntervals);\n\t\t\tself.postMessage({\n\t\t\t\tsortSetupComplete: true,\n\t\t\t});\n\t\t} else if (e.data.sort || e.data.newMatrixWorlds || e.data.newCropsArray) {\n\t\t\tif (e.data.newMatrixWorlds || e.data.newCropsArray) {\n\t\t\t\tcropsArray = e.data.newCropsArray || cropsArray;\n\t\t\t\tmeshMatrixWorlds = e.data.newMatrixWorlds || meshMatrixWorlds;\n\t\t\t\tupdateRenderedSplats(meshMatrixWorlds, cropsArray, meshIndexIntervals);\n\t\t\t}\n\t\t\tsort(e.data.sort.view, e.data.sort.cameraPosition);\n\t\t} else if (e.data.init) {\n\t\t\t// Yep, this is super hacky and gross :(\n\t\t\tConstants = e.data.init.Constants;\n\n\t\t\tsplatCount = e.data.init.splatCount;\n\n\t\t\tconst INDEXES_BYTES_PER_ENTRY = Constants.BytesPerInt;\n\t\t\tconst POSITIONS_BYTES_PER_ENTRY = Constants.BytesPerFloat * 3;\n\n\t\t\tconst sorterWasmBytes = new Uint8Array(e.data.init.sorterWasmBytes);\n\t\t\tconst memoryBytesPerVertex =\n\t\t\t\tINDEXES_BYTES_PER_ENTRY + POSITIONS_BYTES_PER_ENTRY;\n\t\t\tconst memoryRequiredForVertices = splatCount * memoryBytesPerVertex;\n\t\t\tconst memoryRequiredForSortBuffers =\n\t\t\t\tsplatCount * Constants.BytesPerInt * 2 +\n\t\t\t\tConstants.DepthMapRange * Constants.BytesPerInt * 2;\n\t\t\tconst extraMemory = Constants.MemoryPageSize * 32;\n\t\t\tconst totalRequiredMemory =\n\t\t\t\tmemoryRequiredForVertices + memoryRequiredForSortBuffers + extraMemory;\n\t\t\tconst totalPagesRequired =\n\t\t\t\tMath.floor(totalRequiredMemory / Constants.MemoryPageSize) + 1;\n\t\t\tconst sorterWasmImport = {\n\t\t\t\tmodule: {},\n\t\t\t\tenv: {\n\t\t\t\t\tmemory: new WebAssembly.Memory({\n\t\t\t\t\t\tinitial: totalPagesRequired * 2,\n\t\t\t\t\t\tmaximum: totalPagesRequired * 3,\n\t\t\t\t\t\tshared: true,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t};\n\t\t\tWebAssembly.compile(sorterWasmBytes)\n\t\t\t\t.then((wasmModule) => {\n\t\t\t\t\treturn WebAssembly.instantiate(wasmModule, sorterWasmImport);\n\t\t\t\t})\n\t\t\t\t.then((instance) => {\n\t\t\t\t\twasmInstance = instance;\n\t\t\t\t\tindexesOffset = 0;\n\t\t\t\t\tpositionsOffset = splatCount * INDEXES_BYTES_PER_ENTRY;\n\t\t\t\t\tviewProjOffset =\n\t\t\t\t\t\tpositionsOffset + splatCount * POSITIONS_BYTES_PER_ENTRY;\n\t\t\t\t\tsortBuffersOffset = viewProjOffset + 16 * Constants.BytesPerFloat * 2;\n\t\t\t\t\tfrequenciesOffset =\n\t\t\t\t\t\tsortBuffersOffset + splatCount * Constants.BytesPerInt;\n\t\t\t\t\tindexesOutOffset =\n\t\t\t\t\t\tfrequenciesOffset + Constants.DepthMapRange * Constants.BytesPerInt;\n\t\t\t\t\twasmMemory = sorterWasmImport.env.memory.buffer;\n\t\t\t\t\tself.postMessage({\n\t\t\t\t\t\tsortSetupPhase1Complete: true,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t}\n\t};\n}\n",")(self)"],{type:"application/javascript"}))),n=atob("AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"),s=new Uint8Array(n.length);for(let t=0;t<n.length;t++)s[t]=n.charCodeAt(t);return e.postMessage({init:{sorterWasmBytes:s.buffer,splatCount:t,Constants:{BytesPerFloat:ve.BytesPerFloat,BytesPerInt:ve.BytesPerInt,DepthMapRange:ve.DepthMapRange,MemoryPageSize:ve.MemoryPageSize}}}),e}(t),this.sortWorker.onmessage=t=>{t.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(t.data.indexesBuffer)),this.lastSortTime=t.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):t.data.sortCanceled?this.sortRunning=!1:t.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):t.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(t,e){null!==this.splatMesh&&(this.updateSplatMeshUniforms(t,e),this.updateView(!1,e))}getSplatMesh(){return this.splatMesh}},Ae=new gt;Ae.wireframe=!0;var be=new tt,Ce=class extends lt{constructor(t,n){super(),this.data=t,this.sharedAssets=n,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this._normalPassNeeds={outline:!1,cavity:!1},this._needsReflection=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.hairInstances=[],this.shadowsDirty=!0,this.instanceGroupsDirty=!0,this._autoInstancing=null,this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new ge,this.invisibleObjects=new e("jflkdsafjasdifjaslk",{...Z.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(t,n),this.matrixAutoUpdate=!1,this.errorPage=new o("fdasfa",{...N.defaultData,name:""},{shared:n,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markShadowsDirty(){this.shadowsDirty=!0}markInstanceGroupsDirty(){this.instanceGroupsDirty=!0}get autoInstancing(){return this._autoInstancing}updateInstanceGroups(t,e){let n=this._autoInstancing;(null===n||n.minGroupSize!==e)&&(n?.dispose(),n=new Vt(e),this._autoInstancing=n);let s=this.instanceGroupsDirty;return this.instanceGroupsDirty=!1,n.update(t,s),n.stats}releaseInstanceGroups(){this._autoInstancing?.teardown(),this.instanceGroupsDirty=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this.shadowsDirty=!0,this.instanceGroupsDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=i(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._normalPassNeeds=s(this),this._needsNormal=this._normalPassNeeds.outline||this._normalPassNeeds.cavity,this.needsNormalDirty=!1),this._needsNormal}normalPassNeeds(){return this.needsNormal(),this._normalPassNeeds}needsReflection(){return this.needsReflectionDirty&&(this._needsReflection=r(this),this.needsReflectionDirty=!1),this._needsReflection}registerInstanceAndSetUuid(t){let e=t.identity.join("-"),n=this.entityIdentityToEntity[e];n&&(t.uuid=n.uuid),this.entityIdentityToEntity[e]=t,this.entityByUuid[t.uuid]=t}markPenumbraSizeDirty(){for(let t of this.children)t instanceof o&&(t.penumbraSizeArrayCache=null)}findInstance(t){return this.entityIdentityToEntity[t.join("-")]}findInInstance(t,e){let n=e??null;if(!B.is(n))return;let s="Instance"===n.data.type;if(!s&&!n.isVirtualEntity)return;let i="string"==typeof n.identity?[n.identity]:n.identity;for(let e=i.length-(s?0:1);e>=1;e--){let n=this.findInstance([...i.slice(0,e),t]);if(n)return n}for(let e=n;B.is(e);e=e.parent)if("Instance"===e.data.type&&e.data.component===t)return e}findFrom(t,e){return this.findInInstance(t,e)??this.find(t)}syncInstancePathConstraint(t){let e=t.data.pathSnapping?.pathId;if(e){let n=this.findFrom(e,t);this.pathConstraints.setConstraint(t.uuid,n?.uuid??e)}else this.pathConstraints.removeDependencies(t.uuid)}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(t){let e=this.find(t);if(void 0===e)return;let n=[],s=e;for(;s!==this;){let t=s;s=s.parent;let e=s.children.indexOf(t);n.splice(0,0,e)}return{entity:e,sortKey:n}}getAllSorted(t){let e=[];for(let n of t){let t=this.getWithSortKey(n.id);void 0!==t&&e.push(t)}return e.sort((t,e)=>q(t.sortKey,e.sortKey)),e.map(t=>t.entity)}nonExistOrDescendantOf(t,e){let n=this.find(t);if(void 0===n)return!0;for(;n;){if(n.uuid===e)return!0;n=n.parent}return!1}find(t){if(this.activePage&&this.activePage.personalCamera.parent){if("f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera"===t)return this.activePage.personalCamera;if(t===Y)return this.activePage.personalCamera}if(""===t||void 0===t)return;let e=this.entityByUuid[t];return void 0===e?this.getObjectByProperty("uuid",t):e}find2D(t){for(let e of this.children)if(e instanceof o&&e.uiScene){let n=e.uiScene.find(t);if(n)return n}}findScene2DfromObject2D(t){for(let e of this.children)if(e instanceof o&&e.uiScene&&e.uiScene.find(t))return e.uiScene}find2DInUIObjects(t){let e;return this.traverseEntity(n=>{void 0===e&&j(n)&&(e=n.uiCanvas.find(t))}),e}traverse2D(t){for(let e of this.children)e instanceof o&&e.uiScene&&e.uiScene.traverse(t)}debugEnsureEntity(t){let e=this.find(t);e?Array.isArray(e.identity)&&void 0===this.findInstance(e.identity)&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(t){this.toExpandCloner.add(t)}addPendingUpdateCloner(t){this.toUpdateCloner.add(t)}markToExpandCloner(t){this.toExpandCloner.add(t),t.traverseEntityAncestors(t=>{this.toExpandCloner.add(t)})}doPendingExpandCloner(t){this.toExpandCloner.forEach(e=>{e.expandCloner(t)}),this.toExpandCloner.clear()}doPendingUpdateCloner(t){this.toUpdateCloner.forEach(e=>{e.cloner?.update(t)}),this.toUpdateCloner.clear()}doPendingUpdates(t){this.doPendingExpandCloner(t),this.doPendingUpdateCloner(t),this.applyPendingCommands()}addPendingCommand(t){this.pendingCommands.push(t)}applyPendingCommands(){this.pendingCommands.forEach(t=>t()),this.pendingCommands.length=0}updateByLibOp(t,e){1===t.path.length&&"components"===t.path[0]&&1===t.type&&this.createChildrenObjects([{...t.data.asset,id:t.id}],this.invisibleObjects,e)}updateTreeByOp(t,e){if(0===t.path.length&&7===t.type){let n=null===t.parent?this:this.find(t.parent);if(void 0===n)throw new Error(`scene tree add: parent ${t.parent} not found for object ${t.id}`);let s=this.createObject(t.id,t.data,t.children,n,t.localIndex,e);s.updateVisible(this),s.resetBBoxNeedsUpdate(),p(s)&&u(s.parent)&&(s.invalidateUpstreamBooleanData(),s.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(s),this.markToExpandCloner(s),this.markPenumbraSizeDirty(),s.updatePathSnapping()}else if(0===t.path.length&&8===t.type){let e=this.find(t.id);if(void 0===e)throw new Error(`scene tree delete: object ${t.id} not found`);e.traverseEntity(t=>{z(t)&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(e=>e!==t)),E(t)&&(this.hairInstances=this.hairInstances.filter(e=>e!==t))}),this.markToExpandCloner(e),e.resetBBoxNeedsUpdate(),this.unregisterObject(e);let n=e.parent;this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(e),this.markPenumbraSizeDirty(),e.parent.remove(e),u(e.parent)&&(e.parent.invalidateUpstreamBooleanData(),e.parent.invalidateDownstreamBooleanData().recomputeBoolean()),p(e)&&(e.freeBooleanPointer(),n instanceof h&&n.invalidateDownstreamBooleanData().recomputeBoolean()),O(e)&&e.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(e),this.pathConstraints.removeDependencies(e.uuid),e.updatePathSnapping()}else if(0===t.path.length&&9===t.type){let e=this.find(t.id);if(void 0===e)throw new Error(`scene tree move: object ${t.id} not found`);this.markNeedsRecomputeInstancesForChildren(e);let n=e.parent;this.markNeedsRecomputeInstancesForAncessors(n),e.cloner?.resetOnMove(),this.markToExpandCloner(e);let s=null===t.parent?this:this.find(t.parent);if(void 0===s)throw new Error(`scene tree move: new parent ${t.parent} not found for object ${t.id}`);s.add(e),this.markNeedsRecomputeInstancesForAncessors(s),this.markToExpandCloner(e),e.invalidateClonerTransform(e),e.updateVisible(this),e.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let i=t.localIndex;s.children.splice(i,0,s.children.pop()),p(e)&&(e.invalidateUpstreamBooleanData(),u(e.parent)?e.parent.invalidateDownstreamBooleanData().recomputeBoolean():n instanceof h&&n.invalidateDownstreamBooleanData().recomputeBoolean()),e.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(t){this.shadowsDirty=!0,this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let e of this.children)e instanceof o&&(e.visible=e.uuid===t,e.visible&&(this.activePage=e,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(t,e,n,s){if(this.shadowsDirty=!0,0===e.type){if(("overrides"in e.props||"component"in e.props)&&this.markNeedsRecomputeInstances(),"visible"in e.props&&this.markPenumbraSizeDirty(),e.path.includes("overrides")&&"states"in e.props){let{rest:t}=e.props;e={...e,props:t},this.markNeedsRecomputeInstances()}"pathSnapping"===e.path[0]&&void 0!==e.props.pathId&&this.pathConstraints.setConstraint(t,e.props.pathId)}let i=this.find(t);if(i)try{(function(t,e,n,s){t.updateByOp(e,n,s,!1)})(i,e,n,{scene:this,shared:s}),i instanceof I&&i.updateGeometryGroupsIfNeeded()}catch(t){console.error(t)}}updateEntity2DByOp(t,e,n,s,i,r=[]){t.updateEntityByOp(e,n,s,i),this.traverseEntity(t=>{(j(t)||t instanceof o)&&(r.includes(t.frameId??"")||t.frameId===e)&&t.updateEntity2DByOp(e,n,s,i)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(t){this.activePage.switchActiveCamera(t)}isInvisibleObjects(t){return t===this.invisibleObjects||t.hasAnccestor(this.invisibleObjects)}init(t,e){let n=Object.entries(e.data.lib.components).map((t,e)=>({data:t[1].asset.data,children:t[1].asset.children,id:t[0],fi:e}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:e}),this.add(this.invisibleObjects),this.createChildrenObjects(n,this.invisibleObjects,e),this.createChildrenObjects(t.objects,this,e),this.updatePage(t.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(e,!0),this.traverseEntity(t=>{t instanceof c&&t.updateUp()}),this.doPendingExpandCloner({scene:this,shared:e}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(t){t.traverseEntity(t=>{("Component"===t.data.type||"Instance"===t.data.type)&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(t){B.is(t)&&("Component"===t.data.type&&this.markNeedsRecomputeInstances(),t.traverseAncestors(t=>{B.is(t)&&"Component"===t.data.type&&this.markNeedsRecomputeInstances()}))}relativeizeInner(t,e,n,s,i,r,a){if(t){let o=s.find(t);o&&o!==s&&i.forInstancesRec(s=>{s.data=L(s.data,i=>{let o=i.events.data(a.id),l=s.goUp(r);if(l){let s=[...G(l.identity),t].join("-"),i=this.entityIdentityToEntity[s];if(i){let t=i.uuid;Q.zoom(o,e)[n]=t}else console.warn("cannot find instance")}}).data})}}rewriteActions(t,e,n,s,i,r){t.forEach(t=>{"Transition"===t.data.type||"Animation"===t.data.type&&t.data.object?this.relativeizeInner(t.data.object,[...e,t.id],"object",n,s,i,r):"Conditional"===t.data.type&&(this.rewriteActions(t.data.ifActions,[...e,t.id,"ifActions"],n,s,i,r),this.rewriteActions(t.data.elseActions,[...e,t.id,"elseActions"],n,s,i,r))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(t=>{if(T(t)&&"string"==typeof t.identity&&"Component"===t.data.type)return t.traverseEntity((e,n)=>{e.data.events.forEach(s=>{if("GameControl"===s.data.type){let i=!1;if(e.forInstancesRec(t=>{t.data=L(t.data,e=>{t.isInstanceRoot||(e.events.delete(s.id),i=!0)}).data}),!1===i)for(let i of F.list)this.rewriteActions(s.data.gameActions[i],["gameActions",i],t,e,n,s)}else"Conditional"===s.data.type?("Distance"===s.data.condition.type?(this.relativeizeInner(s.data.condition.fromObject,["condition"],"fromObject",t,e,n,s),this.relativeizeInner(s.data.condition.toObject,["condition"],"toObject",t,e,n,s)):"State"===s.data.condition.type?this.relativeizeInner(s.data.condition.object,["condition"],"object",t,e,n,s):"Comparison"===s.data.condition.type&&("Property"===s.data.condition.lOperand.type&&this.relativeizeInner(s.data.condition.lOperand.value[0],["condition","lOperand","value"],0,t,e,n,s),"Property"===s.data.condition.rOperand.type&&this.relativeizeInner(s.data.condition.rOperand.value[0],["condition","rOperand","value"],0,t,e,n,s)),this.rewriteActions(s.data.inActions,["inActions"],t,e,n,s),this.rewriteActions(s.data.outActions,["outActions"],t,e,n,s)):"actions"in s.data&&this.rewriteActions(s.data.actions,["actions"],t,e,n,s)})}),!0})}expandInstances(t,e,s){let i=new Set;this.traverseEntity(n=>{if(T(n)&&n.isInstanceRoot)return n.expandInstanceChildren({scene:this,shared:t,pendingDeletes:i}),e||n.resetBBoxNeedsUpdate(),s&&n.traverseEntity(t=>{s.addClip(t)}),!0});for(let t of i)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(t),n(t)}recomputeInstances(t,e){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(t=>{T(t)&&t.isInstanceRoot&&(t.component=void 0)}),this.expandInstances(t,!1,e))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(t){t.traverseEntity(t=>{let e="string"==typeof t.identity?t.identity:t.identity.join("-");this.entityIdentityToEntity[e]===t&&(delete this.entityByUuid[t.uuid],delete this.entityIdentityToEntity[e],this.pathConstraints.removeDependencies(t.uuid)),t.dispose()})}clearScene(){this._autoInstancing?.dispose(),this._autoInstancing=null,this.instanceGroupsDirty=!0;for(let t of this.children)B.is(t)&&t.disposeRecursively();this.children.length=0}resetAfterClear(t,e){this.init(t,e)}raycast(t){return this.raycast1(t,!1)}raycast1(t,e){let n=[],s=i=>{for(let r of i.children){let i=r.cloner;if(B.is(r)&&!r.raycastLock&&(r.visible||i?.object.data.visible))if(!0===e&&r.isInstanceRoot){let e=[];if(t.intersectObject(r,!0,e),e.length){let t=e[0];t.object=r,t.point.applyMatrix4(t.object.matrixWorld);let s=r.matrixWorld.clone().invert();t.point.applyMatrix4(s),n.push(t)}}else(p(r)||m(r)&&this.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,n),a(r,t,n)),s(r)}};return s(this.activePage),n}raycastWithClones(t){let e=[],n=s=>{for(let i of s.children){let s=i.cloner;B.is(i)&&(i.visible||s?.object.data.visible)&&((p(i)||m(i)&&this.enableHelpers&&i.objectHelper.visible)&&(t.intersectObject(i,!1,e),a(i,t,e,!0)),n(i))}};return n(this),e}forEachEntity(t){for(let e of this.children)B.is(e)&&t(e)}traverseConcreteEntity(t){for(let e of this.children)B.is(e)&&e.isConcreteEntity&&e.traverseEntity(t)}traverseEntity(t){for(let e of this.children)B.is(e)&&e.traverseEntity(t)}updateFont(t,e){this.traverseEntity(n=>{if(n instanceof I&&"Mesh"===n.data.type&&("TextGeometry"===n.data.geometry.type||"InputGeometry"===n.data.geometry.type)&&n.data.geometry.font===t){let s=n.geometry,i=n.data.geometry;s.updateFont(t,e).then(()=>{s.update(i,e);let t=n.invalidateDownstreamBooleanData();u(t)&&t.recomputeBoolean()})}})}traverseObject(t){for(let e of this.children)S.is(e)&&e.traverseObject(t)}traverseVisibleEntity(t){for(let e of this.children)B.is(e)&&e.visible&&e.traverseVisibleEntity(t)}dispose(){this.clearScene()}createChildrenObjects(t,e,n){let s=0;for(let i of t)this.createObject(i.id,i.data,i.children,e,s,n),s+=1}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let e of t.children)this.unregisterObject(e)}createObject(t,e,n,s,i,r){let a={scene:this,shared:r},o=fe(t,e,a);return z(o)&&this.shapeBlendIntances.push(o),E(o)&&this.hairInstances.push(o),o&&(this.entityByUuid[t]=o,s.add(o),s.children.splice(i,0,s.children.pop()),n.length>0&&(o.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(n,o,r)),o.updateState(e,a),o instanceof I&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),e.pathSnapping?.pathId&&this.pathConstraints.setConstraint(t,e.pathSnapping.pathId)),"Empty"===e.type&&e.animations&&o.traverseEntity(t=>{let e=t.dataPatched;if(t instanceof I&&e.bones&&e.boneInverses){let n=e.bones.map(t=>this.find(t)),s=e.boneInverses.map(t=>(new rt).fromArray(t)),i=new Ct(n,s);t.bind(i,t.bindMatrix)}else t.matrixAutoUpdate=!0}),o}getCenter(t){let e=[];for(let n=0,s=t.length;n<s;++n){let{id:s,recursive:i}=t[n],r=this.find(s),a=i?r.recursiveBBox:r.singleBBox;e.push(...a.vertices)}let n=new dt;return n.setFromPoints(e),n.getCenter(be),be}copyMatrixWorld(t,e){if(null===t)return void e.identity();let n=this.find(t);n?(n.updateWorldMatrix(!0,!1),e.copy(n.matrixWorld)):e.identity()}copyParentMatrixWorld(t,e){if(null===t)return void e.identity();let n=this.find(t)?.parent;n?(n.updateWorldMatrix(!0,!1),e.copy(n.matrixWorld)):e.identity()}traverseMaterial(t){this.traverseEntity(e=>{if(e instanceof D)if(Array.isArray(e.material))for(let n of e.material)C(n)&&t(n);else C(e.material)&&t(e.material)})}updateViewPlaneSize(t,e,n=!1){this.traverseConcreteEntity(s=>{s instanceof c&&s.setViewplaneSize(t,e,n)})}initializeSplatViewer(){this.splatViewer=new xe({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}};export{Nt as a,Bt as b,Lt as c,Kt as d,Ae as e,Ce as f};
|
|
1
|
+
import{a as t}from"./runtime-chunk-ANGA7TLB.js";import{a as e}from"./runtime-chunk-E67HCEL4.js";import{a as n}from"./runtime-chunk-F5ERIFRO.js";import{d as s,e as i,f as r,g as a,h as o}from"./runtime-chunk-3HARYNSZ.js";import{a as l,b as d}from"./runtime-chunk-QFOUCKBZ.js";import{a as c,c as h,g as p,h as u,i as m}from"./runtime-chunk-BJ2ZPAHA.js";import{a as f}from"./runtime-chunk-S7G3MNJ3.js";import{b as y}from"./runtime-chunk-WQGGIBPJ.js";import{a as g,b as v}from"./runtime-chunk-AHGISLIW.js";import{a as x}from"./runtime-chunk-PMDUTLDE.js";import{d as A}from"./runtime-chunk-B67QULUB.js";import{P as b,la as w,na as C,oa as I}from"./runtime-chunk-TLPOKI2U.js";import{b as M,c as P,e as S,h as B,v as D}from"./runtime-chunk-RSGWMNDQ.js";import{a as R,b as E,c as z,d as O,f as j,i as W,j as T}from"./runtime-chunk-2PT2WH66.js";import{c as _,e as k,g as U}from"./runtime-chunk-TZCHGFVF.js";import{Ea as N,J as G,Qa as F,a as V,b as q,m as L,n as Q,w as Y,ya as Z}from"./runtime-chunk-ADHKZQMB.js";import{$c as H,Aa as X,Ba as K,Fc as J,Gc as $,Hc as tt,Ic as et,Ie as nt,Ja as st,Oa as it,Qc as rt,Ra as at,Vc as ot,Xc as lt,Zc as dt,_c as ct,dd as ht,ed as pt,ee as ut,fd as mt,l as ft,mc as yt,md as gt,n as vt,nd as xt,od as At,pd as bt,qd as wt,rd as Ct,sd as It,za as Mt}from"./runtime-chunk-KPOUV3HD.js";import{c as Pt}from"./runtime-chunk-ML3Z74BL.js";var St=null;function Bt(t){St=t}var Dt=new WeakMap,Rt=1;function Et(t){let e=Dt.get(t);return void 0===e&&(e=Rt++,Dt.set(t,e)),e}function zt(t){let e=t.states;return void 0!==e&&Object.keys(e).length>0?e:void 0}function Ot(t,e,n){let s=W(t)?t.object:t;return s.builtSharedGeometry===e&&s.material===n}function jt(t,e,n,s){let i=t,r=e;return[Et(n),Et(s),i.layers?.mask??0,i.renderOrder??0,!0===(i.castShadow??r.castShadow)?1:0,!0===(i.receiveShadow??r.receiveShadow)?1:0].join(":")}var Wt=[8,32,128,512],Tt=Wt[Wt.length-1],_t=(new rt).makeScale(0,0,0),kt=class extends It{constructor(t,e,n,s){super(t,e,n),this.isInstanceGroup=!0,this.members=new Array(n).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(s);for(let t=0;t<n;t++)this.setMatrixAt(t,_t);this.instanceMatrix.needsUpdate=!0}adoptPassState(t){this.layers.mask=t.layers.mask,this.renderOrder=t.renderOrder,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow}assign(t,e){this.members[t]=e}writeSlot(t,e,n){return!1===n?(this.setMatrixAt(t,_t),!1):(this.setMatrixAt(t,e.matrixWorld),!0)}park(t){this.members[t]=null,this.setMatrixAt(t,_t)}get memberCount(){let t=0;for(let e of this.members)null!==e&&t++;return t}};function Ut(t,e,n){let s=n.get(t);if(void 0!==s)return s;let i=t.parent,r=null===i?1:Ut(i,e,n),a=t.visible?1&r:0;return(t===e||!!(2&r))&&(a|=2),n.set(t,a),a}var Nt=8,Gt=class{constructor(t=8){this.minGroupSize=t,this.groups=[],this.groupKeys=new WeakMap,this.placements=new Map,this.drawStateMemo=new Map,this.transparencyDissolves=new WeakMap,this.frame=0,this.mirrored=[],this.page=null,this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}},this.reconcileRequested=!1}update(t,e){this.frame++,this.page!==t&&(this.teardown(),this.page=t,e=!0),!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh(t);for(let t of this.mirrored)if(t.matrixWorld.determinant()>=0){this.reconcileRequested=!0;break}this.reconcileRequested&&(this.reconcileRequested=!1,this.reconcile(t),this.refresh(t),this.reconcileRequested=!1)}reconcile(t){let e,n={},s=new Map,i=[];for(let t of this.groups){let n=t.material;if(!0!==n.transparent||e?.has(n))continue;(e??(e=new Set)).add(n);let s=this.transparencyDissolves.get(n),i=void 0!==s&&this.frame-s.frame<=600;this.transparencyDissolves.set(n,{count:i?s.count+1:1,frame:this.frame})}t.traverse(t=>{if(!0===t.isInstanceGroup)return;let e=function(t){if(!0!==t.isMesh)return"not-a-mesh";if(z(t)||j(t)||E(t)||R(t))return"excluded-type";let e=function(t){let e=W(t)?t.object:t;return void 0!==e.geometry?e:void 0}(t);if(void 0===e)return"not-a-mesh";let n=e.material;if(void 0===n)return"not-a-mesh";if(Array.isArray(n))return"array-material";let s=e.builtSharedGeometry;if(void 0===s)return"unrealized-geometry";if(!function(t){return!0===t.isShared}(s))return"unshared-geometry";if(void 0===s.attributes.position)return"empty-geometry";if(void 0!==s.morphAttributes.position)return"morph";if(!0===e.isSkinnedMesh)return"skinned";let i=e.morphTargetInfluences;if(void 0!==i&&i.length>0)return"morph";if(0!==s.drawRange.start||s.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let r=n;if(null!=r.positionNode||null!=r.castShadowPositionNode)return"position-node";if(!0===r.transparent)return"transparent";if(void 0!==e.userData?.__splinePlanarMirror)return"reflection";let a=function(t){let e=t;if(void 0!==zt(e))return"interaction-states";for(let t=e.parent;null!==t;t=t.parent){let e=zt(t);if(void 0===e)continue;let n=t;for(let t of Object.values(e)){if(void 0!==n.cloner||null!=t.cloner&&!0!==t.cloner.disabled)return"interaction-states";let e=t.scale;if(void 0!==e&&((e.x??1)<0||(e.y??1)<0||(e.z??1)<0))return"mirrored"}}}(e);return void 0!==a?a:t.matrixWorld.determinant()<0?"mirrored":{object:t,owner:e,geometry:s,material:n,key:jt(t,e,s,n)}}(t);if("string"!=typeof e&&this.isChurning(e.material)&&(e="transparency-churn"),"string"==typeof e)return n[e]=(n[e]??0)+1,void("mirrored"===e&&t.matrixWorld.determinant()<0&&i.push(t));let r=s.get(e.key);void 0===r?s.set(e.key,[e]):r.push(e)});let r=new Map;for(let[t,e]of s)for(let n of e)r.set(n.object,t);let a=!1;for(let[t,e]of this.placements)r.get(t)!==this.groupKeys.get(e.group)&&this.parkPlacement(t,e);for(let t=this.groups.length-1;t>=0;t--){let e=this.groups[t];e.memberCount>=this.minGroupSize||(this.destroyGroup(e),this.groups.splice(t,1),a=!0)}for(let[e,n]of s){let s=n.filter(t=>!this.placements.has(t.object));if(0===s.length)continue;let i=0;for(let t of this.groups){if(i>=s.length)break;if(this.groupKeys.get(t)!==e)continue;let{members:n}=t;for(let e=0;e<n.length&&i<s.length;e++)null===n[e]&&this.place(t,e,s[i++].object)}for(;s.length-i>=this.minGroupSize;){let n=s.slice(i,i+Tt);this.groups.push(this.createGroup(t,e,n)),i+=n.length,a=!0}}a&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=n,this.mirrored=i}isChurning(t){let e=this.transparencyDissolves.get(t);return void 0!==e&&e.count>=2&&this.frame-e.frame<=600}createGroup(t,e,n){let s=n[0],i=new kt(s.geometry,s.material,function(t){for(let e of Wt)if(t<=e)return e;return Tt}(n.length),s.object);this.groupKeys.set(i,e);for(let t=0;t<n.length;t++)this.place(i,t,n[t].object);return t.add(i),i}destroyGroup(t){for(let e=0;e<t.members.length;e++){let n=t.members[e];null!==n&&this.parkPlacement(n,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,n){t.assign(e,n),this.placements.set(n,{group:t,slot:e}),n.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(t){this.drawStateMemo.clear();for(let e of this.groups){let{members:n}=e,s=e.material;(!0===s.transparent||null!=s.positionNode||null!=s.castShadowPositionNode)&&(this.reconcileRequested=!0);let i=null;for(let s=0;s<n.length;s++){let r=n[s];if(null===r)continue;null===i&&(i=r);let a=Ut(r,t,this.drawStateMemo),o=!!(1&a);(!(2&a)||r.matrixWorld.determinant()<0||!Ot(r,e.geometry,e.material))&&(o=!1,this.reconcileRequested=!0),e.writeSlot(s,r,o)}null!==i&&(e.adoptPassState(i),e.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null,this.mirrored=[]}publishGroupStats(){let t=0;for(let e of this.groups){let n=e.memberCount;n>0&&(t+=n-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}},Ft=function(){let t=new Float32Array(1),e=new Int32Array(t.buffer);return function(n){return t[0]=n,e[0]}}(),Vt=function(t,e,n,s){return t+(e<<8)+(n<<16)+(s<<24)},qt=new J;function Lt(t){let e=!1;return t.scene.objects.traverse((t,n)=>{if(!1===n.visible)return!0;"Splat"===n.type&&(e=!0)}),e}var Qt,Yt,Zt=class extends xt{constructor(t,e,n,s,i=!1,r=1,a,o){super(n,s),this.splatCount=e,this.meshIndexIntervals=a,this.meshMatrixWorlds=o,this.splatBuffers=t,this.geometry=n,this.material=s,this.splatDataTextures=null,this.halfPrecisionCovariancesOnGPU=i,this.devicePixelRatio=r,this.resetLocalSplatDataAndTexturesFromSplatBuffer()}static buildMesh(t,e,n=!1,s=1,i,r){let a=Zt.buildGeomtery(e),o=Zt.buildMaterial(i);return new Zt(t,e,a,o,n,s,i,r)}static buildMaterial(t){if("webgpu"===b()&&St)return St.createSplatMaterial(t);let e={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:t},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new J},viewport:{type:"v2",value:new J},basisViewport:{type:"v2",value:new J},debugColor:{type:"v3",value:new ot},covariancesTextureSize:{type:"v2",value:new J(1024,1024)},centersColorsTextureSize:{type:"v2",value:new J(1024,1024)},orthoZoom:{type:"f",value:-1}};return new ut({uniforms:e,vertexShader:"\n precision highp float;\n #include <common>\n\n attribute uint splatIndex;\n\n uniform highp sampler2D covariancesTexture;\n uniform highp usampler2D centersColorsTexture;\n uniform vec2 focal;\n uniform vec2 viewport;\n uniform vec2 basisViewport;\n uniform vec2 covariancesTextureSize;\n uniform vec2 centersColorsTextureSize;\n\t\t\t\t\t\tuniform highp sampler2D meshMatrixWorldsTexture;\n\t\t\t\t\t\tuniform uint meshIndexIntervals[257];\n\t\t\t\t\t\tuniform float orthoZoom;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\n const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));\n const uvec4 shift4 = uvec4(0, 8, 16, 24);\n vec4 uintToRGBAVec (uint u) {\n uvec4 urgba = mask4 & u;\n urgba = urgba >> shift4;\n vec4 rgba = vec4(urgba) * encodeNorm4;\n return rgba;\n }\n\n vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n void main () {\n uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));\n vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));\n vColor = uintToRGBAVec(sampledCenterColor.r);\n\n vPosition = position.xy * 2.0;\n\n\t\t\t\t\t\t\t\tuint meshIndex;\n\t\t\t\t\t\t\t\tfor (int i = 1; i < 257; i++) {\n\t\t\t\t\t\t\t\t\tif (splatIndex < meshIndexIntervals[i]) {\n\t\t\t\t\t\t\t\t\t\tmeshIndex = uint(i - 1);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tfloat strideMulmeshIndex = float(4u*meshIndex);\n\t\t\t\t\t\t\t\tfloat meshMatrixWorldsTextureLength = float(256*4);\n\n\t\t\t\t\t\t\t\tmat4 modelMat = mat4(\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0))\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tmat4 modelViewMat = viewMatrix * modelMat;\n\t\t\t\t\t\t\t\tvec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); \n vec4 clipCenter = projectionMatrix * viewCenter;\n\n vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg;\n vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg;\n vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg;\n\n vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r);\n vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg);\n\n \n mat3 Vrk = mat3(\n cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,\n cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,\n cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z\n );\n float s = 1.0 / (viewCenter.z * viewCenter.z);\n\n mat3 W = transpose(mat3(modelViewMat));\n mat3 T = orthoZoom > 0.0 ? W : W * mat3(\n\t\t\t\t\t\t\t\t\tfocal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,\n\t\t\t\t\t\t\t\t\t0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,\n\t\t\t\t\t\t\t\t\t0., 0., 0.\n\t\t\t\t\t\t\t\t);\n mat3 cov2Dm = transpose(T) * Vrk * T;\n cov2Dm[0][0] += 0.3;\n cov2Dm[1][1] += 0.3;\n\n \n \n \n \n vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);\n\n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n \n \n \n \n \n \n \n \n float a = cov2Dv.x;\n float d = cov2Dv.z;\n float b = cov2Dv.y;\n float D = a * d - b * b;\n float trace = a + d;\n float traceOver2 = 0.5 * trace;\n float term2 = sqrt(trace * trace / 4.0 - D);\n float eigenValue1 = traceOver2 + term2;\n\t\t\t\t\t\t\t\tfloat eigenValue2 = max(traceOver2 - term2, 0.00); \n\n const float maxSplatSize = 1024.0;\n vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));\n \n vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);\n vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize);\n vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize);\n\n vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport;\n\n\t\t\t\t\t\t\t\tif (orthoZoom > 0.0) {\n\t\t\t\t\t\t\t\t\tndcOffset *= orthoZoom;\n\t\t\t\t\t\t\t\t}\n\n gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);\n }",fragmentShader:"\n precision highp float;\n #include <common>\n\n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\t\t\t\t\t\tlayout(location = 1) out vec4 gVelocity; \n\n void main () {\n \n \n float A = -dot(vPosition, vPosition);\n if (A < -4.0) discard;\n vec3 color = vColor.rgb;\n A = exp(A) * vColor.a;\n gl_FragColor = vec4(color.rgb, A);\n\t\t\t\t\t\t\t\tgVelocity = vec4(0.0); \n }",transparent:!0,alphaTest:1,blending:vt,depthTest:!0,depthWrite:!1,side:ft})}static buildGeomtery(t){let e=new mt;e.setIndex([0,1,2,0,2,3]);let n=new Float32Array(12),s=new H(n,3);e.setAttribute("position",s),s.setXYZ(0,-1,-1,0),s.setXYZ(1,-1,1,0),s.setXYZ(2,1,1,0),s.setXYZ(3,1,-1,0),s.needsUpdate=!0;let i=(new nt).copy(e),r=new Uint32Array(t),a=new Ct(r,1,!1);return a.setUsage(yt),i.setAttribute("splatIndex",a),i.instanceCount=t,i}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(t=>t.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let t=0,e=0,n=0;for(let s of this.splatBuffers){let i=s.nsplats;this.colors.subarray(t,t+4*i).set(s.colorsA),t+=4*i,this.centers.subarray(e,e+3*i).set(s.decoded.xyz.denormDequant().data),e+=3*i,this.covariances.subarray(n,n+6*i).set(new Float32Array(s.precomputedCovarianceBufferData)),n+=6*i}}allocateAndStoreLocalSplatDataInTextures(){let t=this.splatCount,e=new J(4096,1024);for(;e.x*e.y*2<6*t;)e.y*=2;let n,s,i=new J(4096,1024);for(;i.x*i.y*4<4*t;)i.y*=2;if(this.halfPrecisionCovariancesOnGPU){s=new Uint16Array(e.x*e.y*2);for(let t=0;t<this.covariances.length;t++)s[t]=ct.toHalfFloat(this.covariances[t]);n=new bt(s,e.x,e.y,it,K)}else s=new Float32Array(e.x*e.y*2),s.set(this.covariances),n=new bt(s,e.x,e.y,it,X);n.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=n,this.material.uniforms.covariancesTextureSize.value.copy(e);let r=new Uint32Array(i.x*i.y*4);for(let e=0;e<t;e++){let t=4*e,n=3*e,s=4*e;r[s]=Vt(this.colors[t],this.colors[t+1],this.colors[t+2],this.colors[t+3]),r[s+1]=Ft(this.centers[n]),r[s+2]=Ft(this.centers[n+1]),r[s+3]=Ft(this.centers[n+2])}let a=new bt(r,i.x,i.y,at,Mt);"webgpu"!==b()&&(a.internalFormat="RGBA32UI"),a.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=a,this.material.uniforms.centersColorsTextureSize.value.copy(i);let o=new Float32Array(4096);for(let t=0;t<this.meshMatrixWorlds.length;t++)o.set(this.meshMatrixWorlds[t].elements,16*t);let l=new bt(o,1024,1,st,X);l.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=l,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:s,texture:n,size:e},centerColors:{data:r,texture:a,size:i},meshMatrixWorlds:{data:o,texture:l}}}updateIndexes(t){let e=this.geometry;e.attributes.splatIndex.set(t),e.attributes.splatIndex.needsUpdate=!0,e.instanceCount=t.length}updateUniforms(t,e,n,s){this.splatCount>0&&(qt.set(t.x*this.devicePixelRatio,t.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(qt),this.material.uniforms.basisViewport.value.set(2/qt.x,2/qt.y),this.material.uniforms.focal.value.set(e,n),this.material.uniforms.orthoZoom.value=s,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}},Ht=new Promise(t=>{Qt=t}),Xt=!1;function Kt(){if(!Xt)return Yt||(Yt=async function(){let t=await import("./gaussian-splat-compression.js");Qt(t),Xt=!0}())}var Jt=new rt,$t=new et,te=new tt,ee=new tt,ne=new tt,se=new tt,ie=new tt,re=new tt;function ae(t,e,n){n.length=0;let{axis:s,sign:i,limit:r}=e;for(let e=0;e<t.length;e++){let a=t[e],o=t[(e+1)%t.length],l=(0===s?a.px:1===s?a.py:a.pz)*i-r,d=(0===s?o.px:1===s?o.py:o.pz)*i-r,c=l<=0,h=d<=0;if(c&&n.push(a),c!==h){let t=l/(l-d);n.push({px:a.px+(o.px-a.px)*t,py:a.py+(o.py-a.py)*t,pz:a.pz+(o.pz-a.pz)*t,nx:a.nx+(o.nx-a.nx)*t,ny:a.ny+(o.ny-a.ny)*t,nz:a.nz+(o.nz-a.nz)*t})}}return n}function oe(t,e,n,s,i,r,a,o,l){let d=t.geometry,c=d.getAttribute("position");if(void 0===c||0===c.count)return!0;let h=d.getAttribute("normal"),p=d.getIndex(),u=null!==p?p.count:c.count;if(u>15e5)return!0;let m=d.drawRange.start,f=m+(d.drawRange.count===1/0?u-m:Math.min(d.drawRange.count,u-m));Jt.copy(t.objectToDecal),$t.getNormalMatrix(Jt);let y=[],g=[];for(let t=m;t+2<f;t+=3){let d=null!==p?p.getX(t):t,u=null!==p?p.getX(t+1):t+1,m=null!==p?p.getX(t+2):t+2;if(te.fromBufferAttribute(c,d).applyMatrix4(Jt),ee.fromBufferAttribute(c,u).applyMatrix4(Jt),ne.fromBufferAttribute(c,m).applyMatrix4(Jt),te.z>n&&ee.z>n&&ne.z>n||te.z<-n&&ee.z<-n&&ne.z<-n)continue;se.subVectors(ee,te),ie.subVectors(ne,te),re.crossVectors(se,ie);let f=re.length();if(!(0===f||re.z/f<=.01)){if(y.length=0,void 0!==h)se.fromBufferAttribute(h,d).applyMatrix3($t),y.push({px:te.x,py:te.y,pz:te.z,nx:se.x,ny:se.y,nz:se.z}),se.fromBufferAttribute(h,u).applyMatrix3($t),y.push({px:ee.x,py:ee.y,pz:ee.z,nx:se.x,ny:se.y,nz:se.z}),se.fromBufferAttribute(h,m).applyMatrix3($t),y.push({px:ne.x,py:ne.y,pz:ne.z,nx:se.x,ny:se.y,nz:se.z});else{re.divideScalar(f);for(let t of[te,ee,ne])y.push({px:t.x,py:t.y,pz:t.z,nx:re.x,ny:re.y,nz:re.z})}for(let t of e){if(0===y.length)break;let e=ae(y,t,g);g=y,y=e}if(!(y.length<3)){if(a.length/3+3*(y.length-2)>3e5)return!1;for(let t=1;t+1<y.length;t++)for(let e of[y[0],y[t],y[t+1]]){l.push(e.px*s+.5,e.py*i+.5);let t=e.nx,n=e.ny,d=e.nz,c=Math.hypot(t,n,d);c>0?(t/=c,n/=c,d/=c):(t=0,n=0,d=1),a.push(e.px+t*r,e.py+n*r,e.pz+d*r),o.push(t,n,d)}}}}return!0}var le=new dt,de=new dt,ce=new rt,he=new tt,pe=class extends C{constructor(t,e,n){super(t,e),this.data=e,this.geometry=new mt,this.lastSignature=[],this.nextSignature=[],this.scanned=[],this.lastParams={width:0,height:0,depth:0,offset:0},this.targetFilter=new Set,this.context=n;let s=this.data.geometry;this.lastParams={width:this.resolveNumber(s.width,0),height:this.resolveNumber(s.height,0),depth:this.resolveNumber(s.depth,0),offset:s.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(t,e){if("number"==typeof t)return t;let n=Number(this.context.shared.getVariable(t));return Number.isFinite(n)?n:e}currentParams(){let t=this.dataPatched.geometry;return{width:this.resolveNumber(t.width,this.lastParams.width),height:this.resolveNumber(t.height,this.lastParams.height),depth:this.resolveNumber(t.depth,this.lastParams.depth),offset:t.offset??0}}projectionRoot(){let t=this.parent;for(;null!==t&&B.is(t);){if("Page"===t.data?.type)return t;t=t.parent}return this.context.scene}currentTargetFilter(){let t=this.dataPatched.geometry;if("select"!==t.projection)return null;let e=t.projectionTargets;if(e!==this.targetFilterSource&&(this.targetFilterSource=e,this.targetFilter.clear(),void 0!==e))for(let t of e)this.targetFilter.add(t);return this.targetFilter}static matchesTargetFilter(t,e,n){let s=t;for(;null!==s&&s!==n;){if(e.has(s.uuid))return!0;s=s.parent}return!1}scanTargets(t,e,n){let s=this.scanned;s.length=0;let i=this.projectionRoot();if(null===i)return s;let r=this.currentTargetFilter();if(null!==r&&0===r.size)return s;le.makeEmpty();for(let s=0;s<8;s++)he.set((1&s?.5:-.5)*t,(2&s?.5:-.5)*e,(4&s?.5:-.5)*n).applyMatrix4(this.matrixWorld),le.expandByPoint(he);return i.traverse(t=>{if(t===this||!B.is(t)||!(t instanceof D)||t instanceof pe||"Mesh"!==t.dataPatched?.type||!t.visible||t.destroyedInAction||512&t.layers.mask||null!==r&&!pe.matchesTargetFilter(t,r,i))return;let e=t.geometry,n=e?.getAttribute("position");void 0===n||0===n.count||0!==e.drawRange.count&&(null===e.boundingBox&&e.computeBoundingBox(),de.copy(e.boundingBox).applyMatrix4(t.matrixWorld),le.intersectsBox(de)&&s.push(t))}),s}collectSignature(t,e,n){t.length=0,t.push(n.width,n.height,n.depth,n.offset);for(let e of this.matrixWorld.elements)t.push(e);for(let n of e){t.push(n.id,n.geometry.id);let e=n.geometry.getAttribute("position");t.push(void 0===e?-1:"version"in e?e.version:e.data.version);let s=n.geometry.getIndex();t.push(null!==s?s.version:-1),t.push(n.geometry.drawRange.count===1/0?-1:n.geometry.drawRange.count);for(let e of n.matrixWorld.elements)t.push(e)}}signaturesEqual(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let t=this.currentParams(),e=this.scanTargets(t.width,t.height,t.depth);if(this.collectSignature(this.nextSignature,e,t),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let n=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=n,this.lastParams=t,ce.copy(this.matrixWorld).invert();let s=e.map(t=>({geometry:t.geometry,objectToDecal:(new rt).multiplyMatrices(ce,t.matrixWorld)}));return this.geometry.dispose(),this.geometry=function(t,e){let n=Math.max(Math.abs(e.width),1e-6),s=Math.max(Math.abs(e.height),1e-6),i=Math.max(Math.abs(e.depth),1e-6),r=[{axis:0,sign:1,limit:n/2},{axis:0,sign:-1,limit:n/2},{axis:1,sign:1,limit:s/2},{axis:1,sign:-1,limit:s/2},{axis:2,sign:1,limit:i/2},{axis:2,sign:-1,limit:i/2}],a=[],o=[],l=[];for(let d of t)if(!oe(d,r,i/2,1/n,1/s,e.offset,a,o,l))break;let d=new mt;return d.setAttribute("position",new ht(a,3)),d.setAttribute("normal",new ht(o,3)),d.setAttribute("uv",new ht(l,2)),0===a.length?(d.setDrawRange(0,0),d.boundingSphere=new pt):d.computeBoundingSphere(),d}(s,t),this.geometry.userData={type:"DecalGeometry",parameters:{width:t.width,height:t.height,depth:t.depth}},g(this),v(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(t,e,n){super.updateByPatchedOp(t,e,n),M(t.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(t,e){let n=this.currentParams();t.setScalar(0),e.set(n.width,n.height,n.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}},ue=class extends(A(At,x)){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}},me=function(){try{let t=window.location.href;if(t.includes("reducesubdiv=")){let e=t.indexOf("reducesubdiv=")+13;return parseInt(t.slice(e,e+1))}}catch{}}();function fe(n,s,i){if(console.assert(void 0!==s.type),"Mesh"===s.type)return function(t,e,n){let s;if(void 0!==me&&e?.geometry&&"subdivisions"in e.geometry&&(e.geometry.subdivisions??0)>me&&Object.assign(e.geometry,{subdivisions:me}),"TextGeometry"===e.geometry.type||"InputGeometry"===e.geometry.type){let s=U(e.geometry.type);return s?s(t,e,n):(_("InputGeometry"===e.geometry.type?"textinputs":"text",`a Mesh with ${e.geometry.type}`),new I(t,e,n))}if("SubdivGeometry"===e.geometry.type)s=new y(t,e,n);else if("PathGeometry"===e.geometry.type||"VectorGeometry"===e.geometry.type||"ShapeBlendGeometry"===e.geometry.type){let i=U(e.geometry.type);i?s=i(t,e,n):(_("ShapeBlendGeometry"===e.geometry.type?"shape-blends":"PathGeometry"===e.geometry.type?"3d-paths":"vector-shapes",`a Mesh with ${e.geometry.type}`),s=new I(t,e,n))}else if("BooleanGeometry"===e.geometry.type)s=new h(t,e,n);else if("DecalGeometry"===e.geometry.type)s=new pe(t,e,n);else if("UIGeometry"===e.geometry.type){let i=U("UIGeometry");i?s=i(t,e,n):(_("ui-2d","a Mesh with UIGeometry"),s=new I(t,e,n))}else s=new I(t,e,n);return s}(n,s,i);if("Empty"===s.type)return new e(n,s);if("Particle"===s.type){let t=k("Particle");return t?t(n,s,i):(_("particles","a Particle system"),new e(n,s))}if("ParticleCollider"===s.type)return new f(n,s,i);if("Hair"===s.type){let t=k("Hair");return t?t(n,s,i):(_("hair","a Hair System"),new e(n,s))}if("Splat"===s.type)return new e(n,s);if("Bone"===s.type)return new ue(n,s);if("Page"===s.type)return new o(n,s,i);if("PointLight"===s.type)return new t(n,s,i);if("SpotLight"===s.type)return new d(n,s,i);if("DirectionalLight"===s.type)return new l(n,s,i);if("Component"===s.type||"Instance"===s.type){let t=k(s.type);return t?t(n,s,i):(_("components",`a ${s.type}`),new e(n,s))}return G.is(s.type)?new c(n,s):(console.error(s),new e(n,s))}P.createEntity=fe,P.changeEntityProptotype=function(t,e,n){let s=fe(t.identity,e,n),i=t.children,r=t.attachedPaths,a=t.parent,o=t.component,l=t.instances,d=t.overrideData,c=t.uuid,h=t.stateSelection,p=function(t){if(!(t instanceof I&&t.isSkinnedMesh))return;let e=t.dataPatched.bones,n=t.skeleton.bones;return e&&e.length===n.length?new Map(e.map((t,e)=>[t,n[e]])):void 0}(t);t.dispose();for(let e of Object.keys(t))delete t[e];Object.setPrototypeOf(t,Object.getPrototypeOf(s));for(let e of Object.keys(s))t[e]=s[e];t.children=[...t.children,...i],t.attachedPaths=r,t.parent=a,t.component=o,t.instances=l,t.uuid=c,t.overrideData=d,t.updateState(t.data,n),h&&t.changeSelectedState(h,n),p&&t instanceof I&&t.rebindSkeleton(t=>p.get(t)??n.scene.find(t)??void 0),t.resetBBoxNeedsUpdate()};var ye,ge=class{constructor(){this._constraints=new Map}setConstraint(t,e){null===e?this._constraints.delete(t):this._constraints.set(t,e)}getConstraint(t){return this._constraints.get(t)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((n,s)=>{let i=[s,n],r=n;for(;this._constraints.has(r);){if(r=this._constraints.get(r),i.includes(r)){console.warn(`circular dependency detected: ${i.join(" -> ")}`);break}e.has(r)||i.push(r)}for(let n=i.length-2;n>=0;n--)if(!e.has(i[n])){let s=t.find(i[n]);s?s.applyPathSnapping(t):console.warn(`missing entity ${i[n]}`),e.add(i[n])}})}findDependency(t,e){let n=t;for(;this._constraints.has(n);)if(n=this._constraints.get(n),n===e)return!0;return!1}},ve=class{};Pt(ve,"DepthMapRange",65536),Pt(ve,"MemoryPageSize",65536),Pt(ve,"BytesPerFloat",4),Pt(ve,"BytesPerInt",4),Ht.then(t=>ye=t);var xe=class{constructor(t={}){Pt(this,"updateView",function(){let t=new rt,e=[],n=new tt(0,0,-1),s=new tt(0,0,-1),i=new tt,r=new tt;return function(a=!1,o){let l=this.updateMatrixWorldsInWorkerIfNeeded(),d=this.cropsChanged();if(!a){s.set(0,0,-1).applyQuaternion(o.quaternion);let t=!1,e=!1;if(s.dot(n)<=.95&&(t=!0),r.copy(o.position).sub(i).length()>=1&&(e=!0),!(t||e||l||d||this.needsInitialRender))return}this.needsInitialRender=!1,i.copy(o.position),n.copy(s),t.copy(o.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),e[0]=o.position.x,e[1]=o.position.y,e[2]=o.position.z;let c={sort:{view:t.elements,cameraPosition:e,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...l?{newMatrixWorlds:this.meshMatrixWorlds}:{},...d?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=c:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(c))}}()),this.scene=t.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=(new rt).makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(t,e){let n=new J;null!==this.splatMesh&&this.splatMesh.getSplatCount()>0&&(t.getSize(n),this.cameraFocalLengthX=e.projectionMatrix.elements[0]*this.devicePixelRatio*n.x*.45,this.cameraFocalLengthY=e.projectionMatrix.elements[5]*this.devicePixelRatio*n.y*.45,this.splatMesh.updateUniforms(n,this.cameraFocalLengthX,this.cameraFocalLengthY,e.isPerspectiveCamera?-1:e.zoom*this.devicePixelRatio))}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=(new tt).fromArray(t.position)),t.orientation&&(t.orientation=(new $).fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseVisibleEntity(t=>{"Splat"===t.data.type&&e.push(t)}),this.splatMesh&&this.splatMesh.dispose(),0===e.length)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(t=>t.matrixWorld),this.meshMatrixWorldsOld=e.map(t=>t.matrixWorld.clone()),this.cropsArray=e.map(t=>t.data.crops.map(t=>t.data)),this._splatBufferCache??(this._splatBufferCache=new WeakMap);let n=e.map(t=>{let e=this._splatBufferCache.get(t.data.buffer);return void 0===e&&(e=new ye.GSplineBuffer(new Uint8Array(t.data.buffer).buffer),this._splatBufferCache.set(t.data.buffer,e)),e}),s=0,i=[0];for(let t of n)s+=t.getSplatCount(),i.push(s);return this.setupSplatMesh(n,s,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,i,this.meshMatrixWorlds),this.setupSortWorker(s),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,16*e);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((t,e)=>t.equals(this.meshMatrixWorldsOld[e]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(t=>t.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,n)=>{e.data.crops.forEach((e,s)=>{void 0===this.cropsArray[n][s]?(t=!0,this.cropsArray[n][s]=e.data):Object.entries(e.data).forEach(([e,i])=>{(Array.isArray(i)&&i.some((t,i)=>t!==this.cropsArray[n][s][e][i])||i!==this.cropsArray[n][s]?.[e])&&(t=!0,this.cropsArray[n][s][e]=i)})}),e.data.crops.length!==this.cropsArray[n]?.length&&(this.cropsArray[n].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,n=new tt,s=new $,i=!1,r=1,a,o){this.splatMesh=Zt.buildMesh(t,e,i,r,a,o),this.splatMesh.position.copy(n),this.splatMesh.quaternion.copy(s),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=e,this.splatMesh.onBeforeRender=(t,e,n)=>this.update(t,n)}setupSortWorker(t){this.sortWorker=function(t){let e=new Worker(URL.createObjectURL(new Blob(["(","\nfunction sortWorker(self) {\n\tlet wasmInstance;\n\tlet splatCount;\n\tlet splatRC;\n\tlet indexesOffset;\n\tlet positionsOffset;\n\tlet viewProjOffset;\n\tlet frequenciesOffset;\n\tlet indexesOutOffset;\n\tlet sortBuffersOffset;\n\tlet wasmMemory;\n\tlet positions;\n\n\tlet Constants;\n\tlet floatPositions;\n\tlet meshIndexIntervals;\n\tlet meshMatrixWorlds;\n\tlet cropsArray;\n\n\tfunction sort(viewProj) {\n\t\t// console.time('WASM SORT');\n\t\tconst viewProjArray = new Float64Array(wasmMemory, viewProjOffset, 16);\n\t\tfor (let i = 0; i < 16; i++) {\n\t\t\tviewProjArray[i] = viewProj[i];\n\t\t}\n\t\tlet indexesBuffer;\n\t\t// console.timeEnd('WASM SORT');\n\t\tif (splatRC > 1) {\n\t\t\twasmInstance.exports.sortIndexes(\n\t\t\t\tindexesOffset,\n\t\t\t\tpositionsOffset,\n\t\t\t\tsortBuffersOffset,\n\t\t\t\tviewProjOffset,\n\t\t\t\tfrequenciesOffset,\n\t\t\t\tindexesOutOffset,\n\t\t\t\tConstants.DepthMapRange,\n\t\t\t\tsplatRC\n\t\t\t);\n\t\t\tconst indexes = new Uint32Array(splatRC);\n\t\t\tindexesBuffer = indexes.buffer;\n\t\t\tindexes.set(new Uint32Array(wasmMemory, indexesOutOffset, splatRC));\n\t\t} else if (splatRC === 1) {\n\t\t\tconst indexes = new Uint32Array(splatRC);\n\t\t\tindexes[0] = new Uint32Array(wasmMemory, indexesOffset, splatCount)[0];\n\t\t\tindexesBuffer = indexes.buffer;\n\t\t} else {\n\t\t\tindexesBuffer = new ArrayBuffer(0);\n\t\t}\n\n\t\tself.postMessage(\n\t\t\t{\n\t\t\t\tsortDone: true,\n\t\t\t\tindexesBuffer,\n\t\t\t},\n\t\t\t[indexesBuffer]\n\t\t);\n\t}\n\tfunction updateRenderedSplats(\n\t\tmeshMatrixWorlds,\n\t\tcropsArray,\n\t\tmeshIndexIntervals\n\t) {\n\t\tconst renderedPositions = new Float32Array(\n\t\t\twasmMemory,\n\t\t\tpositionsOffset,\n\t\t\tsplatCount * 3\n\t\t);\n\t\tsplatRC = 0;\n\t\tconst wasmMemoryIndexes = new Uint32Array(\n\t\t\twasmMemory,\n\t\t\tindexesOffset,\n\t\t\tsplatCount\n\t\t);\n\t\tfor (let i = 0; i < meshIndexIntervals.length - 1; i++) {\n\t\t\tconst crops = cropsArray[i];\n\t\t\tconst matrixWorld = meshMatrixWorlds[i].elements;\n\t\t\tconst paramsIn = crops\n\t\t\t\t.filter((a) => a.enabled && a.mode === 'Include')\n\t\t\t\t.map((c) =>\n\t\t\t\t\tc.type === 'Box'\n\t\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t\t);\n\t\t\tconst paramsOut = crops\n\t\t\t\t.filter((a) => a.enabled && a.mode === 'Exclude')\n\t\t\t\t.map((c) =>\n\t\t\t\t\tc.type === 'Box'\n\t\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t\t);\n\t\t\tfor (let j = meshIndexIntervals[i]; j < meshIndexIntervals[i + 1]; j++) {\n\t\t\t\tconst x = floatPositions[j * 3];\n\t\t\t\tconst y = floatPositions[j * 3 + 1];\n\t\t\t\tconst z = floatPositions[j * 3 + 2];\n\t\t\t\tif (\n\t\t\t\t\t(paramsIn.length === 0 || isInBounds(x, y, z, paramsIn)) &&\n\t\t\t\t\t(paramsOut.length === 0 || !isInBounds(x, y, z, paramsOut))\n\t\t\t\t) {\n\t\t\t\t\tconst w =\n\t\t\t\t\t\t1 /\n\t\t\t\t\t\t(matrixWorld[3] * x +\n\t\t\t\t\t\t\tmatrixWorld[7] * y +\n\t\t\t\t\t\t\tmatrixWorld[11] * z +\n\t\t\t\t\t\t\tmatrixWorld[15]);\n\t\t\t\t\trenderedPositions[splatRC * 3] =\n\t\t\t\t\t\t(matrixWorld[0] * x +\n\t\t\t\t\t\t\tmatrixWorld[4] * y +\n\t\t\t\t\t\t\tmatrixWorld[8] * z +\n\t\t\t\t\t\t\tmatrixWorld[12]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\trenderedPositions[splatRC * 3 + 1] =\n\t\t\t\t\t\t(matrixWorld[1] * x +\n\t\t\t\t\t\t\tmatrixWorld[5] * y +\n\t\t\t\t\t\t\tmatrixWorld[9] * z +\n\t\t\t\t\t\t\tmatrixWorld[13]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\trenderedPositions[splatRC * 3 + 2] =\n\t\t\t\t\t\t(matrixWorld[2] * x +\n\t\t\t\t\t\t\tmatrixWorld[6] * y +\n\t\t\t\t\t\t\tmatrixWorld[10] * z +\n\t\t\t\t\t\t\tmatrixWorld[14]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\twasmMemoryIndexes[splatRC] = j;\n\t\t\t\t\tsplatRC++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction getOutOfBoundsIndexes(floatPositions, crops) {\n\t\tconst outOfBoundsIndexes = [];\n\t\tconst paramsIn = crops\n\t\t\t.filter((a) => a.enabled && a.mode === 'Include')\n\t\t\t.map((c) =>\n\t\t\t\tc.type === 'Box'\n\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t);\n\t\tconst paramsOut = crops\n\t\t\t.filter((a) => a.enabled && a.mode === 'Exclude')\n\t\t\t.map((c) =>\n\t\t\t\tc.type === 'Box'\n\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t);\n\n\t\tconst len = floatPositions.length;\n\t\tfor (let j = 0; j < len; j += 3) {\n\t\t\tconst x = floatPositions[j];\n\t\t\tconst y = floatPositions[j + 1];\n\t\t\tconst z = floatPositions[j + 2];\n\t\t\tif (\n\t\t\t\t(paramsIn.length === 0 || isInBounds(x, y, z, paramsIn)) &&\n\t\t\t\t(paramsOut.length === 0 || !isInBounds(x, y, z, paramsOut))\n\t\t\t) {\n\t\t\t\t// in bounds: intentionally skip\n\t\t\t} else {\n\t\t\t\toutOfBoundsIndexes.push(j / 3);\n\t\t\t}\n\t\t}\n\t\t// console.log(outOfBoundsIndexes);\n\t\treturn outOfBoundsIndexes;\n\t}\n\n\tfunction isInBounds(x, y, z, params, mode) {\n\t\treturn params[mode === 'Intersect' ? 'every' : 'some']((param) => {\n\t\t\tconst t = applyRotationMatrix(\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\tz,\n\t\t\t\tparam.invRotationMatrix,\n\t\t\t\tparam.cropCenter\n\t\t\t);\n\t\t\treturn Array.isArray(param)\n\t\t\t\t? isVertexInsideBoundingBox(t.x, t.y, t.z, param)\n\t\t\t\t: isPointInsideEllipsoid(t.x, t.y, t.z, param);\n\t\t});\n\t}\n\tfunction applyRotationMatrix(_x, _y, _z, e, pivot) {\n\t\tconst x = _x - pivot[0];\n\t\tconst y = _y - pivot[1];\n\t\tconst z = _z - pivot[2];\n\t\tconst w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\n\t\treturn {\n\t\t\tx: (e[0] * x + e[4] * y + e[8] * z + e[12]) * w + pivot[0],\n\t\t\ty: (e[1] * x + e[5] * y + e[9] * z + e[13]) * w + pivot[1],\n\t\t\tz: (e[2] * x + e[6] * y + e[10] * z + e[14]) * w + pivot[2],\n\t\t};\n\t}\n\tfunction computeBoundingBoxVertices(box) {\n\t\tconst halfSizeX = box.cropSize[0] / 2;\n\t\tconst halfSizeY = box.cropSize[1] / 2;\n\t\tconst halfSizeZ = box.cropSize[2] / 2;\n\t\tconst bounds = [\n\t\t\tbox.cropCenter[0] - halfSizeX,\n\t\t\tbox.cropCenter[1] - halfSizeY,\n\t\t\tbox.cropCenter[2] - halfSizeZ,\n\t\t\tbox.cropCenter[0] + halfSizeX,\n\t\t\tbox.cropCenter[1] + halfSizeY,\n\t\t\tbox.cropCenter[2] + halfSizeZ,\n\t\t];\n\t\tconst invRotationMatrix = getInvRotationMatrix(box.cropRotation);\n\t\treturn Object.assign(bounds, {\n\t\t\tinvRotationMatrix,\n\t\t\tcropCenter: box.cropCenter,\n\t\t});\n\t}\n\tfunction getInvRotationMatrix(_rotation) {\n\t\tconst te = [];\n\t\tconst x = (_rotation[0] * Math.PI) / 180,\n\t\t\ty = (_rotation[1] * Math.PI) / 180,\n\t\t\tz = (_rotation[2] * Math.PI) / 180;\n\t\tconst a = Math.cos(x),\n\t\t\tb = Math.sin(x);\n\t\tconst c = Math.cos(y),\n\t\t\td = Math.sin(y);\n\t\tconst e = Math.cos(z),\n\t\t\tf = Math.sin(z);\n\t\tconst ae = a * e,\n\t\t\taf = a * f,\n\t\t\tbe = b * e,\n\t\t\tbf = b * f;\n\n\t\tte[0] = c * e;\n\t\tte[1] = -c * f;\n\t\tte[2] = d;\n\n\t\tte[4] = af + be * d;\n\t\tte[5] = ae - bf * d;\n\t\tte[6] = -b * c;\n\n\t\tte[8] = bf - ae * d;\n\t\tte[9] = be + af * d;\n\t\tte[10] = a * c;\n\n\t\tte[12] = 0;\n\t\tte[13] = 0;\n\t\tte[14] = 0;\n\n\t\tte[3] = 0;\n\t\tte[7] = 0;\n\t\tte[11] = 0;\n\t\tte[15] = 1;\n\n\t\treturn te;\n\t}\n\tfunction isVertexInsideBoundingBox(x, y, z, bounds) {\n\t\treturn (\n\t\t\tx >= bounds[0] &&\n\t\t\tx <= bounds[3] &&\n\t\t\ty >= bounds[1] &&\n\t\t\ty <= bounds[4] &&\n\t\t\tz >= bounds[2] &&\n\t\t\tz <= bounds[5]\n\t\t);\n\t}\n\tfunction computeEllipsoidParams(ellipsoid) {\n\t\t// Precompute the scaling factors\n\t\tconst invRadiusX = 2 / ellipsoid.cropSize[0];\n\t\tconst invRadiusY = 2 / ellipsoid.cropSize[1];\n\t\tconst invRadiusZ = 2 / ellipsoid.cropSize[2];\n\t\tconst invRotationMatrix = getInvRotationMatrix(ellipsoid.cropRotation);\n\t\treturn {\n\t\t\tinvRadiusX,\n\t\t\tinvRadiusY,\n\t\t\tinvRadiusZ,\n\t\t\tcropCenter: ellipsoid.cropCenter,\n\t\t\tinvRotationMatrix,\n\t\t};\n\t}\n\tfunction isPointInsideEllipsoid(x, y, z, ellipsoidParams) {\n\t\tconst _x = (x - ellipsoidParams.cropCenter[0]) * ellipsoidParams.invRadiusX;\n\t\tconst _y = (y - ellipsoidParams.cropCenter[1]) * ellipsoidParams.invRadiusY;\n\t\tconst _z = (z - ellipsoidParams.cropCenter[2]) * ellipsoidParams.invRadiusZ;\n\t\treturn _x * _x + _y * _y + _z * _z <= 1;\n\t}\n\n\tself.onmessage = (e) => {\n\t\tif (e.data.getCroppedIndexes) {\n\t\t\tconst outOfBoundsIndexes = new Uint32Array(\n\t\t\t\tgetOutOfBoundsIndexes(new Float32Array(e.data.positions), e.data.crops)\n\t\t\t).buffer;\n\t\t\tself.postMessage(\n\t\t\t\t{\n\t\t\t\t\toutOfBoundsIndexes,\n\t\t\t\t},\n\t\t\t\t[outOfBoundsIndexes]\n\t\t\t);\n\t\t} else if (e.data.positions) {\n\t\t\tpositions = e.data.positions;\n\t\t\tfloatPositions = new Float32Array(positions);\n\t\t\tmeshMatrixWorlds = e.data.meshMatrixWorlds;\n\t\t\tcropsArray = e.data.cropsArray;\n\t\t\tmeshIndexIntervals = e.data.meshIndexIntervals;\n\t\t\tupdateRenderedSplats(meshMatrixWorlds, cropsArray, meshIndexIntervals);\n\t\t\tself.postMessage({\n\t\t\t\tsortSetupComplete: true,\n\t\t\t});\n\t\t} else if (e.data.sort || e.data.newMatrixWorlds || e.data.newCropsArray) {\n\t\t\tif (e.data.newMatrixWorlds || e.data.newCropsArray) {\n\t\t\t\tcropsArray = e.data.newCropsArray || cropsArray;\n\t\t\t\tmeshMatrixWorlds = e.data.newMatrixWorlds || meshMatrixWorlds;\n\t\t\t\tupdateRenderedSplats(meshMatrixWorlds, cropsArray, meshIndexIntervals);\n\t\t\t}\n\t\t\tsort(e.data.sort.view, e.data.sort.cameraPosition);\n\t\t} else if (e.data.init) {\n\t\t\t// Yep, this is super hacky and gross :(\n\t\t\tConstants = e.data.init.Constants;\n\n\t\t\tsplatCount = e.data.init.splatCount;\n\n\t\t\tconst INDEXES_BYTES_PER_ENTRY = Constants.BytesPerInt;\n\t\t\tconst POSITIONS_BYTES_PER_ENTRY = Constants.BytesPerFloat * 3;\n\n\t\t\tconst sorterWasmBytes = new Uint8Array(e.data.init.sorterWasmBytes);\n\t\t\tconst memoryBytesPerVertex =\n\t\t\t\tINDEXES_BYTES_PER_ENTRY + POSITIONS_BYTES_PER_ENTRY;\n\t\t\tconst memoryRequiredForVertices = splatCount * memoryBytesPerVertex;\n\t\t\tconst memoryRequiredForSortBuffers =\n\t\t\t\tsplatCount * Constants.BytesPerInt * 2 +\n\t\t\t\tConstants.DepthMapRange * Constants.BytesPerInt * 2;\n\t\t\tconst extraMemory = Constants.MemoryPageSize * 32;\n\t\t\tconst totalRequiredMemory =\n\t\t\t\tmemoryRequiredForVertices + memoryRequiredForSortBuffers + extraMemory;\n\t\t\tconst totalPagesRequired =\n\t\t\t\tMath.floor(totalRequiredMemory / Constants.MemoryPageSize) + 1;\n\t\t\tconst sorterWasmImport = {\n\t\t\t\tmodule: {},\n\t\t\t\tenv: {\n\t\t\t\t\tmemory: new WebAssembly.Memory({\n\t\t\t\t\t\tinitial: totalPagesRequired * 2,\n\t\t\t\t\t\tmaximum: totalPagesRequired * 3,\n\t\t\t\t\t\tshared: true,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t};\n\t\t\tWebAssembly.compile(sorterWasmBytes)\n\t\t\t\t.then((wasmModule) => {\n\t\t\t\t\treturn WebAssembly.instantiate(wasmModule, sorterWasmImport);\n\t\t\t\t})\n\t\t\t\t.then((instance) => {\n\t\t\t\t\twasmInstance = instance;\n\t\t\t\t\tindexesOffset = 0;\n\t\t\t\t\tpositionsOffset = splatCount * INDEXES_BYTES_PER_ENTRY;\n\t\t\t\t\tviewProjOffset =\n\t\t\t\t\t\tpositionsOffset + splatCount * POSITIONS_BYTES_PER_ENTRY;\n\t\t\t\t\tsortBuffersOffset = viewProjOffset + 16 * Constants.BytesPerFloat * 2;\n\t\t\t\t\tfrequenciesOffset =\n\t\t\t\t\t\tsortBuffersOffset + splatCount * Constants.BytesPerInt;\n\t\t\t\t\tindexesOutOffset =\n\t\t\t\t\t\tfrequenciesOffset + Constants.DepthMapRange * Constants.BytesPerInt;\n\t\t\t\t\twasmMemory = sorterWasmImport.env.memory.buffer;\n\t\t\t\t\tself.postMessage({\n\t\t\t\t\t\tsortSetupPhase1Complete: true,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t}\n\t};\n}\n",")(self)"],{type:"application/javascript"}))),n=atob("AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"),s=new Uint8Array(n.length);for(let t=0;t<n.length;t++)s[t]=n.charCodeAt(t);return e.postMessage({init:{sorterWasmBytes:s.buffer,splatCount:t,Constants:{BytesPerFloat:ve.BytesPerFloat,BytesPerInt:ve.BytesPerInt,DepthMapRange:ve.DepthMapRange,MemoryPageSize:ve.MemoryPageSize}}}),e}(t),this.sortWorker.onmessage=t=>{t.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(t.data.indexesBuffer)),this.lastSortTime=t.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):t.data.sortCanceled?this.sortRunning=!1:t.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):t.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(t,e){null!==this.splatMesh&&(this.updateSplatMeshUniforms(t,e),this.updateView(!1,e))}getSplatMesh(){return this.splatMesh}},Ae=new gt;Ae.wireframe=!0;var be=new tt,we=class extends lt{constructor(t,n){super(),this.data=t,this.sharedAssets=n,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this._normalPassNeeds={outline:!1,cavity:!1},this._needsReflection=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.hairInstances=[],this.shadowsDirty=!0,this.instanceGroupsDirty=!0,this._autoInstancing=null,this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new ge,this.invisibleObjects=new e("jflkdsafjasdifjaslk",{...Z.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(t,n),this.matrixAutoUpdate=!1,this.errorPage=new o("fdasfa",{...N.defaultData,name:""},{shared:n,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markShadowsDirty(){this.shadowsDirty=!0}markInstanceGroupsDirty(){this.instanceGroupsDirty=!0}get autoInstancing(){return this._autoInstancing}updateInstanceGroups(t,e){let n=this._autoInstancing;(null===n||n.minGroupSize!==e)&&(n?.dispose(),n=new Gt(e),this._autoInstancing=n);let s=this.instanceGroupsDirty;return this.instanceGroupsDirty=!1,n.update(t,s),n.stats}releaseInstanceGroups(){this._autoInstancing?.teardown(),this.instanceGroupsDirty=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this.shadowsDirty=!0,this.instanceGroupsDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=i(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._normalPassNeeds=s(this),this._needsNormal=this._normalPassNeeds.outline||this._normalPassNeeds.cavity,this.needsNormalDirty=!1),this._needsNormal}normalPassNeeds(){return this.needsNormal(),this._normalPassNeeds}needsReflection(){return this.needsReflectionDirty&&(this._needsReflection=r(this),this.needsReflectionDirty=!1),this._needsReflection}registerInstanceAndSetUuid(t){let e=t.identity.join("-"),n=this.entityIdentityToEntity[e];n&&(t.uuid=n.uuid),this.entityIdentityToEntity[e]=t,this.entityByUuid[t.uuid]=t}markPenumbraSizeDirty(){for(let t of this.children)t instanceof o&&(t.penumbraSizeArrayCache=null)}findInstance(t){return this.entityIdentityToEntity[t.join("-")]}findInInstance(t,e){let n=e??null;if(!B.is(n))return;let s="Instance"===n.data.type;if(!s&&!n.isVirtualEntity)return;let i="string"==typeof n.identity?[n.identity]:n.identity;for(let e=i.length-(s?0:1);e>=1;e--){let n=this.findInstance([...i.slice(0,e),t]);if(n)return n}for(let e=n;B.is(e);e=e.parent)if("Instance"===e.data.type&&e.data.component===t)return e}findFrom(t,e){return this.findInInstance(t,e)??this.find(t)}syncInstancePathConstraint(t){let e=t.data.pathSnapping?.pathId;if(e){let n=this.findFrom(e,t);this.pathConstraints.setConstraint(t.uuid,n?.uuid??e)}else this.pathConstraints.removeDependencies(t.uuid)}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(t){let e=this.find(t);if(void 0===e)return;let n=[],s=e;for(;s!==this;){let t=s;s=s.parent;let e=s.children.indexOf(t);n.splice(0,0,e)}return{entity:e,sortKey:n}}getAllSorted(t){let e=[];for(let n of t){let t=this.getWithSortKey(n.id);void 0!==t&&e.push(t)}return e.sort((t,e)=>q(t.sortKey,e.sortKey)),e.map(t=>t.entity)}nonExistOrDescendantOf(t,e){let n=this.find(t);if(void 0===n)return!0;for(;n;){if(n.uuid===e)return!0;n=n.parent}return!1}find(t){if(this.activePage&&this.activePage.personalCamera.parent){if("f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera"===t)return this.activePage.personalCamera;if(t===Y)return this.activePage.personalCamera}if(""===t||void 0===t)return;let e=this.entityByUuid[t];return void 0===e?this.getObjectByProperty("uuid",t):e}find2D(t){for(let e of this.children)if(e instanceof o&&e.uiScene){let n=e.uiScene.find(t);if(n)return n}}findScene2DfromObject2D(t){for(let e of this.children)if(e instanceof o&&e.uiScene&&e.uiScene.find(t))return e.uiScene}find2DInUIObjects(t){let e;return this.traverseEntity(n=>{void 0===e&&j(n)&&(e=n.uiCanvas.find(t))}),e}traverse2D(t){for(let e of this.children)e instanceof o&&e.uiScene&&e.uiScene.traverse(t)}debugEnsureEntity(t){let e=this.find(t);e?Array.isArray(e.identity)&&void 0===this.findInstance(e.identity)&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(t){this.toExpandCloner.add(t)}addPendingUpdateCloner(t){this.toUpdateCloner.add(t)}markToExpandCloner(t){this.toExpandCloner.add(t),t.traverseEntityAncestors(t=>{this.toExpandCloner.add(t)})}doPendingExpandCloner(t){this.toExpandCloner.forEach(e=>{e.expandCloner(t)}),this.toExpandCloner.clear()}doPendingUpdateCloner(t){this.toUpdateCloner.forEach(e=>{e.cloner?.update(t)}),this.toUpdateCloner.clear()}doPendingUpdates(t){this.doPendingExpandCloner(t),this.doPendingUpdateCloner(t),this.applyPendingCommands()}addPendingCommand(t){this.pendingCommands.push(t)}applyPendingCommands(){this.pendingCommands.forEach(t=>t()),this.pendingCommands.length=0}updateByLibOp(t,e){1===t.path.length&&"components"===t.path[0]&&1===t.type&&this.createChildrenObjects([{...t.data.asset,id:t.id}],this.invisibleObjects,e)}updateTreeByOp(t,e){if(0===t.path.length&&7===t.type){let n=null===t.parent?this:this.find(t.parent);if(void 0===n)throw new Error(`scene tree add: parent ${t.parent} not found for object ${t.id}`);let s=this.createObject(t.id,t.data,t.children,n,t.localIndex,e);s.updateVisible(this),s.resetBBoxNeedsUpdate(),p(s)&&u(s.parent)&&(s.invalidateUpstreamBooleanData(),s.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(s),this.markToExpandCloner(s),this.markPenumbraSizeDirty(),s.updatePathSnapping()}else if(0===t.path.length&&8===t.type){let e=this.find(t.id);if(void 0===e)throw new Error(`scene tree delete: object ${t.id} not found`);e.traverseEntity(t=>{z(t)&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(e=>e!==t)),E(t)&&(this.hairInstances=this.hairInstances.filter(e=>e!==t))}),this.markToExpandCloner(e),e.resetBBoxNeedsUpdate(),this.unregisterObject(e);let n=e.parent;this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(e),this.markPenumbraSizeDirty(),e.parent.remove(e),u(e.parent)&&(e.parent.invalidateUpstreamBooleanData(),e.parent.invalidateDownstreamBooleanData().recomputeBoolean()),p(e)&&(e.freeBooleanPointer(),n instanceof h&&n.invalidateDownstreamBooleanData().recomputeBoolean()),O(e)&&e.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(e),this.pathConstraints.removeDependencies(e.uuid),e.updatePathSnapping()}else if(0===t.path.length&&9===t.type){let e=this.find(t.id);if(void 0===e)throw new Error(`scene tree move: object ${t.id} not found`);this.markNeedsRecomputeInstancesForChildren(e);let n=e.parent;this.markNeedsRecomputeInstancesForAncessors(n),e.cloner?.resetOnMove(),this.markToExpandCloner(e);let s=null===t.parent?this:this.find(t.parent);if(void 0===s)throw new Error(`scene tree move: new parent ${t.parent} not found for object ${t.id}`);s.add(e),this.markNeedsRecomputeInstancesForAncessors(s),this.markToExpandCloner(e),e.invalidateClonerTransform(e),e.updateVisible(this),e.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let i=t.localIndex;s.children.splice(i,0,s.children.pop()),p(e)&&(e.invalidateUpstreamBooleanData(),u(e.parent)?e.parent.invalidateDownstreamBooleanData().recomputeBoolean():n instanceof h&&n.invalidateDownstreamBooleanData().recomputeBoolean()),e.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(t){this.shadowsDirty=!0,this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let e of this.children)e instanceof o&&(e.visible=e.uuid===t,e.visible&&(this.activePage=e,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(t,e,n,s){if(this.shadowsDirty=!0,0===e.type){if(("overrides"in e.props||"component"in e.props)&&this.markNeedsRecomputeInstances(),"visible"in e.props&&this.markPenumbraSizeDirty(),e.path.includes("overrides")&&"states"in e.props){let{rest:t}=e.props;e={...e,props:t},this.markNeedsRecomputeInstances()}"pathSnapping"===e.path[0]&&void 0!==e.props.pathId&&this.pathConstraints.setConstraint(t,e.props.pathId)}let i=this.find(t);if(i)try{(function(t,e,n,s){t.updateByOp(e,n,s,!1)})(i,e,n,{scene:this,shared:s}),i instanceof I&&i.updateGeometryGroupsIfNeeded()}catch(t){console.error(t)}}updateEntity2DByOp(t,e,n,s,i,r=[]){t.updateEntityByOp(e,n,s,i),this.traverseEntity(t=>{(j(t)||t instanceof o)&&(r.includes(t.frameId??"")||t.frameId===e)&&t.updateEntity2DByOp(e,n,s,i)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(t){this.activePage.switchActiveCamera(t)}isInvisibleObjects(t){return t===this.invisibleObjects||t.hasAnccestor(this.invisibleObjects)}init(t,e){let n=Object.entries(e.data.lib.components).map((t,e)=>({data:t[1].asset.data,children:t[1].asset.children,id:t[0],fi:e}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:e}),this.add(this.invisibleObjects),this.createChildrenObjects(n,this.invisibleObjects,e),this.createChildrenObjects(t.objects,this,e),this.updatePage(t.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(e,!0),this.traverseEntity(t=>{t instanceof c&&t.updateUp()}),this.doPendingExpandCloner({scene:this,shared:e}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(t){t.traverseEntity(t=>{("Component"===t.data.type||"Instance"===t.data.type)&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(t){B.is(t)&&("Component"===t.data.type&&this.markNeedsRecomputeInstances(),t.traverseAncestors(t=>{B.is(t)&&"Component"===t.data.type&&this.markNeedsRecomputeInstances()}))}relativeizeInner(t,e,n,s,i,r,a){if(t){let o=s.find(t);o&&o!==s&&i.forInstancesRec(s=>{s.data=L(s.data,i=>{let o=i.events.data(a.id),l=s.goUp(r);if(l){let s=[...V(l.identity),t].join("-"),i=this.entityIdentityToEntity[s];if(i){let t=i.uuid;Q.zoom(o,e)[n]=t}else console.warn("cannot find instance")}}).data})}}rewriteActions(t,e,n,s,i,r){t.forEach(t=>{"Transition"===t.data.type||"Animation"===t.data.type&&t.data.object?this.relativeizeInner(t.data.object,[...e,t.id],"object",n,s,i,r):"Conditional"===t.data.type&&(this.rewriteActions(t.data.ifActions,[...e,t.id,"ifActions"],n,s,i,r),this.rewriteActions(t.data.elseActions,[...e,t.id,"elseActions"],n,s,i,r))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(t=>{if(T(t)&&"string"==typeof t.identity&&"Component"===t.data.type)return t.traverseEntity((e,n)=>{e.data.events.forEach(s=>{if("GameControl"===s.data.type){let i=!1;if(e.forInstancesRec(t=>{t.data=L(t.data,e=>{t.isInstanceRoot||(e.events.delete(s.id),i=!0)}).data}),!1===i)for(let i of F.list)this.rewriteActions(s.data.gameActions[i],["gameActions",i],t,e,n,s)}else"Conditional"===s.data.type?("Distance"===s.data.condition.type?(this.relativeizeInner(s.data.condition.fromObject,["condition"],"fromObject",t,e,n,s),this.relativeizeInner(s.data.condition.toObject,["condition"],"toObject",t,e,n,s)):"State"===s.data.condition.type?this.relativeizeInner(s.data.condition.object,["condition"],"object",t,e,n,s):"Comparison"===s.data.condition.type&&("Property"===s.data.condition.lOperand.type&&this.relativeizeInner(s.data.condition.lOperand.value[0],["condition","lOperand","value"],0,t,e,n,s),"Property"===s.data.condition.rOperand.type&&this.relativeizeInner(s.data.condition.rOperand.value[0],["condition","rOperand","value"],0,t,e,n,s)),this.rewriteActions(s.data.inActions,["inActions"],t,e,n,s),this.rewriteActions(s.data.outActions,["outActions"],t,e,n,s)):"actions"in s.data&&this.rewriteActions(s.data.actions,["actions"],t,e,n,s)})}),!0})}expandInstances(t,e,s){let i=new Set;this.traverseEntity(n=>{if(T(n)&&n.isInstanceRoot)return n.expandInstanceChildren({scene:this,shared:t,pendingDeletes:i}),e||n.resetBBoxNeedsUpdate(),s&&n.traverseEntity(t=>{s.addClip(t)}),!0});for(let t of i)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(t),n(t)}recomputeInstances(t,e){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(t=>{T(t)&&t.isInstanceRoot&&(t.component=void 0)}),this.expandInstances(t,!1,e))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(t){t.traverseEntity(t=>{let e="string"==typeof t.identity?t.identity:t.identity.join("-");this.entityIdentityToEntity[e]===t&&(delete this.entityByUuid[t.uuid],delete this.entityIdentityToEntity[e],this.pathConstraints.removeDependencies(t.uuid)),t.dispose()})}clearScene(){this._autoInstancing?.dispose(),this._autoInstancing=null,this.instanceGroupsDirty=!0;for(let t of this.children)B.is(t)&&t.disposeRecursively();this.children.length=0}resetAfterClear(t,e){this.init(t,e)}raycast(t){return this.raycast1(t,!1)}raycast1(t,e){let n=[],s=i=>{for(let r of i.children){let i=r.cloner;if(B.is(r)&&!r.raycastLock&&(r.visible||i?.object.data.visible))if(!0===e&&r.isInstanceRoot){let e=[];if(t.intersectObject(r,!0,e),e.length){let t=e[0];t.object=r,t.point.applyMatrix4(t.object.matrixWorld);let s=r.matrixWorld.clone().invert();t.point.applyMatrix4(s),n.push(t)}}else(p(r)||m(r)&&this.enableHelpers&&r.objectHelper.visible)&&(t.intersectObject(r,!1,n),a(r,t,n)),s(r)}};return s(this.activePage),n}raycastWithClones(t){let e=[],n=s=>{for(let i of s.children){let s=i.cloner;B.is(i)&&(i.visible||s?.object.data.visible)&&((p(i)||m(i)&&this.enableHelpers&&i.objectHelper.visible)&&(t.intersectObject(i,!1,e),a(i,t,e,!0)),n(i))}};return n(this),e}forEachEntity(t){for(let e of this.children)B.is(e)&&t(e)}traverseConcreteEntity(t){for(let e of this.children)B.is(e)&&e.isConcreteEntity&&e.traverseEntity(t)}traverseEntity(t){for(let e of this.children)B.is(e)&&e.traverseEntity(t)}updateFont(t,e){this.traverseEntity(n=>{if(n instanceof I&&"Mesh"===n.data.type&&("TextGeometry"===n.data.geometry.type||"InputGeometry"===n.data.geometry.type)&&n.data.geometry.font===t){let s=n.geometry,i=n.data.geometry;s.updateFont(t,e).then(()=>{s.update(i,e);let t=n.invalidateDownstreamBooleanData();u(t)&&t.recomputeBoolean()})}})}traverseObject(t){for(let e of this.children)S.is(e)&&e.traverseObject(t)}traverseVisibleEntity(t){for(let e of this.children)B.is(e)&&e.visible&&e.traverseVisibleEntity(t)}dispose(){this.clearScene()}createChildrenObjects(t,e,n){let s=0;for(let i of t)this.createObject(i.id,i.data,i.children,e,s,n),s+=1}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let e of t.children)this.unregisterObject(e)}createObject(t,e,n,s,i,r){let a={scene:this,shared:r},o=fe(t,e,a);return z(o)&&this.shapeBlendIntances.push(o),E(o)&&this.hairInstances.push(o),o&&(this.entityByUuid[t]=o,s.add(o),s.children.splice(i,0,s.children.pop()),n.length>0&&(o.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(n,o,r)),o.updateState(e,a),o instanceof I&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),e.pathSnapping?.pathId&&this.pathConstraints.setConstraint(t,e.pathSnapping.pathId)),"Empty"===e.type&&e.animations&&o.traverseEntity(t=>{let e=t.dataPatched;if(t instanceof I&&e.bones&&e.boneInverses){let n=e.bones.map(t=>this.find(t)),s=e.boneInverses.map(t=>(new rt).fromArray(t)),i=new wt(n,s);t.bind(i,t.bindMatrix)}else t.matrixAutoUpdate=!0}),o}getCenter(t){let e=[];for(let n=0,s=t.length;n<s;++n){let{id:s,recursive:i}=t[n],r=this.find(s),a=i?r.recursiveBBox:r.singleBBox;e.push(...a.vertices)}let n=new dt;return n.setFromPoints(e),n.getCenter(be),be}copyMatrixWorld(t,e){if(null===t)return void e.identity();let n=this.find(t);n?(n.updateWorldMatrix(!0,!1),e.copy(n.matrixWorld)):e.identity()}copyParentMatrixWorld(t,e){if(null===t)return void e.identity();let n=this.find(t)?.parent;n?(n.updateWorldMatrix(!0,!1),e.copy(n.matrixWorld)):e.identity()}traverseMaterial(t){this.traverseEntity(e=>{if(e instanceof D)if(Array.isArray(e.material))for(let n of e.material)w(n)&&t(n);else w(e.material)&&t(e.material)})}updateViewPlaneSize(t,e,n=!1){this.traverseConcreteEntity(s=>{s instanceof c&&s.setViewplaneSize(t,e,n)})}initializeSplatViewer(){this.splatViewer=new xe({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}};export{Nt as a,Bt as b,Lt as c,Kt as d,Ae as e,we as f};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as t}from"./runtime-chunk-GEB7WRKG.js";import{b as e}from"./runtime-chunk-YPX3TS4M.js";import{H as i,ia as r}from"./runtime-chunk-T6KZOJFT.js";import{f as n,v as s}from"./runtime-chunk-BFUMQZ5V.js";import{c as o}from"./runtime-chunk-RTLL6WIB.js";import{c as a}from"./runtime-chunk-2PT2WH66.js";import{L as l}from"./runtime-chunk-ADHKZQMB.js";import{Ec as h,Gc as c,Hc as d,Qc as u,Rc as p,Tc as m,Yc as f,sd as y}from"./runtime-chunk-KPOUV3HD.js";import{a as b,b as x}from"./runtime-chunk-ML3Z74BL.js";var g=x(b((t,e)=>{var i,r;i=t,r=function(){return t.importState=function(e){var i=new t;return i.importState(e),i},t;function t(){return function(t){var e=0,i=0,r=0,n=1;0==t.length&&(t=[+new Date]);var s=function(){var t=4022871197,e=function(e){e=e.toString();for(var i=0;i<e.length;i++){var r=.02519603282416938*(t+=e.charCodeAt(i));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)};return e.version="Mash 0.9",e}();e=s(" "),i=s(" "),r=s(" ");for(var o=0;o<t.length;o++)(e-=s(t[o]))<0&&(e+=1),(i-=s(t[o]))<0&&(i+=1),(r-=s(t[o]))<0&&(r+=1);s=null;var a=function(){var t=2091639*e+2.3283064365386963e-10*n;return e=i,i=r,r=t-(n=0|t)};return a.next=a,a.uint32=function(){return 4294967296*a()},a.fract53=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.version="Alea 0.9",a.args=t,a.exportState=function(){return[e,i,r,n]},a.importState=function(t){e=+t[0]||0,i=+t[1]||0,r=+t[2]||0,n=+t[3]||0},a}(Array.prototype.slice.call(arguments))}},"object"==typeof t?e.exports=r():"function"==typeof define&&define.amd?define(r):i.Alea=r()})()),v=.5*(Math.sqrt(3)-1),M=(3-Math.sqrt(3))/6,w=1/3,j=1/6,A=(Math.sqrt(5),Math.sqrt(5),t=>0|Math.floor(t)),S=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),F=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);function _(t){let e=new Uint8Array(512);for(let t=0;t<256;t++)e[t]=t;for(let i=0;i<255;i++){let r=i+~~(t()*(256-i)),n=e[i];e[i]=e[r],e[r]=n}for(let t=256;t<512;t++)e[t]=e[t-256];return e}var C=new f,z=class{constructor(t){this.weightAttribute=null;let e=t.geometry;if(!e.isBufferGeometry||3!==e.attributes.position.itemSize)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");e.index&&(e=e.toNonIndexed()),this.geometry=e,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let t=this.positionAttribute,e=new Float32Array(t.count/3);for(let i=0;i<t.count;i+=3){let r=1;C.a.fromBufferAttribute(t,i),C.b.fromBufferAttribute(t,i+1),C.c.fromBufferAttribute(t,i+2),r*=C.getArea(),e[i/3]=r}this.distribution=new Float32Array(t.count/3);let i=0;for(let t=0;t<e.length;t++)i+=e[t],this.distribution[t]=i;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e){if(this.distribution){let i=this.distribution[this.distribution.length-1],r=this.binarySearch(this.randomFunction()*i);return this.sampleFace(r,t,e)}}binarySearch(t){if(!this.distribution)return 0;let e=this.distribution,i=0,r=e.length-1,n=-1;for(;i<=r;){let s=Math.ceil((i+r)/2);if(0===s||e[s-1]<=t&&e[s]>t){n=s;break}t<e[s]?r=s-1:i=s+1}return n}sampleFace(t,e,i){let r=this.randomFunction(),n=this.randomFunction();return r+n>1&&(r=1-r,n=1-n),C.a.fromBufferAttribute(this.positionAttribute,3*t),C.b.fromBufferAttribute(this.positionAttribute,3*t+1),C.c.fromBufferAttribute(this.positionAttribute,3*t+2),e.set(0,0,0).addScaledVector(C.a,r).addScaledVector(C.b,n).addScaledVector(C.c,1-(r+n)),C.getNormal(i),this}},O={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},W={polygon_center:0,edge:1,vertex:2},T=(t,e)=>(i,r)=>e&&0!==i&&0!==t?t*r/100:0,N=(t,e)=>{let i=Math.abs(e),r=-1*i;return(t- -1)*(i-r)/2+r},P=new d,B=new d,U=new d,V=new d;function k(t,e){let i=U.fromArray(t),r=V.fromArray(e);B.copy(r).sub(i);let n=B.length();return B.normalize().multiplyScalar(.5*n),P.copy(i).add(B).toArray()}var E,R,I,D,q=new f,L=new d,G=new d,H=new d,$=class extends y{},K=class extends ${constructor(t,e){super(void 0,void 0,e),this.source=t,this.isClonerInstancedMesh=!0,this.pivotMatrix=new u,this.previousModelViewMatrix=new u,this.copyPreviousMatrix=!0,this.capacity=e,this.count=0,this.matrixAutoUpdate=!1}raycast(t,e){}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(let e of this.children)e.updateMatrixWorld(t)}updateWorldMatrix(t,e){let i=this.parent;if(t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),e)for(let t of this.children)t.updateWorldMatrix(!1,!0)}onAfterRender(t,e,i,r,n,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}get visible(){return!0!==this.source.cloner?.insideBoolean&&(this.source.visible||this.source.dataPatched.visible&&!0===this.source.dataPatched.cloner?.hideBase)}set visible(t){}get castShadow(){return this.source.castShadow}set castShadow(t){}get receiveShadow(){return this.source.receiveShadow}set receiveShadow(t){}get layers(){return this.source.layers}set layers(t){}get geometry(){return this.source.geometry}set geometry(t){}get material(){return this.source.material}set material(t){}get morphTargetInfluences(){return this.source.morphTargetInfluences}set morphTargetInfluences(t){}},Q=t=>.5*(1-Math.cos(t*Math.PI)),Z=class{constructor(){this.perlin=new Array(4096)}noise(t,e=0,i=0){if(null==this.perlin){this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=Math.random()}t<0&&(t=-t),e<0&&(e=-e),i<0&&(i=-i);let r,n,s,o,a,l=Math.floor(t),h=Math.floor(e),c=Math.floor(i),d=t-l,u=e-h,p=i-c,m=0,f=.5;for(let t=0;t<4;t++){let t=l+(h<<4)+(c<<8);r=Q(d),n=Q(u),s=this.perlin[4095&t],s+=r*(this.perlin[t+1&4095]-s),o=this.perlin[t+16&4095],o+=r*(this.perlin[t+16+1&4095]-o),s+=n*(o-s),t+=256,o=this.perlin[4095&t],o+=r*(this.perlin[t+1&4095]-o),a=this.perlin[t+16&4095],a+=r*(this.perlin[t+16+1&4095]-a),o+=n*(a-o),s+=Q(p)*(o-s),m+=s*f,f*=.5,l<<=1,d*=2,h<<=1,u*=2,c<<=1,p*=2,d>=1&&(l++,d--),u>=1&&(h++,u--),p>=1&&(c++,p--)}return m}noiseSeed(t){let e=(()=>{let t,e;return{setSeed(i){e=t=(i??4294967296*Math.random())>>>0},getSeed:()=>t,rand:()=>(e=(1664525*e+1013904223)%4294967296,e/4294967296)}})();e.setSeed(t),this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=e.rand()}},Y=1e-4,J=new d,X=new d;i.then(t=>{R=[(E=t).get_face_center,E.get_edge_midpoint,E.get_vertex_position],I=[E.get_face_normal,E.get_edge_normal,E.get_vertex_normal],D=[E.face_count,E.edge_count,E.vertex_count]}),new u;var tt=new u,et=new u,it=new u,rt=new u,nt=new u,st=new u,ot=new d,at=new d,lt=new d,ht=new d,ct=new d,dt=new d,ut=new d,pt=new d,mt=new d,ft=new d,yt=new d,bt=new p,xt=new c;function gt(t){return t?t.version??t.data?.version??0:-1}function vt(t,e){return["number"==typeof t?.[0]?t[0]:"string"==typeof t?.[0]&&e?parseFloat(String(e.shared.getVariable(t[0])??"0")):0,"number"==typeof t?.[1]?t[1]:"string"==typeof t?.[1]&&e?parseFloat(String(e.shared.getVariable(t[1])??"0")):0,"number"==typeof t?.[2]?t[2]:"string"==typeof t?.[2]&&e?parseFloat(String(e.shared.getVariable(t[2])??"0")):0]}var Mt=class{constructor(t,e){this.data=t,this.is3D=e,this.perlin=new Z,"perlin"===t.noiseType?(this.perlin.noiseSeed(t.seed),this.noise=e?(t,e,i)=>this.perlin.noise(t,e,i):t=>this.perlin.noise(t)):this.noise=e?function(t=Math.random){let e=_(t),i=new Float64Array(e).map(t=>F[t%12*3]),r=new Float64Array(e).map(t=>F[t%12*3+1]),n=new Float64Array(e).map(t=>F[t%12*3+2]);return function(t,s,o){let a,l,h,c,d,u,p,m,f,y,b=(t+s+o)*w,x=A(t+b),g=A(s+b),v=A(o+b),M=(x+g+v)*j,S=t-(x-M),F=s-(g-M),_=o-(v-M);S>=F?F>=_?(d=1,u=0,p=0,m=1,f=1,y=0):S>=_?(d=1,u=0,p=0,m=1,f=0,y=1):(d=0,u=0,p=1,m=1,f=0,y=1):F<_?(d=0,u=0,p=1,m=0,f=1,y=1):S<_?(d=0,u=1,p=0,m=0,f=1,y=1):(d=0,u=1,p=0,m=1,f=1,y=0);let C=S-d+j,z=F-u+j,O=_-p+j,W=S-m+2*j,T=F-f+2*j,N=_-y+2*j,P=S-1+.5,B=F-1+.5,U=_-1+.5,V=255&x,k=255&g,E=255&v,R=.6-S*S-F*F-_*_;if(R<0)a=0;else{let t=V+e[k+e[E]];R*=R,a=R*R*(i[t]*S+r[t]*F+n[t]*_)}let I=.6-C*C-z*z-O*O;if(I<0)l=0;else{let t=V+d+e[k+u+e[E+p]];I*=I,l=I*I*(i[t]*C+r[t]*z+n[t]*O)}let D=.6-W*W-T*T-N*N;if(D<0)h=0;else{let t=V+m+e[k+f+e[E+y]];D*=D,h=D*D*(i[t]*W+r[t]*T+n[t]*N)}let q=.6-P*P-B*B-U*U;if(q<0)c=0;else{let t=V+1+e[k+1+e[E+1]];q*=q,c=q*q*(i[t]*P+r[t]*B+n[t]*U)}return 32*(a+l+h+c)}}((0,g.default)(t.seed)):function(t=Math.random){let e=_(t),i=new Float64Array(e).map(t=>S[t%12*2]),r=new Float64Array(e).map(t=>S[t%12*2+1]);return function(t,n){let s,o,a=0,l=0,h=0,c=(t+n)*v,d=A(t+c),u=A(n+c),p=(d+u)*M,m=t-(d-p),f=n-(u-p);m>f?(s=1,o=0):(s=0,o=1);let y=m-s+M,b=f-o+M,x=m-1+2*M,g=f-1+2*M,w=255&d,j=255&u,S=.5-m*m-f*f;if(S>=0){let t=w+e[j];S*=S,a=S*S*(i[t]*m+r[t]*f)}let F=.5-y*y-b*b;if(F>=0){let t=w+s+e[j+o];F*=F,l=F*F*(i[t]*y+r[t]*b)}let _=.5-x*x-g*g;if(_>=0){let t=w+1+e[j+1];_*=_,h=_*_*(i[t]*x+r[t]*g)}return 70*(a+l+h)}}((0,g.default)(t.seed??""))}},wt=class extends(n(m)){constructor(t,e){super(),this.parameters=e,this.isCloner=!0,this.objectForSample=void 0,this._pendingMediaLoad=!1,this.random=null,this.surfaceSamplerCache=null,this.surfacePointsCache=null,this.object=t}resetOnMove(){this.removeFromParent(),this.parent=null}removeFromParent(){return super.removeFromParent(),this.instancedMesh?.removeFromParent(),this}dispose(){this.removeFromParent(),this._disposeInstancedMesh(),this._invalidateBoolean(),this._syncEnclosingCopies(!0)}createCopy(){return new jt(this)}_syncEnclosingCopies(t){!t&&this.parent!==this.object.parent||this.object.traverseEntityAncestors(e=>{let i=e.cloner;void 0===i||null===i.parent||(t&&i.expandCopies(),i.invalidateTransform(this.object))})}_invalidateBoolean(){this.object instanceof s&&this.object.onClonerLayoutUpdated()}expandClones(t){null===this.parent?this.updateState(this.parameters,t):this.expandCopies()}expandCopies(){for(let t of this.children)t instanceof r&&t.expand();this._syncInstancedMesh()}invalidateTransform(t){this.matrixWorldNeedsUpdate=!0}onObjUpdateMatrix(){"toObject"!==this.parameters.type&&(this.matrixWorldNeedsUpdate=!0)}update(t){this._syncEnclosingCopies(this._layout(t))}_layout(t){let e=this.children.length;switch(this._updateCount(t),this.parameters.type){case"radial":this._updateRadial(this.parameters,t);break;case"linear":this._updateLinear(this.parameters,t);break;case"grid":this._updateGrid(this.parameters,t);break;case"toObject":this._updateToObject(this.parameters,t)}for(let t of this.children){let e=t.transformOverride;void 0!==e&&(t.position.fromArray(e.position),t.rotation.fromArray(e.rotation),t.scale.fromArray(e.scale)),t.updateMatrix(),t.hasNonUniformScale&&(t.updateMatrixWorld(),t.updateMatrixWorldRigid())}return this._syncInstancedMesh(),this._invalidateBoolean(),this.children.length!==e}get instancingActive(){return void 0!==this.instancedMesh}get insideBoolean(){return null!==this.parent&&"booleanOp"in this.parent}_instancingEligible(){if(!0!==this.parameters.instanced)return!1;let t=this.object;return!(t.entityChildrenCount()>0||!0!==t.isMesh||a(t)||!0===t.isDecalObject)}_syncInstancedMesh(){if(!this._instancingEligible())return void this._disposeInstancedMesh();let t=this.instancedMesh;if(void 0!==t&&t.capacity<this.children.length&&(this._disposeInstancedMesh(),t=void 0),void 0===t){let e=Math.max(8,Math.ceil(1.5*this.children.length));t=this.instancedMesh=new K(this.object,e)}t.matrix=this.matrix,t.matrixWorldNeedsUpdate=!0,t.parent!==this.parent&&(t.removeFromParent(),this.parent?.add(t)),this.syncInstanceMatrices()}syncInstanceMatrices(){this._invalidateBoolean();let t=this.instancedMesh;if(void 0===t)return;let e=0;for(let i of this.children)!1!==i.playModeVisible&&(et.copy(i.matrix).multiply(i.pivotMatrix),t.setMatrixAt(e++,et));t.count=e,t.instanceMatrix.needsUpdate=!0,t.boundingSphere=null}_disposeInstancedMesh(){let t=this.instancedMesh;void 0!==t&&(this.instancedMesh=void 0,t.removeFromParent(),t.dispose())}_updateCount(t,e){let i;if(void 0!==e)i=e;else{let e=vt(this.parameters.grid.count,t);i="grid"===this.parameters.type?Math.round(e[0])*Math.round(e[1])*Math.round(e[2]):this.parameters.count}if("toObject"===this.parameters.type)if(this.parameters.toObject.object){if(void 0===e&&"random"!==this.parameters.toObject.spreadType)return}else i=0;if(this.children.length!==i)if(this.children.length<i)for(let t=0,e=i-this.children.length;t<e;++t){let t=new r(this.object);t.expand(),this.add(t)}else for(;this.children.length>i;){let t=this.children.pop();t.parent=null,t.dispatchEvent({type:"removed"}),this.dispatchEvent({type:"childremoved",child:t})}}getRandom(t,e=!1){return(null===this.random||this.random.data.seed!==t.seed||this.random.data.noiseType!==t.noiseType||this.random.is3D!==e)&&(this.random=new Mt(t,e)),this.random}_updateRadial(t,e){let i,r=t.radial,n=r.start*h.DEG2RAD,s=n-r.end*h.DEG2RAD,o=vt(r.rotation,e),a=new p(o[0],o[1],o[2]);switch(r.axis){case"z":i=new d(0,0,1);break;case"y":i=new d(0,1,0);break;default:i=new d(1,0,0)}let c=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,u=!0===this.parameters.randomness&&0!==c.strength?this.getRandom(c):null,m=vt(r.scale,e),f=vt(r.position,e),y=vt(c.scale,e),b=vt(c.position,e),x=vt(c.rotation,e),g=s/t.count,v=T(c.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let s=t*(c.freqScale/10)+c.movement,o=null===u?0:u.noise(s,s,s),l=t+1;e.scale.x=m[0]+v(l,N(o,y[0]))||Y,e.scale.y=m[1]+v(l,N(o,y[1]))||Y,e.scale.z=m[2]+v(l,N(o,y[2]))||Y;let h=g*t-n;switch(r.axis){default:case"x":bt.set(0,h,0);break;case"y":bt.set(0,0,h);break;case"z":bt.set(h,0,0)}ut.copy(i).applyQuaternion(xt.setFromEuler(bt)).multiplyScalar(r.radius),e.position.set(ut.x+(f[0]+v(l,N(o,b[0]))),ut.y+(f[1]+v(l,N(o,b[1]))),ut.z+(f[2]+v(l,N(o,b[2]))));let d=v(l,N(o,x[0])),p=v(l,N(o,x[1])),M=v(l,N(o,x[2]));!0===r.alignment?e.rotation.set(bt.x+(a.x+d),bt.y+(a.y+p),bt.z+(a.z+M)):e.rotation.set(a.x+d,a.y+p,a.z+M)}}_updateLinear(t,e){if("linear"!==t.type)throw new Error;let i=t.linear,r=vt(i.rotation,e),n=vt(i.scale,e),s=vt(i.position,e),o=new p(r[0]??0,r[1]??0,r[2]??0),a=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,h=vt(a.rotation,e),c=vt(a.scale,e),d=vt(a.position,e),u=!0===this.parameters.randomness&&0!==a.strength?this.getRandom(a):null,m=T(a.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let i=t*(a.freqScale/10)+a.movement,r=null===u?0:u.noise(i,i,i),l=t+1,p=m(l,N(r,h[0])),f=m(l,N(r,h[1])),y=m(l,N(r,h[2]));e.scale.x=1+(n[0]-1)*t+m(l,N(r,c[0]))||Y,e.scale.y=1+(n[1]-1)*t+m(l,N(r,c[1]))||Y,e.scale.z=1+(n[2]-1)*t+m(l,N(r,c[2]))||Y,e.rotation.set(o.x*t+p,o.y*t+f,o.z*t+y),e.position.x=s[0]*t+m(l,N(r,d[0])),e.position.y=s[1]*t+m(l,N(r,d[1])),e.position.z=s[2]*t+m(l,N(r,d[2]))}}_updateGrid(t,e){let i=0,r=t.grid,n=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,s=vt(n.scale,e),o=vt(n.rotation,e),a=vt(n.position,e),h=!0===this.parameters.randomness&&0!==n.strength?this.getRandom(n,!0):null,c=T(n.strength,this.parameters.randomness),u=vt(r.count,e),p=vt(r.size,e);if(!0===r.useCenter){let t={x:u[0]%2==0?2:1,y:u[1]%2==0?2:1,z:u[2]%2==0?2:1},e=new d(p[0]*(u[0]-t.x)*.5,p[1]*(u[1]-t.y)*.5,p[2]*(u[2]-t.z)*.5);for(let t=0;t<u[0];t++)for(let r=0;r<u[1];r++)for(let l=0;l<u[2];l++){let d=this.children[i++];if(!d)continue;let u=null===h?0:h.noise((t+1)*(n.freqScale/10)+n.movement,(r+1)*(n.freqScale/10)+n.movement,(l+1)*(n.freqScale/10)+n.movement);d.scale.x=1+c(i,N(u,s[0]))||Y,d.scale.y=1+c(i,N(u,s[1]))||Y,d.scale.z=1+c(i,N(u,s[2]))||Y;let m=c(i,N(u,o[0])),f=c(i,N(u,o[1])),y=c(i,N(u,o[2]));d.rotation.set(m,f,y),d.position.x=p[0]*t-e.x+c(i,N(u,a[0])),d.position.y=p[1]*r-e.y+c(i,N(u,a[1])),d.position.z=p[2]*l-e.z+c(i,N(u,a[2]))}}else for(let t=0;t<u[0];t++)for(let e=0;e<u[1];e++)for(let r=0;r<u[2];r++){let l=this.children[i++];if(!l)continue;let d=null===h?0:h.noise((t+1)*(n.freqScale/10)+n.movement,(e+1)*(n.freqScale/10)+n.movement,(r+1)*(n.freqScale/10)+n.movement);l.scale.x=1+c(i,N(d,s[0]))||Y,l.scale.y=1+c(i,N(d,s[1]))||Y,l.scale.z=1+c(i,N(d,s[2]))||Y;let u=c(i,N(d,o[0])),m=c(i,N(d,o[1])),f=c(i,N(d,o[2]));l.rotation.set(u,m,f),l.position.x=p[0]*t+c(i,N(d,a[0])),l.position.y=-p[1]*e+c(i,N(d,a[1])),l.position.z=-p[2]*r+c(i,N(d,a[2]))}}_updateToObject(i,r){if("toObject"!==i.type)throw new Error;let{toObject:n}=i,s=vt(n.rotation,r),o=vt(n.position,r),a=vt(n.scale,r),h=new p(s[0],s[1],s[2]),c=i.randomnessObject??l.defaultData([1,1,1]).randomnessObject,d=vt(c.rotation,r),u=vt(c.position,r),m=vt(c.scale,r),f=!0===this.parameters.randomness&&0!==c.strength?this.getRandom(c):null,y=T(c.strength,this.parameters.randomness);if(!n.object){for(let[,t]of this.children.entries())t.position.set(0,0,0),t.scale.setScalar(1),t.rotation.set(0,0,0);return this.objectForSample=void 0,void this.invalidateSurfaceCaches()}if(!this.objectForSample)return;if(this.objectForSample instanceof t){if(!this.objectForSample.font?.isLoaded||void 0===this.objectForSample.geometry.attributes.position)return void(this._pendingMediaLoad=!0);this._pendingMediaLoad=!1}if(void 0===this.objectForSample.geometry&&this.objectForSample.isAncestorOf(this.object.uuid))return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) seem to be a child/descendant of the object it's being cloned to. Please re-parent it so that they are siblings instead.`);let b=this.getSubdivData();if(b.length>0){let t=Math.round(b.length*n.count/100);this._updateCount(r,t)}else{let t=this.objectForSample.geometry.getAttribute("position");if(!t||isNaN(t.count)||0===t.count)return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`)}this.objectForSample.updateMatrixWorld();let x="random"===n.spreadType,v=null;x&&(v=this.getSurfaceSampler(),v.setRandomGenerator((0,g.default)(this.object.uuid+n.seed)));let M=O[n.axis],w=this.children;ot.fromArray(M);let j=this.objectForSample instanceof e;j&&it.copy(this.objectForSample.matrixWorld).invert(),"normal"!==n.align&&this.object.getWorldDirection(dt),ft.set(ot.y,ot.z,ot.x).normalize(),yt.copy(ft).cross(ot).normalize(),nt.makeBasis(ft,ot,yt).invert();for(let[t,e]of w.entries()){let i=t*(c.freqScale/10)+c.movement,r=null===f?0:f.noise(i,i,i),s=t+1,l=y(s,N(r,d[0])),p=y(s,N(r,d[1])),g=y(s,N(r,d[2]));x?v.sample(lt,ht):(b.length&&(lt.fromArray(b[t].pos),ht.fromArray(b[t].norm)),j&<.applyMatrix4(it)),e.position.copy(lt);let M="normal"===n.align?ht:dt,w=at.fromArray(o);at.x+=y(s,N(r,u[0])),at.y+=y(s,N(r,u[1])),at.z+=y(s,N(r,u[2]));let A=Math.acos(M.dot(ot)),S=ct.crossVectors(ot,M).normalize(),F=tt.makeRotationAxis(S,A);pt.copy(M).cross(this.object.up).normalize(),mt.copy(pt).cross(M).normalize(),rt.makeBasis(pt,M,mt),st.multiplyMatrices(rt,nt),bt.setFromRotationMatrix(st),w.applyMatrix4(F),e.position.add(w),e.rotation.set(bt.x+h.x+l,bt.y+h.y+p,bt.z+h.z+g),e.scale.set(1+a[0]+y(s,N(r,m[0]))||Y,1+a[1]+y(s,N(r,m[1]))||Y,1+a[2]+y(s,N(r,m[2]))||Y),e.scale.multiply(this.object.scale)}}getSurfaceSampler(){let t=this.objectForSample,e=t.geometry,i=e.getAttribute("position"),r=e.index,n=this.surfaceSamplerCache;if(null!==n&&n.geometry===e&&n.position===i&&n.positionVersion===gt(i)&&n.index===r&&n.indexVersion===(null===r?-1:r.version))return n.sampler;let s=new z(t).build();return this.surfaceSamplerCache={geometry:e,position:i,positionVersion:gt(i),index:r,indexVersion:null===r?-1:r.version,sampler:s},s}invalidateSurfaceCaches(){this.surfaceSamplerCache=null,this.surfacePointsCache=null}getSubdivData(){if(!this.objectForSample)return[];let t=this.parameters.toObject.spreadType;if("random"===t)return[];let i=this.objectForSample instanceof e,r=this.objectForSample.geometry;if(!i&&r){let e=this.surfacePointsCache,i=r.getAttribute("position");if(null!==e&&e.spreadType===t&&e.geometry===r&&e.position===i&&e.positionVersion===gt(i)&&e.index===r.index&&e.indexVersion===(null===r.index?-1:r.index.version))return e.points}let n=new Map,s=(t,e)=>{let i=Math.round(1e4*t[0])+"_"+Math.round(1e4*t[1])+"_"+Math.round(1e4*t[2]),r=n.get(i);r?(r.pos[0]+=t[0],r.pos[1]+=t[1],r.pos[2]+=t[2],r.norm[0]+=e[0],r.norm[1]+=e[1],r.norm[2]+=e[2],r.count+=1):n.set(i,{pos:[...t],norm:[...e],count:1})};if(i){let e=this.objectForSample,i=W[t],r=D[i],n=R[i],o=I[i],a=r(e.subdivPointerNew);for(let t=0;t<=a-1;t++){let i=n(e.subdivPointerNew,t),r=o(e.subdivPointerNew,t);J.fromArray(i).applyMatrix4(e.matrixWorld),X.fromArray(r),s(J.toArray(),X.toArray())}}else(r.index?function(t){let e=[],i=Math.floor(t.index.count/3);for(let r=0;r<i;r++)if(L.fromArray(t.index.array,3*r),q.setFromAttributeAndIndices(t.attributes.position,L.x,L.y,L.z),q.getNormal(G),q.getMidpoint(H),!(isNaN(H.x)||isNaN(H.y)||isNaN(H.z))){let{a:t,b:i,c:r}=q,n=t.toArray(),s=i.toArray(),o=r.toArray(),a=t.distanceTo(i),l=i.distanceTo(r),h=r.distanceTo(t),c=k(n,s),d=k(s,o),u=k(o,n),p=[a,l,h],m=Math.max(...p),f=p.filter(t=>Math.round(t)===Math.round(m)).length>1,y=[],b=q.getMidpoint(H).toArray();m===a&&!f&&(y=[d,u,u],b=c),m===l&&!f&&(y=[c,u,u],b=d),m===h&&!f&&(y=[c,d,d],b=u),f&&(y=[c,d,u]),e.push({vertices:[n,s,o],faceCenters:y,midpoint:b,norm:q.getNormal(G).toArray()})}return e}(r):function(t){let e=[],{position:i}=t.attributes;for(let t=0;t<i.count;t++){q.setFromAttributeAndIndices(i,3*t,3*t+1,3*t+2),q.getNormal(G),q.getMidpoint(H);let r=q.a.toArray(),n=q.b.toArray(),s=q.c.toArray();e.push({vertices:[r,n,s],faceCenters:[k(r,n),k(n,s),k(s,r)],midpoint:H.toArray(),norm:G.toArray()})}return e}(r)).forEach((e,i)=>{"polygon_center"===t&&s(e.midpoint,e.norm),"vertex"===t&&(s(e.vertices[0],e.norm),s(e.vertices[1],e.norm),s(e.vertices[2],e.norm)),"edge"===t&&(s(e.faceCenters[0],e.norm),s(e.faceCenters[1],e.norm),s(e.faceCenters[2],e.norm))});let o=Array.from(n.values());for(let t of o)t.pos[0]/=t.count,t.pos[1]/=t.count,t.pos[2]/=t.count,t.norm[0]/=t.count,t.norm[1]/=t.count,t.norm[2]/=t.count;if(!i&&r){let e=r.getAttribute("position");this.surfacePointsCache={spreadType:t,geometry:r,position:e,positionVersion:gt(e),index:r.index,indexVersion:null===r.index?-1:r.index.version,points:o}}return o}updateState(t,e){this.parameters=o(t);let{parent:i,matrix:r}=this;if("toObject"!==this.parameters.type)this.invalidateSurfaceCaches(),(null===this.parent||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(null===this.parent||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent(),this.invalidateSurfaceCaches();let t=e.scene.find(this.parameters.toObject.object);this.objectForSample=t instanceof s?t:void 0,this.matrix=new u,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,t&&t.add(this)}let n=this._layout(e);this._syncEnclosingCopies(n||this.parent!==i||this.matrix!==r)}get pendingMediaLoad(){return this._pendingMediaLoad}},jt=class extends wt{constructor(t){super(t.object,t.parameters),this.source=t,this.matrixAutoUpdate=!1}get insideBoolean(){return this.source.insideBoolean}expand(){this.matrix=this.source.matrix,this.matrixWorldNeedsUpdate=!0;let t=0;for(let e of this.source.children){if(!(e instanceof r))continue;let i=this.children[t];void 0===i&&(i=new r(this.object),this.add(i)),i.matrix=e.matrix,i.matrixWorldNeedsUpdate=!0,i.expand(),t+=1}for(;this.children.length>t;)this.remove(this.children[t])}};export{wt as a};
|
|
1
|
+
import{a as t}from"./runtime-chunk-ATIHBDZ3.js";import{b as e}from"./runtime-chunk-WQGGIBPJ.js";import{H as i,ia as r}from"./runtime-chunk-TLPOKI2U.js";import{f as n,v as s}from"./runtime-chunk-RSGWMNDQ.js";import{c as o}from"./runtime-chunk-RTLL6WIB.js";import{c as a}from"./runtime-chunk-2PT2WH66.js";import{L as l}from"./runtime-chunk-ADHKZQMB.js";import{Ec as h,Gc as c,Hc as d,Qc as u,Rc as p,Tc as m,Yc as f,sd as y}from"./runtime-chunk-KPOUV3HD.js";import{a as b,b as x}from"./runtime-chunk-ML3Z74BL.js";var g=x(b((t,e)=>{var i,r;i=t,r=function(){return t.importState=function(e){var i=new t;return i.importState(e),i},t;function t(){return function(t){var e=0,i=0,r=0,n=1;0==t.length&&(t=[+new Date]);var s=function(){var t=4022871197,e=function(e){e=e.toString();for(var i=0;i<e.length;i++){var r=.02519603282416938*(t+=e.charCodeAt(i));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)};return e.version="Mash 0.9",e}();e=s(" "),i=s(" "),r=s(" ");for(var o=0;o<t.length;o++)(e-=s(t[o]))<0&&(e+=1),(i-=s(t[o]))<0&&(i+=1),(r-=s(t[o]))<0&&(r+=1);s=null;var a=function(){var t=2091639*e+2.3283064365386963e-10*n;return e=i,i=r,r=t-(n=0|t)};return a.next=a,a.uint32=function(){return 4294967296*a()},a.fract53=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.version="Alea 0.9",a.args=t,a.exportState=function(){return[e,i,r,n]},a.importState=function(t){e=+t[0]||0,i=+t[1]||0,r=+t[2]||0,n=+t[3]||0},a}(Array.prototype.slice.call(arguments))}},"object"==typeof t?e.exports=r():"function"==typeof define&&define.amd?define(r):i.Alea=r()})()),v=.5*(Math.sqrt(3)-1),M=(3-Math.sqrt(3))/6,w=1/3,j=1/6,A=(Math.sqrt(5),Math.sqrt(5),t=>0|Math.floor(t)),S=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),_=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);function F(t){let e=new Uint8Array(512);for(let t=0;t<256;t++)e[t]=t;for(let i=0;i<255;i++){let r=i+~~(t()*(256-i)),n=e[i];e[i]=e[r],e[r]=n}for(let t=256;t<512;t++)e[t]=e[t-256];return e}var C=new f,z=class{constructor(t){this.weightAttribute=null;let e=t.geometry;if(!e.isBufferGeometry||3!==e.attributes.position.itemSize)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");e.index&&(e=e.toNonIndexed()),this.geometry=e,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let t=this.positionAttribute,e=new Float32Array(t.count/3);for(let i=0;i<t.count;i+=3){let r=1;C.a.fromBufferAttribute(t,i),C.b.fromBufferAttribute(t,i+1),C.c.fromBufferAttribute(t,i+2),r*=C.getArea(),e[i/3]=r}this.distribution=new Float32Array(t.count/3);let i=0;for(let t=0;t<e.length;t++)i+=e[t],this.distribution[t]=i;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e){if(this.distribution){let i=this.distribution[this.distribution.length-1],r=this.binarySearch(this.randomFunction()*i);return this.sampleFace(r,t,e)}}binarySearch(t){if(!this.distribution)return 0;let e=this.distribution,i=0,r=e.length-1,n=-1;for(;i<=r;){let s=Math.ceil((i+r)/2);if(0===s||e[s-1]<=t&&e[s]>t){n=s;break}t<e[s]?r=s-1:i=s+1}return n}sampleFace(t,e,i){let r=this.randomFunction(),n=this.randomFunction();return r+n>1&&(r=1-r,n=1-n),C.a.fromBufferAttribute(this.positionAttribute,3*t),C.b.fromBufferAttribute(this.positionAttribute,3*t+1),C.c.fromBufferAttribute(this.positionAttribute,3*t+2),e.set(0,0,0).addScaledVector(C.a,r).addScaledVector(C.b,n).addScaledVector(C.c,1-(r+n)),C.getNormal(i),this}},W={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},O={polygon_center:0,edge:1,vertex:2},N=(t,e)=>(i,r)=>e&&0!==i&&0!==t?t*r/100:0,P=(t,e)=>{let i=Math.abs(e),r=-1*i;return(t- -1)*(i-r)/2+r},T=new d,B=new d,U=new d,I=new d;function k(t,e){let i=U.fromArray(t),r=I.fromArray(e);B.copy(r).sub(i);let n=B.length();return B.normalize().multiplyScalar(.5*n),T.copy(i).add(B).toArray()}var R,V,D,E,L=new f,q=new d,G=new d,H=new d,$=class extends y{},Q=class extends ${constructor(t,e){super(void 0,void 0,e),this.source=t,this.isClonerInstancedMesh=!0,this.pivotMatrix=new u,this.previousModelViewMatrix=new u,this.copyPreviousMatrix=!0,this.capacity=e,this.count=0,this.matrixAutoUpdate=!1}raycast(t,e){}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(let e of this.children)e.updateMatrixWorld(t)}updateWorldMatrix(t,e){let i=this.parent;if(t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorld.multiply(this.pivotMatrix),e)for(let t of this.children)t.updateWorldMatrix(!1,!0)}onAfterRender(t,e,i,r,n,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}get visible(){return!0!==this.source.cloner?.insideBoolean&&(this.source.visible||this.source.dataPatched.visible&&!0===this.source.dataPatched.cloner?.hideBase)}set visible(t){}get castShadow(){return this.source.castShadow}set castShadow(t){}get receiveShadow(){return this.source.receiveShadow}set receiveShadow(t){}get layers(){return this.source.layers}set layers(t){}get geometry(){return this.source.geometry}set geometry(t){}get material(){return this.source.material}set material(t){}get morphTargetInfluences(){return this.source.morphTargetInfluences}set morphTargetInfluences(t){}},K=t=>.5*(1-Math.cos(t*Math.PI)),Z=class{constructor(){this.perlin=new Array(4096)}noise(t,e=0,i=0){if(null==this.perlin){this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=Math.random()}t<0&&(t=-t),e<0&&(e=-e),i<0&&(i=-i);let r,n,s,o,a,l=Math.floor(t),h=Math.floor(e),c=Math.floor(i),d=t-l,u=e-h,p=i-c,m=0,f=.5;for(let t=0;t<4;t++){let t=l+(h<<4)+(c<<8);r=K(d),n=K(u),s=this.perlin[4095&t],s+=r*(this.perlin[t+1&4095]-s),o=this.perlin[t+16&4095],o+=r*(this.perlin[t+16+1&4095]-o),s+=n*(o-s),t+=256,o=this.perlin[4095&t],o+=r*(this.perlin[t+1&4095]-o),a=this.perlin[t+16&4095],a+=r*(this.perlin[t+16+1&4095]-a),o+=n*(a-o),s+=K(p)*(o-s),m+=s*f,f*=.5,l<<=1,d*=2,h<<=1,u*=2,c<<=1,p*=2,d>=1&&(l++,d--),u>=1&&(h++,u--),p>=1&&(c++,p--)}return m}noiseSeed(t){let e=(()=>{let t,e;return{setSeed(i){e=t=(i??4294967296*Math.random())>>>0},getSeed:()=>t,rand:()=>(e=(1664525*e+1013904223)%4294967296,e/4294967296)}})();e.setSeed(t),this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=e.rand()}},J=1e-4,Y=new d,X=new d;i.then(t=>{V=[(R=t).get_face_center,R.get_edge_midpoint,R.get_vertex_position],D=[R.get_face_normal,R.get_edge_normal,R.get_vertex_normal],E=[R.face_count,R.edge_count,R.vertex_count]}),new u;var tt=new u,et=new u,it=new u,rt=new u,nt=new u,st=new u,ot=new d,at=new d,lt=new d,ht=new d,ct=new d,dt=new d,ut=new d,pt=new d,mt=new d,ft=new d,yt=new d,bt=new p,xt=new c;function gt(t){return t?t.version??t.data?.version??0:-1}function vt(t,e){return["number"==typeof t?.[0]?t[0]:"string"==typeof t?.[0]&&e?parseFloat(String(e.shared.getVariable(t[0])??"0")):0,"number"==typeof t?.[1]?t[1]:"string"==typeof t?.[1]&&e?parseFloat(String(e.shared.getVariable(t[1])??"0")):0,"number"==typeof t?.[2]?t[2]:"string"==typeof t?.[2]&&e?parseFloat(String(e.shared.getVariable(t[2])??"0")):0]}var Mt=class{constructor(t,e){this.data=t,this.is3D=e,this.perlin=new Z,"perlin"===t.noiseType?(this.perlin.noiseSeed(t.seed),this.noise=e?(t,e,i)=>this.perlin.noise(t,e,i):t=>this.perlin.noise(t)):this.noise=e?function(t=Math.random){let e=F(t),i=new Float64Array(e).map(t=>_[t%12*3]),r=new Float64Array(e).map(t=>_[t%12*3+1]),n=new Float64Array(e).map(t=>_[t%12*3+2]);return function(t,s,o){let a,l,h,c,d,u,p,m,f,y,b=(t+s+o)*w,x=A(t+b),g=A(s+b),v=A(o+b),M=(x+g+v)*j,S=t-(x-M),_=s-(g-M),F=o-(v-M);S>=_?_>=F?(d=1,u=0,p=0,m=1,f=1,y=0):S>=F?(d=1,u=0,p=0,m=1,f=0,y=1):(d=0,u=0,p=1,m=1,f=0,y=1):_<F?(d=0,u=0,p=1,m=0,f=1,y=1):S<F?(d=0,u=1,p=0,m=0,f=1,y=1):(d=0,u=1,p=0,m=1,f=1,y=0);let C=S-d+j,z=_-u+j,W=F-p+j,O=S-m+2*j,N=_-f+2*j,P=F-y+2*j,T=S-1+.5,B=_-1+.5,U=F-1+.5,I=255&x,k=255&g,R=255&v,V=.6-S*S-_*_-F*F;if(V<0)a=0;else{let t=I+e[k+e[R]];V*=V,a=V*V*(i[t]*S+r[t]*_+n[t]*F)}let D=.6-C*C-z*z-W*W;if(D<0)l=0;else{let t=I+d+e[k+u+e[R+p]];D*=D,l=D*D*(i[t]*C+r[t]*z+n[t]*W)}let E=.6-O*O-N*N-P*P;if(E<0)h=0;else{let t=I+m+e[k+f+e[R+y]];E*=E,h=E*E*(i[t]*O+r[t]*N+n[t]*P)}let L=.6-T*T-B*B-U*U;if(L<0)c=0;else{let t=I+1+e[k+1+e[R+1]];L*=L,c=L*L*(i[t]*T+r[t]*B+n[t]*U)}return 32*(a+l+h+c)}}((0,g.default)(t.seed)):function(t=Math.random){let e=F(t),i=new Float64Array(e).map(t=>S[t%12*2]),r=new Float64Array(e).map(t=>S[t%12*2+1]);return function(t,n){let s,o,a=0,l=0,h=0,c=(t+n)*v,d=A(t+c),u=A(n+c),p=(d+u)*M,m=t-(d-p),f=n-(u-p);m>f?(s=1,o=0):(s=0,o=1);let y=m-s+M,b=f-o+M,x=m-1+2*M,g=f-1+2*M,w=255&d,j=255&u,S=.5-m*m-f*f;if(S>=0){let t=w+e[j];S*=S,a=S*S*(i[t]*m+r[t]*f)}let _=.5-y*y-b*b;if(_>=0){let t=w+s+e[j+o];_*=_,l=_*_*(i[t]*y+r[t]*b)}let F=.5-x*x-g*g;if(F>=0){let t=w+1+e[j+1];F*=F,h=F*F*(i[t]*x+r[t]*g)}return 70*(a+l+h)}}((0,g.default)(t.seed??""))}},wt=class extends(n(m)){constructor(t,e){super(),this.parameters=e,this.isCloner=!0,this.objectForSample=void 0,this._pendingMediaLoad=!1,this.random=null,this.surfaceSamplerCache=null,this.surfacePointsCache=null,this.object=t}resetOnMove(){this.removeFromParent(),this.parent=null}removeFromParent(){return super.removeFromParent(),this.instancedMesh?.removeFromParent(),this}dispose(){this.removeFromParent(),this._disposeInstancedMesh(),this._invalidateBoolean(),this._syncEnclosingCopies(!0)}createCopy(){return new jt(this)}_syncEnclosingCopies(t){!t&&this.parent!==this.object.parent||this.object.traverseEntityAncestors(e=>{let i=e.cloner;void 0===i||null===i.parent||(t&&i.expandCopies(),i.invalidateTransform(this.object))})}_invalidateBoolean(){this.object instanceof s&&this.object.onClonerLayoutUpdated()}expandClones(t){null===this.parent?this.updateState(this.parameters,t):this.expandCopies()}expandCopies(){for(let t of this.children)t instanceof r&&t.expand();this._syncInstancedMesh()}invalidateTransform(t){this.matrixWorldNeedsUpdate=!0}onObjUpdateMatrix(){"toObject"!==this.parameters.type&&(this.matrixWorldNeedsUpdate=!0)}update(t){this._syncEnclosingCopies(this._layout(t))}_layout(t){let e=this.children.length;switch(this._updateCount(t),this.parameters.type){case"radial":this._updateRadial(this.parameters,t);break;case"linear":this._updateLinear(this.parameters,t);break;case"grid":this._updateGrid(this.parameters,t);break;case"toObject":this._updateToObject(this.parameters,t)}for(let t of this.children){let e=t.transformOverride;void 0!==e&&(t.position.fromArray(e.position),t.rotation.fromArray(e.rotation),t.scale.fromArray(e.scale)),t.updateMatrix(),t.hasNonUniformScale&&(t.updateMatrixWorld(),t.updateMatrixWorldRigid())}return this._syncInstancedMesh(),this._invalidateBoolean(),this.children.length!==e}get instancingActive(){return void 0!==this.instancedMesh}get insideBoolean(){return null!==this.parent&&"booleanOp"in this.parent}_instancingEligible(){if(!0!==this.parameters.instanced)return!1;let t=this.object;return!(t.entityChildrenCount()>0||!0!==t.isMesh||a(t)||!0===t.isDecalObject)}_syncInstancedMesh(){if(!this._instancingEligible())return void this._disposeInstancedMesh();let t=this.instancedMesh;if(void 0!==t&&t.capacity<this.children.length&&(this._disposeInstancedMesh(),t=void 0),void 0===t){let e=Math.max(8,Math.ceil(1.5*this.children.length));t=this.instancedMesh=new Q(this.object,e)}t.matrix=this.matrix,t.matrixWorldNeedsUpdate=!0,t.parent!==this.parent&&(t.removeFromParent(),this.parent?.add(t)),this.syncInstanceMatrices()}syncInstanceMatrices(){this._invalidateBoolean();let t=this.instancedMesh;if(void 0===t)return;let e=0;for(let i of this.children)!1!==i.playModeVisible&&(et.copy(i.matrix).multiply(i.pivotMatrix),t.setMatrixAt(e++,et));t.count=e,t.instanceMatrix.needsUpdate=!0,t.boundingSphere=null}_disposeInstancedMesh(){let t=this.instancedMesh;void 0!==t&&(this.instancedMesh=void 0,t.removeFromParent(),t.dispose())}_updateCount(t,e){let i;if(void 0!==e)i=e;else{let e=vt(this.parameters.grid.count,t);i="grid"===this.parameters.type?Math.round(e[0])*Math.round(e[1])*Math.round(e[2]):this.parameters.count}if("toObject"===this.parameters.type)if(this.parameters.toObject.object){if(void 0===e&&"random"!==this.parameters.toObject.spreadType)return}else i=0;if(this.children.length!==i)if(this.children.length<i)for(let t=0,e=i-this.children.length;t<e;++t){let t=new r(this.object);t.expand(),this.add(t)}else for(;this.children.length>i;){let t=this.children.pop();t.parent=null,t.dispatchEvent({type:"removed"}),this.dispatchEvent({type:"childremoved",child:t})}}getRandom(t,e=!1){return(null===this.random||this.random.data.seed!==t.seed||this.random.data.noiseType!==t.noiseType||this.random.is3D!==e)&&(this.random=new Mt(t,e)),this.random}_updateRadial(t,e){let i,r=t.radial,n=r.start*h.DEG2RAD,s=n-r.end*h.DEG2RAD,o=vt(r.rotation,e),a=new p(o[0],o[1],o[2]);switch(r.axis){case"z":i=new d(0,0,1);break;case"y":i=new d(0,1,0);break;default:i=new d(1,0,0)}let c=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,u=!0===this.parameters.randomness&&0!==c.strength?this.getRandom(c):null,m=vt(r.scale,e),f=vt(r.position,e),y=vt(c.scale,e),b=vt(c.position,e),x=vt(c.rotation,e),g=s/t.count,v=N(c.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let s=t*(c.freqScale/10)+c.movement,o=null===u?0:u.noise(s,s,s),l=t+1;e.scale.x=m[0]+v(l,P(o,y[0]))||J,e.scale.y=m[1]+v(l,P(o,y[1]))||J,e.scale.z=m[2]+v(l,P(o,y[2]))||J;let h=g*t-n;switch(r.axis){default:case"x":bt.set(0,h,0);break;case"y":bt.set(0,0,h);break;case"z":bt.set(h,0,0)}ut.copy(i).applyQuaternion(xt.setFromEuler(bt)).multiplyScalar(r.radius),e.position.set(ut.x+(f[0]+v(l,P(o,b[0]))),ut.y+(f[1]+v(l,P(o,b[1]))),ut.z+(f[2]+v(l,P(o,b[2]))));let d=v(l,P(o,x[0])),p=v(l,P(o,x[1])),M=v(l,P(o,x[2]));!0===r.alignment?e.rotation.set(bt.x+(a.x+d),bt.y+(a.y+p),bt.z+(a.z+M)):e.rotation.set(a.x+d,a.y+p,a.z+M)}}_updateLinear(t,e){if("linear"!==t.type)throw new Error;let i=t.linear,r=vt(i.rotation,e),n=vt(i.scale,e),s=vt(i.position,e),o=new p(r[0]??0,r[1]??0,r[2]??0),a=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,h=vt(a.rotation,e),c=vt(a.scale,e),d=vt(a.position,e),u=!0===this.parameters.randomness&&0!==a.strength?this.getRandom(a):null,m=N(a.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let i=t*(a.freqScale/10)+a.movement,r=null===u?0:u.noise(i,i,i),l=t+1,p=m(l,P(r,h[0])),f=m(l,P(r,h[1])),y=m(l,P(r,h[2]));e.scale.x=1+(n[0]-1)*t+m(l,P(r,c[0]))||J,e.scale.y=1+(n[1]-1)*t+m(l,P(r,c[1]))||J,e.scale.z=1+(n[2]-1)*t+m(l,P(r,c[2]))||J,e.rotation.set(o.x*t+p,o.y*t+f,o.z*t+y),e.position.x=s[0]*t+m(l,P(r,d[0])),e.position.y=s[1]*t+m(l,P(r,d[1])),e.position.z=s[2]*t+m(l,P(r,d[2]))}}_updateGrid(t,e){let i=0,r=t.grid,n=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,s=vt(n.scale,e),o=vt(n.rotation,e),a=vt(n.position,e),h=!0===this.parameters.randomness&&0!==n.strength?this.getRandom(n,!0):null,c=N(n.strength,this.parameters.randomness),u=vt(r.count,e),p=vt(r.size,e);if(!0===r.useCenter){let t={x:u[0]%2==0?2:1,y:u[1]%2==0?2:1,z:u[2]%2==0?2:1},e=new d(p[0]*(u[0]-t.x)*.5,p[1]*(u[1]-t.y)*.5,p[2]*(u[2]-t.z)*.5);for(let t=0;t<u[0];t++)for(let r=0;r<u[1];r++)for(let l=0;l<u[2];l++){let d=this.children[i++];if(!d)continue;let u=null===h?0:h.noise((t+1)*(n.freqScale/10)+n.movement,(r+1)*(n.freqScale/10)+n.movement,(l+1)*(n.freqScale/10)+n.movement);d.scale.x=1+c(i,P(u,s[0]))||J,d.scale.y=1+c(i,P(u,s[1]))||J,d.scale.z=1+c(i,P(u,s[2]))||J;let m=c(i,P(u,o[0])),f=c(i,P(u,o[1])),y=c(i,P(u,o[2]));d.rotation.set(m,f,y),d.position.x=p[0]*t-e.x+c(i,P(u,a[0])),d.position.y=p[1]*r-e.y+c(i,P(u,a[1])),d.position.z=p[2]*l-e.z+c(i,P(u,a[2]))}}else for(let t=0;t<u[0];t++)for(let e=0;e<u[1];e++)for(let r=0;r<u[2];r++){let l=this.children[i++];if(!l)continue;let d=null===h?0:h.noise((t+1)*(n.freqScale/10)+n.movement,(e+1)*(n.freqScale/10)+n.movement,(r+1)*(n.freqScale/10)+n.movement);l.scale.x=1+c(i,P(d,s[0]))||J,l.scale.y=1+c(i,P(d,s[1]))||J,l.scale.z=1+c(i,P(d,s[2]))||J;let u=c(i,P(d,o[0])),m=c(i,P(d,o[1])),f=c(i,P(d,o[2]));l.rotation.set(u,m,f),l.position.x=p[0]*t+c(i,P(d,a[0])),l.position.y=-p[1]*e+c(i,P(d,a[1])),l.position.z=-p[2]*r+c(i,P(d,a[2]))}}_updateToObject(i,r){if("toObject"!==i.type)throw new Error;let{toObject:n}=i,s=vt(n.rotation,r),o=vt(n.position,r),a=vt(n.scale,r),h=new p(s[0],s[1],s[2]),c=i.randomnessObject??l.defaultData([1,1,1]).randomnessObject,d=vt(c.rotation,r),u=vt(c.position,r),m=vt(c.scale,r),f=!0===this.parameters.randomness&&0!==c.strength?this.getRandom(c):null,y=N(c.strength,this.parameters.randomness);if(!n.object){for(let[,t]of this.children.entries())t.position.set(0,0,0),t.scale.setScalar(1),t.rotation.set(0,0,0);return this.objectForSample=void 0,void this.invalidateSurfaceCaches()}if(!this.objectForSample)return;if(this.objectForSample instanceof t){if(!this.objectForSample.font?.isLoaded||void 0===this.objectForSample.geometry.attributes.position)return void(this._pendingMediaLoad=!0);this._pendingMediaLoad=!1}if(void 0===this.objectForSample.geometry&&this.objectForSample.isAncestorOf(this.object.uuid))return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) seem to be a child/descendant of the object it's being cloned to. Please re-parent it so that they are siblings instead.`);let b=this.getSubdivData();if(b.length>0){let t=Math.round(b.length*n.count/100);this._updateCount(r,t)}else{let t=this.objectForSample.geometry.getAttribute("position");if(!t||isNaN(t.count)||0===t.count)return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`)}this.objectForSample.updateMatrixWorld();let x="random"===n.spreadType,v=null;x&&(v=this.getSurfaceSampler(),v.setRandomGenerator((0,g.default)(this.object.uuid+n.seed)));let M=W[n.axis],w=this.children;ot.fromArray(M);let j=this.objectForSample instanceof e;j&&it.copy(this.objectForSample.matrixWorld).invert(),"normal"!==n.align&&this.object.getWorldDirection(dt),ft.set(ot.y,ot.z,ot.x).normalize(),yt.copy(ft).cross(ot).normalize(),nt.makeBasis(ft,ot,yt).invert();for(let[t,e]of w.entries()){let i=t*(c.freqScale/10)+c.movement,r=null===f?0:f.noise(i,i,i),s=t+1,l=y(s,P(r,d[0])),p=y(s,P(r,d[1])),g=y(s,P(r,d[2]));x?v.sample(lt,ht):(b.length&&(lt.fromArray(b[t].pos),ht.fromArray(b[t].norm)),j&<.applyMatrix4(it)),e.position.copy(lt);let M="normal"===n.align?ht:dt,w=at.fromArray(o);at.x+=y(s,P(r,u[0])),at.y+=y(s,P(r,u[1])),at.z+=y(s,P(r,u[2]));let A=Math.acos(M.dot(ot)),S=ct.crossVectors(ot,M).normalize(),_=tt.makeRotationAxis(S,A);pt.copy(M).cross(this.object.up).normalize(),mt.copy(pt).cross(M).normalize(),rt.makeBasis(pt,M,mt),st.multiplyMatrices(rt,nt),bt.setFromRotationMatrix(st),w.applyMatrix4(_),e.position.add(w),e.rotation.set(bt.x+h.x+l,bt.y+h.y+p,bt.z+h.z+g),e.scale.set(1+a[0]+y(s,P(r,m[0]))||J,1+a[1]+y(s,P(r,m[1]))||J,1+a[2]+y(s,P(r,m[2]))||J),e.scale.multiply(this.object.scale)}}getSurfaceSampler(){let t=this.objectForSample,e=t.geometry,i=e.getAttribute("position"),r=e.index,n=this.surfaceSamplerCache;if(null!==n&&n.geometry===e&&n.position===i&&n.positionVersion===gt(i)&&n.index===r&&n.indexVersion===(null===r?-1:r.version))return n.sampler;let s=new z(t).build();return this.surfaceSamplerCache={geometry:e,position:i,positionVersion:gt(i),index:r,indexVersion:null===r?-1:r.version,sampler:s},s}invalidateSurfaceCaches(){this.surfaceSamplerCache=null,this.surfacePointsCache=null}getSubdivData(){if(!this.objectForSample)return[];let t=this.parameters.toObject.spreadType;if("random"===t)return[];let i=this.objectForSample instanceof e,r=this.objectForSample.geometry;if(!i&&r){let e=this.surfacePointsCache,i=r.getAttribute("position");if(null!==e&&e.spreadType===t&&e.geometry===r&&e.position===i&&e.positionVersion===gt(i)&&e.index===r.index&&e.indexVersion===(null===r.index?-1:r.index.version))return e.points}let n=new Map,s=(t,e)=>{let i=Math.round(1e4*t[0])+"_"+Math.round(1e4*t[1])+"_"+Math.round(1e4*t[2]),r=n.get(i);r?(r.pos[0]+=t[0],r.pos[1]+=t[1],r.pos[2]+=t[2],r.norm[0]+=e[0],r.norm[1]+=e[1],r.norm[2]+=e[2],r.count+=1):n.set(i,{pos:[...t],norm:[...e],count:1})};if(i){let e=this.objectForSample,i=O[t],r=E[i],n=V[i],o=D[i],a=r(e.subdivPointerNew);for(let t=0;t<=a-1;t++){let i=n(e.subdivPointerNew,t),r=o(e.subdivPointerNew,t);Y.fromArray(i).applyMatrix4(e.matrixWorld),X.fromArray(r),s(Y.toArray(),X.toArray())}}else(r.index?function(t){let e=[],i=Math.floor(t.index.count/3);for(let r=0;r<i;r++)if(q.fromArray(t.index.array,3*r),L.setFromAttributeAndIndices(t.attributes.position,q.x,q.y,q.z),L.getNormal(G),L.getMidpoint(H),!(isNaN(H.x)||isNaN(H.y)||isNaN(H.z))){let{a:t,b:i,c:r}=L,n=t.toArray(),s=i.toArray(),o=r.toArray(),a=t.distanceTo(i),l=i.distanceTo(r),h=r.distanceTo(t),c=k(n,s),d=k(s,o),u=k(o,n),p=[a,l,h],m=Math.max(...p),f=p.filter(t=>Math.round(t)===Math.round(m)).length>1,y=[],b=L.getMidpoint(H).toArray();m===a&&!f&&(y=[d,u,u],b=c),m===l&&!f&&(y=[c,u,u],b=d),m===h&&!f&&(y=[c,d,d],b=u),f&&(y=[c,d,u]),e.push({vertices:[n,s,o],faceCenters:y,midpoint:b,norm:L.getNormal(G).toArray()})}return e}(r):function(t){let e=[],{position:i}=t.attributes;for(let t=0;t<i.count;t++){L.setFromAttributeAndIndices(i,3*t,3*t+1,3*t+2),L.getNormal(G),L.getMidpoint(H);let r=L.a.toArray(),n=L.b.toArray(),s=L.c.toArray();e.push({vertices:[r,n,s],faceCenters:[k(r,n),k(n,s),k(s,r)],midpoint:H.toArray(),norm:G.toArray()})}return e}(r)).forEach((e,i)=>{"polygon_center"===t&&s(e.midpoint,e.norm),"vertex"===t&&(s(e.vertices[0],e.norm),s(e.vertices[1],e.norm),s(e.vertices[2],e.norm)),"edge"===t&&(s(e.faceCenters[0],e.norm),s(e.faceCenters[1],e.norm),s(e.faceCenters[2],e.norm))});let o=Array.from(n.values());for(let t of o)t.pos[0]/=t.count,t.pos[1]/=t.count,t.pos[2]/=t.count,t.norm[0]/=t.count,t.norm[1]/=t.count,t.norm[2]/=t.count;if(!i&&r){let e=r.getAttribute("position");this.surfacePointsCache={spreadType:t,geometry:r,position:e,positionVersion:gt(e),index:r.index,indexVersion:null===r.index?-1:r.index.version,points:o}}return o}updateState(t,e){this.parameters=o(t);let{parent:i,matrix:r}=this;if("toObject"!==this.parameters.type)this.invalidateSurfaceCaches(),(null===this.parent||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(null===this.parent||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent(),this.invalidateSurfaceCaches();let t=e.scene.find(this.parameters.toObject.object);this.objectForSample=t instanceof s?t:void 0,this.matrix=new u,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,t&&t.add(this)}let n=this._layout(e);this._syncEnclosingCopies(n||this.parent!==i||this.matrix!==r)}get pendingMediaLoad(){return this._pendingMediaLoad}},jt=class extends wt{constructor(t){super(t.object,t.parameters),this.source=t,this.matrixAutoUpdate=!1}get insideBoolean(){return this.source.insideBoolean}expand(){this.matrix=this.source.matrix,this.matrixWorldNeedsUpdate=!0;let t=0;for(let e of this.source.children){if(!(e instanceof r))continue;let i=this.children[t];void 0===i&&(i=new r(this.object),this.add(i)),i.matrix=e.matrix,i.matrixWorldNeedsUpdate=!0,i.expand(),t+=1}for(;this.children.length>t;)this.remove(this.children[t])}};export{wt as a};
|
|
Binary file
|
|
Binary file
|