@splinetool/runtime 2.0.120 → 2.0.121
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-V5LMC2YR.js → runtime-bloom-XTLXQU6Z.js} +1 -1
- package/build/runtime-bloom-XTLXQU6Z.js.br +0 -0
- package/build/runtime-bloom-XTLXQU6Z.js.gz +0 -0
- package/build/{runtime-brightnessContrast-W2NZ6YEX.js → runtime-brightnessContrast-CDPNJ7RG.js} +1 -1
- package/build/runtime-brightnessContrast-CDPNJ7RG.js.br +0 -0
- package/build/runtime-brightnessContrast-CDPNJ7RG.js.gz +0 -0
- package/build/{runtime-chromaticAberration-7OWHGFI4.js → runtime-chromaticAberration-DDHRMNVQ.js} +1 -1
- package/build/runtime-chromaticAberration-DDHRMNVQ.js.br +0 -0
- package/build/runtime-chromaticAberration-DDHRMNVQ.js.gz +0 -0
- package/build/{runtime-chunk-FT7MGKH6.js → runtime-chunk-2MFKCFLH.js} +1 -1
- package/build/runtime-chunk-2MFKCFLH.js.br +0 -0
- package/build/runtime-chunk-2MFKCFLH.js.gz +0 -0
- package/build/{runtime-chunk-V5ARCZX7.js → runtime-chunk-43PAMFY2.js} +1 -1
- package/build/runtime-chunk-43PAMFY2.js.br +2 -0
- package/build/runtime-chunk-43PAMFY2.js.gz +0 -0
- package/build/{runtime-chunk-7RKTLZVE.js → runtime-chunk-5OG2IWUE.js} +1 -1
- package/build/runtime-chunk-5OG2IWUE.js.br +0 -0
- package/build/runtime-chunk-5OG2IWUE.js.gz +0 -0
- package/build/{runtime-chunk-LS4TJVNI.js → runtime-chunk-5PUPU45E.js} +1 -1
- package/build/runtime-chunk-5PUPU45E.js.br +0 -0
- package/build/runtime-chunk-5PUPU45E.js.gz +0 -0
- package/build/{runtime-chunk-CQS6GEHK.js → runtime-chunk-6LNDQI4B.js} +1 -1
- package/build/runtime-chunk-6LNDQI4B.js.br +0 -0
- package/build/runtime-chunk-6LNDQI4B.js.gz +0 -0
- package/build/{runtime-chunk-6J64GRLM.js → runtime-chunk-AGYFT3FS.js} +1 -1
- package/build/{runtime-chunk-6J64GRLM.js.br → runtime-chunk-AGYFT3FS.js.br} +0 -0
- package/build/runtime-chunk-AGYFT3FS.js.gz +0 -0
- package/build/{runtime-chunk-3LSX6UFK.js → runtime-chunk-AITJTUU6.js} +1 -1
- package/build/runtime-chunk-AITJTUU6.js.br +0 -0
- package/build/runtime-chunk-AITJTUU6.js.gz +0 -0
- package/build/{runtime-chunk-ORI6JQTJ.js → runtime-chunk-ALY3FQFE.js} +1 -1
- package/build/{runtime-chunk-ORI6JQTJ.js.br → runtime-chunk-ALY3FQFE.js.br} +0 -0
- package/build/runtime-chunk-ALY3FQFE.js.gz +0 -0
- package/build/{runtime-chunk-ONTSSVSC.js → runtime-chunk-BKVCF5KL.js} +1 -1
- package/build/runtime-chunk-BKVCF5KL.js.br +0 -0
- package/build/runtime-chunk-BKVCF5KL.js.gz +0 -0
- package/build/{runtime-chunk-K5R5AFO7.js → runtime-chunk-DR4H3WDU.js} +1 -1
- package/build/runtime-chunk-DR4H3WDU.js.br +0 -0
- package/build/runtime-chunk-DR4H3WDU.js.gz +0 -0
- package/build/runtime-chunk-EEGQIKBG.js +1 -0
- package/build/runtime-chunk-EEGQIKBG.js.br +0 -0
- package/build/runtime-chunk-EEGQIKBG.js.gz +0 -0
- package/build/{runtime-chunk-AGCSRI3Z.js → runtime-chunk-EU6SVXPS.js} +1 -1
- package/build/runtime-chunk-EU6SVXPS.js.br +0 -0
- package/build/runtime-chunk-EU6SVXPS.js.gz +0 -0
- package/build/{runtime-chunk-AZYYWYF2.js → runtime-chunk-FVG45G3P.js} +1 -1
- package/build/runtime-chunk-FVG45G3P.js.br +0 -0
- package/build/runtime-chunk-FVG45G3P.js.gz +0 -0
- package/build/{runtime-chunk-2X4DS3ZZ.js → runtime-chunk-FWKFGQQV.js} +1 -1
- package/build/runtime-chunk-FWKFGQQV.js.br +0 -0
- package/build/runtime-chunk-FWKFGQQV.js.gz +0 -0
- package/build/{runtime-chunk-6W6HVQ7K.js → runtime-chunk-GV5YW5SK.js} +1 -1
- package/build/runtime-chunk-GV5YW5SK.js.br +0 -0
- package/build/runtime-chunk-GV5YW5SK.js.gz +0 -0
- package/build/{runtime-chunk-5T4KVHD7.js → runtime-chunk-GX6N3OA3.js} +1 -1
- package/build/runtime-chunk-GX6N3OA3.js.br +0 -0
- package/build/runtime-chunk-GX6N3OA3.js.gz +0 -0
- package/build/{runtime-chunk-Q6JEXIAW.js → runtime-chunk-KIL3Q6FY.js} +1 -1
- package/build/runtime-chunk-KIL3Q6FY.js.br +0 -0
- package/build/runtime-chunk-KIL3Q6FY.js.gz +0 -0
- package/build/{runtime-chunk-H37W2WAU.js → runtime-chunk-L5PKJILG.js} +1 -1
- package/build/runtime-chunk-L5PKJILG.js.br +0 -0
- package/build/runtime-chunk-L5PKJILG.js.gz +0 -0
- package/build/{runtime-chunk-V6BL7K7M.js → runtime-chunk-LW3YSNZG.js} +1 -1
- package/build/runtime-chunk-LW3YSNZG.js.br +0 -0
- package/build/runtime-chunk-LW3YSNZG.js.gz +0 -0
- package/build/{runtime-chunk-YJUK5JAN.js → runtime-chunk-M2P42KAR.js} +1 -1
- package/build/runtime-chunk-M2P42KAR.js.br +0 -0
- package/build/runtime-chunk-M2P42KAR.js.gz +0 -0
- package/build/{runtime-chunk-OBR3SMY6.js → runtime-chunk-M4IH2NUY.js} +1 -1
- package/build/runtime-chunk-M4IH2NUY.js.br +0 -0
- package/build/runtime-chunk-M4IH2NUY.js.gz +0 -0
- package/build/{runtime-chunk-S6MLA45W.js → runtime-chunk-QXXS3OWS.js} +1 -1
- package/build/runtime-chunk-QXXS3OWS.js.br +0 -0
- package/build/runtime-chunk-QXXS3OWS.js.gz +0 -0
- package/build/{runtime-chunk-JB3UAHHJ.js → runtime-chunk-TG6YHZNU.js} +1 -1
- package/build/runtime-chunk-TG6YHZNU.js.br +0 -0
- package/build/runtime-chunk-TG6YHZNU.js.gz +0 -0
- package/build/{runtime-chunk-RZLDKCNG.js → runtime-chunk-WW7HK74K.js} +1 -1
- package/build/runtime-chunk-WW7HK74K.js.br +0 -0
- package/build/runtime-chunk-WW7HK74K.js.gz +0 -0
- package/build/runtime-chunk-Z7C3WAEM.js +1 -0
- package/build/runtime-chunk-Z7C3WAEM.js.br +0 -0
- package/build/runtime-chunk-Z7C3WAEM.js.gz +0 -0
- package/build/{runtime-chunk-PIP3K2LP.js → runtime-chunk-ZLHBRCRQ.js} +1 -1
- package/build/runtime-chunk-ZLHBRCRQ.js.br +0 -0
- package/build/runtime-chunk-ZLHBRCRQ.js.gz +0 -0
- package/build/{runtime-chunk-HSAAIU54.js → runtime-chunk-ZUWSSLSY.js} +1 -1
- package/build/runtime-chunk-ZUWSSLSY.js.br +0 -0
- package/build/{runtime-chunk-HSAAIU54.js.gz → runtime-chunk-ZUWSSLSY.js.gz} +0 -0
- package/build/{runtime-classicRuntime-S2Z5VXUA.js → runtime-classicRuntime-SYPHCDFU.js} +1 -1
- package/build/runtime-classicRuntime-SYPHCDFU.js.br +0 -0
- package/build/runtime-classicRuntime-SYPHCDFU.js.gz +0 -0
- package/build/{runtime-cloners-SFFETEVS.js → runtime-cloners-WXJR7EJS.js} +1 -1
- package/build/runtime-cloners-WXJR7EJS.js.br +0 -0
- package/build/runtime-cloners-WXJR7EJS.js.gz +0 -0
- package/build/{runtime-components-236SWVLU.js → runtime-components-4N7HHT7P.js} +1 -1
- package/build/runtime-components-4N7HHT7P.js.br +0 -0
- package/build/runtime-components-4N7HHT7P.js.gz +0 -0
- package/build/{runtime-createDestroy-KHT7L634.js → runtime-createDestroy-YUXIYS5V.js} +1 -1
- package/build/runtime-createDestroy-YUXIYS5V.js.br +0 -0
- package/build/runtime-createDestroy-YUXIYS5V.js.gz +0 -0
- package/build/{runtime-depthOfField-XCF2SQ2E.js → runtime-depthOfField-5GXRFRPK.js} +1 -1
- package/build/runtime-depthOfField-5GXRFRPK.js.br +0 -0
- package/build/runtime-depthOfField-5GXRFRPK.js.gz +0 -0
- package/build/{runtime-dragDrop-Y44MBNCQ.js → runtime-dragDrop-Z5M36WZW.js} +1 -1
- package/build/runtime-dragDrop-Z5M36WZW.js.br +0 -0
- package/build/runtime-dragDrop-Z5M36WZW.js.gz +0 -0
- package/build/{runtime-gameControls-J6B4H3M2.js → runtime-gameControls-KQONHQ2T.js} +1 -1
- package/build/runtime-gameControls-KQONHQ2T.js.br +0 -0
- package/build/runtime-gameControls-KQONHQ2T.js.gz +0 -0
- package/build/{runtime-hair-5TBTUAQC.js → runtime-hair-WYR7QKPH.js} +1 -1
- package/build/runtime-hair-WYR7QKPH.js.br +1 -0
- package/build/runtime-hair-WYR7QKPH.js.gz +0 -0
- package/build/{runtime-hueSaturation-37AWXZBP.js → runtime-hueSaturation-XOCFJTCM.js} +1 -1
- package/build/runtime-hueSaturation-XOCFJTCM.js.br +0 -0
- package/build/runtime-hueSaturation-XOCFJTCM.js.gz +0 -0
- package/build/{runtime-mergeStaticGeometries-3LPTQXGM.js → runtime-mergeStaticGeometries-V6JAND2W.js} +1 -1
- package/build/runtime-mergeStaticGeometries-V6JAND2W.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-V6JAND2W.js.gz +0 -0
- package/build/{runtime-miscActions-C7NNQTWM.js → runtime-miscActions-HISS2TQB.js} +1 -1
- package/build/runtime-miscActions-HISS2TQB.js.br +0 -0
- package/build/runtime-miscActions-HISS2TQB.js.gz +0 -0
- package/build/{runtime-mouseHover-3HTVMOAZ.js → runtime-mouseHover-V7LU2USF.js} +1 -1
- package/build/runtime-mouseHover-V7LU2USF.js.br +0 -0
- package/build/runtime-mouseHover-V7LU2USF.js.gz +0 -0
- package/build/{runtime-noise-E2O65JME.js → runtime-noise-KKR33IT4.js} +1 -1
- package/build/runtime-noise-KKR33IT4.js.br +0 -0
- package/build/runtime-noise-KKR33IT4.js.gz +0 -0
- package/build/{runtime-particles-BN4SGPK6.js → runtime-particles-RK5MBMNU.js} +1 -1
- package/build/runtime-particles-RK5MBMNU.js.br +0 -0
- package/build/runtime-particles-RK5MBMNU.js.gz +0 -0
- package/build/{runtime-paths-4QGAAGAS.js → runtime-paths-EYUXAWJM.js} +1 -1
- package/build/runtime-paths-EYUXAWJM.js.br +0 -0
- package/build/runtime-paths-EYUXAWJM.js.gz +0 -0
- package/build/{runtime-pixelation-I7IY7MPD.js → runtime-pixelation-PJ66OTBJ.js} +1 -1
- package/build/runtime-pixelation-PJ66OTBJ.js.br +0 -0
- package/build/runtime-pixelation-PJ66OTBJ.js.gz +0 -0
- package/build/{runtime-resize-6ANRHXF4.js → runtime-resize-C44PW3VI.js} +1 -1
- package/build/runtime-resize-C44PW3VI.js.br +0 -0
- package/build/runtime-resize-C44PW3VI.js.gz +0 -0
- package/build/{runtime-sceneTransition-V4I2SDEA.js → runtime-sceneTransition-MXTK4ORW.js} +1 -1
- package/build/runtime-sceneTransition-MXTK4ORW.js.br +0 -0
- package/build/runtime-sceneTransition-MXTK4ORW.js.gz +0 -0
- package/build/{runtime-scroll-ONQ3WAZ2.js → runtime-scroll-J56X4MKN.js} +1 -1
- package/build/runtime-scroll-J56X4MKN.js.br +0 -0
- package/build/runtime-scroll-J56X4MKN.js.gz +0 -0
- package/build/runtime-shapeBlends-HBV2E4ET.js +1 -0
- package/build/runtime-shapeBlends-HBV2E4ET.js.br +2 -0
- package/build/runtime-shapeBlends-HBV2E4ET.js.gz +0 -0
- package/build/{runtime-text-SKXDPVIO.js → runtime-text-XYP3PKEF.js} +1 -1
- package/build/runtime-text-XYP3PKEF.js.br +0 -0
- package/build/runtime-text-XYP3PKEF.js.gz +0 -0
- package/build/{runtime-textInputs-SFSDC4J4.js → runtime-textInputs-S2K6VN56.js} +1 -1
- package/build/runtime-textInputs-S2K6VN56.js.br +0 -0
- package/build/runtime-textInputs-S2K6VN56.js.gz +0 -0
- package/build/{runtime-timeline-UBLPOMON.js → runtime-timeline-DTSEWGQQ.js} +1 -1
- package/build/runtime-timeline-DTSEWGQQ.js.br +0 -0
- package/build/runtime-timeline-DTSEWGQQ.js.gz +0 -0
- package/build/{runtime-tracking-UQUP5GMY.js → runtime-tracking-TNVGNPLL.js} +1 -1
- package/build/runtime-tracking-TNVGNPLL.js.br +0 -0
- package/build/runtime-tracking-TNVGNPLL.js.gz +0 -0
- package/build/{runtime-transitions-GDQQQFEQ.js → runtime-transitions-SLMOC4NU.js} +1 -1
- package/build/runtime-transitions-SLMOC4NU.js.br +0 -0
- package/build/runtime-transitions-SLMOC4NU.js.gz +0 -0
- package/build/{runtime-ui2d-U4CFDJX5.js → runtime-ui2d-YNBRQ4M4.js} +1 -1
- package/build/runtime-ui2d-YNBRQ4M4.js.br +0 -0
- package/build/runtime-ui2d-YNBRQ4M4.js.gz +0 -0
- package/build/{runtime-vectorShapes-3VXB2JQI.js → runtime-vectorShapes-GY4AIX7H.js} +1 -1
- package/build/runtime-vectorShapes-GY4AIX7H.js.br +0 -0
- package/build/runtime-vectorShapes-GY4AIX7H.js.gz +0 -0
- package/build/{runtime-vignette-4F2BPMZY.js → runtime-vignette-JKMV5HSG.js} +1 -1
- package/build/runtime-vignette-JKMV5HSG.js.br +0 -0
- package/build/runtime-vignette-JKMV5HSG.js.gz +0 -0
- package/build/{runtime-webgpu-UK6KUGRI.js → runtime-webgpu-N5BHY2ER.js} +1 -1
- package/build/runtime-webgpu-N5BHY2ER.js.br +0 -0
- package/build/runtime-webgpu-N5BHY2ER.js.gz +0 -0
- package/build/runtime.cjs +340 -340
- 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-V5LMC2YR.js.br +0 -0
- package/build/runtime-bloom-V5LMC2YR.js.gz +0 -0
- package/build/runtime-brightnessContrast-W2NZ6YEX.js.br +0 -0
- package/build/runtime-brightnessContrast-W2NZ6YEX.js.gz +0 -0
- package/build/runtime-chromaticAberration-7OWHGFI4.js.br +0 -0
- package/build/runtime-chromaticAberration-7OWHGFI4.js.gz +0 -0
- package/build/runtime-chunk-2GJB7ICN.js +0 -1
- package/build/runtime-chunk-2GJB7ICN.js.br +0 -0
- package/build/runtime-chunk-2GJB7ICN.js.gz +0 -0
- package/build/runtime-chunk-2X4DS3ZZ.js.br +0 -0
- package/build/runtime-chunk-2X4DS3ZZ.js.gz +0 -0
- package/build/runtime-chunk-3LSX6UFK.js.br +0 -0
- package/build/runtime-chunk-3LSX6UFK.js.gz +0 -0
- package/build/runtime-chunk-5T4KVHD7.js.br +0 -2
- package/build/runtime-chunk-5T4KVHD7.js.gz +0 -0
- package/build/runtime-chunk-6J64GRLM.js.gz +0 -0
- package/build/runtime-chunk-6W6HVQ7K.js.br +0 -0
- package/build/runtime-chunk-6W6HVQ7K.js.gz +0 -0
- package/build/runtime-chunk-7RKTLZVE.js.br +0 -0
- package/build/runtime-chunk-7RKTLZVE.js.gz +0 -0
- package/build/runtime-chunk-AGCSRI3Z.js.br +0 -0
- package/build/runtime-chunk-AGCSRI3Z.js.gz +0 -0
- package/build/runtime-chunk-AZYYWYF2.js.br +0 -0
- package/build/runtime-chunk-AZYYWYF2.js.gz +0 -0
- package/build/runtime-chunk-CJF5I57E.js +0 -1
- package/build/runtime-chunk-CJF5I57E.js.br +0 -0
- package/build/runtime-chunk-CJF5I57E.js.gz +0 -0
- package/build/runtime-chunk-CQS6GEHK.js.br +0 -0
- package/build/runtime-chunk-CQS6GEHK.js.gz +0 -0
- package/build/runtime-chunk-FT7MGKH6.js.br +0 -0
- package/build/runtime-chunk-FT7MGKH6.js.gz +0 -0
- package/build/runtime-chunk-H37W2WAU.js.br +0 -0
- package/build/runtime-chunk-H37W2WAU.js.gz +0 -0
- package/build/runtime-chunk-HSAAIU54.js.br +0 -0
- package/build/runtime-chunk-JB3UAHHJ.js.br +0 -0
- package/build/runtime-chunk-JB3UAHHJ.js.gz +0 -0
- package/build/runtime-chunk-K5R5AFO7.js.br +0 -0
- package/build/runtime-chunk-K5R5AFO7.js.gz +0 -0
- package/build/runtime-chunk-LS4TJVNI.js.br +0 -0
- package/build/runtime-chunk-LS4TJVNI.js.gz +0 -0
- package/build/runtime-chunk-OBR3SMY6.js.br +0 -0
- package/build/runtime-chunk-OBR3SMY6.js.gz +0 -0
- package/build/runtime-chunk-ONTSSVSC.js.br +0 -0
- package/build/runtime-chunk-ONTSSVSC.js.gz +0 -0
- package/build/runtime-chunk-ORI6JQTJ.js.gz +0 -0
- package/build/runtime-chunk-PIP3K2LP.js.br +0 -0
- package/build/runtime-chunk-PIP3K2LP.js.gz +0 -0
- package/build/runtime-chunk-Q6JEXIAW.js.br +0 -0
- package/build/runtime-chunk-Q6JEXIAW.js.gz +0 -0
- package/build/runtime-chunk-RZLDKCNG.js.br +0 -0
- package/build/runtime-chunk-RZLDKCNG.js.gz +0 -0
- package/build/runtime-chunk-S6MLA45W.js.br +0 -0
- package/build/runtime-chunk-S6MLA45W.js.gz +0 -0
- package/build/runtime-chunk-V5ARCZX7.js.br +0 -2
- package/build/runtime-chunk-V5ARCZX7.js.gz +0 -0
- package/build/runtime-chunk-V6BL7K7M.js.br +0 -0
- package/build/runtime-chunk-V6BL7K7M.js.gz +0 -0
- package/build/runtime-chunk-YJUK5JAN.js.br +0 -0
- package/build/runtime-chunk-YJUK5JAN.js.gz +0 -0
- package/build/runtime-classicRuntime-S2Z5VXUA.js.br +0 -0
- package/build/runtime-classicRuntime-S2Z5VXUA.js.gz +0 -0
- package/build/runtime-cloners-SFFETEVS.js.br +0 -0
- package/build/runtime-cloners-SFFETEVS.js.gz +0 -0
- package/build/runtime-components-236SWVLU.js.br +0 -0
- package/build/runtime-components-236SWVLU.js.gz +0 -0
- package/build/runtime-createDestroy-KHT7L634.js.br +0 -0
- package/build/runtime-createDestroy-KHT7L634.js.gz +0 -0
- package/build/runtime-depthOfField-XCF2SQ2E.js.br +0 -0
- package/build/runtime-depthOfField-XCF2SQ2E.js.gz +0 -0
- package/build/runtime-dragDrop-Y44MBNCQ.js.br +0 -0
- package/build/runtime-dragDrop-Y44MBNCQ.js.gz +0 -0
- package/build/runtime-gameControls-J6B4H3M2.js.br +0 -0
- package/build/runtime-gameControls-J6B4H3M2.js.gz +0 -0
- package/build/runtime-hair-5TBTUAQC.js.br +0 -3
- package/build/runtime-hair-5TBTUAQC.js.gz +0 -0
- package/build/runtime-hueSaturation-37AWXZBP.js.br +0 -0
- package/build/runtime-hueSaturation-37AWXZBP.js.gz +0 -0
- package/build/runtime-mergeStaticGeometries-3LPTQXGM.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-3LPTQXGM.js.gz +0 -0
- package/build/runtime-miscActions-C7NNQTWM.js.br +0 -0
- package/build/runtime-miscActions-C7NNQTWM.js.gz +0 -0
- package/build/runtime-mouseHover-3HTVMOAZ.js.br +0 -0
- package/build/runtime-mouseHover-3HTVMOAZ.js.gz +0 -0
- package/build/runtime-noise-E2O65JME.js.br +0 -0
- package/build/runtime-noise-E2O65JME.js.gz +0 -0
- package/build/runtime-particles-BN4SGPK6.js.br +0 -0
- package/build/runtime-particles-BN4SGPK6.js.gz +0 -0
- package/build/runtime-paths-4QGAAGAS.js.br +0 -0
- package/build/runtime-paths-4QGAAGAS.js.gz +0 -0
- package/build/runtime-pixelation-I7IY7MPD.js.br +0 -0
- package/build/runtime-pixelation-I7IY7MPD.js.gz +0 -0
- package/build/runtime-resize-6ANRHXF4.js.br +0 -0
- package/build/runtime-resize-6ANRHXF4.js.gz +0 -0
- package/build/runtime-sceneTransition-V4I2SDEA.js.br +0 -0
- package/build/runtime-sceneTransition-V4I2SDEA.js.gz +0 -0
- package/build/runtime-scroll-ONQ3WAZ2.js.br +0 -0
- package/build/runtime-scroll-ONQ3WAZ2.js.gz +0 -0
- package/build/runtime-shapeBlends-H67QAKUD.js +0 -1
- package/build/runtime-shapeBlends-H67QAKUD.js.br +0 -2
- package/build/runtime-shapeBlends-H67QAKUD.js.gz +0 -0
- package/build/runtime-text-SKXDPVIO.js.br +0 -0
- package/build/runtime-text-SKXDPVIO.js.gz +0 -0
- package/build/runtime-textInputs-SFSDC4J4.js.br +0 -0
- package/build/runtime-textInputs-SFSDC4J4.js.gz +0 -0
- package/build/runtime-timeline-UBLPOMON.js.br +0 -0
- package/build/runtime-timeline-UBLPOMON.js.gz +0 -0
- package/build/runtime-tracking-UQUP5GMY.js.br +0 -0
- package/build/runtime-tracking-UQUP5GMY.js.gz +0 -0
- package/build/runtime-transitions-GDQQQFEQ.js.br +0 -0
- package/build/runtime-transitions-GDQQQFEQ.js.gz +0 -0
- package/build/runtime-ui2d-U4CFDJX5.js.br +0 -0
- package/build/runtime-ui2d-U4CFDJX5.js.gz +0 -0
- package/build/runtime-vectorShapes-3VXB2JQI.js.br +0 -0
- package/build/runtime-vectorShapes-3VXB2JQI.js.gz +0 -0
- package/build/runtime-vignette-4F2BPMZY.js.br +0 -0
- package/build/runtime-vignette-4F2BPMZY.js.gz +0 -0
- package/build/runtime-webgpu-UK6KUGRI.js.br +0 -0
- package/build/runtime-webgpu-UK6KUGRI.js.gz +0 -0
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@splinetool/runtime",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.121",
|
|
4
4
|
"description": "Spline is a collaborative design platform for creating production-ready interactive experiences in multiple dimensions. © 2026 Spline, Inc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"spline",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,d as t}from"./runtime-chunk-4YV3EXSU.js";import{c as i}from"./runtime-chunk-NSD7DU3P.js";import{a as r,b as s,f as n,h as a,k as o,l,m as h,v as d}from"./runtime-chunk-HSAAIU54.js";import{c as u}from"./runtime-chunk-RTLL6WIB.js";import{c as p,i as c}from"./runtime-chunk-TZCHGFVF.js";import{A as g,I as m,Ia as f,Ja as y,U as v,V as b,a as x,c as w,fa as S,ia as M,k as O,n as A,na as P,oa as _}from"./runtime-chunk-CSILWFMF.js";import{$c as D,Aa as C,Ad as E,Ba as I,Ec as L,Fc as U,Gc as B,Gd as G,Hc as z,Hd as R,Ic as T,Id as k,Ja as F,Jb as j,Jd as V,Je as N,Kc as H,Kd as q,Lc as W,Ld as Y,Nd as X,Od as $,Pd as K,Qc as Z,Qd as J,Rc as Q,Tc as ee,Td as te,Vc as ie,Vd as re,Wd as se,Xd as ne,Yc as ae,Yd as oe,Zc as le,_c as he,_d as de,bd as ue,dd as pe,ed as ce,fd as ge,nd as me,pd as fe,qa as ye,td as ve,ue as be}from"./runtime-chunk-KPOUV3HD.js";function xe(e,t=!1){let i=null!==e[0].index,r=new Set(Object.keys(e[0].attributes)),s=new Set(Object.keys(e[0].morphAttributes)),n={},a={},o=e[0].morphTargetsRelative,l=new ge,h=0;for(let d=0;d<e.length;++d){let u=e[d],p=0;if(i!==(null!==u.index))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let e in u.attributes){if(!r.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+'. All geometries must have compatible attributes; make sure "'+e+'" attribute exists among all geometries, or in none of them.'),null;void 0===n[e]&&(n[e]=[]),n[e].push(u.attributes[e]),p++}if(p!==r.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". Make sure all geometries have the same number of attributes."),null;if(o!==u.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let e in u.morphAttributes){if(!s.has(e))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". .morphAttributes must be consistent throughout all geometries."),null;void 0===a[e]&&(a[e]=[]),a[e].push(u.morphAttributes[e])}if(t){let e;if(i)e=u.index.count;else{if(void 0===u.attributes.position)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+d+". The geometry must have either an index or a position attribute"),null;e=u.attributes.position.count}l.addGroup(h,e,d),h+=e}}if(i){let t=0,i=[];for(let r=0;r<e.length;++r){let s=e[r].index;for(let e=0;e<s.count;++e)i.push(s.getX(e)+t);t+=e[r].attributes.position.count}l.setIndex(i)}for(let e in n){let t=we(n[e]);if(!t)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" attribute."),null;l.setAttribute(e,t)}for(let e in a){let t=a[e][0].length;if(0!==t){l.morphAttributes=l.morphAttributes||{},l.morphAttributes[e]=[];for(let i=0;i<t;++i){let t=[];for(let r=0;r<a[e].length;++r)t.push(a[e][r][i]);let r=we(t);if(!r)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+e+" morphAttribute."),null;l.morphAttributes[e].push(r)}}}return l}function we(e){let t,i,r,s=-1,n=0;for(let a=0;a<e.length;++a){let o=e[a];if(void 0===t&&(t=o.array.constructor),t!==o.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(void 0===i&&(i=o.itemSize),i!==o.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(void 0===r&&(r=o.normalized),r!==o.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(-1===s&&(s=o.gpuType),s!==o.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;n+=o.count*i}let a=new t(n),o=new D(a,i,r),l=0;for(let t=0;t<e.length;++t){let r=e[t];if(r.isInterleavedBufferAttribute){let e=l/i;for(let t=0,s=r.count;t<s;t++)for(let s=0;s<i;s++){let i=r.getComponent(t,s);o.setComponent(t+e,s,i)}}else a.set(r.array,l);l+=r.count*i}return void 0!==s&&(o.gpuType=s),o}function Se(e,t=1e-4){t=Math.max(t,Number.EPSILON);let i={},r=e.getIndex(),s=e.getAttribute("position"),n=r?r.count:s.count,a=0,o=Object.keys(e.attributes),l={},h={},d=[],u=["getX","getY","getZ","getW"],p=["setX","setY","setZ","setW"];for(let t=0,i=o.length;t<i;t++){let i=o[t],r=e.attributes[i];l[i]=new r.constructor(new r.array.constructor(r.count*r.itemSize),r.itemSize,r.normalized);let s=e.morphAttributes[i];s&&(h[i]||(h[i]=[]),s.forEach((e,t)=>{let r=new e.array.constructor(e.count*e.itemSize);h[i][t]=new e.constructor(r,e.itemSize,e.normalized)}))}let c=.5*t,g=Math.log10(1/t),m=Math.pow(10,g),f=c*m;for(let t=0;t<n;t++){let s=r?r.getX(t):t,n="";for(let t=0,i=o.length;t<i;t++){let i=o[t],r=e.getAttribute(i),a=r.itemSize;for(let e=0;e<a;e++)n+=~~(r[u[e]](s)*m+f)+","}if(n in i)d.push(i[n]);else{for(let t=0,i=o.length;t<i;t++){let i=o[t],r=e.getAttribute(i),n=e.morphAttributes[i],d=r.itemSize,c=l[i],g=h[i];for(let e=0;e<d;e++){let t=u[e],i=p[e];if(c[i](a,r[t](s)),n)for(let e=0,r=n.length;e<r;e++)g[e][i](a,n[e][t](s))}}i[n]=a,d.push(a),a++}}let y=e.clone();for(let t in e.attributes){let e=l[t];if(y.setAttribute(t,new e.constructor(e.array.slice(0,a*e.itemSize),e.itemSize,e.normalized)),t in h)for(let e=0;e<h[t].length;e++){let i=h[t][e];y.morphAttributes[t][e]=new i.constructor(i.array.slice(0,a*i.itemSize),i.itemSize,i.normalized)}}return y.setIndex(d),y}var Me,Oe,Ae,Pe=null;function _e(e){Pe=e}function De(e){let t=!1;return e.scene.objects.traverse((e,i)=>{"Mesh"===i.type&&("TextGeometry"===i.geometry.type||"InputGeometry"===i.geometry.type)&&(t=!0)}),t}function Ce(e,t){if(!e)throw t||"Assertion Failed!"}(Oe=Me||(Me={}))[Oe.ODD=0]="ODD",Oe[Oe.NONZERO=1]="NONZERO",Oe[Oe.POSITIVE=2]="POSITIVE",Oe[Oe.NEGATIVE=3]="NEGATIVE",Oe[Oe.ABS_GEQ_TWO=4]="ABS_GEQ_TWO",function(e){e[e.POLYGONS=0]="POLYGONS",e[e.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",e[e.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"}(Ae||(Ae={}));var Ee=function(){function e(){}return e.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},e.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},e.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},e.edgeGoesLeft=function(t){return e.vertLeq(t.Dst,t.Org)},e.edgeGoesRight=function(t){return e.vertLeq(t.Org,t.Dst)},e.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},e.edgeEval=function(t,i,r){Ce(e.vertLeq(t,i)&&e.vertLeq(i,r));var s=i.s-t.s,n=r.s-i.s;return s+n>0?s<n?i.t-t.t+(t.t-r.t)*(s/(s+n)):i.t-r.t+(r.t-t.t)*(n/(s+n)):0},e.edgeSign=function(t,i,r){Ce(e.vertLeq(t,i)&&e.vertLeq(i,r));var s=i.s-t.s,n=r.s-i.s;return s+n>0?(i.t-r.t)*s+(i.t-t.t)*n:0},e.transEval=function(t,i,r){Ce(e.transLeq(t,i)&&e.transLeq(i,r));var s=i.t-t.t,n=r.t-i.t;return s+n>0?s<n?i.s-t.s+(t.s-r.s)*(s/(s+n)):i.s-r.s+(r.s-t.s)*(n/(s+n)):0},e.transSign=function(t,i,r){Ce(e.transLeq(t,i)&&e.transLeq(i,r));var s=i.t-t.t,n=r.t-i.t;return s+n>0?(i.s-r.s)*s+(i.s-t.s)*n:0},e.vertCCW=function(e,t,i){return e.s*(t.t-i.t)+t.s*(i.t-e.t)+i.s*(e.t-t.t)>=0},e.interpolate=function(e,t,i,r){return(e=e<0?0:e)<=(i=i<0?0:i)?0===i?(t+r)/2:t+e/(e+i)*(r-t):r+i/(e+i)*(t-r)},e.intersect=function(t,i,r,s,n){var a,o,l;e.vertLeq(t,i)||(l=t,t=i,i=l),e.vertLeq(r,s)||(l=r,r=s,s=l),e.vertLeq(t,r)||(l=t,t=r,r=l,l=i,i=s,s=l),e.vertLeq(r,i)?e.vertLeq(i,s)?((a=e.edgeEval(t,r,i))+(o=e.edgeEval(r,i,s))<0&&(a=-a,o=-o),n.s=e.interpolate(a,r.s,o,i.s)):((a=e.edgeSign(t,r,i))+(o=-e.edgeSign(t,s,i))<0&&(a=-a,o=-o),n.s=e.interpolate(a,r.s,o,s.s)):n.s=(r.s+i.s)/2,e.transLeq(t,i)||(l=t,t=i,i=l),e.transLeq(r,s)||(l=r,r=s,s=l),e.transLeq(t,r)||(l=t,t=r,r=l,l=i,i=s,s=l),e.transLeq(r,i)?e.transLeq(i,s)?((a=e.transEval(t,r,i))+(o=e.transEval(r,i,s))<0&&(a=-a,o=-o),n.t=e.interpolate(a,r.t,o,i.t)):((a=e.transSign(t,r,i))+(o=-e.transSign(t,s,i))<0&&(a=-a,o=-o),n.t=e.interpolate(a,r.t,o,s.t)):n.t=(r.t+i.t)/2},e}(),Ie=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},Le=function(){function e(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(e.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),e}(),Ue=function(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0},Be=function(){function e(){var e=new Ue,t=new Ie,i=new Le(0),r=new Le(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,i.next=i,i.Sym=r,r.next=r,r.Sym=i,this.vHead=e,this.fHead=t,this.eHead=i,this.eHeadSym=r}return e.prototype.makeEdge_=function(e){var t=new Le(0),i=new Le(1);e.Sym.side<e.side&&(e=e.Sym);var r=e.Sym.next;return i.next=r,r.Sym.next=t,t.next=e,e.Sym.next=i,t.Sym=i,t.Onext=t,t.Lnext=i,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,i.Sym=t,i.Onext=i,i.Lnext=t,i.Org=null,i.Lface=null,i.winding=0,i.activeRegion=null,t},e.prototype.splice_=function(e,t){var i=e.Onext,r=t.Onext;i.Sym.Lnext=t,r.Sym.Lnext=e,e.Onext=r,t.Onext=i},e.prototype.makeVertex_=function(e,t,i){var r=e;Ce(r,"Vertex can't be null!");var s=i.prev;r.prev=s,s.next=r,r.next=i,i.prev=r,r.anEdge=t;var n=t;do{n.Org=r,n=n.Onext}while(n!==t)},e.prototype.makeFace_=function(e,t,i){var r=e;Ce(r,"Face can't be null");var s=i.prev;r.prev=s,s.next=r,r.next=i,i.prev=r,r.anEdge=t,r.trail=null,r.marked=!1,r.inside=i.inside;var n=t;do{n.Lface=r,n=n.Lnext}while(n!==t)},e.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,i=e.Sym.next;t.Sym.next=i,i.Sym.next=t},e.prototype.killVertex_=function(e,t){var i=e.anEdge,r=i;do{r.Org=t,r=r.Onext}while(r!==i);var s=e.prev,n=e.next;n.prev=s,s.next=n},e.prototype.killFace_=function(e,t){var i=e.anEdge,r=i;do{r.Lface=t,r=r.Lnext}while(r!==i);var s=e.prev,n=e.next;n.prev=s,s.next=n},e.prototype.makeEdge=function(){var e=new Ue,t=new Ue,i=new Ie,r=this.makeEdge_(this.eHead);return this.makeVertex_(e,r,this.vHead),this.makeVertex_(t,r.Sym,this.vHead),this.makeFace_(i,r,this.fHead),r},e.prototype.splice=function(e,t){var i=!1,r=!1;if(e!==t){if(t.Org!==e.Org&&(r=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!r){var s=new Ue;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!i){var n=new Ie;this.makeFace_(n,t,e.Lface),e.Lface.anEdge=e}}},e.prototype.delete=function(e){var t=e.Sym,i=!1;if(e.Lface!==e.Rface&&(i=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!i){var r=new Ie;this.makeFace_(r,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},e.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),i=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var r=new Ue;return this.makeVertex_(r,i,t.Org),t.Lface=i.Lface=e.Lface,t},e.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e).Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,t),e.Dst=t.Org,t.Dst.anEdge=t.Sym,t.Rface=e.Rface,t.winding=e.winding,t.Sym.winding=e.Sym.winding,t.idx=e.idx,t.Sym.idx=e.Sym.idx,t},e.prototype.connect=function(e,t){var i=!1,r=this.makeEdge_(e),s=r.Sym;if(t.Lface!==e.Lface&&(i=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(r,e.Lnext),this.splice_(s,t),r.Org=e.Dst,s.Org=t.Org,r.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!i){var n=new Ie;this.makeFace_(n,r,e.Lface)}return r},e.prototype.zapFace=function(e){var t,i,r,s,n,a=e.anEdge;i=a.Lnext;do{i=(t=i).Lnext,t.Lface=null,null===t.Rface&&(t.Onext===t?this.killVertex_(t.Org,null):(t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),(r=t.Sym).Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),this.killEdge_(t))}while(t!=a);s=e.prev,(n=e.next).prev=s,s.next=n},e.prototype.countFaceVerts_=function(e){var t=e.anEdge,i=0;do{i++,t=t.Lnext}while(t!==e.anEdge);return i},e.prototype.mergeConvexFaces=function(e){var t,i,r,s,n;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(t.inside)for(n=(i=t.anEdge).Org;r=i.Lnext,(s=i.Sym)&&s.Lface&&s.Lface.inside&&this.countFaceVerts_(t)+this.countFaceVerts_(s.Lface)-2<=e&&Ee.vertCCW(i.Lprev.Org,i.Org,s.Lnext.Lnext.Org)&&Ee.vertCCW(s.Lprev.Org,s.Org,i.Lnext.Lnext.Org)&&(r=s.Lnext,this.delete(s),i=null,s=null),!i||i.Lnext.Org!==n;)i=r;return!0},e.prototype.check=function(){var e,t,i,r,s,n,a=this.fHead,o=this.vHead,l=this.eHead;for(t=a,t=a;(e=t.next)!==a;t=e){Ce(e.prev===t),s=e.anEdge;do{Ce(s.Sym!==s),Ce(s.Sym.Sym===s),Ce(s.Lnext.Onext.Sym===s),Ce(s.Onext.Sym.Lnext===s),Ce(s.Lface===e),s=s.Lnext}while(s!==e.anEdge)}for(Ce(e.prev===t&&null===e.anEdge),r=o,r=o;(i=r.next)!==o;r=i){Ce(i.prev===r),s=i.anEdge;do{Ce(s.Sym!==s),Ce(s.Sym.Sym===s),Ce(s.Lnext.Onext.Sym===s),Ce(s.Onext.Sym.Lnext===s),Ce(s.Org===i),s=s.Onext}while(s!==i.anEdge)}for(Ce(i.prev===r&&null===i.anEdge),n=l,n=l;(s=n.next)!==l;n=s)Ce(s.Sym.next===n.Sym),Ce(s.Sym!==s),Ce(s.Sym.Sym===s),Ce(null!==s.Org),Ce(null!==s.Dst),Ce(s.Lnext.Onext.Sym===s),Ce(s.Onext.Sym.Lnext===s);Ce(s.Sym.next===n.Sym&&s.Sym===this.eHeadSym&&s.Sym.Sym===s&&null===s.Org&&null===s.Dst&&null===s.Lface&&null===s.Rface)},e}(),Ge=function(){this.handle=null},ze=function(){this.key=null,this.node=0},Re=function(){function e(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var i=0;i<e+1;i++)this.nodes[i]=new Ge,this.handles[i]=new ze;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return e.prototype.floatDown_=function(e){var t,i,r,s=this.nodes,n=this.handles;for(t=s[e].handle;;){if((r=e<<1)<this.size&&this.leq(n[s[r+1].handle].key,n[s[r].handle].key)&&++r,Ce(r<=this.max),i=s[r].handle,r>this.size||this.leq(n[t].key,n[i].key)){s[e].handle=t,n[t].node=e;break}s[e].handle=i,n[i].node=e,e=r}},e.prototype.floatUp_=function(e){var t,i,r,s=this.nodes,n=this.handles;for(t=s[e].handle;;){if(i=s[r=e>>1].handle,0===r||this.leq(n[i].key,n[t].key)){s[e].handle=t,n[t].node=e;break}s[e].handle=i,n[i].node=e,e=r}},e.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},e.prototype.min=function(){return this.handles[this.nodes[1].handle].key},e.prototype.insert=function(e){var t,i;if(2*(t=++this.size)>this.max){var r,s;for(this.max*=2,s=this.nodes.length,this.nodes.length=this.max+1,r=s;r<this.nodes.length;r++)this.nodes[r]=new Ge;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new ze}return 0===this.freeList?i=t:(i=this.freeList,this.freeList=this.handles[i].node),this.nodes[t].handle=i,this.handles[i].node=t,this.handles[i].key=e,this.initialized&&this.floatUp_(t),i},e.prototype.extractMin=function(){var e=this.nodes,t=this.handles,i=e[1].handle,r=t[i].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[i].key=null,t[i].node=this.freeList,this.freeList=i,--this.size,this.size>0&&this.floatDown_(1)),r},e.prototype.delete=function(e){var t,i=this.nodes,r=this.handles;Ce(e>=1&&e<=this.max&&null!==r[e].key),i[t=r[e].node].handle=i[this.size].handle,r[i[t].handle].node=t,--this.size,t<=this.size&&(t<=1||this.leq(r[i[t>>1].handle].key,r[i[t].handle].key)?this.floatDown_(t):this.floatUp_(t)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},e}(),Te=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},ke=function(){this.key=null,this.next=null,this.prev=null},Fe=function(){function e(e,t){this.frame=e,this.leq=t,this.head=new ke,this.head.next=this.head,this.head.prev=this.head}return e.prototype.min=function(){return this.head.next},e.prototype.max=function(){return this.head.prev},e.prototype.insert=function(e){return this.insertBefore(this.head,e)},e.prototype.search=function(e){var t=this.head;do{t=t.next}while(null!==t.key&&!this.leq(this.frame,e,t.key));return t},e.prototype.insertBefore=function(e,t){do{e=e.prev}while(null!==e.key&&!this.leq(this.frame,e.key,t));var i=new ke;return i.key=t,i.next=e.next,e.next.prev=i,i.prev=e,e.next=i,i},e.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},e}(),je=function(){function e(){}return e.regionBelow=function(e){return e.nodeUp.prev.key},e.regionAbove=function(e){return e.nodeUp.next.key},e.debugEvent=function(e){},e.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.edgeLeq=function(e,t,i){var r=e.event,s=t.eUp,n=i.eUp;return s.Dst===r?n.Dst===r?Ee.vertLeq(s.Org,n.Org)?Ee.edgeSign(n.Dst,s.Org,n.Org)<=0:Ee.edgeSign(s.Dst,n.Org,s.Org)>=0:Ee.edgeSign(n.Dst,r,n.Org)<=0:n.Dst===r?Ee.edgeSign(s.Dst,r,s.Org)>=0:Ee.edgeEval(s.Dst,r,s.Org)>=Ee.edgeEval(n.Dst,r,n.Org)},e.deleteRegion=function(e,t){t.fixUpperEdge&&Ce(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},e.fixUpperEdge=function(e,t,i){Ce(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=i,i.activeRegion=t},e.topLeftRegion=function(t,i){var r,s=i.eUp.Org;do{i=e.regionAbove(i)}while(i.eUp.Org===s);if(i.fixUpperEdge){if(null===(r=t.mesh.connect(e.regionBelow(i).eUp.Sym,i.eUp.Lnext)))return null;e.fixUpperEdge(t,i,r),i=e.regionAbove(i)}return i},e.topRightRegion=function(t){var i=t.eUp.Dst;do{t=e.regionAbove(t)}while(t.eUp.Dst===i);return t},e.addRegionBelow=function(e,t,i){var r=new Te;return r.eUp=i,r.nodeUp=e.dict.insertBefore(t.nodeUp,r),r.fixUpperEdge=!1,r.sentinel=!1,r.dirty=!1,i.activeRegion=r,r},e.isWindingInside=function(e,t){switch(e.windingRule){case Me.ODD:return!!(1&t);case Me.NONZERO:return 0!==t;case Me.POSITIVE:return t>0;case Me.NEGATIVE:return t<0;case Me.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},e.computeWinding=function(t,i){i.windingNumber=e.regionAbove(i).windingNumber+i.eUp.winding,i.inside=e.isWindingInside(t,i.windingNumber)},e.finishRegion=function(t,i){var r=i.eUp,s=r.Lface;s.inside=i.inside,s.anEdge=r,e.deleteRegion(t,i)},e.finishLeftRegions=function(t,i,r){for(var s,n=null,a=i,o=i.eUp;a!==r;){if(a.fixUpperEdge=!1,(s=(n=e.regionBelow(a)).eUp).Org!=o.Org){if(!n.fixUpperEdge){e.finishRegion(t,a);break}s=t.mesh.connect(o.Lprev,s.Sym),e.fixUpperEdge(t,n,s)}o.Onext!==s&&(t.mesh.splice(s.Oprev,s),t.mesh.splice(o,s)),e.finishRegion(t,a),o=n.eUp,a=n}return o},e.addRightEdges=function(t,i,r,s,n,a){var o,l,h,d,u=!0;h=r;do{Ce(Ee.vertLeq(h.Org,h.Dst)),e.addRegionBelow(t,i,h.Sym),h=h.Onext}while(h!==s);for(null===n&&(n=e.regionBelow(i).eUp.Rprev),l=i,d=n;(h=(o=e.regionBelow(l)).eUp.Sym).Org===d.Org;)h.Onext!==d&&(t.mesh.splice(h.Oprev,h),t.mesh.splice(d.Oprev,h)),o.windingNumber=l.windingNumber-h.winding,o.inside=e.isWindingInside(t,o.windingNumber),l.dirty=!0,!u&&e.checkForRightSplice(t,l)&&(e.addWinding(h,d),e.deleteRegion(t,l),t.mesh.delete(d)),u=!1,l=o,d=h;l.dirty=!0,Ce(l.windingNumber-h.winding===o.windingNumber),a&&e.walkDirtyRegions(t,l)},e.spliceMergeVertices=function(e,t,i){e.mesh.splice(t,i)},e.vertexWeights=function(e,t,i){var r=Ee.vertL1dist(t,e),s=Ee.vertL1dist(i,e),n=.5*s/(r+s),a=.5*r/(r+s);e.coords[0]+=n*t.coords[0]+a*i.coords[0],e.coords[1]+=n*t.coords[1]+a*i.coords[1],e.coords[2]+=n*t.coords[2]+a*i.coords[2]},e.getIntersectData=function(t,i,r,s,n,a){i.coords[0]=i.coords[1]=i.coords[2]=0,i.idx=-1,e.vertexWeights(i,r,s),e.vertexWeights(i,n,a)},e.checkForRightSplice=function(t,i){var r=e.regionBelow(i),s=i.eUp,n=r.eUp;if(Ee.vertLeq(s.Org,n.Org)){if(Ee.edgeSign(n.Dst,s.Org,n.Org)>0)return!1;Ee.vertEq(s.Org,n.Org)?s.Org!==n.Org&&(t.pq.delete(s.Org.pqHandle),e.spliceMergeVertices(t,n.Oprev,s)):(t.mesh.splitEdge(n.Sym),t.mesh.splice(s,n.Oprev),i.dirty=r.dirty=!0)}else{if(Ee.edgeSign(s.Dst,n.Org,s.Org)<0)return!1;e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(s.Sym),t.mesh.splice(n.Oprev,s)}return!0},e.checkForLeftSplice=function(t,i){var r,s=e.regionBelow(i),n=i.eUp,a=s.eUp;if(Ce(!Ee.vertEq(n.Dst,a.Dst)),Ee.vertLeq(n.Dst,a.Dst)){if(Ee.edgeSign(n.Dst,a.Dst,n.Org)<0)return!1;e.regionAbove(i).dirty=i.dirty=!0,r=t.mesh.splitEdge(n),t.mesh.splice(a.Sym,r),r.Lface.inside=i.inside}else{if(Ee.edgeSign(a.Dst,n.Dst,a.Org)>0)return!1;i.dirty=s.dirty=!0,r=t.mesh.splitEdge(a),t.mesh.splice(n.Lnext,a.Sym),r.Rface.inside=i.inside}return!0},e.checkForIntersect=function(t,i){var r,s,n=e.regionBelow(i),a=i.eUp,o=n.eUp,l=a.Org,h=o.Org,d=a.Dst,u=o.Dst,p=new Ue;if(Ce(!Ee.vertEq(u,d)),Ce(Ee.edgeSign(d,t.event,l)<=0),Ce(Ee.edgeSign(u,t.event,h)>=0),Ce(l!==t.event&&h!==t.event),Ce(!i.fixUpperEdge&&!n.fixUpperEdge),l===h||Math.min(l.t,d.t)>Math.max(h.t,u.t))return!1;if(Ee.vertLeq(l,h)){if(Ee.edgeSign(u,l,h)>0)return!1}else if(Ee.edgeSign(d,h,l)<0)return!1;return e.debugEvent(t),Ee.intersect(d,l,u,h,p),Ce(Math.min(l.t,d.t)<=p.t),Ce(p.t<=Math.max(h.t,u.t)),Ce(Math.min(u.s,d.s)<=p.s),Ce(p.s<=Math.max(h.s,l.s)),Ee.vertLeq(p,t.event)&&(p.s=t.event.s,p.t=t.event.t),r=Ee.vertLeq(l,h)?l:h,Ee.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),Ee.vertEq(p,l)||Ee.vertEq(p,h)?(e.checkForRightSplice(t,i),!1):!Ee.vertEq(d,t.event)&&Ee.edgeSign(d,t.event,p)>=0||!Ee.vertEq(u,t.event)&&Ee.edgeSign(u,t.event,p)<=0?u===t.event?(t.mesh.splitEdge(a.Sym),t.mesh.splice(o.Sym,a),i=e.topLeftRegion(t,i),a=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),n),e.addRightEdges(t,i,a.Oprev,a,a,!0),!0):d===t.event?(t.mesh.splitEdge(o.Sym),t.mesh.splice(a.Lnext,o.Oprev),n=i,i=e.topRightRegion(i),s=e.regionBelow(i).eUp.Rprev,n.eUp=o.Oprev,o=e.finishLeftRegions(t,n,null),e.addRightEdges(t,i,o.Onext,a.Rprev,s,!0),!0):(Ee.edgeSign(d,t.event,p)>=0&&(e.regionAbove(i).dirty=i.dirty=!0,t.mesh.splitEdge(a.Sym),a.Org.s=t.event.s,a.Org.t=t.event.t),Ee.edgeSign(u,t.event,p)<=0&&(i.dirty=n.dirty=!0,t.mesh.splitEdge(o.Sym),o.Org.s=t.event.s,o.Org.t=t.event.t),!1):(t.mesh.splitEdge(a.Sym),t.mesh.splitEdge(o.Sym),t.mesh.splice(o.Oprev,a),a.Org.s=p.s,a.Org.t=p.t,a.Org.pqHandle=t.pq.insert(a.Org),e.getIntersectData(t,a.Org,l,d,h,u),e.regionAbove(i).dirty=i.dirty=n.dirty=!0,!1)},e.walkDirtyRegions=function(t,i){for(var r,s,n=e.regionBelow(i);;){for(;n.dirty;)i=n,n=e.regionBelow(n);if(!i.dirty&&(n=i,null===(i=e.regionAbove(i))||!i.dirty))return;if(i.dirty=!1,r=i.eUp,s=n.eUp,r.Dst!==s.Dst&&e.checkForLeftSplice(t,i)&&(n.fixUpperEdge?(e.deleteRegion(t,n),t.mesh.delete(s),s=(n=e.regionBelow(i)).eUp):i.fixUpperEdge&&(e.deleteRegion(t,i),t.mesh.delete(r),r=(i=e.regionAbove(n)).eUp)),r.Org!==s.Org)if(r.Dst===s.Dst||i.fixUpperEdge||n.fixUpperEdge||r.Dst!==t.event&&s.Dst!==t.event)e.checkForRightSplice(t,i);else if(e.checkForIntersect(t,i))return;r.Org===s.Org&&r.Dst===s.Dst&&(e.addWinding(s,r),e.deleteRegion(t,i),t.mesh.delete(r),i=e.regionAbove(n))}},e.connectRightVertex=function(t,i,r){var s,n=r.Onext,a=e.regionBelow(i),o=i.eUp,l=a.eUp,h=!1;o.Dst!==l.Dst&&e.checkForIntersect(t,i),Ee.vertEq(o.Org,t.event)&&(t.mesh.splice(n.Oprev,o),i=e.topLeftRegion(t,i),n=e.regionBelow(i).eUp,e.finishLeftRegions(t,e.regionBelow(i),a),h=!0),Ee.vertEq(l.Org,t.event)&&(t.mesh.splice(r,l.Oprev),r=e.finishLeftRegions(t,a,null),h=!0),h?e.addRightEdges(t,i,r.Onext,n,n,!0):(s=Ee.vertLeq(l.Org,o.Org)?l.Oprev:o,s=t.mesh.connect(r.Lprev,s),e.addRightEdges(t,i,s,s.Onext,s.Onext,!1),s.Sym.activeRegion.fixUpperEdge=!0,e.walkDirtyRegions(t,i))},e.connectLeftDegenerate=function(t,i,r){var s,n,a,o,l;return s=i.eUp,Ee.vertEq(s.Org,r)?(Ce(!1),void e.spliceMergeVertices(t,s,r.anEdge)):Ee.vertEq(s.Dst,r)?(Ce(!1),i=e.topRightRegion(i),n=o=(a=(l=e.regionBelow(i)).eUp.Sym).Onext,l.fixUpperEdge&&(Ce(n!==a),e.deleteRegion(t,l),t.mesh.delete(a),a=n.Oprev),t.mesh.splice(r.anEdge,a),Ee.edgeGoesLeft(n)||(n=null),void e.addRightEdges(t,i,a.Onext,o,n,!0)):(t.mesh.splitEdge(s.Sym),i.fixUpperEdge&&(t.mesh.delete(s.Onext),i.fixUpperEdge=!1),t.mesh.splice(r.anEdge,s),void e.sweepEvent(t,r))},e.connectLeftVertex=function(t,i){var r,s,n,a,o,l,h=new Te;if(h.eUp=i.anEdge.Sym,r=t.dict.search(h).key,s=e.regionBelow(r)){if(a=r.eUp,o=s.eUp,0===Ee.edgeSign(a.Dst,i,a.Org))return void e.connectLeftDegenerate(t,r,i);n=Ee.vertLeq(o.Dst,a.Dst)?r:s,r.inside||n.fixUpperEdge?(l=n===r?t.mesh.connect(i.anEdge.Sym,a.Lnext):t.mesh.connect(o.Dnext,i.anEdge).Sym,n.fixUpperEdge?e.fixUpperEdge(t,n,l):e.computeWinding(t,e.addRegionBelow(t,r,l)),e.sweepEvent(t,i)):e.addRightEdges(t,r,i.anEdge,i.anEdge,null,!0)}},e.sweepEvent=function(t,i){t.event=i,e.debugEvent(t);for(var r=i.anEdge;null===r.activeRegion;)if((r=r.Onext)===i.anEdge)return void e.connectLeftVertex(t,i);var s=e.topLeftRegion(t,r.activeRegion);Ce(null!==s);var n=e.regionBelow(s),a=n.eUp,o=e.finishLeftRegions(t,n,null);o.Onext===a?e.connectRightVertex(t,s,o):e.addRightEdges(t,s,o.Onext,a,a,!0)},e.addSentinel=function(e,t,i,r){var s=new Te,n=e.mesh.makeEdge();n.Org.s=i,n.Org.t=r,n.Dst.s=t,n.Dst.t=r,e.event=n.Dst,s.eUp=n,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},e.initEdgeDict=function(t){t.dict=new Fe(t,e.edgeLeq);var i=t.bmax[0]-t.bmin[0],r=t.bmax[1]-t.bmin[1],s=t.bmin[0]-i,n=t.bmax[0]+i,a=t.bmin[1]-r,o=t.bmax[1]+r;e.addSentinel(t,s,n,a),e.addSentinel(t,s,n,o)},e.doneEdgeDict=function(t){for(var i,r=0;null!==(i=t.dict.min().key);)i.sentinel||(Ce(i.fixUpperEdge),Ce(1===++r)),Ce(0===i.windingNumber),e.deleteRegion(t,i)},e.removeDegenerateEdges=function(t){var i,r,s,n=t.mesh.eHead;for(i=n.next;i!==n;i=r)r=i.next,s=i.Lnext,Ee.vertEq(i.Org,i.Dst)&&i.Lnext.Lnext!==i&&(e.spliceMergeVertices(t,s,i),t.mesh.delete(i),s=(i=s).Lnext),s.Lnext===i&&(s!==i&&((s===r||s===r.Sym)&&(r=r.next),t.mesh.delete(s)),(i===r||i===r.Sym)&&(r=r.next),t.mesh.delete(i))},e.initPriorityQ=function(e){var t,i,r,s=0;for(i=(r=e.mesh.vHead).next;i!==r;i=i.next)s++;for(s+=8,t=e.pq=new Re(s,Ee.vertLeq),i=(r=e.mesh.vHead).next;i!==r;i=i.next)i.pqHandle=t.insert(i);return i===r&&(t.init(),!0)},e.donePriorityQ=function(e){e.pq=null},e.removeDegenerateFaces=function(t,i){var r,s,n;for(r=i.fHead.next;r!==i.fHead;r=s)s=r.next,Ce((n=r.anEdge).Lnext!==n),n.Lnext.Lnext===n&&(e.addWinding(n.Onext,n),t.mesh.delete(n));return!0},e.computeInterior=function(t,i){var r,s;if(void 0===i&&(i=!0),e.removeDegenerateEdges(t),!e.initPriorityQ(t))return!1;for(e.initEdgeDict(t);null!==(r=t.pq.extractMin());){for(;null!==(s=t.pq.min())&&Ee.vertEq(s,r);)s=t.pq.extractMin(),e.spliceMergeVertices(t,r.anEdge,s.anEdge);e.sweepEvent(t,r)}return t.event=t.dict.min().key.eUp.Org,e.debugEvent(t),e.doneEdgeDict(t),e.donePriorityQ(t),!!e.removeDegenerateFaces(t,t.mesh)&&(i&&t.mesh.check(),!0)},e}(),Ve=function(){function e(){this.mesh=new Be,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Me.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return e.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},e.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},e.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},e.prototype.computeNormal_=function(e){var t,i,r,s,n,a,o=[0,0,0],l=[0,0,0],h=[0,0,0],d=[0,0,0],u=[0,0,0],p=[null,null,null],c=[null,null,null],g=this.mesh.vHead;t=g.next;for(var m=0;m<3;++m)s=t.coords[m],l[m]=s,c[m]=t,o[m]=s,p[m]=t;for(t=g.next;t!==g;t=t.next)for(var f=0;f<3;++f)(s=t.coords[f])<l[f]&&(l[f]=s,c[f]=t),s>o[f]&&(o[f]=s,p[f]=t);var y=0;if(o[1]-l[1]>o[0]-l[0]&&(y=1),o[2]-l[2]>o[y]-l[y]&&(y=2),l[y]>=o[y])return e[0]=0,e[1]=0,void(e[2]=1);for(a=0,i=c[y],r=p[y],h[0]=i.coords[0]-r.coords[0],h[1]=i.coords[1]-r.coords[1],h[2]=i.coords[2]-r.coords[2],t=g.next;t!==g;t=t.next)d[0]=t.coords[0]-r.coords[0],d[1]=t.coords[1]-r.coords[1],d[2]=t.coords[2]-r.coords[2],u[0]=h[1]*d[2]-h[2]*d[1],u[1]=h[2]*d[0]-h[0]*d[2],u[2]=h[0]*d[1]-h[1]*d[0],(n=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>a&&(a=n,e[0]=u[0],e[1]=u[1],e[2]=u[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(h)]=1)},e.prototype.checkOrientation_=function(){for(var e,t,i=this.mesh.fHead,r=this.mesh.vHead,s=0,n=i.next;n!==i;n=n.next)if(!((t=n.anEdge).winding<=0))do{s+=(t.Org.s-t.Dst.s)*(t.Org.t+t.Dst.t),t=t.Lnext}while(t!==n.anEdge);if(s<0){for(e=r.next;e!==r;e=e.next)e.t=-e.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},e.prototype.projectPolygon_=function(){var e,t,i=this.mesh.vHead,r=[0,0,0],s=!1;r[0]=this.normal[0],r[1]=this.normal[1],r[2]=this.normal[2],!r[0]&&!r[1]&&!r[2]&&(this.computeNormal_(r),s=!0),e=this.sUnit,t=this.tUnit;var n=this.longAxis_(r);e[n]=0,e[(n+1)%3]=1,e[(n+2)%3]=0,t[n]=0,t[(n+1)%3]=0,t[(n+2)%3]=r[n]>0?1:-1;for(var a=i.next;a!==i;a=a.next)a.s=this.dot_(a.coords,e),a.t=this.dot_(a.coords,t);s&&this.checkOrientation_();for(var o=!0,l=i.next;l!==i;l=l.next)o?(this.bmin[0]=this.bmax[0]=l.s,this.bmin[1]=this.bmax[1]=l.t,o=!1):(l.s<this.bmin[0]&&(this.bmin[0]=l.s),l.s>this.bmax[0]&&(this.bmax[0]=l.s),l.t<this.bmin[1]&&(this.bmin[1]=l.t),l.t>this.bmax[1]&&(this.bmax[1]=l.t))},e.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},e.prototype.tessellateMonoRegion_=function(e,t){var i,r;if((i=t.anEdge).Lnext===i||i.Lnext.Lnext===i)throw"Mono region invalid";for(;Ee.vertLeq(i.Dst,i.Org);i=i.Lprev);for(;Ee.vertLeq(i.Org,i.Dst);i=i.Lnext);for(r=i.Lprev;i.Lnext!==r;)if(Ee.vertLeq(i.Dst,r.Org)){for(;r.Lnext!==i&&(Ee.edgeGoesLeft(r.Lnext)||Ee.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)r=e.connect(r.Lnext,r).Sym;r=r.Lprev}else{for(;r.Lnext!==i&&(Ee.edgeGoesRight(i.Lprev)||Ee.edgeSign(i.Dst,i.Org,i.Lprev.Org)>=0);)i=e.connect(i,i.Lprev).Sym;i=i.Lnext}if(r.Lnext===i)throw"Mono region invalid";for(;r.Lnext.Lnext!==i;)r=e.connect(r.Lnext,r).Sym;return!0},e.prototype.tessellateInterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)if(t=i.next,i.inside&&!this.tessellateMonoRegion_(e,i))return!1;return!0},e.prototype.discardExterior_=function(e){for(var t,i=e.fHead.next;i!==e.fHead;i=t)t=i.next,i.inside||e.zapFace(i)},e.prototype.setWindingNumber_=function(e,t,i){for(var r,s=e.eHead.next;s!==e.eHead;s=r)r=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:i?e.delete(s):s.winding=0},e.prototype.getNeighbourFace_=function(e){return e.Rface&&e.Rface.inside?e.Rface.n:-1},e.prototype.outputPolymesh_=function(e,t,i,r){var s,n,a=0,o=0;i>3&&e.mergeConvexFaces(i);for(var l=e.vHead.next;l!==e.vHead;l=l.next)l.n=-1;for(var h=e.fHead.next;h!==e.fHead;h=h.next)if(h.n=-1,h.inside){s=h.anEdge,n=0;do{-1===(l=s.Org).n&&(l.n=o,o++),n++,s=s.Lnext}while(s!==h.anEdge);if(n>i)throw"Face vertex greater that support polygon";h.n=a,++a}for(this.elementCount=a,t===Ae.CONNECTED_POLYGONS&&(a*=2),this.elements=[],this.elements.length=a*i,this.vertexCount=o,this.vertices=[],this.vertices.length=o*r,this.vertexIndices=[],this.vertexIndices.length=o,l=e.vHead.next;l!==e.vHead;l=l.next)if(-1!==l.n){var d=l.n*r;this.vertices[d+0]=l.coords[0],this.vertices[d+1]=l.coords[1],r>2&&(this.vertices[d+2]=l.coords[2]),this.vertexIndices[l.n]=l.idx}var u=0;for(h=e.fHead.next;h!==e.fHead;h=h.next)if(h.inside){s=h.anEdge,n=0;do{l=s.Org,this.elements[u++]=l.n,n++,s=s.Lnext}while(s!==h.anEdge);for(var p=n;p<i;++p)this.elements[u++]=-1;if(t===Ae.CONNECTED_POLYGONS){s=h.anEdge;do{this.elements[u++]=this.getNeighbourFace_(s),s=s.Lnext}while(s!==h.anEdge);for(var c=n;c<i;++c)this.elements[u++]=-1}}},e.prototype.outputContours_=function(e,t){var i,r,s=0,n=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(a.inside){r=i=a.anEdge;do{this.vertexCount++,i=i.Lnext}while(i!==r);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var o=0,l=0,h=0;for(s=0,a=e.fHead.next;a!==e.fHead;a=a.next)if(a.inside){n=0,r=i=a.anEdge;do{this.vertices[o++]=i.Org.coords[0],this.vertices[o++]=i.Org.coords[1],t>2&&(this.vertices[o++]=i.Org.coords[2]),this.vertexIndices[l++]=this.vertexIdCallback?this.vertexIdCallback(i):i.Org.idx,n++,i=i.Lnext}while(i!==r);this.elements[h++]=s,this.elements[h++]=n,s+=n}},e.prototype.addContour=function(e,t){null===this.mesh&&(this.mesh=new Be),e<2&&(e=2),e>3&&(e=3);for(var i=null,r=0;r<t.length;r+=e)null===i?(i=this.mesh.makeEdge(),this.mesh.splice(i,i.Sym)):(this.mesh.splitEdge(i),i=i.Lnext),i.Org.coords[0]=t[r+0],i.Org.coords[1]=t[r+1],i.Org.coords[2]=e>2?t[r+2]:0,i.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(i),i.winding=1,i.Sym.winding=-1},e.prototype.tesselate=function(e,t,i,r,s,n){if(void 0===e&&(e=Me.ODD),void 0===t&&(t=Ae.POLYGONS),void 0===n&&(n=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=e,r<2&&(r=2),r>3&&(r=3),!this.mesh)return!1;this.projectPolygon_(),je.computeInterior(this,n);var a=this.mesh;return t===Ae.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),n&&a.check(),t===Ae.BOUNDARY_CONTOURS?this.outputContours_(a,r):this.outputPolymesh_(a,t,i,r),!0},e}();function Ne(e){var t=e.windingRule,i=void 0===t?Me.ODD:t,r=e.elementType,s=void 0===r?Ae.POLYGONS:r,n=e.polySize,a=void 0===n?3:n,o=e.vertexSize,l=void 0===o?2:o,h=e.normal,d=void 0===h?[0,0,1]:h,u=e.contours,p=void 0===u?[]:u,c=e.strict,g=void 0===c||c,m=e.debug,f=void 0!==m&&m;if(!p&&g)throw new Error("Contours can't be empty");if(p){var y=new Ve;e.edgeCreateCallback&&(y.edgeCreateCallback=e.edgeCreateCallback),e.vertexIdCallback&&(y.vertexIdCallback=e.vertexIdCallback);for(var v=0;v<p.length;v++)y.addContour(l||2,p[v]);return y.tesselate(i,s,a,l,d,g),{vertices:y.vertices,vertexIndices:y.vertexIndices,vertexCount:y.vertexCount,elements:y.elements,elementCount:y.elementCount,mesh:f?y.mesh:void 0}}}Me.ODD,Me.NONZERO,Me.POSITIVE,Me.NEGATIVE,Me.ABS_GEQ_TWO,Ae.POLYGONS,Ae.CONNECTED_POLYGONS,Ae.BOUNDARY_CONTOURS;var He=1e-12,qe=class{constructor(e){this.position=new U,this.startPosition=new U,this.uuid=L.generateUUID(),this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new qe(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},We=class extends qe{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new We(this.parent).copy(this)}},Ye=class extends qe{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new We(this),new We(this))}static create(e,t){let i=new Ye(e,new U(...t.position));return i.controls[0].position.set(...t.controlPrevious.position),i.controls[1].position.set(...t.controlNext.position),i.roundness=t.roundness,i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,i}getOppositeControl(e){let t=this.controls.indexOf(e);return 0===t?this.controls[1]:1===t?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let i=0,r=this.controls.length;i<r;i++){let r=this.controls[i];this.position.distanceTo(r.position)<=t?r.position.copy(this.position):r.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new Ye(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}computeTangents(){let e=this.curveBefore?.getTangentAt(1),t=this.curveAfter?.getTangentAt(0);return[e,t]}computeNormals(e=new U,t=new U){let[i,r]=this.computeTangents();return i&&r&&(Xe(i,e),Xe(r,t)),[e,t]}computeTangent(e=new U){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new U){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}};function Xe(e,t=new U){let i=e.length();return t.set(-e.y/i,e.x/i)}var $e=e=>e,Ke=new U,Ze=new U,Je=new U,Qe=new U,et=new U,tt=new U,it=new z,rt=new z;function st(e){let t=new U;t.addVectors(e.v0,Ke.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new U;return i.addVectors(e.v2,Ze.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new Y(e.v0,t,i,e.v2)}function nt(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function at(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function ot(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function lt(e,t,i){let r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2)),n=Math.sqrt(Math.pow(i.x-e.x,2)+Math.pow(i.y-e.y,2));return Math.acos((s*s+r*r-n*n)/(2*s*r))}function ht(e,t,i){return mt(e,t)&&mt(t,i)&&dt(e.position,t.position,i.position)}function dt(e,t,i){return 0===Ke.copy(t).sub(e).cross(Ze.copy(i).sub(e))}function ut(e,t,i,r,s){let n=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),a=(e.y+t.y)/2,o=(e.x+t.x)/2,l=Math.sqrt(Math.pow(i,2)-Math.pow(n/2,2))*(e.y-t.y)/n,h=Math.sqrt(Math.pow(i,2)-Math.pow(n/2,2))*(t.x-e.x)/n;return r.set(o+l,a+h),s.set(o-l,a-h),[r,s]}function pt(e,t,i){return e.distanceTo(i)<t.distanceTo(i)?t:e}function ct(e,t,i,r,s,n){let a,o=t.x-e.x,l=t.y-e.y,h=i.x-e.x,d=i.y-e.y,u=Math.sqrt((o+h)*(o+h)+(l+d)*(l+d));return lt(t,e,i)>Math.PI&&(u*=-1),a=nt(d,l)?(l+d)*(r/u-.5)*8/3/(o-h):(o+h)*(r/u-.5)*8/3/(d-l),s.set(t.x-a*l,t.y+a*o),n.set(i.x+a*d,i.y-a*h),[s,n]}function gt(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function mt(e,t){return dt(e.position,e.controls[1].position,t.position)&&dt(e.position,t.controls[0].position,t.position)}function ft(e,t=12,i=!1){let r=[];for(let s=0,n=e.length;s<n;s++){let n=e[s],a=0;if(i&&void 0!==n.roundedCurveCorner){let e=.5*yt(n.roundedCurveCorner,t);s>0&&(r[s-1]+=e),a+=e}void 0!==n.curveAfter&&(a+=yt(n.curveAfter,t)),r.push(a)}return e.length>0&&i&&void 0!==e[0].roundedCurveCorner&&(r[e.length-1]+=.5*yt(e[0].roundedCurveCorner,t)),r}function yt(e,t=12){return e&&e instanceof q?2*t:e&&(e instanceof X||e instanceof $)?1:e&&e instanceof J?t*e.points.length:t}var vt=new U,bt=new U,xt=new U,wt=new U,St=new U,Mt=new U,Ot=class extends te{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new ve(new z(0,0,-1)),this.subdivision=0,this.controlSnapDistance=4,this.pointIDs=0,this.isMesh2D=!1,this.isText=!1,this._roundness=0,this.isClosed=!1,this.useCubicForRoundedCorners=!0,this.uuid=L.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new Ot;return r.isClosed=e.isClosed,r.points=e.points.map(e=>Ye.create(e.id,e.data)),"number"==typeof e.roundness&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(e=>Ot.createFromState(e)),void 0!==t&&void 0!==i&&r.applySize(t,i),r.update(),r}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,i=this.points.length;t<i;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(e=>this.getPointIndexById(e)).filter(e=>e>=0)}getPointIndexById(e){let t=this.points.length,i=this.points.findIndex(t=>t.uuid===e);if(i<0){let i=t;for(let t=0,r=this.shapeHoles.length;t<r;t++){let r=this.shapeHoles[t],s=r.points.length,n=r.getPointIndexById(e);if(!(n<0))return n+i;i+=s}}return i}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0){let t=this.points.length;for(let i=0,r=this.shapeHoles.length;i<r;i++){let r=this.shapeHoles[i],s=e-t;if(s<=r.points.length-1)return r.points[s];t+=r.points.length}}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let i=0,r=this.shapeHoles.length;i<r;i++){let r=this.shapeHoles[i],s=r.points.indexOf(e);if(s>=0)return t+s;t+=r.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(e=>e.points));return[...this.points,...e]}applySize(e,t){0===e&&(e=.001),0===t&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let i=vt.set(e,t);for(let e=0,t=this.points.length;e<t;e++){let t=this.points[e];t.position.multiply(i),t.controls[0].position.multiply(i),t.controls[1].position.multiply(i)}for(let i=0,r=this.shapeHoles.length;i<r;i++)this.shapeHoles[i].applyScale(e,t);this._update()}createPoint(e,t=0,i=L.generateUUID()){let r;r=e instanceof U?e:new U(e,t);let s=new Ye(i,r);return s.roundness=this.roundness,s}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t];if(i.uuid===e)return i}for(let t=0,i=this.shapeHoles.length;t<i;t++){let i=this.shapeHoles[t].getPointByUuid(e);if(i)return i}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(t=>t.uuid===e);t&&this.removePoint(t)}update(){for(let e=0,t=this.shapeHoles.length;e<t;e++)this.shapeHoles[e].update();this._update()}extractShapePointsToBuffer(e,t=12,i=!1){this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t);let r=i?this.roundedCurveDivisions:this.curveDivisions;return function(e,t,i=12,r=!0){let s,n=rt.set(0,0,0),a=0,o=[];for(let r=0;r<t.length;r++){let l=$e(t[r]),h=Ke,d=yt(l,i);o.push(d);for(let t=0;t<=d;t++)if(l instanceof Y||l instanceof K||l instanceof X){if(l.getPoint(t/d,h),n.set(h.x,h.y,0),void 0!==s&&ot(s,n))continue;void 0===s&&(s=it),s.copy(n),e.setXYZ(a,n.x,n.y,n.z),a++}}r&&a>1&&(e.getX(a-1)!==e.getX(0)||e.getY(a-1)!==e.getY(0)||e.getZ(a-1)!==e.getZ(0))&&(e.setXYZ(a,e.getX(0),e.getY(0),e.getZ(0)),a++)}(e,i?this.roundedCurves:this.curves,t,this.autoClose),r.reduce((e,t)=>e+t,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=ft(this.points,e,!1),this.roundedCurveDivisions=ft(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(e,t,i,r=12,s=!0){let n=rt.set(0,0,0),a=0,o=[];for(let s=0;s<t.length;s++){if(!1===i[s])continue;let l,h=$e(t[s]),d=Ke,u=yt(h,r);o.push(u);for(let t=0;t<=u;t++)if(h instanceof Y||h instanceof K||h instanceof X){if(h.getPoint(t/u,d),n.set(d.x,d.y,0),l?.equals(n))continue;void 0===l?l=it:(e.setXYZ(a,l.x,l.y,l.z),a++,e.setXYZ(a,n.x,n.y,n.z),a++),l.copy(n)}}return s&&a>1&&!(e.getX(a-1)===e.getX(0)&&e.getY(a-1)===e.getY(0)&&e.getZ(a-1)===e.getZ(0))&&(e.setXYZ(a,e.getX(0),e.getY(0),e.getZ(0)),a++),o}(e,this.curves,t,i,this.autoClose).reduce((e,t)=>e+t,0)}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,void 0===this.curveDivisions&&this.computeCurveDivisions(t),function(e,t,i=12,r=!0){let s,n=0;for(let r=0;r<t.length;r++){let a=$e(t[r]),o=yt(a,i),l=Ke;for(let t=0;t<=o;t++)if(a instanceof Y||a instanceof K||a instanceof X){if(a.getPoint(t/o,l),void 0!==s&&at(s,l,He))continue;void 0===s&&(s=Ze),s.copy(l),e.push(l.x,l.y),n++}}return nt(e[0],e[e.length-2],He)&&nt(e[1],e[e.length-1],He)&&(e.pop(),e.pop()),r&&n>1&&!(nt(e[n-1],e[1],He)&&nt(e[n-2],e[0],He))&&(e.push(e[0],e[1]),n++),e}(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let i=0;void 0===this.curveDivisions&&this.computeCurveDivisions(this.subdivision);let r=t?this.roundedCurveDivisions:this.curveDivisions,s=0;t&&void 0!==this.points[0].roundedCurveCorner&&(s=.5*yt(this.points[0].roundedCurveCorner,this.subdivision));let n=e-s;n<0&&(n+=r.reduce((e,t)=>e+t,0));for(let e=0,t=r.length;e<t;e++){let t=r[e];if(n<i+t)return[e,(n-i+1)/t];i+=t}return[0,1]}getCurveT(e,t,i){let r=this.points[e],s=this.points[e>=this.points.length-1?0:e+1],n=this.curveDivisions,a=n[e];if(gt(r,s)){let e=r.position.distanceTo(s.position);return r.position.distanceTo(vt.set(i.x,i.y))/e}let o=0;for(let t=0;t<e;t++)o+=n[t];return(t-o)/a}dispose(){}_applyCurveForPoint(e,t){gt(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let i=this.curves[this.curves.length-1];e.curveBefore=i,t.curveAfter=i;let r=i.clone();e.roundedCurveBefore=r,t.roundedCurveAfter=r,e.roundedCurveCorner=void 0,this.roundedCurves.push(r)}_update(){if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let e=0,t=this.points.length;e<t;e++){let t=this.points[e];if(0===e)this.moveTo(t.position.x,t.position.y);else{let i=this.points[e-1];this._applyCurveForPoint(t,i)}}let e=this.getLastPoint();if(e?.curveAfter&&(e.curveAfter=void 0),this.isClosed){let e=this.points[0],t=this.points[this.points.length-1];this._applyCurveForPoint(e,t)}if(this.points.length>2){let e=0;for(let t=0,i=this.points.length;t<i;t++){let i=this.points[t],r=this.points[t-1]??this.points[this.points.length-1],s=this.points[t+1]??this.points[0],n=i.roundness,a=r&&s&&ht(r,i,s);if(!i.controlsMoved()&&n>0&&!a){let r=i.curveBefore,s=i.curveAfter;if(void 0===r||void 0===s)continue;let a,o=i.roundedCurveBefore,l=i.roundedCurveAfter,h=r instanceof X?r.v1.distanceTo(r.v2):r.getLength(),d=s instanceof X?s.v1.distanceTo(s.v2):s.getLength(),u=Math.min(n,.499*h),p=Math.min(n,.499*d),c=Math.min(u,p),g=1-c/h,m=c/d,f=r.getPointAt(g,vt),y=s.getPointAt(m,bt);if(this._subSplitCurve(r,o,g,f,void 0),this._subSplitCurve(s,l,m,void 0,y),this.useCubicForRoundedCorners){let e=lt(f,i.position,y)/2,t=Math.tan(e)*f.distanceTo(i.position),[r,s]=ut(f,y,t,xt,wt),n=pt(r,s,i.position),[o,l]=ct(n,f,y,t,St,Mt);a=new Y(f.clone(),o.clone(),l.clone(),y.clone())}else a=new K(f.clone(),i.position.clone(),y.clone());i.roundedCurveCorner=a,this.roundedCurves.splice(t+e,0,a),e++}}}}_subSplitCurve(e,t,i,r,s){if(!(e instanceof X)){let n=e,a=t,o=n.getUtoTmapping(i,0),l=function(e,t,i,r,s=.5){let n=Ke.subVectors(t,e).multiplyScalar(s).add(e),a=Ze.subVectors(i,t).multiplyScalar(s).add(t),o=Je.subVectors(r,i).multiplyScalar(s).add(i),l=n,h=Qe.subVectors(a,n).multiplyScalar(s).add(n),d=et.subVectors(o,a).multiplyScalar(s).add(a),u=o,p=tt.subVectors(d,h).multiplyScalar(s).add(h);return[e.x,e.y,l.x,l.y,h.x,h.y,p.x,p.y,d.x,d.y,u.x,u.y,r.x,r.y]}(n.v0,n.v1,n.v2,n.v3,o);return void 0!==r&&(a.v0.set(l[0],l[1]),a.v1.set(l[2],l[3]),a.v2.set(l[4],l[5]),a.v3.set(l[6],l[7])),void 0!==s&&(a.v0.set(l[6],l[7]),a.v1.set(l[8],l[9]),a.v2.set(l[10],l[11]),a.v3.set(l[12],l[13])),a}return void 0!==r&&t.v2.copy(r),void 0!==s&&t.v1.copy(s),t}clone(){let e=new Ot(this._width,this._height);return e.points=this.points.map(e=>e.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(e=>e.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let i=0;i<t;i++){let t=7*i,r=e.points[t+0],s=e.points[t+1],n=e.points[t+2],a=e.points[t+3],o=e.points[t+4],l=e.points[t+5],h=e.points[t+6],d=new Ye(L.generateUUID(),new U(r,s));d.controls[0].position.set(n,a),d.controls[1].position.set(o,l),d.roundness=h,this.points.push(d)}return this.shapeHoles=e.shapeHoles?.length?e.shapeHoles.map(e=>{let t=new Ot;return t.fromJSON(e),t}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e,t=!1){this.isText=t;let i=(e,t)=>{t instanceof Y&&t.v3.equals(e.position)&&e.controls[0].position.copy(t.v2)};return this.points=(e=>{let t,r,s=[];for(t=0,r=e.length;t<r;t++)e[t]instanceof K&&(e[t]=st(e[t]));for(t=0,r=e.length;t<r;t++){let r,n=e[t],a=t>0?e[t-1]:null;n instanceof Y?(r=this.createPoint(n.v0),r.controls[1].position.copy(n.v1)):n instanceof X&&(r=this.createPoint(n.v1)),void 0!==r&&(null!==a&&i(r,a),s.push(r))}let n=e[e.length-1],a=!1;return n instanceof Y?n.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(n.v2),a=!0):n instanceof X&&n.v2.equals(s[0].position)&&(a=!0),this.isClosed=a,s})(e.curves),e instanceof te&&(this.shapeHoles=e.holes.map(e=>{let t=new Ot;return t.fromShape(e),t})),this.update(),this}updatePoint(e,t){let i=this.getPointByUuid(e);i&&(void 0!==t.position&&i.position.fromArray(t.position),void 0!==t.roundness&&(i.roundness=t.roundness),void 0!==t.areControlsDirectionsMirrored&&(i.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored),this.needsUpdate=!0)}updatePreviousControl(e,t){let i=this.getPointByUuid(e)?.controls[0];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}updateNextControl(e,t){let i=this.getPointByUuid(e)?.controls[1];i&&(t.position&&i.position.fromArray(t.position),this.needsUpdate=!0)}};function At(e,t){let i=e.length/2;if(i<2)return[];let r=0;for(let t=0;t<i;t++){let s=(t+1)%i;r+=e[2*t]*e[2*s+1]-e[2*s]*e[2*t+1]}let s=r>0!==t?1:-1,n=[];for(let t=0;t<i;t++){let r=(t+1)%i,a=e[2*r]-e[2*t],o=e[2*r+1]-e[2*t+1],l=Math.hypot(a,o);n.push(l>0?[s*o/l,-s*a/l]:[0,0])}let a=Math.cos(40*Math.PI/180),o=(e,t)=>{if(e[0]*t[0]+e[1]*t[1]<=a)return e;let[i,r]=[e[0]+t[0],e[1]+t[1]],s=Math.hypot(i,r);return s>0?[i/s,r/s]:e};return n.map((e,t)=>[o(e,n[(t+i-1)%i]),o(e,n[(t+1)%i])])}function Pt(e,t,i){let r=e.length/2,s=new Float32Array(r+1);if(!(t>0)||!(i>0)||r<2)return{u:s,vScale:0};let n=0;for(let a=0;a<r;a++){let o=(a+1)%r;n+=Math.hypot((e[2*o]-e[2*a])/t,(e[2*o+1]-e[2*a+1])/i),s[a+1]=n}return{u:s,vScale:Math.sqrt(t*i)}}function _t(e,t,i){for(let r=0;r<i.length;r+=3){let s=3*i[r],n=3*i[r+1],a=3*i[r+2],o=e[n]-e[s],l=e[n+1]-e[s+1],h=e[n+2]-e[s+2],d=e[a]-e[s],u=e[a+1]-e[s+1],p=e[a+2]-e[s+2],c=h*d-o*p,g=o*u-l*d;if((l*p-h*u)*(t[s]+t[n]+t[a])+c*(t[s+1]+t[n+1]+t[a+1])+g*(t[s+2]+t[n+2]+t[a+2])<0){let e=i[r+1];i[r+1]=i[r+2],i[r+2]=e}}}var Dt={vertices:[160,160,-160,160,-160,-160,160,-160],vertexIndices:[1,0,3,2],vertexCount:4,elements:[0,4],elementCount:1,mesh:void 0},Ct={vertices:[],vertexIndices:[],vertexCount:0,elements:[],elementCount:0,mesh:void 0},Et={vertices:[-160,160,160,-160,160,160,-160,-160],vertexIndices:[1,3,0,2],vertexCount:4,elements:[0,1,2,1,0,3],elementCount:2,mesh:void 0};function It(e,t){return e.normals[3*t+2]<.9999}var Lt=new WeakMap;function Ut(e){let t=Lt.get(e);if(void 0!==t)return t;if(!(e.rise>0))return e;let i=new Float32Array(e.normals),r=e.positions.length/3;for(let t=0;t<r;t++){if(!It(e,t))continue;let r=i[3*t],s=i[3*t+1],n=Math.hypot(r,s);if(0===n)continue;let a=e.rise-e.positions[3*t+2],o=Math.min(1,Math.max(0,1-a/e.rise)),l=Math.sqrt(1-o*o);i[3*t]=r/n*l,i[3*t+1]=s/n*l,i[3*t+2]=o}let s={...e,normals:i};return Lt.set(e,s),s}function Bt(e,t,i,r){let s=(t-e.minX)/e.spanX,n=(i-e.minY)/e.spanY;return r?[n,s]:[s,n]}var Gt,zt,Rt=class extends ge{constructor(e,t,i=12,r=Me.ODD,s,n=!1){super(),this.type="FlatExtrusionGeometry",this._nearSide=new Uint8Array(0),this._vScale=0,this._shape=e,this._depth=t,this._curveSegments=i,this._windingRule=r,this._uvPitch=n?void 0:s,this._legacy=n;let a,o=[e.extractShapePointsToFlatArray([],i),...e.shapeHoles.map(e=>e.extractShapePointsToFlatArray([],i))];try{a=Ne({contours:o,windingRule:r,elementType:Ae.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{a=Et}let l=a?.vertexCount??0,h=a?.elementCount??0,d=1/0,u=1/0,p=-1/0,c=-1/0;for(let e of o)for(let t=0;t<e.length;t+=2)e[t]<d&&(d=e[t]),e[t]>p&&(p=e[t]),e[t+1]<u&&(u=e[t+1]),e[t+1]>c&&(c=e[t+1]);let g=this._uvPitch,m=g??(p-d||1),f=g??(c-u||1),y=void 0===g?d:0,v=void 0===g?u:0,b=o.map((e,t)=>At(e,t>0)),x=0;for(let e of b)x+=e.length;let w=2*l+4*x,S=3*h*2+6*x,M=new Float32Array(3*w),O=new Float32Array(3*w),A=new Float32Array(2*w),P=new Uint32Array(S),_=new Uint8Array(w),C=0,E=0,I=0,L=!1,U=(e,i,r,s,n,a,o=(e-y)/m,l=(i-v)/f)=>{let h=3*E;M[h]=e,M[h+1]=i,M[h+2]=r,O[h]=s,O[h+1]=n,O[h+2]=a,_[E]=r===t?L?2:1:0,A[2*E]=o,A[2*E+1]=l,E++};if(void 0!==a)for(let[e,i]of[[t,1],[0,-1]]){let t=E;for(let t=0;t<l;t++)U(a.vertices[2*t],a.vertices[2*t+1],e,0,0,i);for(let e=0;e<h;e++){let[r,s,n]=[a.elements[3*e],a.elements[3*e+1],a.elements[3*e+2]];P[I++]=t+r,P[I++]=t+(i>0?s:n),P[I++]=t+(i>0?n:s)}}L=!0;for(let e=0;e<o.length;e++){let i=o[e],r=b[e],s=i.length/2,{u:a,vScale:l}=n?{u:new Float32Array(s+1),vScale:0}:Pt(i,m,f);C=l;let h=0===l?0:t/l,d={minX:y,minY:v,spanX:m,spanY:f},u=(e,[r,s],a,o)=>{let l=i[2*e],u=i[2*e+1],[p,c]=n?Bt(d,l,u,a):[o,a?0:h];U(l,u,a?0:t,r,s,0,p,c)};for(let e=0;e<r.length;e++){let t=(e+1)%s,[i,n]=r[e],[o,l]=[a[e],a[e+1]],h=E;u(e,i,!1,o),u(e,i,!0,o),u(t,n,!1,l),u(t,n,!0,l),P[I++]=h,P[I++]=h+1,P[I++]=h+2,P[I++]=h+3,P[I++]=h+2,P[I++]=h+1}}_t(M,O,P),this.setAttribute("position",new D(M,3)),this.setAttribute("normal",new D(O,3)),this.setAttribute("uv",new D(A,2)),this.setIndex(new D(P,1)),this._nearSide=_,this._vScale=C}takeDepthStateFrom(e){let t=e;void 0!==t._nearSide&&(this._depth=t._depth??this._depth,this._nearSide=t._nearSide,this._vScale=t._vScale??this._vScale)}canShiftDepthTo(e){return this._nearSide.length>0&&this._depth>0&&e>0}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let t=e-this._depth;if(this._depth=e,0===t)return!0;let i=this.getAttribute("position");if(void 0===i)return!1;let r=i.array,s=this.getAttribute("uv"),n=s?.array,a=this._vScale>0?t/this._vScale:0,o=this._nearSide;for(let e=0;e<o.length;e++){let i=o[e];0!==i&&(r[3*e+2]+=t,2===i&&void 0!==n&&(n[2*e+1]+=a))}return i.needsUpdate=!0,void 0!==s&&0!==a&&(s.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(null===this.boundingBox&&null===this.boundingSphere)return;null===this.boundingBox&&this.computeBoundingBox();let t=this.boundingBox;t.min.z=Math.min(0,e),t.max.z=Math.max(0,e),null!==this.boundingSphere&&t.getBoundingSphere(this.boundingSphere)}clone(){let e=new Rt(this._shape,this._depth,this._curveSegments,this._windingRule,this._uvPitch,this._legacy);return e.userData=u(this.userData),e}},Tt=class extends ge{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=Me.ODD,this.elementType=Ae.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:Me.ODD,elementType:Ae.POLYGONS,polySize:3,vertexSize:2,strict:!0},i);let r,s,n,a=this._shape.extractShapePointsToFlatArray([],this._curveSegments),o=this._shape.shapeHoles.map(e=>e.extractShapePointsToFlatArray([],this._curveSegments)),l=!0,h=!0;for(let e=0,t=a.length/2;e<t;e++){let t=2*e,i=a[t+0],r=a[t+1];if(void 0!==s&&i!==s&&(l=!1),void 0!==n&&r!==n&&(h=!1),s=i,n=r,!l&&!h)break}if(!l&&!h)try{r=Ne({contours:[a,...o],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})}catch{r=Dt}let d=r?.vertexCount??1,u=r?.elementCount??1;if(this._positionAttribute=new D(new Float32Array(3*d),3),this._normalAttribute=new D(new Float32Array(3*d),3),this._uvAttribute=new D(new Float32Array(2*d),2),this._indexAttribute=new D(new Uint32Array(3*u),1),r){let e=1/0,t=-1/0,i=1/0,s=-1/0;for(let n=0,a=d;n<a;n++){let a=2*n,o=r.vertices[a+0],l=r.vertices[a+1];o<e&&(e=o),o>t&&(t=o),l<i&&(i=l),l>s&&(s=l)}let n=t-e,a=s-i;for(let t=0,s=d;t<s;t++){let s=2*t,o=r.vertices[s+0],l=r.vertices[s+1],h=(o-e)/n,d=(l-i)/a;this._positionAttribute.setXYZ(t,o,l,0),this._normalAttribute.setXYZ(t,0,0,1),this._uvAttribute.setXY(t,h,d)}for(let e=0,t=u;e<t;e++){let t=3*e,i=r.elements[t+0],s=r.elements[t+1],n=r.elements[t+2];this._indexAttribute.setX(t+0,i),this._indexAttribute.setX(t+1,s),this._indexAttribute.setX(t+2,n)}}this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.setDrawRange(0,3*(r?.elementCount??1))}clone(){let e=new Tt(this._shape,this._curveSegments);return e.userData=u(this.userData),e}};function kt(e){return zt||(zt=async function(){let t=e??"https://unpkg.com/@splinetool/runtime@2.0.120/build",i=import("./bevel.js"),[r,s]=await Promise.all([i,fetch(`${t}/bevel.wasm`).then(e=>e.arrayBuffer())]);await r.default({module_or_path:s}),Gt=r}())}var Ft=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]);function jt(e){let t=!1;return e.scene.objects.traverse((e,i)=>{let r=i.geometry;if(void 0!==r&&(Ft.has(r.type)&&void 0!==r.depth&&r.depth>0&&(r.extrudeBevelSize??0)>0&&(t=!0),"PathGeometry"===r.type)){let e=r.extrusion;void 0!==e&&"round"===e.capType&&(e.bevel??0)>0&&(t=!0)}}),t}function Vt(e,t){let i=[e.extractShapePointsToFlatArray([],t)];for(let r of e.shapeHoles)i.push(r.extractShapePointsToFlatArray([],t));let r=0;for(let e of i)r+=e.length>>1;let s=new Float64Array(2*r),n=new Uint32Array(i.length),a=0;for(let e=0;e<i.length;e++)s.set(i[e],2*a),a+=i[e].length>>1,n[e]=a;return{points:s,ends:n}}var Nt=new T;function Ht(e,t,i,r,s,n){let a=e.positions.length/3,o=s.elements,l=Nt.getNormalMatrix(s).elements;for(let r=0;r<a;r++){let s=3*r,a=3*(i+r),h=e.positions[s],d=e.positions[s+1],u=e.positions[s+2];t.positions[a]=o[0]*h+o[4]*d+o[8]*u+o[12],t.positions[a+1]=o[1]*h+o[5]*d+o[9]*u+o[13],t.positions[a+2]=o[2]*h+o[6]*d+o[10]*u+o[14];let p=e.normals[s],c=e.normals[s+1],g=e.normals[s+2];t.normals[a]=l[0]*p+l[3]*c+l[6]*g,t.normals[a+1]=l[1]*p+l[4]*c+l[7]*g,t.normals[a+2]=l[2]*p+l[5]*c+l[8]*g;let m=2*(i+r);if(void 0===n)t.uvs[m]=e.uvs[2*r],t.uvs[m+1]=e.uvs[2*r+1];else{let[i,s]=n(h,d,e.uvs[2*r],e.uvs[2*r+1],r);t.uvs[m]=i,t.uvs[m+1]=s}}let h=s.determinant()<0;for(let s=0;s<e.indices.length;s+=3)t.indices[r+s]=e.indices[s]+i,t.indices[r+s+1]=e.indices[s+(h?2:1)]+i,t.indices[r+s+2]=e.indices[s+(h?1:2)]+i}var qt=new Z,Wt=new Z,Yt=(new Z).makeScale(1,1,-1),Xt=new Map,$t={assemblies:0,placements:0};function Kt(e){let{owner:t,shape:i,curveSegments:r,assembledAt:s,bevel:n,bevelSegments:a}=e,o=function(e,t){let i=[t],r=e=>{i.push(e.points.length,e.isClosed?1:0,e.roundness??0);for(let t of e.points){i.push(t.roundness??0,t.position.x,t.position.y);for(let e of t.controls)i.push(e.position.x,e.position.y)}i.push(e.shapeHoles.length);for(let t of e.shapeHoles)r(t)};return r(e),function(e){let t=2166136261;for(let i=0;i<e.length;i++)t^=e[i],t=Math.imul(t,16777619)>>>0;return t}(new Uint8Array(new Float64Array(i).buffer))}(i,r),l=t??`outline:${o}`,h=`${n}/${a}`,d=Xt.get(l);if(void 0!==d&&d.outlineVersion===o&&d.capKey===h&&(e.stillServes?.(d)??1))return $t.placements++,d.cap;let u=function(e,t,i,r,s){let{points:n,ends:a}=Vt(e,t);return Gt.assemble_cap(n,a,i,r,0,Math.max(1,Math.floor(s)),.4,40)}(i,r,s,n,a);$t.assemblies++;try{let e=function(e,t){return function(e,t,i,r,s){let n=1/0;for(let t=2;t<e.length;t+=3)e[t]<n&&(n=e[t]);if(n===1/0&&(n=0),0!==n)for(let t=2;t<e.length;t+=3)e[t]-=n;return{positions:e,normals:t,uvs:i,indices:r,rise:s-n}}(e.positions(),e.normals(),e.uvs(),e.indices(),t)}(u,s);return Xt.set(l,{outlineVersion:o,capKey:h,assembledAt:s,cap:e}),e}finally{u.free()}}var Zt=class extends ge{constructor(e,t,i=0,r=12,s=3,n,a,o=!1){if(super(),this.type="ShapeGeometry",this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0,void 0===Gt)throw new Error("bevel-wasm is not loaded");this._shape=e,this._uvPitch=a,this._legacy=o,this._depth=t,this._bevel=i,this._curveSegments=r,this._bevelSegments=s,this._ownerId=n,this.rebuild()}takeDepthStateFrom(e){let t=e;void 0!==t._nearSide&&(this._depth=t._depth??this._depth,this._nearSide=t._nearSide,this._vScale=t._vScale??this._vScale,this._effectiveBevel=t._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length>0&&Qt(this._effectiveBevel,e)&&Qt(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let t=e-this._depth;if(this._depth=e,0===t)return!0;let i=this.getAttribute("position");if(void 0===i)return!1;let r=i.array,s=this.getAttribute("uv"),n=s?.array,a=this._vScale>0?t/this._vScale:0,o=this._nearSide;for(let e=0;e<o.length;e++){let i=o[e];0!==i&&(r[3*e+2]+=t,2===i&&void 0!==n&&(n[2*e+1]+=a))}return i.needsUpdate=!0,void 0!==s&&0!==a&&(s.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(null===this.boundingBox&&null===this.boundingSphere)return;null===this.boundingBox&&this.computeBoundingBox();let t=this.boundingBox;t.min.z=Math.min(0,e),t.max.z=Math.max(0,e),null!==this.boundingSphere&&t.getBoundingSphere(this.boundingSphere)}setDepth(e){e!==this._depth&&(this._depth=e,this.rebuild(),this.computeBoundingSphere(),this.computeBoundingBox())}rebuild(){let e=Kt({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:e=>Qt(e.cap.rise,this._depth)&&Qt(e.cap.rise,e.assembledAt)}),t=function(e,t,i,r,s,n=!1){let a=r.positions.length/3,o=i-r.rise,l=r.rise,{points:h,ends:d}=Vt(e,t),u=1/0,p=1/0,c=-1/0,g=-1/0;for(let e=0;e<h.length;e+=2)h[e]<u&&(u=h[e]),h[e]>c&&(c=h[e]),h[e+1]<p&&(p=h[e+1]),h[e+1]>g&&(g=h[e+1]);n&&(s=void 0);let m=s??c-u,f=s??g-p,y={minX:u,minY:p,spanX:c-u||1,spanY:g-p||1},v=[],b=0;for(let e of d)v.push({at:b,count:e-b}),b=e;let x=0;for(let e of v)x+=e.count;let w=2*a+4*x,S=new Float32Array(3*w),M=new Float32Array(3*w),O=new Float32Array(2*w),A=new Uint32Array(2*r.indices.length+6*x),P=new Uint8Array(w),_=0,D=void 0===s?void 0:(e,t)=>[e/s,t/s],C=n?(e,t,i,s,n)=>It(r,n)?[s,i]:[i,s]:D,E=n?Ut(r):r,I={positions:S,normals:M,uvs:O,indices:A};Ht(E,I,0,0,qt.makeTranslation(0,0,o),D),Ht(E,I,a,r.indices.length,Wt.makeTranslation(0,0,l).multiply(Yt),C),P.fill(1,0,a);let L=2*a,U=2*r.indices.length;for(let e=0;e<v.length;e++){let{at:t,count:i}=v[e],r=h.subarray(2*t,2*(t+i)),s=At(r,e>0),a=n?{u:new Float32Array(i+1),vScale:0}:Pt(r,m,f),d=a.u;_=a.vScale;for(let e=0;e<i;e++){let t=(e+1)%i,[a,h]=s[e],u=L;for(let[i,s,u,p,c,g]of[[r[2*e],r[2*e+1],a,o,d[e],2],[r[2*t],r[2*t+1],h,o,d[e+1],2],[r[2*t],r[2*t+1],h,l,d[e+1],0],[r[2*e],r[2*e+1],a,l,d[e],0]]){let e=3*L;if(S[e]=i,S[e+1]=s,S[e+2]=p,M[e]=u[0],M[e+1]=u[1],M[e+2]=0,n){let[e,t]=Bt(y,i,s,0===g);O[2*L]=e,O[2*L+1]=t}else O[2*L]=c,O[2*L+1]=0===_?0:(p-l)/_;P[L]=g,L++}A[U++]=u,A[U++]=u+1,A[U++]=u+2,A[U++]=u,A[U++]=u+2,A[U++]=u+3}}return _t(S,M,A),{positions:S,normals:M,uvs:O,indices:A,nearSide:P,vScale:_}}(this._shape,this._curveSegments,this._depth,e,this._uvPitch,this._legacy);this._nearSide=t.nearSide,this._vScale=t.vScale,this._effectiveBevel=e.rise;let i=this.getAttribute("position"),r=this.getAttribute("normal"),s=this.getAttribute("uv"),n=this.getIndex();if(void 0!==i&&void 0!==r&&void 0!==s&&null!==n&&i.array.length===t.positions.length&&r.array.length===t.normals.length&&s.array.length===t.uvs.length&&n.array.length===t.indices.length)return i.array.set(t.positions),r.array.set(t.normals),s.array.set(t.uvs),n.array.set(t.indices),i.needsUpdate=!0,r.needsUpdate=!0,s.needsUpdate=!0,void(n.needsUpdate=!0);this.setAttribute("position",new D(t.positions,3)),this.setAttribute("normal",new D(t.normals,3)),this.setAttribute("uv",new D(t.uvs,2)),this.setIndex(new D(t.indices,1))}clone(){let e=new Zt(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId,this._uvPitch,this._legacy);return e.userData=u(this.userData),e}};function Jt(e,t,i,r,s){if(void 0!==Gt&&t>0)return Kt({owner:s,shape:e,curveSegments:r,assembledAt:2*t,bevel:t,bevelSegments:i})}function Qt(e,t){return.5*t>1.001*e}var ei=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i,r=Object.assign({},t?.parameters??{width:100,subdivisions:40,roundness:0,extrudeBevelSize:0,extrudeBevelSegments:3,windingRule:Me.ODD},e.parameters),s=Math.abs(r.width),n=Math.abs(r.height??r.width),a=Math.abs(r.depth??0),o=e.shape??t?.shape,l=o?.roundness??r.roundness;void 0!==o&&(o instanceof Ot?(i=o,(i.width!==s||i.height!==n)&&i.applySize(s,n)):i=new Ot(s,n).fromJSON(o),void 0!==e.parameters?.roundness&&e.parameters?.roundness>0&&i.update());let h=i??new Ot(s,n);return{parameters:Object.assign(r,{width:s,height:n,depth:a,roundness:l}),shape:h,ownerId:e.ownerId??t?.ownerId}}static build(e){let t,{depth:i,extrudeBevelSize:r,extrudeBevelSegments:s,subdivisions:n,roundness:a,windingRule:o,uvPitch:l,extrusionVersion:h}=e.parameters,d=1===h;return e.shape.roundness=a,i<=0?t=new Tt(e.shape,n,{windingRule:o}):r<=0?t=new Rt(e.shape,i,n,o,l,d):void 0!==Gt?t=new Zt(e.shape,i,r,n,s,e.ownerId,l,d):(console.error("[extrude] engine not loaded — extruding without a bevel"),t=new Rt(e.shape,i,n,o,l,d)),Object.assign(t,{userData:{...e,type:"VectorGeometry"}})}};function ti(){let e=new ge;return e.setAttribute("position",new D(new Float32Array([]),3)),e.setIndex(new D(new Uint16Array([]),1)),e}var ii,ri,si,ni,ai,oi,li=ti().attributes,hi=class extends ge{constructor(e,t){super(),this.isTextGeometry=!0,this.charWidths=[],this.charCoords=[],this.wrappedText=[],this.isLowResolution=!1,this.vectorShapes=[],this._nearSide=new Uint8Array(0),this._depth=0,this._effectiveBevel=0,this._vScale=0,Object.assign(this.attributes,li),this.userData={parameters:e,type:"TextGeometry"};let i=t.getFont(e.font);i?.isLoaded?(this.font=i,this.update(e,t)):this.updateFont(e.font,t).then(()=>{this.update(e,t),t?.requestRender()})}async updateFont(e,t){let i=t.getFont(e);i&&(this.font=i,await i.loadingPromise)}update(e,t){let i=this.font;if(this.userData={parameters:e,type:"TextGeometry"},!i?.isLoaded)return void console.warn("Cannot update text because its font is not loaded");let{width:r,height:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o,text:l,textTransform:h,fontSize:d,extrusionVersion:u}=e,p=f.getDisplayedValue(l),c=function(e,t,i,r){let s="string"==typeof e.width?Number(r.getVariable(e.width)):e.width,n=[""],a="";for(let r of i)a+=r," "===r||"\n"===r?(n[n.length-1]+=a,a="","\n"===r&&n.push("")):t.getTextWidth(n[n.length-1]+a,e)>s&&(n[n.length-1].length&&n.push(""),t.getTextWidth(n[n.length-1]+a,e)>s&&(1===a.length?(n[n.length-1]+=a,a=""):(n[n.length-1]+=a.slice(0,-1),a=a[a.length-1],n.push(""))));return n[n.length-1]+=a,n}(e,i,2===h?p.toUpperCase():3===h?p.toLowerCase():p,t),{shapes:g,charWidths:m,charCoords:y}=i.generateShapes(c,e,t),v=.5*("number"==typeof r?r:Number(t.getVariable(r))),b=.5*("number"==typeof s?s:Number(t.getVariable(s))),x=g.map(e=>(new Ot).fromShape(e,!0));this.vectorShapes=x;let w=x.map(e=>ei.create({shape:e,parameters:{depth:n,extrudeBevelSegments:o,extrudeBevelSize:a,uvPitch:1===u?void 0:d,extrusionVersion:u,windingRule:n<=0?Me.NONZERO:Me.ODD,subdivisions:this.isLowResolution&&n>0?1:12}})),S=w.length?xe(w):ti();S.translate(-v,b,0),this.dispose(),this.wrappedText=c,this.charCoords=y,this.charWidths=m,this.deleteAttribute("extrudeNormal"),Object.entries(S.attributes).forEach(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(S.index),this.adoptNearSide(w,n),this.computeBoundingSphere()}adoptNearSide(e,t){this._depth=t;let i=0,r=0,s=0;for(let t of e){let e=t,n=e._nearSide;if(void 0===n||0===n.length)return this._nearSide=new Uint8Array(0),this._effectiveBevel=0,void(this._vScale=0);i+=n.length,r=Math.max(r,e._effectiveBevel??0),s=e._vScale??s}this._effectiveBevel=r,this._vScale=s;let n=new Uint8Array(i),a=0;for(let t of e){let e=t._nearSide;n.set(e,a),a+=e.length}this._nearSide=n}takeDepthStateFrom(e){let t=e;void 0!==t._nearSide&&(this._depth=t._depth??this._depth,this._nearSide=t._nearSide,this._vScale=t._vScale??this._vScale,this._effectiveBevel=t._effectiveBevel??this._effectiveBevel)}canShiftDepthTo(e){return this._nearSide.length===this.getAttribute("position")?.count&&Qt(this._effectiveBevel,e)&&Qt(this._effectiveBevel,this._depth)}shiftDepthTo(e){if(!this.canShiftDepthTo(e))return!1;let t=e-this._depth;if(this._depth=e,0===t)return!0;let i=this.getAttribute("position"),r=i.array,s=this.getAttribute("uv"),n=s?.array,a=this._vScale>0?t/this._vScale:0,o=this._nearSide;for(let e=0;e<o.length;e++){let i=o[e];0!==i&&(r[3*e+2]+=t,2===i&&void 0!==n&&(n[2*e+1]+=a))}return i.needsUpdate=!0,void 0!==s&&0!==a&&(s.needsUpdate=!0),this.refreshDepthBounds(e),!0}refreshDepthBounds(e){if(null===this.boundingBox&&null===this.boundingSphere)return;null===this.boundingBox&&this.computeBoundingBox();let t=this.boundingBox;t.min.z=Math.min(0,e),t.max.z=Math.max(0,e),null!==this.boundingSphere&&t.getBoundingSphere(this.boundingSphere)}clone(){let e=w(new ge,hi.prototype);return e.copy(this),console.log("CloneGeometry",this,e),e}copy(e){return Object.entries(e.attributes).forEach(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(e.index),this.userData={parameters:{...e.userData.parameters},type:"TextGeometry"},this}async setText(e,t){this.font&&await this.font.loadingPromise,await this.update({...this.userData.parameters,text:{textValue:e}},t)}get text(){return this.userData.parameters.text??""}},di="webgl",ui=!1;function pi(e){di=e}function ci(){return di}function gi(e){ii=e}function mi(e){ri=e}function fi(){if("webgpu"===di){if(void 0!==ii)return ii;ui||(ui=!0,console.warn('[spe] Material backend is "webgpu" but no TSL material factory is registered — import spe/src/renderer/webgpu before creating materials. Falling back to WebGL materials.'))}if(void 0===ri)throw new Error('[spe] Classic (WebGL) materials are not available in this build — it was compiled WebGPU-only. Re-export the scene with renderer "Both" or "WebGL 2", or load the full runtime.');return ri}function yi(e,t){return fi().createRootMaterial(e,t)}function vi(e,t,i){return fi().createSharedMaterial(e,t,i)}function bi(e){return void 0===e.getLayersOfType&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function xi(e){si=e}function wi(e){ni=e}function Si(e){ai=e}function Mi(){return ai}function Oi(e){oi=e}function Ai(e,t){return void 0!==oi&&oi(e,t)}var Pi=[3,4,8,9];function _i(e){for(let t of Pi)e.enable(t)}var Di,Ci=5,Ei=3,Ii=32,Li=.98,Ui=class extends ie{constructor(e,t,i,r){super(e,t,i),this.isColorA=!0,this.a=r}setRGBA(e,t,i,r){super.setRGB(e,t,i),this.a=r}copy(e){return super.copy(e),this.a="a"in e?e.a:1,this}clone(){return new this.constructor(this.r,this.g,this.b,this.a)}equals(e){return super.equals(e)&&this.a===e.a}setStyle(e,t="srgb"){let i;if("transparent"===e)return this.setRGBA(0,0,0,0),this;if(i=/^((?:rgb|hsl)a?)\(([^)]*)\)/.exec(e)){let r,s=i[1],n=i[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a="rgba"===s?parseFloat(r[4]):1,super.setStyle(e,t);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)%\s*,\s*(\d*\.?\d+)%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(n))return this.a="hsla"===s?parseFloat(r[4]):1,super.setStyle(e,t)}}return super.setStyle(e,t)}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}},Bi=class{constructor(e=1e4){this.timeout=e,this.cache=new Map,this.head={data:null,time:0,src:null,next:null,prev:null},this.tail={data:null,time:1/0,src:null,next:null,prev:null},this.hasClean=!1,this.cleanupTimer=null,this.head.next=this.tail,this.tail.prev=this.head}log(...e){}remove(e){let t=this.cache.get(e);t&&(this.dispose(e,t.data),this.cache.delete(e),t.prev.next=t.next,t.next.prev=t.prev,t.next=null,t.prev=null,t.data=null)}scheduleCleanup(){this.hasClean||(this.log("scheduled cleanup"),this.hasClean=!0,this.cleanupTimer=setTimeout(()=>{this.hasClean=!1,this.cleanupTimer=null,this.log("cleaning");let e=Date.now(),t=this.head.next;for(;t.time<e-this.timeout;){this.dispose(t.src,t.data),this.cache.delete(t.src);let e=t;t=t.next,t.prev=this.head,this.head.next=t,e.next=null,e.prev=null,e.data=null}this.head.next!==this.tail?this.scheduleCleanup():this.log("no more cleanup")},this.timeout+1e3))}has(e){return this.cache.get(e)?.data}load(e){let t=Date.now(),i=this.cache.get(e);return void 0===i?(i={data:this.create(e),src:e,time:t,next:null,prev:null},this.cache.set(e,i)):(i.time=t,i.prev.next=i.next,i.next.prev=i.prev),i.prev=this.tail.prev,i.next=this.tail,this.tail.prev.next=i,this.tail.prev=i,this.scheduleCleanup(),i.data}disposeAll(){null!==this.cleanupTimer&&(clearTimeout(this.cleanupTimer),this.cleanupTimer=null),this.hasClean=!1,this.cache.forEach((e,t)=>{this.dispose(t,e.data),e.next=null,e.prev=null,e.data=null}),this.cache.clear(),this.head.next=this.tail,this.tail.prev=this.head}destroy(){this.disposeAll(),this.head=null,this.tail=null}},Gi=class extends Bi{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}};function zi(){Di&&Di.disposeAll()}var Ri=class{constructor(e,t){this.data=e,this.cache=t,this.refCount=0}deref(){this.refCount,this.refCount-=1,0===this.refCount&&(this.cache.remove(this),this.dispose())}dispose(){this.refCount}},Ti=class{constructor(){this.cache=new Map}remove(e){this.cache.delete(e.data)}load(e){let t=this.cache.get(e);return void 0===t&&(t=this.create(e),this.cache.set(e,t)),t.refCount+=1,t}},ki=class extends be{constructor(e){super(e),this.type=I}parse(e){let t=function(e,t){switch(e){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(t||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(t||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(t||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(t||""))}},i=function(e,t,i){t=t||1024;let r=e.pos,s=-1,n=0,a="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));for(;0>(s=o.indexOf("\n"))&&n<t&&r<e.byteLength;)a+=o,n+=o.length,r+=128,o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<s&&(!1!==i&&(e.pos+=n+s+1),a+o.slice(0,s))},r=function(e,t,i,r){let s=e[t+3],n=Math.pow(2,s-128)/255;i[r+0]=e[t+0]*n,i[r+1]=e[t+1]*n,i[r+2]=e[t+2]*n,i[r+3]=1},s=function(e,t,i,r){let s=e[t+3],n=Math.pow(2,s-128)/255;i[r+0]=he.toHalfFloat(Math.min(e[t+0]*n,65504)),i[r+1]=he.toHalfFloat(Math.min(e[t+1]*n,65504)),i[r+2]=he.toHalfFloat(Math.min(e[t+2]*n,65504)),i[r+3]=he.toHalfFloat(1)},n=new Uint8Array(e);n.pos=0;let a,o,l,h=function(e){let r,s,n=/^#\?(\S+)/,a=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,l=/^\s*FORMAT=(\S+)\s*$/,h=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,d={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};for((e.pos>=e.byteLength||!(r=i(e)))&&t(1,"no header found"),(s=r.match(n))||t(3,"bad initial token"),d.valid|=1,d.programtype=s[1],d.string+=r+"\n";r=i(e),!1!==r;)if(d.string+=r+"\n","#"!==r.charAt(0)){if((s=r.match(a))&&(d.gamma=parseFloat(s[1])),(s=r.match(o))&&(d.exposure=parseFloat(s[1])),(s=r.match(l))&&(d.valid|=2,d.format=s[1]),(s=r.match(h))&&(d.valid|=4,d.height=parseInt(s[1],10),d.width=parseInt(s[2],10)),2&d.valid&&4&d.valid)break}else d.comments+=r+"\n";return 2&d.valid||t(3,"missing format specifier"),4&d.valid||t(3,"missing image size specifier"),d}(n),d=h.width,u=h.height,p=function(e,i,r){let s=i;if(s<8||s>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);s!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");let n=new Uint8Array(4*i*r);n.length||t(4,"unable to allocate buffer space");let a=0,o=0,l=4*s,h=new Uint8Array(4),d=new Uint8Array(l),u=r;for(;u>0&&o<e.byteLength;){o+4>e.byteLength&&t(1),h[0]=e[o++],h[1]=e[o++],h[2]=e[o++],h[3]=e[o++],(2!=h[0]||2!=h[1]||(h[2]<<8|h[3])!=s)&&t(3,"bad rgbe scanline format");let i,r=0;for(;r<l&&o<e.byteLength;){i=e[o++];let s=i>128;if(s&&(i-=128),(0===i||r+i>l)&&t(3,"bad scanline data"),s){let t=e[o++];for(let e=0;e<i;e++)d[r++]=t}else d.set(e.subarray(o,o+i),r),r+=i,o+=i}let p=s;for(let e=0;e<p;e++){let t=0;n[a]=d[e+t],t+=s,n[a+1]=d[e+t],t+=s,n[a+2]=d[e+t],t+=s,n[a+3]=d[e+t],a+=4}u--}return n}(n.subarray(n.pos),d,u);switch(this.type){case C:l=p.length/4;let e=new Float32Array(4*l);for(let t=0;t<l;t++)r(p,4*t,e,4*t);a=e,o=C;break;case I:l=p.length/4;let t=new Uint16Array(4*l);for(let e=0;e<l;e++)s(p,4*e,t,4*e);a=t,o=I;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:d,height:u,data:a,header:h.string,gamma:h.gamma,exposure:h.exposure,type:o,colorSpace:j,minFilter:ye,magFilter:ye,generateMipmaps:!1,flipY:!0}}setDataType(e){return this.type=e,this}};function Fi(e){return e.length>2&&35===e[0]&&63===e[1]}function ji(e){return"object"==typeof e&&null!==e&&!0===e.isSplineHdr}function Vi(e){let t=new fe(e.data,e.width,e.height,F,I);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var Ni=0,Hi=class extends Ri{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.instanceId=++Ni,this.loaded=!1,this.isVideo=!1,this.isBuffer=!1,this.isHdr=!1,this._cache={1e3:{},1001:{},1002:{}},this.isVideo="video"===e.type,this.isBuffer=!0===e.isWebGLRenderTarget,this.loadPromise=this.updateSrc(this.isBuffer?e:e.data)}async updateSrc(e){if(typeof document>"u")return;this.disposeTextures(),this.loaded=!1,this.isHdr=!1;let t=()=>{this.loaded=!0;for(let e of Object.values(this._cache))for(let t of Object.values(e))for(let e of Object.values(t))e&&(e.image=this.img,e.needsUpdate=!0);this.shared.requestRender()};if(this.isBuffer)this.img=e,this.loaded=!0;else if(this.isVideo){if(this.img=document.createElement("video"),this.img.preload="auto",this.img.playsInline=!0,this.img.currentTime=.01,"string"!=typeof e){let t,i=new FileReader;i.readAsDataURL(new Blob([e],{type:"video/mp4"})),await new Promise(e=>{i.onloadend=i=>{t=i.target?.result,e(null)}}),this.img.src=t}else this.img.src=e;this.img.onloadeddata=()=>{t()}}else if(e instanceof Uint8Array?Fi(e):"string"==typeof e&&/\.hdr($|[?#])/i.test(e)){let i=e instanceof Uint8Array?e:null;if(null===i)try{i=new Uint8Array(await(await fetch(e)).arrayBuffer())}catch{i=null}let r=null!==i&&Fi(i)?function(e){try{let t=(new ki).parse(e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength));if(!t||!t.width||!t.height)return null;let{width:i,height:r}=t,s=t.data,n=new Uint16Array(s.length),a=4*i,o=e=>he.toHalfFloat(Math.pow(Math.max(he.fromHalfFloat(e),0),1/2.2)),l=new Map,h=e=>{let t=l.get(e);return void 0===t&&(t=o(e),l.set(e,t)),t};for(let e=0;e<r;e++){let t=e*a,i=(r-1-e)*a;for(let e=0;e<a;e+=4)n[i+e]=h(s[t+e]),n[i+e+1]=h(s[t+e+1]),n[i+e+2]=h(s[t+e+2]),n[i+e+3]=s[t+e+3]}return{isSplineHdr:!0,data:n,width:i,height:r}}catch{return null}}(i):null;null!==r&&(this.isHdr=!0,this.img=r,t())}else this.img=new Image,this.img.src=function(e){return"string"==typeof e?e:(Di||(Di=new Gi),Di.load(e))}(e),this.img.onload=t,await new Promise(e=>{this.img.onload=()=>{t(),e(null)}})}getTexture(e,t=1008,i=1006){let r=this._cache[e]?.[t]?.[i];if(r)return r;{let r;return this.isBuffer?r=this.img.texture:this.isVideo?r=new E(this.img,void 0,e,e):this.isHdr?(r=Vi(this.img),r.wrapS=e,r.wrapT=e,r.magFilter=i,r.minFilter=t):r=new H(this.img,void 0,e,e,i,t),this.isBuffer||(r.anisotropy=8,r.generateMipmaps=1008===t),this.loaded&&(r.needsUpdate=!0),void 0===this._cache[e]&&(this._cache[e]={}),void 0===this._cache[e][t]&&(this._cache[e][t]={}),this._cache[e][t][i]=r,r}}setNeedsUpdate(e){if(!this.isBuffer)for(let t of Object.values(this._cache))for(let i of Object.values(t))for(let t of Object.values(i))t&&(t.needsUpdate=e)}disposeTextures(){for(let[e,t]of Object.entries(this._cache))for(let[i,r]of Object.entries(t))for(let[t,s]of Object.entries(r))s?.dispose(),void 0!==this._cache[e]&&void 0!==this._cache[e][i]&&(this._cache[e][i][t]=void 0)}dispose(){super.dispose(),this.disposeTextures()}},qi=class extends Hi{},Wi=2*Math.PI;function Yi({x:e,y:t},i,r,s,n){return{x:e*i+s,y:t*r+n}}function Xi(e,t){let i=1.5707963267948966===t?.551915024494:-1.5707963267948966===t?-.551915024494:1.3333333333333333*Math.tan(t/4),r=Math.cos(e),s=Math.sin(e),n=Math.cos(e+t),a=Math.sin(e+t);return[{x:r-s*i,y:s+r*i},{x:n+a*i,y:a-n*i},{x:n,y:a}]}function $i(e,t,i,r){let s=e*r-t*i<0?-1:1,n=Math.min(1,Math.max(-1,e*i+t*r));return s*Math.acos(n)}var Ki=2*Math.PI,Zi=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return i.angle=L.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof Ot?e.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let t,{width:i,height:r,spikes:s,angle:n,innerRadius:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:d}=e.parameters,u=e.shape,p=function(e,t,i,r,s,n){if(r>=Ki)return s>30||s%4==0?(function(e,t,i,r=0,s=0,n=0){let a=.5522847498,o=t*a,l=i*a;e.addPoint(er(s-t,n,s-t,n-l,s-t,n+l)),e.addPoint(er(s,n+i,s-o,n+i,s+o,n+i)),e.addPoint(er(s+t,n,s+t,n+l,s+t,n-l)),e.addPoint(er(s,n-i,s+o,n-i,s-o,n-i)),r>0&&ir(e,t,i,r)}(e,t,i,n),Math.round(s/4)):Ji(e,r,s,t,i,n);let a={x:0,y:i},o=(r=Math.max(r,.001))+.5*Math.PI,l={x:Math.cos(o)*t,y:Math.sin(o)*i},h=function({px:e,py:t,cx:i,cy:r,rx:s,ry:n,largeArcFlag:a,sweepFlag:o}){let l=[];if(0===s||0===n)return[];let h=(e-i)/2,d=(t-r)/2;if(0===h&&0===d)return[];s=Math.abs(s),n=Math.abs(n);let u=Math.pow(h,2)/Math.pow(s,2)+Math.pow(d,2)/Math.pow(n,2);u>1&&(s*=Math.sqrt(u),n*=Math.sqrt(u));let p=function(e,t,i,r,s,n,a,o,l,h){let d=Math.pow(s,2),u=Math.pow(n,2),p=Math.pow(a,2),c=Math.pow(o,2),g=d*u-d*c-u*p;g<0&&(g=0),g/=d*c+u*p,g=Math.sqrt(g)*(l===h?-1:1);let m=g*s/n*o,f=g*-n/s*a,y=m+(e+i)/2,v=f+(t+r)/2,b=(a-m)/s,x=(o-f)/n,w=(-a-m)/s,S=(-o-f)/n,M=$i(1,0,b,x),O=$i(b,x,w,S);return!h&&O>0&&(O-=Wi),h&&O<0&&(O+=Wi),{centerx:y,centery:v,ang1:M,ang2:O}}(e,t,i,r,s,n,h,d,a,o),{ang1:c,ang2:g}=p,{centerx:m,centery:f}=p,y=Math.abs(g)/(Wi/4);Math.abs(1-y)<1e-7&&(y=1);let v=Math.max(Math.ceil(y),1);g/=v;for(let e=0;e<v;e++)l.push(Xi(c,g)),c+=g;return l.map(e=>{let{x:t,y:i}=Yi(e[0],s,n,m,f),{x:r,y:a}=Yi(e[1],s,n,m,f),{x:o,y:l}=Yi(e[2],s,n,m,f);return{x1:t,y1:i,x2:r,y2:a,x:o,y:l}})}({px:a.x,py:a.y,cx:l.x,cy:l.y,rx:t,ry:i,largeArcFlag:r>Math.PI,sweepFlag:!0});return s>30||s%h.length===0?function(e,t,i,r,s,n,a,o){let l=Math.round(s/r.length);e.addPoint(Qi(t,i));for(let t=0,i=r.length;t<i;t++){let i=r[t],s=e.points[t],n=Qi(i.x,i.y);s.controls[1].position.set(i.x1,i.y1),n.controls[0].position.set(i.x2,i.y2),e.addPoint(n)}return o>0?tr(e,n,a,o):e.addPoint(Qi(0,0)),l}(e,a.x,a.y,h,s,t,i,n):Ji(e,r,s,t,i,n)}(u,.5*i,.5*r,n*Math.PI/180,s,a);return u.isClosed=!0,u.update(),0===n?(t=new ge,t.setAttribute("position",new pe([],3))):t=ei.create({shape:u,parameters:{subdivisions:p,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:d}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}};function Ji(e,t,i,r,s,n){let a=-t/i;for(let t=0;t<=i;t++){let i=a*t,n=Math.sin(i)*r,o=Math.cos(i)*s;e.addPoint(Qi(n,o))}return t<Ki?n>0?tr(e,r,s,n):e.addPoint(Qi(0,0)):(e.removePoint(e.points[e.points.length-1]),n>0&&ir(e,r,s,n)),1}function Qi(e,t){return new Ye(L.generateUUID(),new U(e,t))}function er(e,t,i,r,s,n){let a=Qi(e,t);return a.controls[0].position.set(i,r),a.controls[1].position.set(s,n),a}function tr(e,t,i,r){rr(e,t,i,r).forEach(t=>e.addPoint(t))}function ir(e,t,i,r){let s=rr(e,t,i,r),n=new Ot;s.forEach(e=>n.addPoint(e)),n.isClosed=!0,e.shapeHoles.push(n)}function rr(e,t,i,r){let s=r*t/100,n=s*(Math.abs(i)/Math.abs(t)),a=new U(s/t,n/i),o=e.points.map(e=>{let t=e.clone();return t.uuid=L.generateUUID(),t}).reverse();return o.forEach(e=>{e.position.multiply(a);let t=e.controls[0].position.clone().multiply(a),i=e.controls[1].position.clone().multiply(a);e.controls[0].position.copy(i),e.controls[1].position.copy(t)}),o}var sr,nr,ar=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:3},e.parameters);return{shape:e.shape&&e.shape instanceof Ot?e.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,spikes:r,cornerRadius:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}=e.parameters,h=e.shape,d=.5*t,u=.5*i,p=2*Math.PI/r;for(let e=0;e<r;e++){let t=p*e,i=0+Math.sin(t)*d,r=0+Math.cos(t)*u;h.addPoint(h.createPoint(i,r))}h.isClosed=!0;for(let e=0,t=h.points.length;e<t;e++)h.points[e].roundness=s;h.roundness=s,h.update();let c=ei.create({shape:h,parameters:{roundness:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o,extrusionVersion:l}});return Object.assign(c,{userData:{...e,type:"PolygonGeometry"}})}},or=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters),r=Object.assign(t?.ui??{enabledIndieCorners:!1},e.ui);return{shape:e.shape&&e.shape instanceof Ot?e.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)}),ui:r}}static build(e){let t=e.shape,{width:i,height:r,cornerRadius:s,cornerType:n,depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:h}=e.parameters,d={x:.5*i,y:.5*r},u={x:-d.x,y:-d.y},p={x:d.x,y:d.y};function c(e,t,s){return t>i&&s>r?Math.min(e*i/t,e*r/s):t>i?e*i/t:s>r?e*r/s:e}let g=[];g[0]=0===s[0]?0:c(s[0],s[0]+s[3],s[0]+s[1]),g[1]=0===s[1]?0:c(s[1],s[1]+s[2],s[1]+s[0]),g[2]=0===s[2]?0:c(s[2],s[2]+s[1],s[2]+s[3]),g[3]=0===s[3]?0:c(s[3],s[3]+s[0],s[3]+s[2]);let m=u.x,f=p.x,y=p.y,v=u.y;t.addPoint(t.createPoint(m,y)),t.addPoint(t.createPoint(f,y)),t.addPoint(t.createPoint(f,v)),t.addPoint(t.createPoint(m,v)),t.isClosed=!0;let b=!0;for(let e=0,i=t.points.length;e<i;e++)t.points[e].roundness=g[e],e>0&&g[e]!==g[e-1]&&(b=!1);b&&(t.roundness=g[0]),t.useCubicForRoundedCorners=1!==n,t.update();let x=ei.create({shape:t,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l,extrusionVersion:h}});return Object.assign(x,{userData:{...e,type:"RectangleGeometry"}})}},lr=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeBevelSize:0,extrudeBevelSegments:1},e.parameters);return{shape:e.shape&&e.shape instanceof Ot?e.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i,innerRadiusPercent:r,spikes:s,cornerRadius:n,angle:a,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:d}=e.parameters,u=e.shape,p=.5*t,c=.5*i,g=a*Math.PI/360/s,m=Math.PI/2*3*-1,f=p*r/100,y=c*r/100;if(3===s&&50===r){g=2*Math.PI/s;for(let e=0;e<s;e++){let t=g*e,i=0+Math.sin(t)*p,r=0+Math.cos(t)*c;u.addPoint(u.createPoint(i,r))}}else for(let e=0;e<s;e++){let e=0+Math.cos(m)*p,t=0+Math.sin(m)*c;u.addPoint(u.createPoint(e,t)),m+=g,e=0+Math.cos(m)*f,t=0+Math.sin(m)*y,u.addPoint(u.createPoint(e,t)),m+=g}u.isClosed=!0;for(let e=0,t=u.points.length;e<t;e++)u.points[e].roundness=n;u.roundness=n,u.update();let v=ei.create({shape:u,parameters:{roundness:n,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h,extrusionVersion:d}});return Object.assign(v,{userData:{...e,type:"StarGeometry"}})}},hr=new Promise(e=>{sr=e}),dr=!1;function ur(e){if(!dr)return nr||(nr=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.120/build",i=import("./process.js"),[r,s]=await Promise.all([i,fetch(`${t}/process.wasm`).then(e=>e.arrayBuffer())]),n=r.default,a=await n({wasmBinary:s});sr(a),dr=!0}())}var pr=class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=e.parameters?.radiusTop,r=e.parameters?.radiusBottom,s=Object.assign({},t?.parameters??{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:8,cornerSegments:8,hollow:0},e.parameters);s.thetaLength=L.clamp(s.thetaLength,0,360),s.hollow=L.clamp(s.hollow??0,0,1);let n=s.width/2,a=s.radiusTop??n,o=s.radiusBottom??n;if(a===o?(a=n,o=n):a>o?(a=n,o=o*n/a):(a=a*n/o,o=n),s.shapeBlendNode){a=i??n,o=r??n;let e=2*Math.max(a,o);s.width=e,s.depth=e}return{parameters:Object.assign(s,{width:Math.abs(s.width),height:Math.abs(s.height??s.width),depth:Math.abs(s.depth??s.width),radiusTop:a,radiusBottom:o})}}static build(e){let t,{width:i,depth:r,height:s,radialSegments:n,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,radiusTop:d,radiusBottom:u,cornerRadius:p,cornerSegments:c,hollow:g}=e.parameters;0===h?(t=new ge,t.setAttribute("position",new pe([],3))):t=p||g?new gr(d,u,s,n,a,o,l,h*Math.PI/180,p,p,c,g):new R(d,u,s,n,a,o,l,h*Math.PI/180);let m=r/i;return 1!==m&&t.scale(1,1,m),Object.assign(t,{userData:{...e,type:"CylinderGeometry"}})}};function cr(e){return new U(e.y,-e.x)}var gr=class extends ge{constructor(e,t,i,r,s,n,a,o,l,h,d,u,p=!1){super(),this.type="RoundedCylinderBufferGeometry",e=void 0!==e?e:1,t=void 0!==t?t:1,i=i||1,r=Math.floor(r)||8,s=Math.floor(s)||1,n=void 0!==n&&n,a=void 0!==a?a:0,o=void 0!==o?o:2*Math.PI,n&&(l=0,h=0);let c=i/2;p&&0==e&&(e=l),p&&0==t&&(t=h);let g=new U(e,c),m=new U(t,-c),f=null,y=null,v=null,b=null,x=g.clone().sub(m),w=0,S=0,M=0;u>0&&(w=Math.min(e,t)*(1-u),S=e-w,M=t-w);let O=g.clone();O.x-=w;let A=Math.PI-x.angle(),P=x.angle(),_=Math.tan(P/2),C=Math.tan(A/2),E=_+C,I=u?E:C,L=u?E:_;if(l=Math.min(l,(e-S)/I,x.length()/E),h=Math.min(h,(t-M)/L,x.length()/E),l>0){let e=l/_;f=g.clone().sub(new U(e,l)),u&&(v=f.clone(),v.x-=w-E*l),g.sub(x.clone().setLength(e))}if(h>0){let e=h/C;y=m.clone().sub(new U(e,-h)),m.add(x.clone().setLength(e)),u&&(b=y.clone(),b.x-=w-E*h,O.sub(x.clone().setLength(e)))}x=g.clone().sub(m);let B=x.length()<.5,G=[],z=[],R=[],T=[],k=[],F=[],j=(e,t,r,s,n)=>{for(let a=0;a<d+1;a++){let o=a/d,l=s<0?o:1-o;n&&(l-=1),l*=e;let h=Math.sin(l),u=Math.cos(l)*s,p=u*t+r.y;G.push(h*t+r.x),z.push(p),R.push(h),T.push(u),k.push(.5+p/i),F.push(!1)}},V=(e,t,i)=>{let r=[e,t];i<0&&r.reverse();for(let e of r)G.push(e),z.push(c*i),R.push(0),T.push(i),k.push(.5),F.push(!0)};if(b&&y?(j(A,h,b,-1,!0),j(P,h,y,-1,!1)):y?(V(y.x,0,-1),j(P,h,y,-1,!1)):n||V(t,M,-1),!B){let e=cr(x).normalize();for(let t=0;t<=s;t++){let r=t/s,n=x.y*r+m.y;G.push(x.x*r+m.x),z.push(n),R.push(e.x),T.push(e.y),k.push(.5+n/i),F.push(!1)}}if(v&&f?(j(A,l,f,1,!1),j(P,l,v,1,!0)):f?(j(A,l,f,1,!1),V(f.x,0,1)):n||V(e,S,1),u&&!B){let e=cr(x).multiplyScalar(-1).normalize();for(let t=0;t<=s;t++){let r=t/s,n=x.y*-r+O.y;G.push(x.x*-r+O.x),z.push(n),R.push(e.x),T.push(e.y),k.push(.5+n/i),F.push(!1)}}let N=G.length,H=N+(u&&!n?1:0),q=(e,t)=>e*N+(t===N?0:t),W=o<2*Math.PI,Y=(r+1)*N+(W?2*(1+H):0),X=new Float32Array(3*Y),$=new Float32Array(3*Y),K=new Float32Array(2*Y),Z=Y-1>65535?new Uint32Array(r*Math.max(0,H-1)*6+(W?2*(H+1)*3:0)):new Uint16Array(r*Math.max(0,H-1)*6+(W?2*(H+1)*3:0)),J=0,Q=0;for(let e=0;e<=r;e++){let t=e/r,i=t*o+a,s=Math.sin(i),n=Math.cos(i);for(let e=0;e<N;e++){let i=3*Q,r=2*Q,a=G[e],o=R[e];X[i]=a*s,X[i+1]=z[e],X[i+2]=a*n,$[i]=o*s,$[i+1]=T[e],$[i+2]=o*n,F[e]?(K[r]=.5,K[r+1]=.5):(K[r]=t,K[r+1]=k[e]),Q++}}for(let e=0;e<r;e++)for(let t=0;t<H-1;t++){if(n&&u&&t==s)continue;let i=q(e,t),r=q(e+1,t),a=q(e+1,t+1),o=q(e,t+1),l=X[3*a+0],h=X[3*a+2];Z[J++]=i,Z[J++]=r,Z[J++]=o,(0!=l||0!=h)&&(Z[J++]=r,Z[J++]=a,Z[J++]=o)}function ee(i,r,s){let n=Math.sin(s),a=Math.cos(s),o=-a,l=n,h=i<0?(e,t,i)=>{Z[J++]=e,Z[J++]=t,Z[J++]=i}:(e,t,i)=>{Z[J++]=e,Z[J++]=i,Z[J++]=t},d=(e+t+S+M)/4,u=3*Q,p=2*Q;X[u]=d*n,X[u+1]=0,X[u+2]=d*a,$[u]=o,$[u+1]=0,$[u+2]=l,K[p]=.5,K[p+1]=.5;let c=Q++;for(let e=0;e<H;e++){let t=3*(r+(e===N?0:e));u=3*Q,p=2*Q,X[u]=X[t],X[u+1]=X[t+1],X[u+2]=X[t+2],$[u]=o,$[u+1]=0,$[u+2]=l;let i=t/3*2|0;K[p]=K[i],K[p+1]=K[i+1],Q++}for(let e=c+1;e<Q-1;e++)h(c,e,e+1);h(c,Q-1,c+1)}W&&(ee(-1,0,a),ee(1,r*N,a+o)),this.setIndex(new D(Z.slice(0,J),1)),this.setAttribute("position",new D(X,3)),this.setAttribute("normal",new D($,3)),this.setAttribute("uv",new D(K,2))}},mr=Math.PI/2,fr=class extends ge{constructor(e=1,t=1,i=1,r=1,s=1,n=1,a=0,o=4){super(),this.type="BoxGeometry",r=Math.floor(r),s=Math.floor(s),n=Math.floor(n),o=Math.floor(o);let l=(a=Math.min(a,e/2,t/2,i/2))>0,h=o+1,d=2*((n+1)*(s+1)+(r+1)*(n+1)+(r+1)*(s+1))+(l?4*h*(n+1+(r+1)+(s+1))+h*(h+1)/2*8:0),u=2*(n*s+r*n+r*s)+(l?4*o*(n+r+s):0),p=l?8*o*o:0,c=new Float32Array(3*d),g=new Float32Array(3*d),m=new Float32Array(2*d),f=d-1>65535?new Uint32Array(6*u+3*p):new Uint16Array(6*u+3*p),y=0,v=0,b=new Float64Array(h),x=new Float64Array(h),w=new Float64Array(h),S=new Float64Array(h);for(let e=0;e<h;e++){let t=e/o*mr;b[e]=Math.sin(t)*a,x[e]=(1-Math.cos(t))*a,w[e]=Math.sin(t),S[e]=Math.cos(t)}let M=h*(h+1)/2,O=new Float64Array(3*M),A=new Float64Array(3*M);{let r=new z(e/2,t/2,i/2);r.subScalar(a);let s=0;for(let e=0;e<=o;e++){let t=mr*(1-e/o),i=Math.cos(t),n=Math.sin(t),l=0;for(let t=0;t<=e;t++){let t=i*Math.cos(l),o=n,h=i*Math.sin(l);O[3*s]=t,O[3*s+1]=o,O[3*s+2]=h,A[3*s]=r.x+t*a,A[3*s+1]=r.y+o*a,A[3*s+2]=r.z+h*a,s++,l+=mr/e}}}function P(e,t,i,r,s,n,o,l,h,d){let u=(n-2*a)/h,p=(o-2*a)/d,b=n/2-a,x=o/2-a,w=l/2,S=h+1,M=d+1,O=0,A=new z;for(let n=0;n<M;n++){let a=n*p-x;for(let o=0;o<S;o++){let p=o*u-b,f=3*(y+O),v=2*(y+O);A[e]=p*r,A[t]=a*s,A[i]=w,c[f]=A.x,c[f+1]=A.y,c[f+2]=A.z,A[e]=0,A[t]=0,A[i]=l>0?1:-1,g[f]=A.x,g[f+1]=A.y,g[f+2]=A.z,m[v]=o/h,m[v+1]=1-n/d,O+=1}}for(let e=0;e<d;e++)for(let t=0;t<h;t++){let i=y+t+S*e,r=y+t+S*(e+1),s=y+(t+1)+S*(e+1),n=y+(t+1)+S*e;f[v++]=i,f[v++]=r,f[v++]=n,f[v++]=r,f[v++]=s,f[v++]=n}y+=O}function _(e,t,i,r,s,n,l,h,d,u){let p=(l-2*a)/u,M=l/2-a,O=h/2-a,A=d/2,P=u+1,_=0,D=new z,C=new z;for(let a=0;a<o+1;a++){D[t]=(O+b[a])*s,D[i]=(A-x[a])*n,C[e]=0,C[t]=w[a]*Math.sign(D[t]),C[i]=S[a]*Math.sign(D[i]);for(let t=0;t<P;t++){let i=t*p-M;D[e]=i*r;let s=3*(y+_),n=2*(y+_);c[s]=D.x,c[s+1]=D.y,c[s+2]=D.z,g[s]=C.x,g[s+1]=C.y,g[s+2]=C.z,m[n]=t/u,m[n+1]=0,_+=1}}for(let e=0;e<o;e++)for(let t=0;t<u;t++){let i=y+t+P*e,r=y+t+P*(e+1),s=y+(t+1)+P*(e+1),n=y+(t+1)+P*e;f[v++]=i,f[v++]=r,f[v++]=n,f[v++]=r,f[v++]=s,f[v++]=n}y+=_}function C(e,t,i){let r=e*t*i>0?(e,t,i)=>{f[v++]=e,f[v++]=t,f[v++]=i}:(e,t,i)=>{f[v++]=e,f[v++]=i,f[v++]=t},s=y;for(let r=0;r<M;r++){let s=3*r,n=3*y,a=2*y;c[n]=e*A[s],c[n+1]=t*A[s+1],c[n+2]=i*A[s+2],g[n]=e*O[s],g[n+1]=t*O[s+1],g[n+2]=i*O[s+2],m[a]=0,m[a+1]=0,y++}for(let e=0;e<o;e++){let t=s+e*(e+1)/2,i=s+(e+1)*(e+2)/2;r(t,i+1,i);for(let s=1;s<=e;s++)r(t+s-1,t+s,i+s),r(t+s,i+s+1,i+s)}}P("z","y","x",-1,-1,i,t,e,n,s),P("z","y","x",1,-1,i,t,-e,n,s),P("x","z","y",1,1,e,i,t,r,n),P("x","z","y",1,-1,e,i,-t,r,n),P("x","y","z",1,-1,e,t,i,r,s),P("x","y","z",-1,-1,e,t,-i,r,s),a>0&&(_("z","y","x",-1,-1,1,i,t,e,n),_("z","y","x",1,-1,-1,i,t,e,n),_("z","y","x",-1,1,-1,i,t,e,n),_("z","y","x",1,1,1,i,t,e,n),_("x","y","z",-1,-1,-1,e,t,i,r),_("x","y","z",1,-1,1,e,t,i,r),_("x","y","z",-1,1,1,e,t,i,r),_("x","y","z",1,1,-1,e,t,i,r),_("y","x","z",-1,-1,1,t,e,i,s),_("y","x","z",1,-1,-1,t,e,i,s),_("y","x","z",1,1,1,t,e,i,s),_("y","x","z",-1,1,-1,t,e,i,s),C(1,1,1),C(-1,1,1),C(1,-1,1),C(-1,-1,1),C(1,1,-1),C(-1,1,-1),C(1,-1,-1),C(-1,-1,-1)),this.setIndex(new D(f,1)),this.setAttribute("position",new D(c,3)),this.setAttribute("normal",new D(g,3)),this.setAttribute("uv",new D(m,2))}},yr=class extends ge{constructor(e=[],t=[],i="",r=1,s=.2,n=4){super(),this.type="PolyhedronGeometryRound";let a,o,l,h=0;return function(){0==(s=Math.min(.99999,s))&&(n=0);let d={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[i],u=new z,p=u.clone(),c=new ae,g=s*r,m=r-g,f=n+1,y=new z,v=(e,t)=>y.subVectors(e,t).normalize(),b=(e,t)=>Array(e).fill(void 0).map(t),x=b(e.length/3,(t,i)=>(new z).fromArray(e,3*i).setLength(r)),w=[],S=1e6;for(let e=0;e<x.length;e++){let i,r,s,n=x[e],a=[],o=1e10,l=-1;for(;-1!=(l=t.indexOf(e,l+1));){let e=l-l%3;i=t[e+(l+1)%3],r=t[e+(l+2)%3],s=n.distanceToSquared(x[i]),o=Math.min(o,s),a.push([i,r,s])}o+=1e-6;let h=[],d=0,u=a.length;for(let t=0;t<u;t++){[i,r,s]=a[d];let t=1==w[i]?.includes(e);s<=o&&h.push(i+ +t*S),d=a.findIndex(e=>e[0]==r)}w.push(h)}let M=[];{let e,t,i=0,r=0,s=3==d;for(let a=0;a<=n;a++){e=a*(a+1)/2,t=(a+1)*(a+2)/2;for(let o=0;o<n-a;o++)[i,r]=[e+o+a+2,t+o+a+3],M.push(e,t,...s?[r,e]:[i,t],r,i),[e,t]=[i,r];M.push(e,t,e+n+2)}}let O=0;for(let e=0;e<w.length;e++)for(let t=0;t<d;t++)w[e][t]<S&&O++;let A=x.length*d*M.length*3+O*f*6*3+2*O*3*3;a=new Float64Array(A),o=new Float64Array(A),l=new Float64Array(A/3*2);let P=(e,t,i)=>{let r=h/3*2;l[r]=Math.atan2(i,-e)/2/Math.PI+.5,l[r+1]=1-(Math.atan2(-t,Math.sqrt(e*e+i*i))/Math.PI+.5)},_=e=>{a[h]=e.x,a[h+1]=e.y,a[h+2]=e.z,o[h]=y.x,o[h+1]=y.y,o[h+2]=y.z,P(e.x,e.y,e.z),h+=3},D=e=>{a[h]=e[0].x,a[h+1]=e[0].y,a[h+2]=e[0].z,o[h]=e[1].x,o[h+1]=e[1].y,o[h+2]=e[1].z,P(e[0].x,e[0].y,e[0].z),h+=3},C=(n+2)*(n+3)/2,E=new Float64Array(3*C),I=new Float64Array(3*C),L=new Float64Array(2*C),U=b(2*d*f,()=>new z),B=b(n*Math.max(0,n-1)/2,()=>new z),G=u.clone(),R=u.clone(),T=u.clone(),k=u.clone(),F=u.clone(),j=[],V=b(x.length,()=>b(d,()=>u.clone()));for(let e=0;e<x.length;e++){u.copy(x[e]).normalize(),G.copy(u).multiplyScalar(m);let t=w[e];for(let i=0;i<t.length;i++){let r=t[i],s=t[(i+1)%d];c.setFromPointsAndIndices(x,e,r%S,s%S),c.b.sub(c.a).setLength(1e10).add(c.a),c.c.sub(c.a).setLength(1e10).add(c.a),c.closestPointToPoint(G,V[e][i])}let i=0,r=[],s=[],b=new z;0==n&&[...V[e]].reduce((e,t)=>e.add(t),b).multiplyScalar(1/d);for(let t=0;t<d;t++){let a=[],o=(t-1+d)%d,l=V[e][o],h=V[e][t];u.copy(l).sub(G),p.copy(h).sub(G);let c=G.angleTo(u),x=u.angleTo(p),w=Math.cos(c)*g;0==n?R.copy(b):R.copy(G).setLength(m+w),r.push(w);let S=[R,l,h];for(let e=0;e<2;e++){let t=S[e],r=S[e+1];k.subVectors(t,G),F.subVectors(r,G),T.crossVectors(k,F).normalize();for(let r=0;r<f;r++){let s=[c,x][e]*r/f;u.copy(k).applyAxisAngle(T,s).add(G),U[i++].copy(u),e&&(v(u,G),a.push([0==r?t:u.clone(),y.clone()]))}e&&(v(r,G),a.push([r,y.clone()]))}s.push(a)}j.push(s);let O=2*f,A=2;for(let e=0;e<d;e++){let t=O*e,i=O*((e+1)%d),s=0,n=[U[t]];for(let a=1;a<f;a++){let o=U[t+a],l=U[i+a];n.push(o);for(let t=1,i=a-A+1;t<=i;t++)u.lerpVectors(o,l,t/(i+1)),u.sub(G).setLength(r[e]).add(G),n.push(B[s++].copy(u));n.push(l)}for(let e=0;e<f;e++)n.push(U[e+f+t]);n.push(U[i+f]);for(let e=0,t=n.length;e<t;e++){let t=n[e],i=3*e,r=2*e;E[i]=t.x,E[i+1]=t.y,E[i+2]=t.z,v(t,G),I[i]=y.x,I[i+1]=y.y,I[i+2]=y.z,L[r]=Math.atan2(t.z,-t.x)/2/Math.PI+.5,L[r+1]=1-(Math.atan2(-t.y,Math.sqrt(t.x*t.x+t.z*t.z))/Math.PI+.5)}for(let e=0,t=M.length;e<t;e++){let t=3*M[e],i=2*M[e],r=h/3*2;a[h]=E[t],a[h+1]=E[t+1],a[h+2]=E[t+2],o[h]=I[t],o[h+1]=I[t+1],o[h+2]=I[t+2],l[r]=L[i],l[r+1]=L[i+1],h+=3}}}let N=[];for(let e=0;e<w.length;e++)for(let t=0;t<d;t++){let i=w[e][t];if(i<S){let r=w[i].findIndex(t=>t%S==e),s=j[e][t],n=j[i][r];for(let e=0;e<f;e++){let t=s[e],i=n[f-e],r=s[e+1],a=n[f-(e+1)];D(t),D(i),D(r),D(r),D(i),D(a)}N.push(s[0][0],n[f][0],s[f][0],n[0][0])}}for(;N.length;){let e,t,i,[r,s]=N.splice(0,2);e=s;let n=[r];for(;r!=e;)n.push(e),t=N.indexOf(e),i=t%2,e=N.splice(t-i,2)[1-i];y.subVectors(n[0],n[1]).cross(u.subVectors(n[0],n[2])).normalize();let a=y.dot(n[0])<0;a&&y.negate();for(let e=1;e<=n.length-2;e++)_(n[e+ +a]),_(n[e+1-+a]),_(n[0])}}(),function(){let e=new z,t=new z,i=new z,r=new z,s=new U,n=new U,o=new U,d=(e,t,i,r)=>{r<0&&1===e.x&&(l[t]=e.x-1),0===i.x&&0===i.z&&(l[t]=r/2/Math.PI+.5)};for(let u=0,c=0;u<h;u+=9,c+=6){e.set(a[u+0],a[u+1],a[u+2]),t.set(a[u+3],a[u+4],a[u+5]),i.set(a[u+6],a[u+7],a[u+8]),s.set(l[c+0],l[c+1]),n.set(l[c+2],l[c+3]),o.set(l[c+4],l[c+5]),r.copy(e).add(t).add(i).divideScalar(3);let h=p(r);d(s,c+0,e,h),d(n,c+2,t,h),d(o,c+4,i,h)}let u=h/3*2;for(let e=0;e<u;e+=6){let t=l[e+0],i=l[e+2],r=l[e+4],s=Math.max(t,i,r),n=Math.min(t,i,r);s>.9&&n<.1&&(t<.2&&(l[e+0]+=1),i<.2&&(l[e+2]+=1),r<.2&&(l[e+4]+=1))}function p(e){return Math.atan2(e.z,-e.x)}}(),this.setAttribute("position",new D(new Float32Array(a.subarray(0,h)),3)),this.setAttribute("normal",new D(new Float32Array(o.subarray(0,h)),3)),void this.setAttribute("uv",new D(new Float32Array(l.subarray(0,h/3*2)),2))}static fromJSON(e){return new yr(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}},vr=class extends yr{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,s=1/r,n="DodecahedronGeometry";super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-r,0,-s,r,0,s,-r,0,s,r,-s,-r,0,-s,r,0,s,-r,0,s,r,0,-r,0,-s,r,0,-s,-r,0,s,r,0,s],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],n,e,t,i),this.type=n}static fromJSON(e){return new vr(e.radius,e.corner,e.cornerSides)}},br=class extends yr{constructor(e=1,t=.2,i=4){let r=(1+Math.sqrt(5))/2,s="IcosahedronGeometry";super([-1,r,0,1,r,0,-1,-r,0,1,-r,0,0,-1,r,0,1,r,0,-1,-r,0,1,-r,r,0,-1,r,0,1,-r,0,-1,-r,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],s,e,t,i),this.type=s}static fromJSON(e){return new br(e.radius,e.corner,e.cornerSides)}},xr=1e4;function wr(e,t){return Math.abs(t-e)/2+Math.min(e,t)}var Sr=class{constructor(e=1){this.subdivisions=e}modify(e){let t=function(e){let t=e.getAttribute("position");if(void 0===t)return console.error("SubdivisionModifier: Position attribute required for subdivision."),{positions:new Float64Array(0),faces:new Uint32Array(0),materialIndices:[],uvs:null};let i=e.getAttribute("uv"),r=e.getIndex(),s=t.count,n=new Map,a=new Uint32Array(s),o=[],l=0;for(let e=0;e<s;e++){let i=t.getX(e),r=t.getY(e),s=t.getZ(e),h=Math.round(i*xr),d=Math.round(r*xr),u=Math.round(s*xr),p=n.get(h);void 0===p&&(p=new Map,n.set(h,p));let c=p.get(d);void 0===c&&(c=new Map,p.set(d,c));let g=c.get(u);void 0===g&&(g=l++,c.set(u,g),o.push(i,r,s)),a[e]=g}let h=[],d=[],u=void 0===i?null:[],p=null!==r?r.count:s,c=(e,t)=>{let n=null!==r?r.getX(e):e,o=null!==r?r.getX(e+1):e+1,l=null!==r?r.getX(e+2):e+2;if(!(n<s&&o<s&&l<s))return;let p=a[n],c=a[o],g=a[l];p===c||c===g||g===p||(h.push(p,c,g),d.push(t),null!==u&&u.push(i.getX(n),i.getY(n),i.getX(o),i.getY(o),i.getX(l),i.getY(l)))},g=e.groups;if(g.length>0)for(let e=0;e<g.length;e++){let t=g[e],i=void 0===t.materialIndex?0:t.materialIndex,r=Math.max(t.start,0),s=Math.min(t.start+t.count,p);for(let e=r;e<s&&e+2<p;e+=3)c(e,i)}else for(let e=0;e+2<p;e+=3)c(e,0);return{positions:Float64Array.from(o),faces:Uint32Array.from(h),materialIndices:d,uvs:null===u?null:Float64Array.from(u)}}(e),i=this.subdivisions;for(;i-- >0;)t=Mr(t);return function(e,t){let{positions:i,faces:r,materialIndices:s,uvs:n}=e,a=i.length/3,o=r.length/3,l=new Float64Array(3*a);for(let e=0;e<o;e++){let t=3*r[3*e],s=3*r[3*e+1],n=3*r[3*e+2],a=i[n]-i[s],o=i[n+1]-i[s+1],h=i[n+2]-i[s+2],d=i[t]-i[s],u=i[t+1]-i[s+1],p=i[t+2]-i[s+2],c=o*p-h*u,g=h*d-a*p,m=a*u-o*d;l[t]+=c,l[t+1]+=g,l[t+2]+=m,l[s]+=c,l[s+1]+=g,l[s+2]+=m,l[n]+=c,l[n+1]+=g,l[n+2]+=m}for(let e=0;e<a;e++){let t=l[3*e],i=l[3*e+1],r=l[3*e+2],s=Math.sqrt(t*t+i*i+r*r)||1;l[3*e]=t/s,l[3*e+1]=i/s,l[3*e+2]=r/s}let h=3*o,d=new Float32Array(3*h),u=new Float32Array(3*h),p=null!==n&&n.length>0?new Float32Array(2*h):null;for(let e=0;e<h;e++){let t=3*r[e];d[3*e]=i[t],d[3*e+1]=i[t+1],d[3*e+2]=i[t+2],u[3*e]=l[t],u[3*e+1]=l[t+1],u[3*e+2]=l[t+2]}null!==p&&p.set(n.subarray(0,2*h));let c=new ge;c.setAttribute("position",new D(d,3)),h>0&&(c.setAttribute("normal",new D(u,3)),c.setAttribute("color",new D(new Float32Array(3*h).fill(1),3))),null!==p&&c.setAttribute("uv",new D(p,2));for(let e=0;e<o;){let t=s[e],i=e;do{e++}while(e<o&&s[e]===t);c.addGroup(3*i,3*(e-i),t)}return null!==t.boundingBox&&(c.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(c.boundingSphere=t.boundingSphere.clone()),c}(t,e)}};function Mr(e){let{positions:t,faces:i,materialIndices:r,uvs:s}=e,n=t.length/3,a=i.length/3,o=null!==s&&a>0,l=3*a,h=new Uint32Array(l),d=new Uint32Array(l),u=new Uint32Array(l),p=new Uint32Array(l),c=new Uint32Array(l),g=0,m=8;for(;m<2*l;)m*=2;let f=m-1,y=new Int32Array(m).fill(-1),v=(e,t)=>{let i=(Math.imul(e,2654435761)^t)&f;for(;;){let r=y[i];if(-1===r)return y[i]=g,h[g]=e,d[g]=t,g++;if(h[r]===e&&d[r]===t)return r;i=i+1&f}},b=(e,t)=>{let i=e<t?e:t,r=e<t?t:e,s=(Math.imul(i,2654435761)^r)&f;for(;;){let e=y[s];if(h[e]===i&&d[e]===r)return e;s=s+1&f}},x=new Uint32Array(n),w=new Float64Array(3*n),S=(e,i,r)=>{let s=e<i?v(e,i):v(i,e),n=++u[s];1===n?p[s]=r:2===n&&(c[s]=r),x[e]++,x[i]++,w[3*e]+=t[3*i],w[3*e+1]+=t[3*i+1],w[3*e+2]+=t[3*i+2],w[3*i]+=t[3*e],w[3*i+1]+=t[3*e+1],w[3*i+2]+=t[3*e+2]};for(let e=0;e<a;e++){let t=i[3*e],r=i[3*e+1],s=i[3*e+2];S(t,r,s),S(r,s,t),S(s,t,r)}let M=new Float64Array(3*g);for(let e=0;e<g;e++){let i=3*h[e],r=3*d[e];if(2===u[e]){let s=3*p[e],n=3*c[e];M[3*e]=.375*(t[i]+t[r])+.125*(t[s]+t[n]),M[3*e+1]=.375*(t[i+1]+t[r+1])+.125*(t[s+1]+t[n+1]),M[3*e+2]=.375*(t[i+2]+t[r+2])+.125*(t[s+2]+t[n+2])}else M[3*e]=.5*(t[i]+t[r]),M[3*e+1]=.5*(t[i+1]+t[r+1]),M[3*e+2]=.5*(t[i+2]+t[r+2])}let O,A=new Float64Array(3*n);for(let e=0;e<n;e++){let i=x[e];3===i?O=3/16:i>3&&(O=3/(8*i));let r=1-i*Number(O),s=Number(O);2===i&&(r=3/4,s=1/8),A[3*e]=t[3*e]*r+w[3*e]*s,A[3*e+1]=t[3*e+1]*r+w[3*e+1]*s,A[3*e+2]=t[3*e+2]*r+w[3*e+2]*s}let P=new Float64Array(3*(n+g));P.set(A),P.set(M,3*n);let _=new Uint32Array(12*a),D=new Array(4*a),C=o?new Float64Array(24*a):null;for(let e=0;e<a;e++){let t=i[3*e],a=i[3*e+1],o=i[3*e+2],l=b(t,a)+n,h=b(a,o)+n,d=b(o,t)+n,u=12*e;_[u++]=l,_[u++]=h,_[u++]=d,_[u++]=t,_[u++]=l,_[u++]=d,_[u++]=a,_[u++]=h,_[u++]=l,_[u++]=o,_[u++]=d,_[u++]=h;let p=r[e];if(D[4*e]=p,D[4*e+1]=p,D[4*e+2]=p,D[4*e+3]=p,null!==C){let t=6*e,i=s[t],r=s[t+1],n=s[t+2],a=s[t+3],o=s[t+4],l=s[t+5],h=wr(i,n),d=wr(r,a),u=wr(n,o),p=wr(a,l),c=wr(i,o),g=wr(r,l),m=24*e;C[m++]=h,C[m++]=d,C[m++]=u,C[m++]=p,C[m++]=c,C[m++]=g,C[m++]=i,C[m++]=r,C[m++]=h,C[m++]=d,C[m++]=c,C[m++]=g,C[m++]=n,C[m++]=a,C[m++]=u,C[m++]=p,C[m++]=h,C[m++]=d,C[m++]=o,C[m++]=l,C[m++]=c,C[m++]=g,C[m++]=u,C[m++]=p}}return{positions:P,faces:_,materialIndices:D,uvs:C}}var Or=new z;function Ar(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}var Pr=new z,_r=new z;function Dr(e,t,i,r,s,n){let a=Pr.copy(t).sub(e),o=_r.copy(i).sub(e),l=a.angleTo(o);if(a.normalize(),o.normalize(),r===s){let t=a.add(o).normalize();n.copy(e).addScaledVector(t,r/Math.sin(l/2))}else{let t=a.angleTo(o);n.copy(e),n.addScaledVector(a,s/Math.sin(t)),n.addScaledVector(o,r/Math.sin(t))}}function Cr(e,t,i){let r=e.clone().sub(t),s=i.clone().sub(t);return r.projectOnVector(s),r.add(t)}var Er=class extends ge{constructor(e=.5,t=1,i=4,r=1,s=!1,n=0,a=4){super(),i=Math.floor(Math.max(3,i)),r=Math.floor(r),a=Math.floor(a);let o,l=[],h=[],d=[],u=[],p=0,c=t/2,g=Math.PI/i,m=e*Math.cos(Math.PI/i),f=2*Math.PI/i,y=(i-2)*Math.PI/i,v=Math.PI-y,b=new z(0,-c,0),x=new z(0,c,0),w=new U(e,-c),S=new U(m,-c),M=new U(0,x.y).sub(S),O=new U(0,x.y).sub(w),A=new U(M.y,-M.x).normalize(),P=new U(O.y,-O.x).normalize(),_=e*Math.cos(Math.PI/i)*Math.tan((Math.PI-M.angle())/2)-1e-8;n=Math.min(n,_);{let e=new z(A.x,A.y,0),t=new z(Math.cos(f)*e.x,e.y,Math.sin(f)*e.x);o=e.angleTo(t)}let D=n/Math.tan((Math.PI-M.angle())/2),C=n/Math.tan((Math.PI-o)/2),E=new z;if(!s){h.push(b.x,b.y,b.z),d.push(0,-1,0),u.push(0,0);let e=p++,t=[],r=w.clone(),s=D/Math.cos(Math.PI/i);r.x-=s;for(let e=0;e<i;e++){let s=e/i*Math.PI*2+g;Ar(r,new U(Math.sin(s),Math.cos(s)),E),h.push(E.x,E.y,E.z),d.push(0,-1,0),u.push(0,0),t.push(p++)}for(let i=0;i<t.length;i++)l.push(t[i],e,t[(i+1)%t.length])}let I=[];{let e=new z,t=new z,r=new z,s=new z,c=new z,m=new z;for(let f=0;f<i;f++){let y=f/i*Math.PI*2+g,v=(f+.5)/i*Math.PI*2+g,S=(f+1)/i*Math.PI*2+g,O=new U(Math.sin(y),Math.cos(y)),_=new U(Math.sin(v),Math.cos(v)),E=new U(Math.sin(S),Math.cos(S));Ar(w,O,t),Ar(w,E,r),Ar(A,_,e),Dr(x,t,r,C,C,s),h.push(s.x,s.y,s.z),Dr(t,x,r,C,D,c),h.push(c.x,c.y,c.z),Dr(r,t,x,D,C,m),h.push(m.x,m.y,m.z),d.push(e.x,e.y,e.z),d.push(e.x,e.y,e.z),d.push(e.x,e.y,e.z),u.push(0,0),u.push(0,0),u.push(0,0);let G=p++,R=p++,T=p++;if(l.push(G,R,T),n>0){{let e=t.clone().add(r).multiplyScalar(.5),i=x.clone().sub(e).normalize(),s=b.clone().sub(e).normalize().add(i).normalize().multiplyScalar(-1);L(e,m.clone().sub(c),s,M.angle())}let g,f;{let e=new z;Ar(P,E,e);let t=m.clone().add(s).multiplyScalar(.5);t=Cr(t,r,x);let i=m.clone().sub(s);[g,f]=L(t,i,e,o,s.y)}{let e=g,t=e.clone().setY(0).normalize(),i=new z(0,-1,0),r=t.clone().cross(i);B(e,t,i,r)}I.concat(f);{let t=M.angle(),r=Math.PI-t,s=x.clone();s.y-=n/Math.sin(t-Math.PI/2);let o=new z,c=[];for(let t=0;t<a;t++){let l=[],g=Math.PI/2-r*t/a,m=Math.cos(g),f=Math.sin(g),y=v;for(let r=0;r<=t;r++){let r=Math.cos(y),a=Math.sin(y);e.x=m*a,e.y=f,e.z=m*r,o.copy(s).addScaledVector(e,n),h.push(o.x,o.y,o.z),d.push(e.x,e.y,e.z),u.push(0,0),l.push(p++),y+=2*Math.PI/t/i}c.push(l)}f.reverse(),c.push(f);let g=c.length-1;for(let e=0;e<g;e++){let t=c[e],i=c[e+1],r=t.length-1;l.push(i[1],t[0],i[0]);for(let e=1;e<=r;e++)l.push(t[e],t[e-1],i[e]),l.push(i[e+1],t[e],i[e])}}}}}function L(e,t,i,r,s){let o=-r/2,c=(Math.PI-r)/2,g=t.clone().normalize().cross(i);e.addScaledVector(i,-n/Math.sin(c));let m=new z,f=new z,y=p,v=[];for(let l=0;l<=a;l++){let c=o+l/a*r;f.set(0,0,0),f.addScaledVector(g,Math.sin(c)),f.addScaledVector(i,Math.cos(c));for(let i=0;i<=1;i++){let r=i/1-.5;if(m.copy(e),m.addScaledVector(t,r),m.addScaledVector(f,n),null!=s){let e=Math.max(0,m.y-s);m.addScaledVector(t,-e/t.y)}h.push(m.x,m.y,m.z),d.push(f.x,f.y,f.z),u.push(0,0),0===i&&v.push(p),p++}}for(let e=0;e<a;e++)for(let t=0;t<1;t++){let i=y+t+2*e,r=i+2,s=r+1,n=i+1;l.push(i,r,n),l.push(r,s,n)}return[e.clone().addScaledVector(t,.5),v]}function B(e,t,i,r){let s=Math.PI/2,o=O.angle()-s,c=[],g=new z,m=new z;for(let l=0;l<=a;l++){let f=[],y=l/a;for(let a=0;a<=l;a++){let c=((l?a/l:0)-.5)*v,b=Math.cos(c),x=Math.sin(c),w=(s+Math.atan(Math.tan(o)*b))*y,S=Math.cos(w),M=Math.sin(w);g.set(0,0,0),g.addScaledVector(t,M*b),g.addScaledVector(i,S),g.addScaledVector(r,M*x),m.copy(e).addScaledVector(g,n),h.push(m.x,m.y,m.z),d.push(g.x,g.y,g.z),u.push(0,0),f.push(p++)}c.push(f)}let f=c.length-1;for(let e=0;e<f;e++){let t=c[e],i=c[e+1],r=t.length-1;l.push(t[0],i[1],i[0]);for(let e=1;e<=r;e++)l.push(t[e-1],t[e],i[e]),l.push(t[e],i[e+1],i[e])}}this.setIndex(l),this.setAttribute("position",new pe(h,3)),this.setAttribute("normal",new pe(d,3)),this.setAttribute("uv",new pe(u,2))}},Ir=class extends ge{constructor(e=1,t=1,i=1,r=90,s=10,n=24){super(),this.type="BackdropGeometry";let a=[],o=[],l=[],h=.001;0==s&&(n=1),n=Math.max(1,Math.floor(n)),s=Math.min(s,100),r=Math.min(180-h,r),r*=Math.PI/180;let d=[],u=Math.PI/2,p=(e=0,t=0,i=0)=>new z(e,t,i),c=p(),g=p(),[m,f,y]=[t/2,e/2,i/2],v=-f,b=+f,[x,w,S]=[p(v,-m,+y),p(v,-m,-y),p(v,+m,-y)],M=(e,t=!1)=>Math.sin(e-Math.PI/(+t+1)),O=(e,t=!1)=>Math.cos(e-Math.PI/(+t+1));S.y=Math.sin(r)*t-m;let A=Math.cos(r)*t-y,P=x.z-h;r<=u?(S.z=Math.min(A,P),S.z==P&&(S.y-=(A-P)/Math.tan(u-r))):w.z=Math.min(w.z-A-y,x.z-h),c.subVectors(x,w),g.subVectors(S,w);let _=Math.min(c.length(),g.length())*s/100,D=_*Math.tan(r/2),C=_/Math.cos(r/2),E=c.clone().normalize().add(g.normalize()).setLength(C).add(w);c.set(0,M(r,!0),O(r,!0)),d.push([S,c.clone()]);let I=(Math.PI-r)/n;for(let e=0;e<=n;e++){let t=u+r+e*I;c.set(0,Math.sin(t)*D,Math.cos(t)*D),c.add(E),g.set(0,M(t),O(t)),d.push([c.clone(),g.clone()])}d.push([x,p(0,1,0)]);let L=Math.sin(I/2)*D*2,U=d.length-1,B=d[0][0].distanceTo(d[1][0]),G=B+L*n+d[U-1][0].distanceTo(d[U][0]);d[0].push(1);for(let e=0;e<=n;e++)d[e+1].push(1-(B+e*L)/G);d[U].push(0);let R,T,k,[F,j,V]=d[0];for(let e=1;e<d.length;e++)[R,T,k]=d[e],a.push(v,F.y,F.z,v,R.y,R.z,b,F.y,F.z,b,F.y,F.z,v,R.y,R.z,b,R.y,R.z),o.push(0,j.y,j.z,0,T.y,T.z,0,j.y,j.z,0,j.y,j.z,0,T.y,T.z,0,T.y,T.z),l.push(0,V,0,k,1,V,1,V,0,k,1,k),[F,j,V]=[R,T,k];this.setAttribute("position",new pe(a,3)),this.setAttribute("normal",new pe(o,3)),this.setAttribute("uv",new pe(l,2))}},Lr={ConeGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:8,cornerRadiusBottom:8,cornerSegments:8},e.parameters);return i.thetaLength=L.clamp(i.thetaLength,0,360),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let t,{width:i,depth:r,height:s,radialSegments:n,heightSegments:a,openEnded:o,thetaStart:l,thetaLength:h,cornerRadiusTop:d,cornerRadiusBottom:u,cornerSegments:p}=e.parameters;0===h?(t=new ge,t.setAttribute("position",new pe([],3))):t=d>0||u>0||h<360?new gr(0,i/2,s,n,a,o,l,h*Math.PI/180,d,u,p,0,!0):new k(i/2,s,n,a,o);let c=r/i;return 1!==c&&t.scale(1,1,c),Object.assign(t,{userData:{...e,type:"ConeGeometry"}})}},CubeGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:8,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let t,{width:i,height:r,depth:s,widthSegments:n,heightSegments:a,depthSegments:o,cornerRadius:l,cornerSegments:h}=e.parameters;return t=0===l?new G(i,r,s,n,a,o):new fr(i,r,s,n,a,o,l,h),Object.assign(t,{userData:{...e,type:"CubeGeometry"}})}},CylinderGeometry:pr,DodecahedronGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,detail:s,corner:n,cornerSides:a}=e.parameters,o=0===s&&0!==n?new vr(.5*t,n,a):new V(.5*t,s),l=i/t,h=r/t;return(1!==l||1!==h)&&o.scale(1,l,h),Object.assign(o,{userData:{...e,type:"DodecahedronGeometry"}})}},EllipseGeometry:Zi,HelixGeometry:o,IcosahedronGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,detail:0,corner:0,cornerSides:4},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,detail:s,corner:n,cornerSides:a}=e.parameters,o=0===s&&0!==n?new br(.5*t,n,a):new re(.5*t,s),l=i/t,h=r/t;return(1!==l||1!==h)&&o.scale(1,l,h),Object.assign(o,{userData:{...e,type:"IcosahedronGeometry"}})}},LatheGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){(e.parameters?.points??[]).forEach(e=>{Array.isArray(e)&&(e.x=e[0],e.y=e[1])});let i=Object.assign({},t?.parameters??{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{points:t,segments:i,verticalSegments:r}=e.parameters,s=new te;s.moveTo(t[0].x,t[0].y),s.bezierCurveTo(t[1].x,t[1].y,t[2].x,t[2].y,t[3].x,t[3].y);let n=new se(s.extractPoints(r).shape,i);return n.rotateZ(Math.PI),Object.assign(n,{userData:{...e,type:"LatheGeometry"}})}},NonParametricGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i,r=e.geometry??t?.geometry??(new ge).copy(new G(100,100,100));void 0===t?(r.computeBoundingBox(),r.boundingBox.getSize(Or),i={width:Or.x,height:Or.y,depth:Or.z,subdivisions:0}):i=t.parameters;let s={...i,...e.parameters};return{parameters:{width:Math.abs(s.width),height:Math.abs(s.height),depth:Math.abs(s.depth),subdivisions:Math.abs(s.subdivisions)},geometry:r}}static build(e){let{width:t,height:i,depth:r,subdivisions:s}=e.parameters,n=e.geometry??(new ge).copy(new G(100,100,100)),a=n.userData.parameters;void 0===a?(n.boundingBox=function(e){let t=new le,i=e.attributes.position;return i?(t.setFromBufferAttribute(i),t):(t.makeEmpty(),t)}(n),n.boundingBox.getSize(Or)):Or.set(a.width,a.height,a.depth),(t!==Or.x||i!==Or.y||r!==Or.z)&&n.scale(0===Or.x?1:t/Or.x,0===Or.y?1:i/Or.y,0===Or.z?1:r/Or.z);let o=n.originalGeometry;try{s>0?(void 0===o||a?.subdivisions!==s)&&(void 0===o&&(o=n),n=new Sr(s).modify(o)):(void 0!==o&&(n=o),o=void 0,void 0===n.getAttribute("normal")&&n.computeVertexNormals())}catch{void 0!==o&&(n=o),o=void 0,void 0===n.getAttribute("normal")&&n.computeVertexNormals()}return void 0!==o&&Object.assign(n,{originalGeometry:o}),delete e.geometry,Object.assign(n,{userData:{...e,type:"NonParametricGeometry"}})}static loadFromUrl(e,t,i){new N(i).load(e,e=>{let i=this.normalizeInputs({geometry:e});e.boundingBox.getSize(Or);let r=100/Or.x;Object.assign(i.parameters,{width:100,height:Or.y*r,depth:Or.z*r}),t(this.build(i))})}},PolygonGeometry:ar,PyramidGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,radialSegments:s,heightSegments:n,openEnded:a,cornerRadius:o,cornerSegments:l}=e.parameters,h=new Er(.5*t,i,s,n,a,o,l),d=r/t;return 1!==d&&h.scale(1,1,d),Object.assign(h,{userData:{...e,type:"PyramidGeometry"}})}},RectangleGeometry:or,SphereGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:180},e.parameters);return i.thetaLength=L.clamp(i.thetaLength,0,180),{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let t,{width:i=100,height:r=i,depth:s=i,widthSegments:n=64,heightSegments:a=64,phiStart:o,phiLength:l,thetaStart:h,thetaLength:d}=e.parameters;return 0===d?(t=new ge,t.setAttribute("position",new pe([],3))):t=new oe(.5*i,n,a,o,l,h,d*L.DEG2RAD),t.scale(1,r/i,s/i),Object.assign(t,{userData:{...e,type:"SphereGeometry"}})}},PlaneGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,widthSegments:8,heightSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:0})}}static build(e){let{width:t=100,height:i=t,widthSegments:r=8,heightSegments:s=8}=e.parameters,n=new ne(t,i,r,s);return n.scale(1,1,1),Object.assign(n,{userData:{...e,type:"PlaneGeometry"}})}},BackdropGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,angle:90,cornerRadius:24,cornerSegments:8},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width)})}}static build(e){let{width:t,height:i,depth:r,angle:s,cornerRadius:n,cornerSegments:a}=e.parameters,o=new Ir(t,i,r,s,n,a);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},StarGeometry:lr,TextFrameGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t,height:i}=e.parameters,r=new ne(t,i);return Object.assign(r,{userData:{...e,type:"TextFrameGeometry"}})}},TorusGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,radialSegments:32,tubularSegments:64,arc:360,cornerRadius:30,cornerSegments:8},e.parameters),r=Math.abs(i.width),s=Math.abs(i.height??i.width);i.shapeBlendNode&&(s=r);let n=Math.round(Math.abs(i.depth??.25*i.width));return{parameters:Object.assign(i,{width:r,height:s,depth:n})}}static build(e){let{width:t,height:i,depth:r,radialSegments:s,tubularSegments:n,arc:a,cornerRadius:o,cornerSegments:l}=e.parameters,d=function(e,t,i,r,s,n,a,o,l,d,u){[t,i]=[i,t],a=t/2;let p=L.clamp(s/360,0,1);if(0===p){let e=new ge;return e.setAttribute("position",new pe([],3)),e}return 1===p&&(d=0),new h(!0,e,t,i,r,p,n,a,0,l,d,u)}(t,i,r,.5*t,a,n,0,0,s,o,l);return d.scale(1,i/t,1),Object.assign(d,{userData:{...e,type:"TorusGeometry"}})}},TorusKnotGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},e.parameters);return{parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width),depth:Math.abs(i.depth??i.width),tube:i.tube??.125*i.width})}}static build(e){let{width:t,tube:i,tubularSegments:r,radialSegments:s,p:n,q:a}=e.parameters,o=.5*t;o!==i&&(o-=i);let l=new de(o,i,r,s,n,a);return Object.assign(l,{userData:{...e,type:"TorusKnotGeometry"}})}},TriangleGeometry:class{static create(e){return this.build(this.normalizeInputs(e))}static normalizeInputs(e,t){let i=Object.assign({},t?.parameters??{width:100,depth:0,spikes:5,cornerRadius:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},e.parameters);return{shape:e.shape&&e.shape instanceof Ot?e.shape:new Ot,parameters:Object.assign(i,{width:Math.abs(i.width),height:Math.abs(i.height??i.width*(i.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(i.depth??0)})}}static build(e){let{width:t=100,height:i,cornerRadius:r,depth:s,extrudeBevelSize:n,extrudeBevelSegments:a,isRect:o,extrusionVersion:l}=e.parameters,h=e.shape,d=.5*t,u=.5*i;o?(h.addPoint(h.createPoint(-d,u)),h.addPoint(h.createPoint(d,-u)),h.addPoint(h.createPoint(-d,-u))):(h.addPoint(h.createPoint(0,u)),h.addPoint(h.createPoint(d,-u)),h.addPoint(h.createPoint(-d,-u))),h.isClosed=!0;for(let e=0,t=h.points.length;e<t;e++)h.points[e].roundness=r;h.roundness=r,h.update();let p=ei.create({shape:h,parameters:{roundness:r,depth:s,extrudeBevelSize:n,extrudeBevelSegments:a,extrusionVersion:l}});return Object.assign(p,{userData:{...e,type:"TriangleGeometry"}})}},VectorGeometry:ei},Ur=e=>{let t=Lr[e.type]??c(e.type);if(void 0===t)throw new Error(`No geometry factory registered for "${e.type}" — was its feature compiled out of this runtime build?`);return t.create(e)},Br=["font"];function Gr(e,t,i,r){let s,n,a;"PathGeometry"===e.type?(n={...e,extrusion:{...e.extrusion}},a=[[],["extrusion"]]):(n={...e},a=[[]]);for(let e of a){let i=n;for(let t of e)i=i[t];for(s in i){let n=i[s];m(n)&&!Br.includes(s)&&(i[s]=t.getVariable(n,[r.uuid,"geometry",...e,s]),m(i[s])&&(i[s]=1))}}let o,l={parameters:n,type:n.type};if("PathGeometry"===n.type){l.path=n.path;let e=r.profileShape;void 0!==e&&(l.shapeData=e),l.ownerId=r.uuid}else if("VectorGeometry"===n.type){let e=Ot.createFromState(n.shape,n.width,n.height);l.shape=e,l.ownerId=r.uuid}else if("NonParametricGeometry"===n.type){if(n.data.groups&&n.data.groups?.forEach(e=>e.materialIndex=Math.max(e.materialIndex??0,0)),l.geometry=(new N).parse(n),0===l.geometry.groups.length){let e=l.geometry;e.addGroup(0,Math.max(e.getIndex()?.count??0,e.getAttribute("position").count),0)}}else{if("SubdivGeometry"===n.type){let t=new Xr(n,i);return t.data=e,t}if("TextGeometry"===n.type||"InputGeometry"===n.type){let e=c(n.type);if(e)return e.create(n,t);p("text",`a ${n.type}`);let i=Ot.createFromState(M.defaultData(),100,100);return Ur({...n,shape:i,type:"VectorGeometry"})}if("UIGeometry"===n.type)return or.create({parameters:{width:n.width,height:n.height,cornerRadius:n.cornerRadius,cornerType:n.cornerType}})}try{o=Ur(l)}catch(e){console.error(e),console.error(`Error generating geometry with inputs: ${l}`);let t=Ot.createFromState(M.defaultData(),100,100);l.shape=t,l.type="VectorGeometry",o=Ur(l)}return o}var zr=new Z;function Rr(e,t){if(Object.keys(e.morphAttributes).length>0||Object.keys(t.morphAttributes).length>0)return!1;let i=Object.keys(e.attributes),r=Object.keys(t.attributes);if(i.length!==r.length)return!1;for(let i of r){let r=e.attributes[i],s=t.attributes[i];if(void 0===r||!0===r.isInterleavedBufferAttribute||!0===s.isInterleavedBufferAttribute||r.itemSize!==s.itemSize||r.normalized!==s.normalized||r.array.constructor!==s.array.constructor||r.array.length!==s.array.length)return!1}let s=e.index,n=t.index;if(null===s!=(null===n))return!1;let a=!1;if(null!==s&&null!==n){if(s.array.length!==n.array.length)return!1;let e=s.array.constructor,t=n.array.constructor;if(e!==t){if(e!==Uint32Array||t!==Uint16Array)return!1;a=!0}}if(e.groups.length!==t.groups.length)return!1;for(let i=0;i<t.groups.length;i++){let r=e.groups[i],s=t.groups[i];if(r.start!==s.start||r.count!==s.count||r.materialIndex!==s.materialIndex)return!1}for(let i of r){let r=e.attributes[i],s=t.attributes[i];r.array.set(s.array),r.needsUpdate=!0}let o=e.takeDepthStateFrom;if("function"==typeof o&&o.call(e,t),null!==s&&null!==n){if(a){let e=s.array,t=n.array;for(let i=0,r=t.length;i<r;i++){let r=t[i];e[i]=65535===r?4294967295:r}}else s.array.set(n.array);s.needsUpdate=!0}return e.drawRange.start=t.drawRange.start,e.drawRange.count=t.drawRange.count,e.userData=t.userData,e.boundingBox=null,e.boundingSphere=null,!0}function Tr(e,t,i,r){let s,n,a,o=e.position.array,l=e.normal.array,h=zr.makeScale(t,i,r).invert().elements;for(let e=0,d=o.length;e<d;e+=3)o[e]*=t,o[e+1]*=i,o[e+2]*=r,s=l[e],n=l[e+1],a=l[e+2],l[e]=h[0]*s+h[4]*n+h[8]*a,l[e+1]=h[1]*s+h[5]*n+h[9]*a,l[e+2]=h[2]*s+h[6]*n+h[10]*a;e.position.needsUpdate=!0,e.normal.needsUpdate=!0}var kr,Fr=new le,jr=new z;hr.then(e=>{kr=e});var Vr=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Nr=new Uint32Array([0,1,2,3]),Hr=new Uint8Array([4]);function qr(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===e?t:-1}function Wr(e){if(null!=e){if(Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView))return e;if("object"==typeof e)return function(e){let t=Object.keys(e),i=0;for(let e of t){let t=qr(e);t>=i&&(i=t+1)}if(0===i||i>t.length)return;let r=new Array(i);for(let t=0;t<i;t++){let i=e[t];if("number"!=typeof i)return;r[t]=i}return r}(e)}}function Yr(e){if(null==e)return"missing";if(Array.isArray(e))return`Array(${e.length})`;if(ArrayBuffer.isView(e)){let t=e;return`${e.constructor.name}(${t.length})`}if("object"!=typeof e)return typeof e;let t=Object.keys(e),i=t.filter(e=>-1===qr(e)),r=0;for(let e of t){let t=qr(e);t>=r&&(r=t+1)}let s=e,n=-1,a=-1;for(let e=0;e<r;e++)e in s?"number"!=typeof s[e]&&-1===a&&(a=e):-1===n&&(n=e);let o=[`${t.length} keys`,"max index "+(r-1)];return-1!==n&&o.push(`first missing index ${n}`),-1!==a&&o.push(`non-number at ${a} (${typeof s[a]})`),i.length&&o.push(`stray keys ${i.slice(0,3).join(",")}`),`Object{${o.join(", ")}}`}var Xr=class extends ge{constructor(e,t){super(),this.data=e,this.flatShading=t,this.subdivPointer=0,this.rebuild(),this.freeSubdivPointer()}mutateDirectlyScaleBaked(e,t){this.freeSubdivPointer();let i=this.data.scaleBaked.map(e=>"number"==typeof e?e:1),r=g.div(t.map(e=>"number"==typeof e?e:0),i);if(r.every(e=>1===e))return;this.subdividedGeometry&&Tr(this.subdividedGeometry.attributes,...r),this.originalGeometry&&Tr(this.originalGeometry.attributes,...r),this.data=e;let s=this.userData.parameters;this.userData.parameters={width:s.width*r[0],height:s.height*r[1],depth:s.depth*r[2]},this.originalGeometry.boundingSphere.center.multiply(jr.fromArray(r));let n=jr.set(s.width,s.height,s.depth).length();this.originalGeometry.boundingSphere.radius=n/2}ensureSubdivPointer(){return 0===this.subdivPointer&&this.rebuild(),this.subdivPointer}mutateDirectlySubdivisions(e){this.freeSubdivPointer(),this.data=e;let t=e.phongAngle??35;this.flatShading&&(t=-1);let i=null;if(e.subdivisions>0){let r=0;try{r=Xr.allocate(e),i=Xr.buildRefined(r,e.subdivisions,t)}catch(t){console.error(t,e)}finally{r&&Xr.freeSubdivPointer(r)}}this.subdividedGeometry?.dispose(),this.subdividedGeometry=i??void 0,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=this.originalGeometry.boundingSphere);let r=this.userData.parameters;Object.assign(this,this.subdividedGeometry??this.originalGeometry),this.userData.parameters=r}rebuild(){let e,t,i;try{({originalGeometry:e,subdividedGeometry:t,subdivPointer:i}=Xr.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new G(100,100,100),i=0}this.subdivPointer=i,this.originalGeometry=e,this.subdividedGeometry=t??void 0;let r=this.subdividedGeometry??this.originalGeometry;Object.assign(this,r),this.calcBoundingBox()}freeSubdivPointer(){this.subdivPointer&&(Xr.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new ce,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;Fr.setFromBufferAttribute(t),Fr.getCenter(i),e.boundingSphere.radius=i.distanceTo(Fr.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Fr.getSize(jr);let r={width:jr.x,height:jr.y,depth:jr.z};return this.userData.parameters=r,r}static build(e,t,i,r){let s,n,a=e?.phongAngle??35;!1===i&&(a=-1),t&&(kr.free_bvh(t),kr.free_subdivision_surface(t));try{s=Xr.allocate(e,r)}catch(t){console.error(t,e),s=Xr.allocate({positionWASM:Vr,indexWASM:Nr,verticesPerFaceWASM:Hr},r)}kr.set_destination_refinement_level(s,0);let o=Xr.buildLevel(s,!0,a);return n=e.subdivisions>0?Xr.buildRefined(s,e.subdivisions,a):null,{subdivPointer:s,originalGeometry:o,subdividedGeometry:n}}static buildRefined(e,t,i){try{return kr.set_destination_refinement_level(e,t),Xr.buildLevel(e,!1,i)??null}catch{try{return kr.set_destination_refinement_level(e,t-1),Xr.buildLevel(e,!1,i)??null}catch{return null}}}static primitiveToQuads(e,t,i){e.widthSegments>16&&(e.widthSegments=16),e.heightSegments>16&&(e.heightSegments=16),e.depthSegments>16&&(e.depthSegments=16),e.radialSegments>16&&(e.radialSegments=16),"DodecahedronGeometry"===e.type&&(e.detail=0);let r,s=void 0!==e.shape||void 0!==e.path?t.geometry:Gr(e,i,!1,t);r=l(e)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let n,{positions:a,triIndices:o,triOriginals:h}=Kr(s.getAttribute("position"),r);if("CylinderGeometry"===e.type&&0===e.cornerRadius&&0===e.hollow&&!1===e.openEnded){let t=e.radialSegments*e.heightSegments*3*2;n=[t,t+3*e.radialSegments]}let{indices:d,verticesPerFace:u,uvs:p}=function(e,t,i,r,s){let n=[],a=[],o=s?i.getAttribute("uv"):void 0,l=o&&2===o.itemSize?[]:void 0,h=e=>{if(l){let t=s[e];l.push(o.getX(t),o.getY(t))}};if(void 0!==i.userData.shape&&0===i.userData.parameters.depth&&0===i.userData.shape.shapeHoles.length){let t=i.userData.shape.extractShapePointsToFlatArray([]),r=i.userData.parameters.spikes;if("EllipseGeometry"===i.userData.type&&r<=24&&r%4==0&&i.userData.parameters.angle>=360){let e=t.length/2/r;t=t.filter((t,i)=>Math.floor(i/2)%e===0)}let s=0;for(let e=0;e<t.length;e+=2)s+=(t[e]-t[(0===e?t.length:e)-2])*(t[e+1]+t[(0===e?t.length:e)-1]);e.length=0;let o=0;if(s<0)for(let i=0;i<t.length;i+=2)e.push(t[i],t[i+1],0),n.push(o++);else for(let i=t.length-2;i>=0;i-=2)e.push(t[i],t[i+1],0),n.push(o++);return a.push(o),{indices:n,verticesPerFace:a}}let d=new Float32Array([i.userData.parameters.depth])[0],u=0;for(;u<t.length;){if(i.useNgonForTopBottomFaceDuringBake){let i=0;if((e[3*t[u]+2]===d||0===e[3*t[u]+2])&&i++,(e[3*t[u+1]+2]===d||0===e[3*t[u+1]+2])&&i++,(e[3*t[u+2]+2]===d||0===e[3*t[u+2]+2])&&i++,3===i)break}if(t[u+1]===t[u+3]&&t[u+2]===t[u+5]||t[u+0]===t[u+3]&&t[u+2]===t[u+4]){Zr.set(e[3*t[u]],e[3*t[u]+1],e[3*t[u]+2]),Jr.set(e[3*t[u+1]],e[3*t[u+1]+1],e[3*t[u+1]+2]),Qr.set(e[3*t[u+4]],e[3*t[u+4]+1],e[3*t[u+4]+2]),es.set(e[3*t[u+5]],e[3*t[u+5]+1],e[3*t[u+5]+2]),Jr.sub(Zr).normalize(),Qr.sub(Zr).normalize(),es.sub(Zr).normalize();let i=Jr.cross(Qr).dot(es),s=u;Math.abs(i)>.005||r&&r.some((e,t)=>t%2!=1&&s>=r[t]&&s<r[t+1])?(n.push(t[u],t[u+1],t[u+2]),h(u),h(u+1),h(u+2),a.push(3),u+=3):(n.push(t[u],t[u+1],t[u+4],t[u+5]),h(u),h(u+1),h(u+4),h(u+5),a.push(4),u+=6)}else n.push(t[u],t[u+1],t[u+2]),h(u),h(u+1),h(u+2),a.push(3),u+=3}if(i.useNgonForTopBottomFaceDuringBake){let t=[],r=[],s=0;for(let i=0,n=0;i<e.length;i+=3,n++)0===e[i+2]&&(t.push(n),s++),e[i+2]===d&&r.push(n);if(0===i.userData.parameters.extrudeBevelSize){let e=r[0];r[0]=r[1],r[1]=e}t.reverse(),n.push(...t,...r),a.push(s,s),l=void 0}return{indices:n,verticesPerFace:a,uvs:l}}(a,o,s,n,h);return{positions:a,indices:d,verticesPerFace:u,uvs:p}}static allocate(e,t){let i,r,s,n=[],a=[],o=Wr(e.positionWASM),l=Wr(e.indexWASM),h=Wr(e.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!h?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology — positionWASM ${Yr(e.positionWASM)}, indexWASM ${Yr(e.indexWASM)}, verticesPerFaceWASM ${Yr(e.verticesPerFaceWASM)}`);i=o,r=l,s=h;let t=Wr(e.uvWASM);kr.alloc_subdivision_surface_uvs&&t&&t.length===2*r.length&&(a=t)}else i=Vr,r=Nr,s=Hr;let d=i.length,u=r.length,p=s.length,c=i.length+n.length+a.length,g=r.length+s.length,m=c*Float32Array.BYTES_PER_ELEMENT+g*Uint32Array.BYTES_PER_ELEMENT,f=c*Float32Array.BYTES_PER_ELEMENT,y=kr._malloc(m);if(!y)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${m}) failed`);let v,b=new Float32Array(kr.HEAPF32.buffer,y,c),x=new Uint32Array(kr.HEAPU32.buffer,y+f,g);b.set(i,0),b.set(n,i.length),b.set(a,i.length+n.length),x.set(r,0),x.set(s,r.length),e?.scaleBaked?.some(e=>1!==e)&&(v=(new Z).makeScale(...e.scaleBaked.map(e=>"number"==typeof e?e:1))),t&&(v?v.premultiply(t):v=t);let w=y+(i.length+n.length)*Float32Array.BYTES_PER_ELEMENT,S=a.length?v?kr.alloc_subdivision_surface_uvs2(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,w,a.length,v.elements):kr.alloc_subdivision_surface_uvs(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,w,a.length):v?kr.alloc_subdivision_surface2(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,v.elements):kr.alloc_subdivision_surface(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p);return kr._free(y),S}static buildLevel(e,t,i,r,s,n=!1){let a=s?kr.get_mesh_data2(e,t?kr.Level.CONTROL:kr.Level.REFINED,i,s.elements):kr.get_mesh_data(e,t?kr.Level.CONTROL:kr.Level.REFINED,i),o=kr.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),h=0,d=kr.HEAPU32[o[h]>>2],u=kr.HEAPF32.subarray(d>>2,(d>>2)+l[h]);h++;let p=kr.HEAPU32[o[h]>>2],c=kr.HEAPF32.subarray(p>>2,(p>>2)+l[h]);h++;let g=kr.HEAPU32[o[h]>>2],m=kr.HEAPU32.subarray(g>>2,(g>>2)+l[h]);h++;let f,y=kr.HEAPU32[o[h]>>2],v=kr.HEAPU32.subarray(y>>2,(y>>2)+l[h]);if(h++,kr.alloc_subdivision_surface_uvs){let e=o[9];if(e>0){let t=kr.HEAPU32[o[8]>>2];f=kr.HEAPF32.subarray(t>>2,(t>>2)+e)}}if(void 0===r){let e=new ge;if(e.setIndex(new ue(v,1)),e.setAttribute("position",new pe(u,3)),e.setAttribute("normal",new pe(c,3)),f&&e.setAttribute("uv",new pe(f,2)),t){e.setAttribute("faceMap",new ue(m,1));let t=new Float32Array(c.length/3*4).fill(0);e.setAttribute("color",new D(t,4))}return kr.free_mesh_data(a),e.userData.type="SubdivGeometry",e}if(r.getAttribute("position").copyArray(u),r.getAttribute("normal").copyArray(c),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,n){let e=r.getIndex();null!==e&&e.array.length===v.length&&(e.copyArray(v),e.needsUpdate=!0)}let b=r.getAttribute("uv");f&&b&&b.array.length===f.length&&(b.copyArray(f),b.needsUpdate=!0),kr.free_mesh_data(a)}static freeSubdivPointer(e){kr.free_bvh(e),kr.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=kr.get_wireframe_data_for_base_level(e),s=kr.HEAPU32.subarray(r>>2,4+(r>>2)),n=s.subarray(2,4),a=0,o=kr.HEAPU32[s[a]>>2],l=kr.HEAPF32.subarray(o>>2,(o>>2)+n[a]);a++;let h=kr.HEAPU32[s[a]>>2],d=kr.HEAPU32.subarray(h>>2,(h>>2)+n[a]);if(void 0===t){let e=new ge;e.setAttribute("position",new pe(l,3));let t=new Float32Array(l.length);for(let e=0,r=l.length;e<r;)t[e++]=i.r,t[e++]=i.g,t[e++]=i.b;return e.setAttribute("color",new D(t,3)),e.setIndex(new ue(d,1)),kr.free_wireframe_data_for_base_level(r),e}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,kr.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=0===t;r||kr.set_destination_refinement_level(e,t);let s=i?kr.get_topological_data2(e,r?kr.Level.CONTROL:kr.Level.REFINED,i.elements):kr.get_topological_data(e,r?kr.Level.CONTROL:kr.Level.REFINED),n=kr.HEAPU32.subarray(s>>2,8+(s>>2)),a=n.subarray(3,6),o=0,l=kr.HEAPU32[n[o]>>2],h=new Float32Array(kr.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let d=kr.HEAPU32[n[o]>>2],u=new Uint32Array(kr.HEAPU32.subarray(d>>2,(d>>2)+a[o]));o++;let p,c=kr.HEAPU32[n[o]>>2],g=new Uint8Array(kr.HEAPU32.subarray(c>>2,(c>>2)+a[o]));if(kr.alloc_subdivision_surface_uvs){let e=n[7];if(e>0){let t=kr.HEAPU32[n[6]>>2];p=new Float32Array(kr.HEAPF32.subarray(t>>2,(t>>2)+e))}}return kr.free_topological_data(s),{positions:h,indices:u,verticesPerFace:g,uvs:p}}};function $r(e){let t=Object.keys(e);return 1===t.length&&"subdivisions"===t[0]}function Kr(e,t){let i=t?t.count:e.count,r=0,s=1e4,n=new Map,a=new Uint32Array(i),o=[];for(let l=0;l<i;l++){let i=t?t.getX(l):l,h=e.getX(i),d=e.getY(i),u=e.getZ(i),p=Math.round(h*s),c=Math.round(d*s),g=Math.round(u*s),m=n.get(p);void 0===m&&(m=new Map,n.set(p,m));let f=m.get(c);void 0===f&&(f=new Map,m.set(c,f));let y=f.get(g);void 0===y&&(y=r++,f.set(g,y),o.push(h,d,u)),a[l]=y}let l=[],h=[];for(let e=0;e<a.length;e+=3)a[e]===a[e+1]||a[e]===a[e+2]||a[e+1]===a[e+2]||(l.push(a[e],a[e+1],a[e+2]),h.push(t?t.getX(e):e,t?t.getX(e+1):e+1,t?t.getX(e+2):e+2));return{positions:o,triIndices:l,triOriginals:h}}var Zr=new z,Jr=new z,Qr=new z,es=new z;function ts(e,t){let i=0;if(!e.layers||0===e.layers.length)return!1;let r=e.layers?.find(e=>"light"===e.data.type);if(r){let e=r.data,i=Number(t.getVariable(e.alphaOverride));if(("string"==typeof e.alphaOverride?i/100:e.alphaOverride)<1)return!0}for(let r of e.layers){if("displace"!==r.data.type&&r.data.isMask)return!0;if("displace"!==r.data.type&&"alpha"in r.data&&"light"!==r.data.type&&"fresnel"!==r.data.type&&"cavity"!==r.data.type&&"dust"!==r.data.type&&"texture"!==r.data.type&&"matcap"!==r.data.type&&"rainbow"!==r.data.type&&"outline"!==r.data.type&&"pattern"!==r.data.type){let e=r.data.visible?r.data.alpha:0;if("string"==typeof e&&(e=Math.max(0,Math.min(1,Number(t.getVariable(e)??100)/100))),1===e&&"depth"===r.data.type||"gradient"===r.data.type){for(let t of r.data.colors)if(t[3]<1){e=t[3];break}}else if(1===e&&"noise"===r.data.type){let i=t.color(r.data.colorA).a,s=t.color(r.data.colorB).a,n=t.color(r.data.colorC).a,a=t.color(r.data.colorD).a,o=Math.min(i,Math.min(s,Math.min(n,a)));o<1&&(e=o)}i+=(1-i)*e}}return i<1}var is=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable("number"==typeof e?100*e:e,i)??100)/100))??1,rs=(e,t,i)=>"number"==typeof e?e:t.getVariable(e,i),ss=(e,t)=>(e||(e=new z),e.x=rs(e.x,t)??0,e.y=rs(e.y,t)??0,e.z=rs(e.z,t)??0,e),ns=(e,t)=>(e||(e=new U),e.x=rs(e.x,t)??0,e.y=rs(e.y,t)??0,e);function as(e,t){return"displace"===e?"intensity"===t:"alpha"===t}function os(e,t,i){let r="alpha"===e?Math.max(0,Math.min(Number(t)/100,1)):Number(t);return i?r:0}function ls(e){let t="string"==typeof e?e:e.type;return"texture"===t||"video"===t||"displace_map"===t||"matcap"===t}function hs(e){return"string"==typeof e||"number"==typeof e&&0!==e}var ds={noise:["noiseType"],texture:["projection","axis","projectionAxis","side"],video:["projection","axis","projectionAxis","side"],displace:["noiseType"],light:["roughnessMap","bumpMap","roughnessMapChannel","metalnessMap","metalnessMapChannel","normalMap","aoMap","aoMapChannel","emissiveMap"],depth:["smooth","isWorldSpace","gradientType","isVector"],pattern:["style","projection","axis"],reflection:["tracingMode","mirror"]},us={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]},ps=class extends(n(ee)){},cs=class extends ps{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1}raycast(e,t){}expand(){let e=0,t=this.object.entityChildren(e);for(;t;){let i=this.children[e];i?.object!==t&&(i&&this.remove(i),i=new cs(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.shearMatrix=t.shearMatrix,i.pivotMatrix=t.pivotMatrix),i.expand(),e+=1,t=this.object.entityChildren(e)}for(;this.children.length>e;)this.remove(this.children[e]);this.pivotMatrix=this.object.pivotMatrix}get visible(){let e=this.object.cloner;return(void 0===e||this.parent!==e||!e.instancingActive&&!e.insideBoolean)&&(void 0!==this.playModeVisible?this.playModeVisible:this.object.visible||this.object.dataPatched.visible&&!0===this.object.dataPatched.cloner?.hideBase)}set visible(e){}get castShadow(){return this.object.castShadow}set castShadow(e){}get receiveShadow(){return this.object.receiveShadow}set receiveShadow(e){}get isMesh(){return(()=>"Mesh"===this.object.type)()}get isLight(){return this.object.isLight}get layers(){return this.object.layers}set layers(e){}get isCamera(){return!1}get geometry(){if(this.object.geometry)return this.object.geometry}get material(){if(this.object.material)return this.object.material}get morphTargetInfluences(){if(this.object.morphTargetInfluences)return this.object.morphTargetInfluences}set morphTargetInfluences(e){}},gs=class extends Ui{},ms=new Set(["CubeGeometry","SphereGeometry","CylinderGeometry","ConeGeometry","TorusGeometry","TorusKnotGeometry","IcosahedronGeometry","DodecahedronGeometry","PyramidGeometry","PlaneGeometry","BackdropGeometry","HelixGeometry"]);function fs(e){switch(typeof e){case"number":return Number.isFinite(e)?JSON.stringify(e):void 0;case"boolean":return JSON.stringify(e);case"string":return m(e)?void 0:JSON.stringify(e);case"object":{if(null===e)return"null";if(Array.isArray(e)){let t="[";for(let i=0;i<e.length;i++){let r=fs(e[i]);if(void 0===r)return;t+=(i>0?",":"")+r}return t+"]"}let t=e,i="{",r=!0;for(let e of Object.keys(t).sort()){if(void 0===t[e])continue;let s=fs(t[e]);if(void 0===s)return;i+=`${r?"":","}${JSON.stringify(e)}:${s}`,r=!1}return i+"}"}default:return}}var ys=class{constructor(){this.objects=new Map,this.refs=new Map,this.sharedByKey=new WeakSet,this.unreachable=new Set}resolveObject(e,t,i){return this.createObject(e,t,i)}onObjectDisposed(e){}getCached(e){return this.objects.get(e)}get size(){return this.objects.size}get(e,t,i){let r=this.objects.get(e);return void 0===r?(r=this.resolveObject(e,t,i),this.objects.set(e,r),this.retain(r)):(this.sharedByKey.add(r),r.isShared=!0),r}forceDelete(e){let t=this.objects.get(e);t&&(this.objects.delete(e),this.release(t))}adopt(e,t){this.replace(e,t),this.retain(t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&!0!==i.isShared)return this.objects.delete(e),this.replace(t,i),i}replace(e,t){let i=this.objects.get(e);this.objects.set(e,t),void 0!==i&&i!==t&&this.release(i)}startGc(){this.unreachable=new Set(this.objects.keys())}markAsReachable(e,t){t===this.objects.get(e)&&this.unreachable.delete(e)}endGc(){this.unreachable.forEach(e=>{let t=this.objects.get(e);this.objects.delete(e),this.release(t)}),this.unreachable.clear()}dispose(){new Set(this.objects.values()).forEach(e=>{this.disposeObject(e),this.onObjectDisposed(e)}),this.objects.clear(),this.refs.clear()}retain(e){let t=(this.refs.get(e)??0)+1;this.refs.set(e,t),t>1&&(e.isShared=!0)}release(e){let t=(this.refs.get(e)??1)-1;if(t>0)return this.refs.set(e,t),void(1===t&&!this.sharedByKey.has(e)&&(e.isShared=!1));this.refs.delete(e),this.disposeObject(e),this.onObjectDisposed(e)}},vs=class extends ys{constructor(e){super(),this.flatShading=e,this.dedupeByValue=!1,this.byValue=new Map,this.valueKeyOf=new Map}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Gr(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}resolveObject(e,t,i){let r=this.dedupeByValue?function(e,t,i){if(!ms.has(e.type))return;let r=e;if(null!=r.shapeBlendNode||i.isTransientGeometryKey(e))return;let s=t.material;if(void 0===s||Array.isArray(s))return;let n=s;if("function"!=typeof n.getLayersOfType||n.getLayersOfType("outline").length>0||n.getLayersOfType("cavity").length>0)return;let a=e.type;for(let e of Object.keys(r).sort()){let t=r[e];if(void 0===t||"type"===e)continue;let i=fs(t);if(void 0===i)return;a+=`|${e}=${i}`}return a}(e,i,t):void 0;if(void 0!==r){let e=this.byValue.get(r);if(void 0!==e)return e}let s=this.createObject(e,t,i);return void 0!==r&&(this.byValue.set(r,s),this.valueKeyOf.set(s,r)),s}mutateIfUnique(e,t){let i=super.mutateIfUnique(e,t);return void 0!==i&&this.forgetValue(i),i}onObjectDisposed(e){this.forgetValue(e)}forgetValue(e){let t=this.valueKeyOf.get(e);void 0!==t&&(this.valueKeyOf.delete(e),this.byValue.get(t)===e&&this.byValue.delete(t))}},bs={markNeedsUpdateRendererDirty:()=>{}};function xs(e){return"variable_"+e}var ws=new Z,Ss=new z,Ms=new B,Os=new z,As=new Q,Ps=class extends Ti{constructor(e){super(),this.shared=e}create(e){return new Hi(e,this.shared)}},_s=new Set,Ds=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new vs(!0),this.geometryCache2=new vs(!1),this.imageHolderCache=new Ps(this),this.thisContext={scene:bs,shared:this},this.deletedImage=new qi(v.emptyImage,this),this.deletedVideo=new qi(b.defaultVideo,this),this.materials={},this.images={},this.uiBuffers={},this.videos={},this.colors={},this.audios={},this.particles={},this.fonts={},this.variables={},this.userAPIs={},this.userWebhooks={},this.mouseProperty=null,this.raycastProperty=null,this.requestRender=()=>{this._requestRender&&this._requestRender()},this.transientGeometryKeys=new WeakSet,t.images)for(let[e,i]of Object.entries(t.images))this.addImage(e,i);if(t.videos)for(let[e,i]of Object.entries(t.videos))this.addVideo(e,i);if(t.audios)for(let[e,i]of Object.entries(t.audios))this.addAudio(e,i);if(t.particles)for(let[e,i]of Object.entries(t.particles))this.addParticle(e,i);this.reset(e)}get deletedMaterial(){return this._deletedMaterial??(this._deletedMaterial=vi(S.defaultTwoLayerData("phong"),this.thisContext,"")),this._deletedMaterial}setRequestRender(e){this._requestRender=e}getImageLoadPromises(){return Object.values(this.images).map(e=>e.loadPromise)}setEntityOpContext(e){this.entityOpContext=e}reset(e,t=!1,i=!1){this.data=e,this.resetLib(e.lib);for(let{id:i,data:r}of e.variables)this.addVariableHolder(i,r),t&&this.updateVariableHolder(i,r);for(let[t,i]of Object.entries(e.userAPIs??{}))this.addUserAPI(t,i);for(let[t,i]of Object.entries(e.userWebhooks??{}))this.addUserWebhook(t,i);if(!i){for(let[t,i]of Object.entries(e.images))this.addImage(t,i);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i)}for(let[t,i]of Object.entries(e.colors))this.addColor(t,i);for(let[t,i]of Object.entries(e.lib.materials))this.addMaterial(t,i.asset);for(let[t,i]of Object.entries(e.materials))this.addMaterial(t,i);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i)}addMaterial(e,t){if(t=S.withRepairedLayers(t),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=vi(t,this.thisContext,e);this.materials[e]=i}}deleteMaterial(e){this.materials[e]&&(this.materials[e].nodeMaterialDispose(),delete this.materials[e])}getMaterial(e){return this.materials[e]}getMaterialOrDeletedPlaceholder(e){return this.materials[e]??this.deletedMaterial}material(e){return"string"==typeof e?this.getMaterialOrDeletedPlaceholder(e):null==e?(console.error("material is undefined or null"),this.deletedMaterial):yi(S.withRepairedLayers(e),this.thisContext)}getMaterials(){return this.materials}addImage(e,t){return this.images[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.images[e].updateSrc(t.data),!0):(this.images[e]=new qi(t,this),!1)}deleteImage(e){let t=this.images[e];t&&(t.dispose(),delete this.images[e])}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]??this.deletedImage}image(e){return"string"==typeof e?this.getImage(e):this.imageHolderCache.load(e)}addUIBuffer(e,t){return this.uiBuffers[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),this.uiBuffers[e].updateSrc(t),!0):(this.uiBuffers[e]=new qi(t,this),!1)}uiBuffer(e){return this.uiBuffers[e]}getEntityTexture(e,t={}){let i=e.material;if(!i)return null;for(let e of Array.isArray(i)?i:[i]){let i=e.root??e;for(let e of i?.data?.layers??[]){let i=e?.data;if("texture"!==i?.type&&"matcap"!==i?.type||void 0!==t.layer&&e.id!==t.layer&&i.type!==t.layer)continue;let r=i.texture?.image;if(null==r)continue;let s=("string"==typeof r?this.uiBuffer(r):void 0)??this.image(r);if(!s)continue;let n=s.getTexture(i.texture.wrapping??("texture"===i.type?1e3:1001),i.texture.minFilter??1008,i.texture.magFilter??1006),a=s.img;return{texture:n,width:a?.width??0,height:a?.height??0,layerId:e.id,layerType:i.type}}}return null}addVideo(e,t){return this.videos[e]?(this.videos[e].updateSrc(t.data),!0):(this.videos[e]=new qi(t,this),!1)}deleteVideo(e){let t=this.videos[e];t&&(t.dispose(),delete this.videos[e])}getVideo(e){return this.videos[e]??this.deletedVideo}video(e){return"string"==typeof e?this.getVideo(e):this.imageHolderCache.load(e)}addColor(e,t){return this.colors[e]?(this.onColorOrImageUpdate&&this.onColorOrImageUpdate(),"a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):(this.colors[e]=new gs(t.r,t.g,t.b,"a"in t?t.a:1),!1)}updateColor(e,t){if(this.colors[e]){this.onColorOrImageUpdate&&this.onColorOrImageUpdate();let i=this.colors[e];return this.colors[e].r=t.r??i.r,this.colors[e].g=t.g??i.g,this.colors[e].b=t.b??i.b,this.colors[e].a=t.a??i.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}getColorNames(){return Object.values(this.data.colors).map(e=>e.name)}getColorByName(e){for(let t in this.data.colors)if(this.data.colors[t].name===e)return{color:this.colors[t],id:t}}color(e){let t;if("string"!=typeof e)return new Ui(e.r,e.g,e.b,"a"in e?e.a:1);{let i=this.getColor(e);i?t=i:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new Ui(0,0,0,0))}return t}addAudio(e,t){this.audios[e]=t}getAudio(e){let t=this.audios[e];if(t instanceof i)return t;{let r=new i({src:t.data});return this.audios[e]=r,r}}addParticle(e,t){this.particles[e]=t}getParticle(e){return this.particles[e]}deleteParticle(e){this.particles[e]&&delete this.particles[e]}deleteAudio(e){let t=this.audios[e];t&&(t instanceof i&&t.dispose(),delete this.audios[e])}addFont(e,t){let i=Pe;null!==i?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):p("text","a font asset")}getFont(e){return this.fonts[e]}deleteFont(e){this.fonts[e]&&delete this.fonts[e]}dispose(){Object.keys(this.materials).forEach(e=>this.deleteMaterial(e)),this._requestRender=void 0,Object.values(this.audios).forEach(e=>{e instanceof i&&e.dispose()}),this.audios={},this.particles={},this.geometryCache.dispose(),this.geometryCache2.dispose()}addVariableHolder(e,t){if(void 0===this.variables[e]){let i=t.value;if(this.enableLocalStorageForPersistentVariables&&t.persistent){let r=localStorage.getItem(xs(e));i=null!==r?JSON.parse(r):t.value}return this.variables[e]={value:i,locations:[],persistent:t.persistent},"dynamicVariableType"in t&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0),!0}return this.variables[e].value=t.value,!1}resetDynamicVariablePlayState(){for(let e in this.variables)void 0!==this.variables[e].dynamicVariablePlayState&&(this.variables[e].dynamicVariablePlayState="Playing",this.variables[e].dynamicVariableToggleIsForward=void 0)}updateVariableHolder(e,t){this.updateVariable(e,t.value)}updateVariable(e,t){if(void 0===this.variables[e])return!1;this.variables[e].value=t,this.enableLocalStorageForPersistentVariables&&this.variables[e].persistent&&localStorage.setItem(xs(e),JSON.stringify(t));let i=t;for(;"string"==typeof i;)i=this.variables[i].value;let r=this.entityOpContext.scene,s=!1;for(let t=this.variables[e].locations.length-1;t>=0;t--){let n=this.variables[e].locations[t];if("material"===n[0]){let e=n[1],t=i,s={scene:r,shared:this},a=n.slice(2);r.traverseMaterial(i=>{let r=i.root??i;r.uuid===e&&r.onVariableUpdate(a,t,s)});let o=this.materials[e];o&&o.onVariableUpdate(a,t,s)}else{let o=r.find(n[0]);if(void 0===o){this.variables[e].locations.splice(t,1);continue}if(s=!0,"geometry"!==n[1]&&"particles"!==n[1]){for(let e=1;e<n.length-1;e++)o=o[n[e]];"rotation"===n[1]?o[n[n.length-1]]=i*L.DEG2RAD:o[n[n.length-1]]=i}if(o=r.find(n[0]),"ParticleEmitter"===o.type&&o.updateVariableState(i,n),a.is(o))if("position"===n[1]||"rotation"===n[1]||"scale"===n[1])o.onVariableUpdate();else if("geometry"===n[1]){let e=o;o.component&&(e=o.component);let t=e.dataPatched;e.chooseGeoemtryCache(this).forceDelete(t.geometry),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData(),e.instances.forEach(e=>{let t=e.dataPatched;e.chooseGeoemtryCache(this).forceDelete(t.geometry),e.createGeometryDelayed(this.entityOpContext),e.onVariableUpdate(!0),e.invalidateDownstreamBooleanData()})}else"morphTargetInfluences"===n[1]&&o.updateMorphInfluences(n[2],i)}}return s&&r.markShadowsDirty(),this.requestRender(),!0}isTransientGeometryKey(e){return this.transientGeometryKeys.has(e)}updateEntityGeometryParams(e,t){let i=e;if(i.component&&(i=i.component),"function"!=typeof i.chooseGeoemtryCache)return!1;let r=i.dataPatched,s=r?.geometry;if(!s||"string"!=typeof s.type||"VectorGeometry"===s.type||"PathGeometry"===s.type)return!1;let n=e=>e.toLowerCase().replace(/[\s_.-]+/g,""),a=new Map;for(let e of Object.keys(s))a.set(n(e),e);let o={};for(let[e,i]of Object.entries(t??{})){let t=a.get(n(e));if(void 0===t||"type"===t||"font"===t||"shape"===t||"path"===t||"data"===t)continue;if("text"===t){("string"==typeof i||"number"==typeof i)&&(o[t]={textValue:String(i)});continue}let r=s[t];"number"==typeof i&&isFinite(i)&&("number"==typeof r||"string"==typeof r)&&(o[t]=i)}if(0===Object.keys(o).length)return!1;let l={...s,...o};return i.dataPatched={...r,geometry:l},this.transientGeometryKeys.has(s)&&i.chooseGeoemtryCache(this).forceDelete(r.geometry),this.transientGeometryKeys.add(l),i.createGeometryDelayed(this.entityOpContext),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}resetEntityGeometryParams(e){let t=e;if(t.component&&(t=t.component),"function"!=typeof t.chooseGeoemtryCache)return!1;let i=t.dataPatched?.geometry;return!(!i||!this.transientGeometryKeys.has(i)||(t.dataPatched=t.data,t.chooseGeoemtryCache(this).forceDelete(i),t.createGeometryDelayed(this.entityOpContext),t.onVariableUpdate(!0),t.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),0))}updateEntityGeometryVertices(e,t){let i=e;if(i.component&&(i=i.component),"function"!=typeof i.chooseGeoemtryCache)return!1;let r=i.dataPatched,s=r?.geometry;if(!s||"NonParametricGeometry"!==s.type)return!1;let n=t?.vertices;if(void 0===n||"number"!=typeof n.length||n.length<9||n.length%3!=0||n.length/3>Ds.MAX_TRANSIENT_VERTICES)return!1;let a,o,l,h=n instanceof Float32Array?n:Float32Array.from(n),d=h.length/3;if(void 0!==t.normals){if(t.normals.length!==h.length)return!1;a=t.normals instanceof Float32Array?t.normals:Float32Array.from(t.normals)}if(void 0!==t.uvs){if(t.uvs.length!==2*d)return!1;o=t.uvs instanceof Float32Array?t.uvs:Float32Array.from(t.uvs)}if(void 0!==t.indices){let e=d>65535?Uint32Array.from(t.indices):Uint16Array.from(t.indices);if(0===e.length||e.length%3!=0)return!1;for(let t=0;t<e.length;t++)if(e[t]>=d)return!1;l={array:e,itemSize:1,type:e.constructor.name,normalized:!1}}else{let e=s.data,t=e?.index;if(t?.array?.length){let i=(e?.attributes?.position?.array?.length??0)/3;if(d!==i)return function(e,t){let i=`${e}/${t}`;_s.has(i)||(_s.add(i),console.warn(`[spline] updateObject: ignoring a geometry update of ${e} vertices for a mesh that holds ${t}. Without \`indices\` the write is taken as a morph of the mesh's own vertices, which only means anything at the same count — send \`indices\` alongside \`vertices\` to replace the topology too.`))}(d,i),!1;l=t}}let u=1/0,p=1/0,c=1/0,g=-1/0,m=-1/0,f=-1/0;for(let e=0;e<h.length;e+=3){let t=h[e],i=h[e+1],r=h[e+2];t<u&&(u=t),t>g&&(g=t),i<p&&(p=i),i>m&&(m=i),r<c&&(c=r),r>f&&(f=r)}let y=(e,t)=>({array:e,itemSize:t,type:"Float32Array",normalized:!1}),v={position:y(h,3)};a&&(v.normal=y(a,3)),o&&(v.uv=y(o,2));let b={...s,width:g-u,height:m-p,depth:f-c,data:{attributes:v,...l?{index:l}:{}}},x=this.transientGeometryKeys.has(s);return i.dataPatched={...r,geometry:b},this.transientGeometryKeys.add(b),i.applyTransientGeometryData(this.entityOpContext,x),i.onVariableUpdate(!0),i.invalidateDownstreamBooleanData(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),!0}setEntityInstanceTransforms(e,t){let i=e;i.component&&(i=i.component);let r=i.cloner;if(void 0===r)return-1;let s=r.children,n=Math.PI/180,a=!1;if(null===t)for(let e of s)void 0!==e.transformOverride&&(e.transformOverride=void 0,a=!0);else{if(!Array.isArray(t))return s.length;{let e=Math.min(t.length,s.length);for(let i=0;i<e;i++){let e=t[i],r=s[i];if(null==e){void 0!==r.transformOverride&&(r.transformOverride=void 0,a=!0);continue}let o=r.transformOverride??{position:[r.position.x,r.position.y,r.position.z],rotation:[r.rotation.x,r.rotation.y,r.rotation.z],scale:[r.scale.x,r.scale.y,r.scale.z]};e.position&&("number"==typeof e.position.x&&(o.position[0]=e.position.x),"number"==typeof e.position.y&&(o.position[1]=e.position.y),"number"==typeof e.position.z&&(o.position[2]=e.position.z)),e.rotation&&("number"==typeof e.rotation.x&&(o.rotation[0]=e.rotation.x*n),"number"==typeof e.rotation.y&&(o.rotation[1]=e.rotation.y*n),"number"==typeof e.rotation.z&&(o.rotation[2]=e.rotation.z*n)),e.scale&&("number"==typeof e.scale.x&&(o.scale[0]=e.scale.x),"number"==typeof e.scale.y&&(o.scale[1]=e.scale.y),"number"==typeof e.scale.z&&(o.scale[2]=e.scale.z)),r.transformOverride=o,r.position.fromArray(o.position),r.rotation.fromArray(o.rotation),r.scale.fromArray(o.scale),r.updateMatrix(),r.hasNonUniformScale&&(r.updateMatrixWorld(),r.updateMatrixWorldRigid())}}}return a?r.update(this.entityOpContext):r.syncInstanceMatrices(),r.invalidateTransform(i),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),s.length}spawnRuntimeClone(e,t={}){if("function"!=typeof e.entityChildren)return;let i=e.parent;if(null===i)return;let r=new cs(e);r.playModeVisible=!1!==t.visible,r.expand(),"string"==typeof t.name&&(r.name=t.name);let s=Math.PI/180;return r.position.copy(e.position),r.rotation.copy(e.rotation),r.scale.copy(e.scale),r.shearMatrix.copy(e.shearMatrix),t.position&&("number"==typeof t.position.x&&(r.position.x=t.position.x),"number"==typeof t.position.y&&(r.position.y=t.position.y),"number"==typeof t.position.z&&(r.position.z=t.position.z)),t.rotation&&("number"==typeof t.rotation.x&&(r.rotation.x=t.rotation.x*s),"number"==typeof t.rotation.y&&(r.rotation.y=t.rotation.y*s),"number"==typeof t.rotation.z&&(r.rotation.z=t.rotation.z*s)),t.scale&&("number"==typeof t.scale.x&&(r.scale.x=t.scale.x),"number"==typeof t.scale.y&&(r.scale.y=t.scale.y),"number"==typeof t.scale.z&&(r.scale.z=t.scale.z)),r.updateMatrix(),i.add(r),r.updateWorldMatrix(!0,!0),this.entityOpContext.scene.markShadowsDirty(),this.requestRender(),r}destroyRuntimeClone(e){e.removeFromParent(),this.entityOpContext.scene.markShadowsDirty(),this.requestRender()}updateEntityMaterialParams(e,t){let i=e.material;if(!i)return!1;let r=[];for(let e of Array.isArray(i)?i:[i]){let t=e.root??e;t&&Array.isArray(t.layers)&&t.data&&!r.includes(t)&&r.push(t)}if(0===r.length)return!1;let s={scene:this.entityOpContext.scene,shared:this},n=e=>e.toLowerCase().replace(/[\s_.-]+/g,""),a=e=>{if("string"==typeof e){let t=new Ui(1,1,1,1);try{t.set(e)}catch{return null}return{r:t.r,g:t.g,b:t.b,a:void 0}}if(e&&"object"==typeof e&&"r"in e){let t=e;if([t.r,t.g,t.b].some(e=>"number"!=typeof e||!isFinite(e)))return null;let i=Math.max(t.r,t.g,t.b)>1?1/255:1;return{r:t.r*i,g:t.g*i,b:t.b*i,a:"number"==typeof t.a?Math.max(0,Math.min(t.a,1)):void 0}}return null},o=(e,t,i)=>{if(!e.hasValue(t))return!1;let r=e.getValue(t);if(!r||"object"!=typeof r||!r.isColor)return!1;let s=i.a??("number"==typeof r.a?r.a:1);return r instanceof gs?e.setValue(t,new Ui(i.r,i.g,i.b,s)):"function"==typeof r.setRGBA?r.setRGBA(i.r,i.g,i.b,s):r.setRGB(i.r,i.g,i.b),!0},l=!1;for(let e of r){let i=e.data.layers??[],r=t=>e.layers.find(e=>e.uuid===t);if(void 0!==t.color){let n=a(t.color),h=i.find(e=>"color"===e.data.type),d=h&&r(h.id);if(n&&d&&o(d,"color",n)&&(l=!0,void 0!==n.a)){let t=n.a<1||ts(e.data,this);e.setTransparent?e.setTransparent(t,s.scene):e.transparent=t}}"number"==typeof t.alpha&&isFinite(t.alpha)&&(e.onVariableUpdate?.(["alphaOverride"],Math.max(0,Math.min(t.alpha,100)),s),l=!0);for(let h of t.layers??[]){if(!h||"object"!=typeof h)continue;let t="string"==typeof h.id?i.find(e=>e.id===h.id):"number"==typeof h.index?i[h.index]:"string"==typeof h.type?i.find(e=>e.data.type===h.type):void 0,d=t&&r(t.id);if(!t||!d)continue;let u=ds[t.data.type]??[],p=Object.keys(t.data);for(let[i,r]of Object.entries(h)){if("id"===i||"index"===i||"type"===i)continue;let h=p.find(e=>e===i)??p.find(e=>n(e)===n(i))??i;if(u.includes(h))continue;let c=a(r);if(c&&o(d,h,c))l=!0;else if("number"==typeof r&&isFinite(r))e.onVariableUpdate?.(["layer",t.id,h],r,s),l=!0;else if(Array.isArray(r)&&r.length<=3&&r.every(e=>"number"==typeof e&&isFinite(e))){let i=["x","y","z"];r.forEach((r,n)=>{e.onVariableUpdate?.(["layer",t.id,h,i[n]],r,s)}),l=!0}}}}return l&&this.requestRender(),l}deleteVariable(e){this.variables[e]&&delete this.variables[e]}referencesMissingObject(e){return Array.isArray(e)&&"mouse"!==e[0]&&"raycast"!==e[0]&&void 0===this.entityOpContext.scene.find(e[0])}getVariable(e,t){if(Array.isArray(e)){if("mouse"===e[0])return this.mouseProperty?.[e[1]]??0;if("raycast"===e[0])return this.raycastProperty?.[e[1]]??0;let t=this.entityOpContext.scene.find(e[0]);if(void 0===t)return;if("width"===e[1]||"height"===e[1]||"depth"===e[1])return t.geometry.userData.parameters[e[1]];if(("position"===e[1]||"rotation"===e[1])&&e.length>2&&t?.getPhysicsLocalMatrix?.(ws))return ws.decompose(Ss,Ms,Os),"position"===e[1]?Ss[e[2]]:(As.setFromQuaternion(Ms,t.rotation.order),As[e[2]]*L.RAD2DEG);for(let i=1;i<e.length;i++)t=t[e[i]];return"rotation"===e[1]&&(t*=L.RAD2DEG),t}for(let e in this.variables){if(void 0===t)break;let i=this.variables[e],r=i.locations?.findIndex(e=>A.equal(e,t));void 0!==r&&-1!==r&&i.locations.splice(r,1)}if("string"==typeof e){let i=e,r=e;do{if(r=i,void 0===this.variables[i])break;let e=this.variables[i].value;t&&void 0!==this.variables[r]&&this.variables[r].locations.push(t),i=e}while("string"==typeof i);return i}return e}getVariables(){return this.variables}getVariablesNames(){return this.data.variables.map(e=>e.data.name)}getVariableByName(e){for(let t of this.data.variables)if(t.data.name===e)return{variable:t.data,id:t.id}}getDynamicVariablePlayState(e){return this.variables[e]?.dynamicVariablePlayState}setDynamicVariablePlayState(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariablePlayState=t)}getDynamicVariableToggleIsForward(e){return this.variables[e]?.dynamicVariableToggleIsForward}setDynamicVariableToggleIsForward(e,t){void 0!==this.variables[e]&&(this.variables[e].dynamicVariableToggleIsForward=t)}resetLib(e){for(let[t,i]of Object.entries(e.images))this.addImage(t,i.asset);for(let[t,i]of Object.entries(e.audios))this.addAudio(t,i.asset);for(let[t,i]of Object.entries(e.particles))this.addParticle(t,i.asset);for(let[t,i]of Object.entries(e.colors))this.addColor(t,i.asset);for(let[t,i]of Object.entries(e.fonts))this.addFont(t,i.asset);for(let[t,i]of Object.entries(e.videos))this.addVideo(t,i.asset);for(let[t,i]of Object.entries(e.variables))this.addVariableHolder(t,i.asset)}updateLibByOp(e,t){"images"===e.path[0]?1===e.path.length&&1===e.type?this.addImage(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteImage(e.id):"videos"===e.path[0]?1===e.path.length&&1===e.type?this.addVideo(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVideo(e.id):"audios"===e.path[0]?1===e.path.length&&1===e.type?this.addAudio(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteAudio(e.id):"particles"===e.path[0]?1===e.path.length&&1===e.type?this.addParticle(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteParticle(e.id):"colors"===e.path[0]?1===e.path.length&&1===e.type?this.addColor(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteColor(e.id):"materials"===e.path[0]?1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteMaterial(e.id):"fonts"===e.path[0]?1===e.path.length&&1===e.type?this.addFont(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteFont(e.id):"variables"===e.path[0]?1===e.path.length&&1===e.type?this.addVariableHolder(e.id,e.data.asset):1===e.path.length&&2===e.type&&this.deleteVariable(e.id):"components"===e.path[0]&&t.updateByLibOp(e,this)}updateByOp(e,t,i){if(this.data=t,"images"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.getImage(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addImage(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteImage(e.id);else if("videos"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.getVideo(e.path[1]).updateSrc(e.props.data):1===e.path.length&&1===e.type?this.addVideo(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteVideo(e.id);else if("audios"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.addAudio(e.path[1],t.audios[e.path[1]]):1===e.path.length&&1===e.type?this.addAudio(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteAudio(e.id);else if("particles"===e.path[0])2===e.path.length&&0===e.type?e.props.data&&this.addParticle(e.path[1],t.particles[e.path[1]]):1===e.path.length&&1===e.type?this.addParticle(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteParticle(e.id);else if("colors"===e.path[0])2===e.path.length&&0===e.type?this.updateColor(e.path[1],e.props):1===e.path.length&&1===e.type?this.addColor(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteColor(e.id);else if("materials"===e.path[0])1===e.path.length&&1===e.type?this.addMaterial(e.id,e.data):1===e.path.length&&2===e.type?this.deleteMaterial(e.id):e.path.length>1&&this.getMaterial(e.path[1]).updateByOp(O.drop(e,2),t.materials[e.path[1]],{shared:this,scene:i});else if("fonts"===e.path[0])2===e.path.length&&0===e.type?this.updateFont(e.path[1],e,i):1===e.path.length&&1===e.type?this.addFont(e.id,e.data):1===e.path.length&&2===e.type&&this.deleteFont(e.id);else if("variables"===e.path[0])2===e.path.length&&0===e.type?"value"in e.props?this.updateVariable(e.path[1],e.props.value):"persistent"in e.props&&(this.variables[e.path[1]].persistent=e.props.persistent):1===e.path.length&&4===e.type?this.addVariableHolder(e.id,e.data):1===e.path.length&&5===e.type&&this.deleteVariable(e.id);else if("userAPIs"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserAPI(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserAPI(e.id);else if("string"==typeof e.path[1]){let i=t.userAPIs[e.path[1]];if(i){let t=0===e.type&&void 0===e.props.debounce,r=this.getUserAPI(e.path[1]);void 0!==r&&r===this.openAIRealtime?r.update(i):r?.update(i,this,t)}}}else if("userWebhooks"===e.path[0]){if(1===e.path.length&&1===e.type)this.addUserWebhook(e.id,e.data);else if(1===e.path.length&&2===e.type)this.deleteUserWebhook(e.id);else if("string"==typeof e.path[1]){let i=t.userWebhooks[e.path[1]];i&&this.getUserWebhook(e.path[1])?.update(i)}}else"lib"===e.path[0]&&this.updateLibByOp(O.drop(e,1),i)}updateFont(e,t,i){if(t.props.url){let r=this.getFont(e),s={...this.data.fonts[e],url:t.props.url};r.update(s),r.loadingPromise.then(()=>this.requestRender()),i.updateFont(e,this)}}addUserAPI(i,r){if(this.userAPIs[i])return this.userAPIs[i].update(r,this),!0;if(this.openAIRealtime?.id===i)return this.openAIRealtime.update(r),!0;if("VoiceAssistant"===r.integration?.type){let e=t();return null===e?(p("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=e(r,i,this),!1)}{let t=e();return null===t?(p("api-services","a user API integration"),!1):(this.userAPIs[i]=t.createUserAPI(i,r,this),!1)}}getUserAPI(e){return this.openAIRealtime?.id===e?this.openAIRealtime:this.userAPIs[e]}getUserAPIs(){return this.userAPIs}deleteUserAPI(e){let t=this.userAPIs[e];t&&(t.dispose(),delete this.userAPIs[e])}addUserWebhook(t,i){if(this.userWebhooks[t])return this.userWebhooks[t].update(i),!0;{let r=e();return null===r?(p("api-services","a user webhook"),!1):(this.userWebhooks[t]=r.createUserWebhook(t,i),!1)}}getUserWebhook(e){return this.userWebhooks[e]}getUserWebhooks(){return this.userWebhooks}deleteUserWebhook(e){let t=this.userWebhooks[e];t&&(t.dispose(),delete this.userWebhooks[e])}get scene(){return this.entityOpContext.scene}},Cs=Ds;function Es(e){return!0===e?.isClassicNodeMaterial}function Is(e){return Es(e)||!0===e?.isTSLNodeMaterial}Cs.MAX_TRANSIENT_VERTICES=6e4,new Cs(y.emptyData());var Ls=class extends d{setMaterialOverride(e,t){this.materialOverride=bi(e),this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.materialOverride,this.layers.set(0),this.syncShapeBlendNodeLayer(),t.scene.markNeedsUpdateRendererDirty())}updateByPatchedOp(e,t,i){if(super.updateByPatchedOp(e,t,i),s(e.path,["geometry"])&&this.syncShadowCatcher(i),null!==r(e.path,["materials"])&&0===e.type&&Array.isArray(this.material))for(let[t,r]of Object.entries(e.props)){let e=this.material[Number(t)],s=i.shared.material(r);s!==e&&Ls.disposeOneMaterial(e),this.material[Number(t)]=s}else if(s(e.path,["material"])){let r=this.material;!Array.isArray(r)&&"function"==typeof r?.updateByOp&&"material"in t&&"string"!=typeof t.material&&r.updateByOp(O.drop(e,1),t.material,i)}else if(s(e.path,["materials","*"])&&Array.isArray(this.material)){let r=e.path[1];if("materials"in t&&r<this.material.length){let s=t.materials[r];"string"!=typeof s&&this.material[r].updateByOp(O.drop(e,2),s,i)}}}get needsAO(){return void 0!==this.material&&(Array.isArray(this.material)?this.material[0]:this.material).hasAO}syncShapeBlendNodeLayer(){"Mesh"===this.dataPatched.type&&this.dataPatched.geometry.shapeBlendNode?this.layers.set(9):512&this.layers.mask&&this.layers.set(0)}updateState(e,t){super.updateState(e,t),void 0!==e.castShadow&&(this.castShadow=e.castShadow),void 0!==e.receiveShadow&&(this.receiveShadow=e.receiveShadow);let i,r=this.dataPatched;this.syncShapeBlendNodeLayer(),"Mesh"===this.dataPatched.type&&"ShapeBlendGeometry"===this.dataPatched.geometry.type&&(i={resolutionLevel:Math.min(8,this.dataPatched.geometry.resolutionLevel),useChildrenColors:this.dataPatched.geometry.useChildrenColors});let s=void 0!==this.materialOverride;!s&&"NonParametricGeometry"!==e.geometry?.type&&"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe,i),t.scene.markNeedsUpdateRendererDirty()),!s&&("NonParametricGeometry"===e.geometry?.type||"materials"in e)&&("materials"in e&&void 0!==e.materials?(this.disposeMaterial(),this.material=e.materials.map(e=>t.shared.material(e).getFlavor(r.flatShading,r.side,r.wireframe)),t.scene.markNeedsUpdateRendererDirty()):"material"in e&&void 0!==e.material&&(this.disposeMaterial(),this.material=[t.shared.material(e.material).getFlavor(r.flatShading,r.side,r.wireframe)],t.scene.markNeedsUpdateRendererDirty()));let n=this.data;if(!s&&"NonParametricGeometry"!==n.geometry?.type&&"materials"in n&&void 0!==n.materials&&(this.disposeMaterial(),this.material=t.shared.material(n.materials[0]).getFlavor(r.flatShading,r.side,r.wireframe)),!s&&(void 0!==e.flatShading||void 0!==e.wireframe||void 0!==e.side))if(Array.isArray(this.material))for(let e=0;e<this.material.length;e++)this.material[e]=this.material[e].getFlavor(r.flatShading,r.side,r.wireframe);else this.material=this.material.getFlavor(r.flatShading,r.side,r.wireframe,i);this.syncShadowCatcher(t)}shadowCatcherActive(){let e=this.dataPatched,t=e.geometry?.type;return!0===e.shadowCatcher&&("RectangleGeometry"===t||"PlaneGeometry"===t)}syncShadowCatcher(e){let t=this.dataPatched;if(this.shadowCatcherActive()){if(void 0===this.shadowCatcherMaterial){let e=function(){let e="webgpu"===di&&void 0!==si?si:ni;return void 0===e?null:bi(e())}();if(null===e)return;this.shadowCatcherMaterial=e}this.shadowCatcherMaterial.side=t.side,this.material!==this.shadowCatcherMaterial&&(this.disposeMaterial(),this.material=this.shadowCatcherMaterial,e.scene.markNeedsUpdateRendererDirty()),this.castShadow=!1,this.receiveShadow=!0,this.layers.set(0)}else void 0!==this.shadowCatcherMaterial&&this.material===this.shadowCatcherMaterial&&(void 0!==this.materialOverride?(this.material=this.materialOverride,e.scene.markNeedsUpdateRendererDirty()):"material"in t&&void 0!==t.material&&(this.material=e.shared.material(t.material).getFlavor(t.flatShading,t.side,t.wireframe),e.scene.markNeedsUpdateRendererDirty(),this.needsAO&&this.layers.enable(5)),this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow)}static disposeOneMaterial(e){Is(e)&&!function(e){return function(e){return!0===e?.isClassicSharedMaterial}(e)||!0===e?.isTSLSharedMaterial}(e)&&e.nodeMaterialDispose()}disposeMaterial(){this.material&&x(this.material).forEach(e=>{Ls.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}},Us=new z,Bs=new W,Gs=new W,zs=new z,Rs=new Z,Ts=new me,ks=Ts.geometry,Fs=Ts.material,js=new z,Vs=class extends Ls{constructor(e,t,i){super(e,t),this.data=t,this.isSkinnedMesh=!1,this.localGeometry=void 0,t.bindMode&&t.bindMatrix&&(this.bindMode=t.bindMode,this.bindMatrix=(new Z).fromArray(t.bindMatrix),this.bindMatrixInverse=new Z)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return!0!==e.isTextGeometry}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof ge&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(void 0===this.localGeometry)return this.geometryCreateDeleyed instanceof ge?this.geometryCreateDeleyed:void 0}get geometry(){if(void 0!==this.localGeometry)return this.localGeometry;if(this.geometryCreateDeleyed instanceof Cs){let e=this.geometryCreateDeleyed,t=this.chooseGeoemtryCache(e),i=this.dataPatched.geometry;this.geometryCreateDeleyed=t.get(i,e,this),this._geometryCacheKey=i}return this.geometryCreateDeleyed}set geometry(e){this.localGeometry=e}get is2DAndNoDepth(){let e=this.dataPatched.geometry;return P.is2DParametricMesh(e.type)&&0===e.depth}get is2DType(){return P.is2DParametricMesh(this.geometry.userData.type)}get isTextType(){return!0===this.geometry.isTextGeometry}get isNonParametric(){return"NonParametricGeometry"===this.geometry.userData.type}updateByPatchedOp(e,t,i){super.updateByPatchedOp(e,t,i),s(e.path,["geometry"])&&this.updateByPatchedOpGeometry(O.drop(e,1),t.geometry,i)}removeInteractionGeometry(e){this.localGeometry?.dispose(),this.localGeometry=void 0}dispose(){super.dispose(),function(e){Xt.delete(e)}(this.uuid),this._posed=void 0}get appliedGeometrySize(){let e=this.localGeometry?.userData;if(void 0!==e&&void 0!==e.sxPrev)return[e.sxPrev,e.syPrev,e.szPrev]}updateGeometryInteractions(e,t){this.invalidateDownstreamBooleanData();let i=this.data.geometry.type;if("NonParametricGeometry"===i||"SubdivGeometry"===i){let i,r,s,n=e;if(void 0===this.localGeometry){let e={...this.data.geometry,...n};this.localGeometry=Gr(e,t,this.data.flatShading,this)}n.scaleBaked?[i,r,s]=n.scaleBaked:({width:i,height:r,depth:s}=n);let a=this.localGeometry.userData,o="number"==typeof i?i:1,l="number"==typeof r?r:1,h="number"==typeof s?s:1;void 0!==a.sxPrev&&Tr(this.localGeometry.attributes,o/a.sxPrev,l/a.syPrev,h/a.szPrev),a.sxPrev=o,a.syPrev=l,a.szPrev=h}else if(!this.absorbDepthInteraction(e)){let r=Gr("VectorGeometry"===i?_.merge(this.data.geometry,e):{...this.data.geometry,...e},t,this.data.flatShading,this);void 0!==this.localGeometry&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&Rr(this.localGeometry,r)?r.dispose():(this.localGeometry?.dispose(),this.localGeometry=r)}}absorbDepthInteraction(e){let t=this.localGeometry;if(void 0===t?.shiftDepthTo)return!1;let i=e;if("number"!=typeof i.depth)return!1;let r=t.userData?.parameters;if(void 0===r)return!1;for(let e of Object.keys(i))if("depth"!==e&&i[e]!==r[e])return!1;return!!t.shiftDepthTo(i.depth)&&(r.depth=i.depth,!0)}refreshAttachedClonersInteractions(e){for(let t of this.attachedSurfaceCloners)t.update(e)}refreshAttachedCloners(e){for(let t of this.attachedSurfaceCloners)e.scene.addPendingUpdateCloner(t.object)}refreshAttachedPaths(e){for(let t of this.attachedPaths)e.scene.addPendingCommand(()=>t.updateShape())}createGeometryDelayed(e){this.geometryCreateDeleyed=e.shared,this.refreshAttachedCloners(e),this.refreshAttachedPaths(e)}updateByPatchedOpGeometry(e,t,i){let r=!1;if(0===e.type&&0===e.path.length&&Object.keys(e.props).includes("scaleBaked")&&this.geometryCreateDeleyed instanceof Xr&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlyScaleBaked(t,e.props.scaleBaked),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&0===e.type&&0===e.path.length&&$r(e.props)&&this.geometryCreateDeleyed instanceof Xr&&this.chooseGeoemtryCache(i.shared).mutateIfUnique(this.geometryCreateDeleyed.data,t)===this.geometryCreateDeleyed&&(r=!0,this.geometryCreateDeleyed.mutateDirectlySubdivisions(t),this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)),!r&&0===e.type&&0===e.path.length&&this.geometryCreateDeleyed instanceof ge&&!(this.geometryCreateDeleyed instanceof Xr)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&void 0!==this._geometryCacheKey){let e=i.shared,t=this.chooseGeoemtryCache(e),s=this.geometryCreateDeleyed;if(t.getCached(this._geometryCacheKey)===s&&!0!==s.isShared){let n=this.dataPatched.geometry,a=Gr(n,e,this.data.flatShading,this);Rr(s,a)?(a.dispose(),s.computeBoundingSphere(),t.mutateIfUnique(this._geometryCacheKey,n)):(a.computeBoundingSphere(),t.forceDelete(this._geometryCacheKey),t.adopt(n,a),this.geometryCreateDeleyed=a),this._geometryCacheKey=n,r=!0,this.refreshAttachedCloners(i),this.refreshAttachedPaths(i)}}r||(i.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(i)),this.syncShapeBlendNodeLayer(),this.resetBBoxNeedsUpdate(),this.invalidateDownstreamBooleanData()}updateGeometryOnStateUpdate(e,t){this.createGeometryDelayed(t)}applyTransientGeometryData(e,t){let i=e.shared,r=this.dataPatched.geometry;if(this.geometryCreateDeleyed instanceof ge&&!(this.geometryCreateDeleyed instanceof Xr)&&this.supportsInPlaceGeometryUpdate(this.geometryCreateDeleyed)&&void 0!==this._geometryCacheKey){let t=this.chooseGeoemtryCache(i),s=this.geometryCreateDeleyed;if(t.getCached(this._geometryCacheKey)===s&&!0!==s.isShared){let n=Gr(r,i,this.data.flatShading,this);return Rr(s,n)?(n.dispose(),s.computeBoundingSphere(),t.mutateIfUnique(this._geometryCacheKey,r)):(n.computeBoundingSphere(),t.forceDelete(this._geometryCacheKey),t.adopt(r,n),this.geometryCreateDeleyed=n),this._geometryCacheKey=r,this.refreshAttachedCloners(e),void this.refreshAttachedPaths(e)}}t&&void 0!==this._geometryCacheKey&&this.chooseGeoemtryCache(i).forceDelete(this._geometryCacheKey),e.scene?.markGeometryCacheDirty(),this.createGeometryDelayed(e)}updateState(e,t){void 0!==e.geometry&&this.updateGeometryOnStateUpdate(e.geometry,t);let i=e.morphTargetInfluences;if(i){this.updateMorphTargets(),this.geometry.morphTargetsRelative=!0;for(let{data:{name:e,value:r}}of i)this.updateMorphInfluences(e,t.shared.getVariable(r,[this.uuid,"morphTargetInfluences",e]))}super.updateState(e,t)}updateMorphInfluences(e,t){if(void 0===this.morphTargetDictionary)return;let i=this.morphTargetDictionary[e];void 0!==i&&(this.morphTargetInfluences[i]=t)}updateGeometryGroupsIfNeeded(){Array.isArray(this.material)&&0===this.geometry.groups.length&&this.geometry.addGroup(0,Math.max(this.geometry.getIndex()?.count??0,this.geometry.getAttribute("position").count),0)}updateEntityBoxSize(e,t){let i=this.posedGeometry()?.boundingBox;if(i)return i.getCenter(e),void i.getSize(t).multiplyScalar(.5);let r=this.geometry.userData.parameters;this.is2DType||this.isTextType?e.set(0,0,.5*r.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(r.width,r.height,r.depth??0).multiplyScalar(.5)):r.centerOffset?e.fromArray(r.centerOffset):e.setScalar(0),t.set(r.width,r.height,r.depth??0).multiplyScalar(.5)}updateMatrixWorld(e){super.updateMatrixWorld(e),"attached"===this.bindMode?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}bind(e,t){this.skeleton=e,this.isSkinnedMesh=!0,void 0===t&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(e){let t=new W,i=this.geometry.attributes.skinWeight;for(let e=0,r=i.count;e<r;e++){t.fromBufferAttribute(i,e);let r=1/t.manhattanLength();r!==1/0?t.multiplyScalar(r):t.set(1,0,0,0),i.setXYZW(e,t.x,t.y,t.z,t.w)}}boneTransform(e,t){let i=this.skeleton;if(void 0===i)return;let r=this.geometry;Bs.fromBufferAttribute(r.attributes.skinIndex,e),Gs.fromBufferAttribute(r.attributes.skinWeight,e),Us.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=Gs.getComponent(e);if(0!==r){let s=Bs.getComponent(e);Rs.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(zs.copy(Us).applyMatrix4(Rs),r)}}return t.applyMatrix4(this.bindMatrixInverse)}raycastDeformed(e,t){let i=this.posedGeometry();if(void 0===i)return!1;Ts.geometry=i,Ts.material=this.material,Ts.matrixWorld.copy(this.matrixWorld);let r=t.length;Ts.raycast(e,t);for(let e=r;e<t.length;e++)t[e].object=this;return Ts.geometry=ks,Ts.material=Fs,!0}posedGeometry(){let e=this.skeleton;if(!this.isSkinnedMesh||void 0===e)return;let t=this.geometry,{position:i,skinIndex:r,skinWeight:s}=t.attributes;if(!i||!r||!s)return;let n=[...this.bindMatrix.elements,...this.bindMatrixInverse.elements,...this.morphTargetInfluences??[]];for(let t=0;t<e.bones.length;t++){let i=e.bones[t];if(!i||!e.boneInverses[t])return;n.push(...i.matrixWorld.elements)}let a=this._posed;if(a?.source===t&&a.version===i.version&&a.pose.length===n.length&&a.pose.every((e,t)=>e===n[t]))return a.geometry;let o=i.count,l=a?.geometry.attributes.position,h=l?.count===o?l:new D(new Float32Array(3*o),3);for(let e=0;e<o;e++)this.boneTransform(e,this.getVertexPosition(e,js)),h.setXYZ(e,js.x,js.y,js.z);let d=new ge;d.setAttribute("position",h);for(let e of["normal","uv","uv1"]){let i=t.attributes[e];i&&d.setAttribute(e,i)}return d.setIndex(t.index),d.groups=t.groups,d.drawRange=t.drawRange,d.computeBoundingSphere(),d.computeBoundingBox(),this._posed={source:t,version:i.version,pose:n,geometry:d},d}};export{xe as a,Se as b,_i as c,Ci as d,Ei as e,Ii as f,Li as g,Es as h,Ui as i,gs as j,zi as k,ji as l,Vi as m,qi as n,_e as o,De as p,pr as q,Me as r,Ae as s,Ne as t,Dt as u,Ct as v,Et as w,Ut as x,kt as y,jt as z,Ht as A,Jt as B,Zi as C,ar as D,or as E,lr as F,hi as G,hr as H,ur as I,Xr as J,$r as K,Kr as L,Lr as M,Gr as N,pi as O,ci as P,gi as Q,mi as R,yi as S,xi as T,wi as U,Si as V,Mi as W,Oi as X,Ai as Y,ts as Z,is as _,rs as $,ss as aa,ns as ba,as as ca,os as da,ls as ea,hs as fa,ds as ga,us as ha,cs as ia,xs as ja,Cs as ka,Is as la,Ls as ma,Vs as na};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|