@splinetool/runtime 2.0.64 → 2.0.65
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-aiAssistant-WCXMKTQK.js → runtime-aiAssistant-P56R6EIU.js} +1 -1
- package/build/runtime-aiAssistant-P56R6EIU.js.br +0 -0
- package/build/runtime-aiAssistant-P56R6EIU.js.gz +0 -0
- package/build/{runtime-apiServices-DRMLTDTB.js → runtime-apiServices-ADKEC7LW.js} +1 -1
- package/build/runtime-apiServices-ADKEC7LW.js.br +0 -0
- package/build/runtime-apiServices-ADKEC7LW.js.gz +0 -0
- package/build/{runtime-audio-7LXSIVLU.js → runtime-audio-YJWGAMZD.js} +1 -1
- package/build/runtime-audio-YJWGAMZD.js.br +0 -0
- package/build/runtime-audio-YJWGAMZD.js.gz +0 -0
- package/build/{runtime-chunk-NFPL6LCH.js → runtime-chunk-2E7GVSUY.js} +1 -1
- package/build/runtime-chunk-2E7GVSUY.js.br +0 -0
- package/build/runtime-chunk-2E7GVSUY.js.gz +0 -0
- package/build/{runtime-chunk-UTXZTSXZ.js → runtime-chunk-2ZXAF4ZV.js} +1 -1
- package/build/runtime-chunk-2ZXAF4ZV.js.br +0 -0
- package/build/runtime-chunk-2ZXAF4ZV.js.gz +0 -0
- package/build/{runtime-chunk-7L46WKPR.js → runtime-chunk-3XHWZFQU.js} +1 -1
- package/build/runtime-chunk-3XHWZFQU.js.br +0 -0
- package/build/runtime-chunk-3XHWZFQU.js.gz +0 -0
- package/build/{runtime-chunk-65Z7LNTT.js → runtime-chunk-43Q5EQ2J.js} +1 -1
- package/build/runtime-chunk-43Q5EQ2J.js.br +2 -0
- package/build/runtime-chunk-43Q5EQ2J.js.gz +0 -0
- package/build/{runtime-chunk-FLYEGFUP.js → runtime-chunk-5NM7RKBR.js} +1 -1
- package/build/runtime-chunk-5NM7RKBR.js.br +0 -0
- package/build/runtime-chunk-5NM7RKBR.js.gz +0 -0
- package/build/{runtime-chunk-4OGX3VGG.js → runtime-chunk-7B4QYJTA.js} +1 -1
- package/build/runtime-chunk-7B4QYJTA.js.br +0 -0
- package/build/runtime-chunk-7B4QYJTA.js.gz +0 -0
- package/build/{runtime-chunk-EMM5BAG5.js → runtime-chunk-7MMQV3HJ.js} +1 -1
- package/build/runtime-chunk-7MMQV3HJ.js.br +0 -0
- package/build/runtime-chunk-7MMQV3HJ.js.gz +0 -0
- package/build/{runtime-chunk-PZC5R2IA.js → runtime-chunk-CUONFDTI.js} +1 -1
- package/build/runtime-chunk-CUONFDTI.js.br +0 -0
- package/build/runtime-chunk-CUONFDTI.js.gz +0 -0
- package/build/{runtime-chunk-OUUOTV4G.js → runtime-chunk-DLWYJQ4V.js} +1 -1
- package/build/runtime-chunk-DLWYJQ4V.js.br +0 -0
- package/build/runtime-chunk-DLWYJQ4V.js.gz +0 -0
- package/build/{runtime-chunk-UBIS23VA.js → runtime-chunk-EV4CK3C7.js} +1 -1
- package/build/runtime-chunk-EV4CK3C7.js.br +0 -0
- package/build/runtime-chunk-EV4CK3C7.js.gz +0 -0
- package/build/{runtime-chunk-XWIXLZ5T.js → runtime-chunk-FYDUP54R.js} +1 -1
- package/build/runtime-chunk-FYDUP54R.js.br +0 -0
- package/build/runtime-chunk-FYDUP54R.js.gz +0 -0
- package/build/{runtime-chunk-STNNKZRL.js → runtime-chunk-JBWHP5MO.js} +1 -1
- package/build/runtime-chunk-JBWHP5MO.js.br +0 -0
- package/build/runtime-chunk-JBWHP5MO.js.gz +0 -0
- package/build/{runtime-chunk-GGOMRZAR.js → runtime-chunk-JKLH336O.js} +1 -1
- package/build/runtime-chunk-JKLH336O.js.br +0 -0
- package/build/runtime-chunk-JKLH336O.js.gz +0 -0
- package/build/{runtime-chunk-M6FFVLT6.js → runtime-chunk-L6ERXCVI.js} +1 -1
- package/build/runtime-chunk-L6ERXCVI.js.br +0 -0
- package/build/runtime-chunk-L6ERXCVI.js.gz +0 -0
- package/build/{runtime-chunk-2WZ2DHUS.js → runtime-chunk-MCFVICLC.js} +1 -1
- package/build/runtime-chunk-MCFVICLC.js.br +0 -0
- package/build/runtime-chunk-MCFVICLC.js.gz +0 -0
- package/build/{runtime-chunk-4YSIMIIS.js → runtime-chunk-N5TTNKHM.js} +1 -1
- package/build/runtime-chunk-N5TTNKHM.js.br +0 -0
- package/build/runtime-chunk-N5TTNKHM.js.gz +0 -0
- package/build/{runtime-chunk-TZDJI7XT.js → runtime-chunk-QQNBC64K.js} +1 -1
- package/build/runtime-chunk-QQNBC64K.js.br +0 -0
- package/build/runtime-chunk-QQNBC64K.js.gz +0 -0
- package/build/{runtime-chunk-WS3W6I75.js → runtime-chunk-TDIP7R6D.js} +1 -1
- package/build/runtime-chunk-TDIP7R6D.js.br +0 -0
- package/build/runtime-chunk-TDIP7R6D.js.gz +0 -0
- package/build/{runtime-chunk-WQ5L4XSQ.js → runtime-chunk-TPLWLQ5S.js} +1 -1
- package/build/runtime-chunk-TPLWLQ5S.js.br +0 -0
- package/build/runtime-chunk-TPLWLQ5S.js.gz +0 -0
- package/build/runtime-chunk-UKHPMEMB.js +1 -0
- package/build/runtime-chunk-UKHPMEMB.js.br +0 -0
- package/build/runtime-chunk-UKHPMEMB.js.gz +0 -0
- package/build/{runtime-chunk-6UKGQUL5.js → runtime-chunk-W3B6DFIX.js} +1 -1
- package/build/runtime-chunk-W3B6DFIX.js.br +0 -0
- package/build/runtime-chunk-W3B6DFIX.js.gz +0 -0
- package/build/{runtime-chunk-P2RJUWN3.js → runtime-chunk-WB3J5FJI.js} +1 -1
- package/build/{runtime-chunk-P2RJUWN3.js.br → runtime-chunk-WB3J5FJI.js.br} +0 -0
- package/build/runtime-chunk-WB3J5FJI.js.gz +0 -0
- package/build/{runtime-chunk-YLZEQDL2.js → runtime-chunk-WMQY3ILP.js} +1 -1
- package/build/runtime-chunk-WMQY3ILP.js.br +0 -0
- package/build/runtime-chunk-WMQY3ILP.js.gz +0 -0
- package/build/{runtime-chunk-BSJNKHDI.js → runtime-chunk-WVVVYBSF.js} +1 -1
- package/build/runtime-chunk-WVVVYBSF.js.br +0 -0
- package/build/runtime-chunk-WVVVYBSF.js.gz +0 -0
- package/build/{runtime-chunk-KWEZUCEY.js → runtime-chunk-WWFCN36W.js} +1 -1
- package/build/runtime-chunk-WWFCN36W.js.br +0 -0
- package/build/runtime-chunk-WWFCN36W.js.gz +0 -0
- package/build/{runtime-chunk-P4VXE26L.js → runtime-chunk-XDQY6LBL.js} +1 -1
- package/build/runtime-chunk-XDQY6LBL.js.br +0 -0
- package/build/runtime-chunk-XDQY6LBL.js.gz +0 -0
- package/build/{runtime-classicRuntime-2LP2RINT.js → runtime-classicRuntime-NM4XQWT5.js} +1 -1
- package/build/runtime-classicRuntime-NM4XQWT5.js.br +0 -0
- package/build/runtime-classicRuntime-NM4XQWT5.js.gz +0 -0
- package/build/{runtime-cloners-UXNJ35Q7.js → runtime-cloners-CMLDJYNE.js} +1 -1
- package/build/runtime-cloners-CMLDJYNE.js.br +0 -0
- package/build/runtime-cloners-CMLDJYNE.js.gz +0 -0
- package/build/{runtime-components-SONNU6VA.js → runtime-components-7ONZVUTR.js} +1 -1
- package/build/runtime-components-7ONZVUTR.js.br +0 -0
- package/build/runtime-components-7ONZVUTR.js.gz +0 -0
- package/build/{runtime-conditional-3OCYMAD5.js → runtime-conditional-L7VSDRAB.js} +1 -1
- package/build/{runtime-conditional-3OCYMAD5.js.br → runtime-conditional-L7VSDRAB.js.br} +0 -0
- package/build/{runtime-conditional-3OCYMAD5.js.gz → runtime-conditional-L7VSDRAB.js.gz} +0 -0
- package/build/{runtime-createDestroy-NOHVBEAO.js → runtime-createDestroy-B3YEFOHV.js} +1 -1
- package/build/runtime-createDestroy-B3YEFOHV.js.br +0 -0
- package/build/runtime-createDestroy-B3YEFOHV.js.gz +0 -0
- package/build/{runtime-dragDrop-VTVWV5KA.js → runtime-dragDrop-VRTDO3WT.js} +1 -1
- package/build/runtime-dragDrop-VRTDO3WT.js.br +0 -0
- package/build/runtime-dragDrop-VRTDO3WT.js.gz +0 -0
- package/build/{runtime-gameControls-COW4KVOP.js → runtime-gameControls-IUHW7XWB.js} +1 -1
- package/build/runtime-gameControls-IUHW7XWB.js.br +0 -0
- package/build/runtime-gameControls-IUHW7XWB.js.gz +0 -0
- package/build/{runtime-hair-TRDVYNIC.js → runtime-hair-ALM2NN7E.js} +1 -1
- package/build/runtime-hair-ALM2NN7E.js.br +1 -0
- package/build/runtime-hair-ALM2NN7E.js.gz +0 -0
- package/build/{runtime-mergeStaticGeometries-BOYWYTHP.js → runtime-mergeStaticGeometries-S652OZFE.js} +1 -1
- package/build/runtime-mergeStaticGeometries-S652OZFE.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-S652OZFE.js.gz +0 -0
- package/build/{runtime-miscActions-U6DP3DWY.js → runtime-miscActions-DI5R4ACV.js} +1 -1
- package/build/runtime-miscActions-DI5R4ACV.js.br +0 -0
- package/build/runtime-miscActions-DI5R4ACV.js.gz +0 -0
- package/build/{runtime-mouseHover-D26PWFUI.js → runtime-mouseHover-62CQW4RX.js} +1 -1
- package/build/runtime-mouseHover-62CQW4RX.js.br +0 -0
- package/build/runtime-mouseHover-62CQW4RX.js.gz +0 -0
- package/build/{runtime-particles-6U43I2Y4.js → runtime-particles-FEZH2I3I.js} +1 -1
- package/build/runtime-particles-FEZH2I3I.js.br +0 -0
- package/build/runtime-particles-FEZH2I3I.js.gz +0 -0
- package/build/{runtime-paths-PQHDXTF4.js → runtime-paths-LZT6QD74.js} +1 -1
- package/build/runtime-paths-LZT6QD74.js.br +0 -0
- package/build/runtime-paths-LZT6QD74.js.gz +0 -0
- package/build/{runtime-resize-UMOXP26N.js → runtime-resize-FMBLODB2.js} +1 -1
- package/build/runtime-resize-FMBLODB2.js.br +0 -0
- package/build/runtime-resize-FMBLODB2.js.gz +0 -0
- package/build/{runtime-sceneTransition-5MZBTXK2.js → runtime-sceneTransition-Y4UMTGGY.js} +1 -1
- package/build/runtime-sceneTransition-Y4UMTGGY.js.br +0 -0
- package/build/runtime-sceneTransition-Y4UMTGGY.js.gz +0 -0
- package/build/{runtime-scroll-O7MW4PGX.js → runtime-scroll-NFPB7RR6.js} +1 -1
- package/build/runtime-scroll-NFPB7RR6.js.br +0 -0
- package/build/runtime-scroll-NFPB7RR6.js.gz +0 -0
- package/build/runtime-shapeBlends-WALVWP2N.js +1 -0
- package/build/runtime-shapeBlends-WALVWP2N.js.br +2 -0
- package/build/runtime-shapeBlends-WALVWP2N.js.gz +0 -0
- package/build/{runtime-text-4AHR5UXX.js → runtime-text-EPA5OWWM.js} +1 -1
- package/build/runtime-text-EPA5OWWM.js.br +0 -0
- package/build/runtime-text-EPA5OWWM.js.gz +0 -0
- package/build/{runtime-textInputs-W6K3BQMF.js → runtime-textInputs-GIRQCNBR.js} +1 -1
- package/build/runtime-textInputs-GIRQCNBR.js.br +0 -0
- package/build/runtime-textInputs-GIRQCNBR.js.gz +0 -0
- package/build/{runtime-timeline-JEZKTTPW.js → runtime-timeline-3OEUGOCF.js} +1 -1
- package/build/runtime-timeline-3OEUGOCF.js.br +0 -0
- package/build/runtime-timeline-3OEUGOCF.js.gz +0 -0
- package/build/{runtime-tracking-UYBHQWE3.js → runtime-tracking-CP2GIDM3.js} +1 -1
- package/build/runtime-tracking-CP2GIDM3.js.br +0 -0
- package/build/runtime-tracking-CP2GIDM3.js.gz +0 -0
- package/build/{runtime-transitions-6HDRQDLB.js → runtime-transitions-SH4DHADK.js} +1 -1
- package/build/runtime-transitions-SH4DHADK.js.br +0 -0
- package/build/runtime-transitions-SH4DHADK.js.gz +0 -0
- package/build/{runtime-ui2d-TFL4GHUX.js → runtime-ui2d-FY2KGZES.js} +1 -1
- package/build/runtime-ui2d-FY2KGZES.js.br +0 -0
- package/build/runtime-ui2d-FY2KGZES.js.gz +0 -0
- package/build/{runtime-variables-QPWCA6SV.js → runtime-variables-VMN76G6O.js} +1 -1
- package/build/runtime-variables-VMN76G6O.js.br +0 -0
- package/build/runtime-variables-VMN76G6O.js.gz +0 -0
- package/build/{runtime-vectorShapes-JBKXDWUW.js → runtime-vectorShapes-LU4MWOJZ.js} +1 -1
- package/build/runtime-vectorShapes-LU4MWOJZ.js.br +0 -0
- package/build/runtime-vectorShapes-LU4MWOJZ.js.gz +0 -0
- package/build/{runtime-video-BFI3XXUJ.js → runtime-video-XEINPQPG.js} +1 -1
- package/build/runtime-video-XEINPQPG.js.br +0 -0
- package/build/runtime-video-XEINPQPG.js.gz +0 -0
- package/build/runtime-webgpu-DAJRCKLZ.js +1 -0
- package/build/runtime-webgpu-DAJRCKLZ.js.br +0 -0
- package/build/runtime-webgpu-DAJRCKLZ.js.gz +0 -0
- package/build/runtime.cjs +8 -8
- 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-aiAssistant-WCXMKTQK.js.br +0 -0
- package/build/runtime-aiAssistant-WCXMKTQK.js.gz +0 -0
- package/build/runtime-apiServices-DRMLTDTB.js.br +0 -0
- package/build/runtime-apiServices-DRMLTDTB.js.gz +0 -0
- package/build/runtime-audio-7LXSIVLU.js.br +0 -0
- package/build/runtime-audio-7LXSIVLU.js.gz +0 -0
- package/build/runtime-chunk-2WZ2DHUS.js.br +0 -0
- package/build/runtime-chunk-2WZ2DHUS.js.gz +0 -0
- package/build/runtime-chunk-4OGX3VGG.js.br +0 -0
- package/build/runtime-chunk-4OGX3VGG.js.gz +0 -0
- package/build/runtime-chunk-4YSIMIIS.js.br +0 -0
- package/build/runtime-chunk-4YSIMIIS.js.gz +0 -0
- package/build/runtime-chunk-65Z7LNTT.js.br +0 -2
- package/build/runtime-chunk-65Z7LNTT.js.gz +0 -0
- package/build/runtime-chunk-6UKGQUL5.js.br +0 -0
- package/build/runtime-chunk-6UKGQUL5.js.gz +0 -0
- package/build/runtime-chunk-7L46WKPR.js.br +0 -0
- package/build/runtime-chunk-7L46WKPR.js.gz +0 -0
- package/build/runtime-chunk-BKTNVUN3.js +0 -1
- package/build/runtime-chunk-BKTNVUN3.js.br +0 -0
- package/build/runtime-chunk-BKTNVUN3.js.gz +0 -0
- package/build/runtime-chunk-BSJNKHDI.js.br +0 -0
- package/build/runtime-chunk-BSJNKHDI.js.gz +0 -0
- package/build/runtime-chunk-EMM5BAG5.js.br +0 -0
- package/build/runtime-chunk-EMM5BAG5.js.gz +0 -0
- package/build/runtime-chunk-FLYEGFUP.js.br +0 -0
- package/build/runtime-chunk-FLYEGFUP.js.gz +0 -0
- package/build/runtime-chunk-GGOMRZAR.js.br +0 -0
- package/build/runtime-chunk-GGOMRZAR.js.gz +0 -0
- package/build/runtime-chunk-KWEZUCEY.js.br +0 -0
- package/build/runtime-chunk-KWEZUCEY.js.gz +0 -0
- package/build/runtime-chunk-M6FFVLT6.js.br +0 -0
- package/build/runtime-chunk-M6FFVLT6.js.gz +0 -0
- package/build/runtime-chunk-NFPL6LCH.js.br +0 -0
- package/build/runtime-chunk-NFPL6LCH.js.gz +0 -0
- package/build/runtime-chunk-OUUOTV4G.js.br +0 -0
- package/build/runtime-chunk-OUUOTV4G.js.gz +0 -0
- package/build/runtime-chunk-P2RJUWN3.js.gz +0 -0
- package/build/runtime-chunk-P4VXE26L.js.br +0 -0
- package/build/runtime-chunk-P4VXE26L.js.gz +0 -0
- package/build/runtime-chunk-PZC5R2IA.js.br +0 -0
- package/build/runtime-chunk-PZC5R2IA.js.gz +0 -0
- package/build/runtime-chunk-STNNKZRL.js.br +0 -0
- package/build/runtime-chunk-STNNKZRL.js.gz +0 -0
- package/build/runtime-chunk-TZDJI7XT.js.br +0 -0
- package/build/runtime-chunk-TZDJI7XT.js.gz +0 -0
- package/build/runtime-chunk-UBIS23VA.js.br +0 -0
- package/build/runtime-chunk-UBIS23VA.js.gz +0 -0
- package/build/runtime-chunk-UTXZTSXZ.js.br +0 -0
- package/build/runtime-chunk-UTXZTSXZ.js.gz +0 -0
- package/build/runtime-chunk-WQ5L4XSQ.js.br +0 -0
- package/build/runtime-chunk-WQ5L4XSQ.js.gz +0 -0
- package/build/runtime-chunk-WS3W6I75.js.br +0 -0
- package/build/runtime-chunk-WS3W6I75.js.gz +0 -0
- package/build/runtime-chunk-XWIXLZ5T.js.br +0 -0
- package/build/runtime-chunk-XWIXLZ5T.js.gz +0 -0
- package/build/runtime-chunk-YLZEQDL2.js.br +0 -0
- package/build/runtime-chunk-YLZEQDL2.js.gz +0 -0
- package/build/runtime-classicRuntime-2LP2RINT.js.br +0 -0
- package/build/runtime-classicRuntime-2LP2RINT.js.gz +0 -0
- package/build/runtime-cloners-UXNJ35Q7.js.br +0 -1
- package/build/runtime-cloners-UXNJ35Q7.js.gz +0 -0
- package/build/runtime-components-SONNU6VA.js.br +0 -0
- package/build/runtime-components-SONNU6VA.js.gz +0 -0
- package/build/runtime-createDestroy-NOHVBEAO.js.br +0 -0
- package/build/runtime-createDestroy-NOHVBEAO.js.gz +0 -0
- package/build/runtime-dragDrop-VTVWV5KA.js.br +0 -0
- package/build/runtime-dragDrop-VTVWV5KA.js.gz +0 -0
- package/build/runtime-gameControls-COW4KVOP.js.br +0 -0
- package/build/runtime-gameControls-COW4KVOP.js.gz +0 -0
- package/build/runtime-hair-TRDVYNIC.js.br +0 -1
- package/build/runtime-hair-TRDVYNIC.js.gz +0 -0
- package/build/runtime-mergeStaticGeometries-BOYWYTHP.js.br +0 -0
- package/build/runtime-mergeStaticGeometries-BOYWYTHP.js.gz +0 -0
- package/build/runtime-miscActions-U6DP3DWY.js.br +0 -0
- package/build/runtime-miscActions-U6DP3DWY.js.gz +0 -0
- package/build/runtime-mouseHover-D26PWFUI.js.br +0 -0
- package/build/runtime-mouseHover-D26PWFUI.js.gz +0 -0
- package/build/runtime-particles-6U43I2Y4.js.br +0 -0
- package/build/runtime-particles-6U43I2Y4.js.gz +0 -0
- package/build/runtime-paths-PQHDXTF4.js.br +0 -0
- package/build/runtime-paths-PQHDXTF4.js.gz +0 -0
- package/build/runtime-resize-UMOXP26N.js.br +0 -0
- package/build/runtime-resize-UMOXP26N.js.gz +0 -0
- package/build/runtime-sceneTransition-5MZBTXK2.js.br +0 -0
- package/build/runtime-sceneTransition-5MZBTXK2.js.gz +0 -0
- package/build/runtime-scroll-O7MW4PGX.js.br +0 -0
- package/build/runtime-scroll-O7MW4PGX.js.gz +0 -0
- package/build/runtime-shapeBlends-JZBMFVOG.js +0 -1
- package/build/runtime-shapeBlends-JZBMFVOG.js.br +0 -0
- package/build/runtime-shapeBlends-JZBMFVOG.js.gz +0 -0
- package/build/runtime-text-4AHR5UXX.js.br +0 -0
- package/build/runtime-text-4AHR5UXX.js.gz +0 -0
- package/build/runtime-textInputs-W6K3BQMF.js.br +0 -0
- package/build/runtime-textInputs-W6K3BQMF.js.gz +0 -0
- package/build/runtime-timeline-JEZKTTPW.js.br +0 -0
- package/build/runtime-timeline-JEZKTTPW.js.gz +0 -0
- package/build/runtime-tracking-UYBHQWE3.js.br +0 -0
- package/build/runtime-tracking-UYBHQWE3.js.gz +0 -0
- package/build/runtime-transitions-6HDRQDLB.js.br +0 -0
- package/build/runtime-transitions-6HDRQDLB.js.gz +0 -0
- package/build/runtime-ui2d-TFL4GHUX.js.br +0 -0
- package/build/runtime-ui2d-TFL4GHUX.js.gz +0 -0
- package/build/runtime-variables-QPWCA6SV.js.br +0 -0
- package/build/runtime-variables-QPWCA6SV.js.gz +0 -0
- package/build/runtime-vectorShapes-JBKXDWUW.js.br +0 -0
- package/build/runtime-vectorShapes-JBKXDWUW.js.gz +0 -0
- package/build/runtime-video-BFI3XXUJ.js.br +0 -0
- package/build/runtime-video-BFI3XXUJ.js.gz +0 -0
- package/build/runtime-webgpu-5H7LPI55.js +0 -1
- package/build/runtime-webgpu-5H7LPI55.js.br +0 -0
- package/build/runtime-webgpu-5H7LPI55.js.gz +0 -0
|
@@ -1 +1 @@
|
|
|
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-P2RJUWN3.js";import{c as u}from"./runtime-chunk-RTLL6WIB.js";import{b as p}from"./runtime-chunk-EFBUAWKV.js";import{c,i as g}from"./runtime-chunk-TZCHGFVF.js";import{A as m,Ga as f,Ha as y,I as v,U as b,a as x,c as w,ea as S,ha as M,k as O,ma as A,n as P}from"./runtime-chunk-K3UQCG3P.js";import{$c as _,Aa as D,Ba as C,Cc as E,Dc as I,Ec as U,Ed as L,Fc as B,Fd as z,Gc as R,Gd as G,Hd as T,He as F,Ic as k,Id as j,Ja as N,Jb as V,Jc as H,Jd as q,Ld as W,Md as Y,Nd as X,Oc as $,Od as Z,Pc as K,Rc as J,Rd as Q,Tc as ee,Td as te,Ud as ie,Vd as re,Wc as se,Wd as ne,Xc as ae,Yc as oe,Yd as le,Zc as he,bd as de,cd as ue,dd as pe,nd as ce,qa as ge,rd as me,se as fe,yd as ye}from"./runtime-chunk-BVVSZMXD.js";function ve(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 pe,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=be(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=be(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 be(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 he(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 xe(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 we,Se,Me,Oe=null;function Ae(e){Oe=e}function Pe(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 _e(e,t){if(!e)throw t||"Assertion Failed!"}(Se=we||(we={}))[Se.ODD=0]="ODD",Se[Se.NONZERO=1]="NONZERO",Se[Se.POSITIVE=2]="POSITIVE",Se[Se.NEGATIVE=3]="NEGATIVE",Se[Se.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"}(Me||(Me={}));var De=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){_e(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){_e(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){_e(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){_e(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}(),Ce=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},Ee=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}(),Ie=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},Ue=function(){function e(){var e=new Ie,t=new Ce,i=new Ee(0),r=new Ee(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 Ee(0),i=new Ee(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;_e(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;_e(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 Ie,t=new Ie,i=new Ce,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 Ie;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!i){var n=new Ce;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 Ce;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 Ie;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 Ce;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&&De.vertCCW(i.Lprev.Org,i.Org,s.Lnext.Lnext.Org)&&De.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){_e(e.prev===t),s=e.anEdge;do{_e(s.Sym!==s),_e(s.Sym.Sym===s),_e(s.Lnext.Onext.Sym===s),_e(s.Onext.Sym.Lnext===s),_e(s.Lface===e),s=s.Lnext}while(s!==e.anEdge)}for(_e(e.prev===t&&null===e.anEdge),r=o,r=o;(i=r.next)!==o;r=i){_e(i.prev===r),s=i.anEdge;do{_e(s.Sym!==s),_e(s.Sym.Sym===s),_e(s.Lnext.Onext.Sym===s),_e(s.Onext.Sym.Lnext===s),_e(s.Org===i),s=s.Onext}while(s!==i.anEdge)}for(_e(i.prev===r&&null===i.anEdge),n=l,n=l;(s=n.next)!==l;n=s)_e(s.Sym.next===n.Sym),_e(s.Sym!==s),_e(s.Sym.Sym===s),_e(null!==s.Org),_e(null!==s.Dst),_e(s.Lnext.Onext.Sym===s),_e(s.Onext.Sym.Lnext===s);_e(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}(),Le=function(){this.handle=null},Be=function(){this.key=null,this.node=0},ze=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 Le,this.handles[i]=new Be;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,_e(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 Le;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new Be}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;_e(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}(),Re=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},Ge=function(){this.key=null,this.next=null,this.prev=null},Te=function(){function e(e,t){this.frame=e,this.leq=t,this.head=new Ge,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 Ge;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}(),Fe=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?De.vertLeq(s.Org,n.Org)?De.edgeSign(n.Dst,s.Org,n.Org)<=0:De.edgeSign(s.Dst,n.Org,s.Org)>=0:De.edgeSign(n.Dst,r,n.Org)<=0:n.Dst===r?De.edgeSign(s.Dst,r,s.Org)>=0:De.edgeEval(s.Dst,r,s.Org)>=De.edgeEval(n.Dst,r,n.Org)},e.deleteRegion=function(e,t){t.fixUpperEdge&&_e(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},e.fixUpperEdge=function(e,t,i){_e(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 Re;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 we.ODD:return!!(1&t);case we.NONZERO:return 0!==t;case we.POSITIVE:return t>0;case we.NEGATIVE:return t<0;case we.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{_e(De.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,_e(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=De.vertL1dist(t,e),s=De.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(De.vertLeq(s.Org,n.Org)){if(De.edgeSign(n.Dst,s.Org,n.Org)>0)return!1;De.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(De.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(_e(!De.vertEq(n.Dst,a.Dst)),De.vertLeq(n.Dst,a.Dst)){if(De.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(De.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 Ie;if(_e(!De.vertEq(u,d)),_e(De.edgeSign(d,t.event,l)<=0),_e(De.edgeSign(u,t.event,h)>=0),_e(l!==t.event&&h!==t.event),_e(!i.fixUpperEdge&&!n.fixUpperEdge),l===h||Math.min(l.t,d.t)>Math.max(h.t,u.t))return!1;if(De.vertLeq(l,h)){if(De.edgeSign(u,l,h)>0)return!1}else if(De.edgeSign(d,h,l)<0)return!1;return e.debugEvent(t),De.intersect(d,l,u,h,p),_e(Math.min(l.t,d.t)<=p.t),_e(p.t<=Math.max(h.t,u.t)),_e(Math.min(u.s,d.s)<=p.s),_e(p.s<=Math.max(h.s,l.s)),De.vertLeq(p,t.event)&&(p.s=t.event.s,p.t=t.event.t),r=De.vertLeq(l,h)?l:h,De.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),De.vertEq(p,l)||De.vertEq(p,h)?(e.checkForRightSplice(t,i),!1):!De.vertEq(d,t.event)&&De.edgeSign(d,t.event,p)>=0||!De.vertEq(u,t.event)&&De.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):(De.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),De.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),De.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),De.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=De.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,De.vertEq(s.Org,r)?(_e(!1),void e.spliceMergeVertices(t,s,r.anEdge)):De.vertEq(s.Dst,r)?(_e(!1),i=e.topRightRegion(i),n=o=(a=(l=e.regionBelow(i)).eUp.Sym).Onext,l.fixUpperEdge&&(_e(n!==a),e.deleteRegion(t,l),t.mesh.delete(a),a=n.Oprev),t.mesh.splice(r.anEdge,a),De.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 Re;if(h.eUp=i.anEdge.Sym,r=t.dict.search(h).key,s=e.regionBelow(r)){if(a=r.eUp,o=s.eUp,0===De.edgeSign(a.Dst,i,a.Org))return void e.connectLeftDegenerate(t,r,i);n=De.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);_e(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 Re,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 Te(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||(_e(i.fixUpperEdge),_e(1===++r)),_e(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,De.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 ze(s,De.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,_e((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())&&De.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}(),ke=function(){function e(){this.mesh=new Ue,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=we.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(;De.vertLeq(i.Dst,i.Org);i=i.Lprev);for(;De.vertLeq(i.Org,i.Dst);i=i.Lnext);for(r=i.Lprev;i.Lnext!==r;)if(De.vertLeq(i.Dst,r.Org)){for(;r.Lnext!==i&&(De.edgeGoesLeft(r.Lnext)||De.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)r=e.connect(r.Lnext,r).Sym;r=r.Lprev}else{for(;r.Lnext!==i&&(De.edgeGoesRight(i.Lprev)||De.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===Me.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===Me.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 Ue),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=we.ODD),void 0===t&&(t=Me.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_(),Fe.computeInterior(this,n);var a=this.mesh;return t===Me.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),n&&a.check(),t===Me.BOUNDARY_CONTOURS?this.outputContours_(a,r):this.outputPolymesh_(a,t,i,r),!0},e}();function je(e){var t=e.windingRule,i=void 0===t?we.ODD:t,r=e.elementType,s=void 0===r?Me.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 ke;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}}}we.ODD,we.NONZERO,we.POSITIVE,we.NEGATIVE,we.ABS_GEQ_TWO,Me.POLYGONS,Me.CONNECTED_POLYGONS,Me.BOUNDARY_CONTOURS;var Ne=1e-12,Ve=class{constructor(e){this.position=new I,this.startPosition=new I,this.uuid=E.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 Ve(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},He=class extends Ve{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new He(this.parent).copy(this)}},qe=class extends Ve{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new He(this),new He(this))}static create(e,t){let i=new qe(e,new I(...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 qe(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 I,t=new I){let[i,r]=this.computeTangents();return i&&r&&(We(i,e),We(r,t)),[e,t]}computeTangent(e=new I){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new I){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}};function We(e,t=new I){let i=e.length();return t.set(-e.y/i,e.x/i)}var Ye=e=>e,Xe=new I,$e=new I,Ze=new I,Ke=new I,Je=new I,Qe=new I,et=new B,tt=new B;function it(e){let t=new I;t.addVectors(e.v0,Xe.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new I;return i.addVectors(e.v2,$e.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new q(e.v0,t,i,e.v2)}function rt(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function st(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function nt(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function at(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 ot(e,t,i){return ct(e,t)&&ct(t,i)&<(e.position,t.position,i.position)}function lt(e,t,i){return 0===Xe.copy(t).sub(e).cross($e.copy(i).sub(e))}function ht(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 dt(e,t,i){return e.distanceTo(i)<t.distanceTo(i)?t:e}function ut(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 at(t,e,i)>Math.PI&&(u*=-1),a=rt(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 pt(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function ct(e,t){return lt(e.position,e.controls[1].position,t.position)&<(e.position,t.controls[0].position,t.position)}function gt(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*mt(n.roundedCurveCorner,t);s>0&&(r[s-1]+=e),a+=e}void 0!==n.curveAfter&&(a+=mt(n.curveAfter,t)),r.push(a)}return e.length>0&&i&&void 0!==e[0].roundedCurveCorner&&(r[e.length-1]+=.5*mt(e[0].roundedCurveCorner,t)),r}function mt(e,t=12){return e&&e instanceof j?2*t:e&&(e instanceof W||e instanceof Y)?1:e&&e instanceof Z?t*e.points.length:t}var ft=new I,yt=new I,vt=new I,bt=new I,xt=new I,wt=new I,St=class extends Q{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new me(new B(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=E.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new St;return r.isClosed=e.isClosed,r.points=e.points.map(e=>qe.create(e.id,e.data)),"number"==typeof e.roundness&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(e=>St.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=ft.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=E.generateUUID()){let r;r=e instanceof I?e:new I(e,t);let s=new qe(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=tt.set(0,0,0),a=0,o=[];for(let r=0;r<t.length;r++){let l=Ye(t[r]),h=Xe,d=mt(l,i);o.push(d);for(let t=0;t<=d;t++)if(l instanceof q||l instanceof X||l instanceof W){if(l.getPoint(t/d,h),n.set(h.x,h.y,0),void 0!==s&&nt(s,n))continue;void 0===s&&(s=et),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=gt(this.points,e,!1),this.roundedCurveDivisions=gt(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(e,t,i,r=12,s=!0){let n=tt.set(0,0,0),a=0,o=[];for(let s=0;s<t.length;s++){if(!1===i[s])continue;let l,h=Ye(t[s]),d=Xe,u=mt(h,r);o.push(u);for(let t=0;t<=u;t++)if(h instanceof q||h instanceof X||h instanceof W){if(h.getPoint(t/u,d),n.set(d.x,d.y,0),l?.equals(n))continue;void 0===l?l=et:(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=Ye(t[r]),o=mt(a,i),l=Xe;for(let t=0;t<=o;t++)if(a instanceof q||a instanceof X||a instanceof W){if(a.getPoint(t/o,l),void 0!==s&&st(s,l,Ne))continue;void 0===s&&(s=$e),s.copy(l),e.push(l.x,l.y),n++}}return rt(e[0],e[e.length-2],Ne)&&rt(e[1],e[e.length-1],Ne)&&(e.pop(),e.pop()),r&&n>1&&!(rt(e[n-1],e[1],Ne)&&rt(e[n-2],e[0],Ne))&&(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*mt(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(pt(r,s)){let e=r.position.distanceTo(s.position);return r.position.distanceTo(ft.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){pt(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&&ot(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 W?r.v1.distanceTo(r.v2):r.getLength(),d=s instanceof W?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,ft),y=s.getPointAt(m,yt);if(this._subSplitCurve(r,o,g,f,void 0),this._subSplitCurve(s,l,m,void 0,y),this.useCubicForRoundedCorners){let e=at(f,i.position,y)/2,t=Math.tan(e)*f.distanceTo(i.position),[r,s]=ht(f,y,t,vt,bt),n=dt(r,s,i.position),[o,l]=ut(n,f,y,t,xt,wt);a=new q(f.clone(),o.clone(),l.clone(),y.clone())}else a=new X(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 W)){let n=e,a=t,o=n.getUtoTmapping(i,0),l=function(e,t,i,r,s=.5){let n=Xe.subVectors(t,e).multiplyScalar(s).add(e),a=$e.subVectors(i,t).multiplyScalar(s).add(t),o=Ze.subVectors(r,i).multiplyScalar(s).add(i),l=n,h=Ke.subVectors(a,n).multiplyScalar(s).add(n),d=Je.subVectors(o,a).multiplyScalar(s).add(a),u=o,p=Qe.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 St(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 qe(E.generateUUID(),new I(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 St;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 q&&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 X&&(e[t]=it(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 q?(r=this.createPoint(n.v0),r.controls[1].position.copy(n.v1)):n instanceof W&&(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 q?n.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(n.v2),a=!0):n instanceof W&&n.v2.equals(s[0].position)&&(a=!0),this.isClosed=a,s})(e.curves),e instanceof Q&&(this.shapeHoles=e.holes.map(e=>{let t=new St;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 Mt(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 Ot(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 At(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 Pt,_t,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},It=class extends pe{constructor(e,t,i=12,r=we.ODD,s){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=s;let n,a=[e.extractShapePointsToFlatArray([],i),...e.shapeHoles.map(e=>e.extractShapePointsToFlatArray([],i))];try{n=je({contours:a,windingRule:r,elementType:Me.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{n=Et}let o=n?.vertexCount??0,l=n?.elementCount??0,h=1/0,d=1/0,u=-1/0,p=-1/0;for(let e of a)for(let t=0;t<e.length;t+=2)e[t]<h&&(h=e[t]),e[t]>u&&(u=e[t]),e[t+1]<d&&(d=e[t+1]),e[t+1]>p&&(p=e[t+1]);let c=this._uvPitch,g=c??(u-h||1),m=c??(p-d||1),f=void 0===c?h:0,y=void 0===c?d:0,v=a.map((e,t)=>Mt(e,t>0)),b=0;for(let e of v)b+=e.length;let x=2*o+4*b,w=3*l*2+6*b,S=new Float32Array(3*x),M=new Float32Array(3*x),O=new Float32Array(2*x),A=new Uint32Array(w),P=new Uint8Array(x),_=0,D=0,C=0,E=!1,I=(e,i,r,s,n,a,o=(e-f)/g,l=(i-y)/m)=>{let h=3*D;S[h]=e,S[h+1]=i,S[h+2]=r,M[h]=s,M[h+1]=n,M[h+2]=a,P[D]=r===t?E?2:1:0,O[2*D]=o,O[2*D+1]=l,D++};if(void 0!==n)for(let[e,i]of[[t,1],[0,-1]]){let t=D;for(let t=0;t<o;t++)I(n.vertices[2*t],n.vertices[2*t+1],e,0,0,i);for(let e=0;e<l;e++){let[r,s,a]=[n.elements[3*e],n.elements[3*e+1],n.elements[3*e+2]];A[C++]=t+r,A[C++]=t+(i>0?s:a),A[C++]=t+(i>0?a:s)}}E=!0;for(let e=0;e<a.length;e++){let i=a[e],r=v[e],s=i.length/2,{u:n,vScale:o}=Ot(i,g,m);_=o;let l=0===o?0:t/o;for(let e=0;e<r.length;e++){let a=(e+1)%s,[o,h]=r[e],[d,u]=[n[e],n[e+1]],p=D;I(i[2*e],i[2*e+1],t,o[0],o[1],0,d,l),I(i[2*e],i[2*e+1],0,o[0],o[1],0,d,0),I(i[2*a],i[2*a+1],t,h[0],h[1],0,u,l),I(i[2*a],i[2*a+1],0,h[0],h[1],0,u,0),A[C++]=p,A[C++]=p+1,A[C++]=p+2,A[C++]=p+3,A[C++]=p+2,A[C++]=p+1}}At(S,M,A),this.setAttribute("position",new he(S,3)),this.setAttribute("normal",new he(M,3)),this.setAttribute("uv",new he(O,2)),this.setIndex(new he(A,1)),this._nearSide=P,this._vScale=_}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 It(this._shape,this._depth,this._curveSegments,this._windingRule);return e.userData=u(this.userData),e}},Ut=class extends pe{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=we.ODD,this.elementType=Me.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:we.ODD,elementType:Me.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=je({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 he(new Float32Array(3*d),3),this._normalAttribute=new he(new Float32Array(3*d),3),this._uvAttribute=new he(new Float32Array(2*d),2),this._indexAttribute=new he(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 Ut(this._shape,this._curveSegments);return e.userData=u(this.userData),e}};function Lt(e){return _t||(_t=async function(){let t=e??"https://unpkg.com/@splinetool/runtime@2.0.64/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}),Pt=r}())}var Bt=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]);function zt(e){let t=!1;return e.scene.objects.traverse((e,i)=>{let r=i.geometry;if(void 0!==r&&(Bt.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 Rt(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 Gt=new R;function Tt(e,t,i,r,s,n){let a=e.positions.length/3,o=s.elements,l=Gt.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]);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 Ft=new $,kt=new $,jt=(new $).makeScale(1,1,-1),Nt=new Map,Vt={assemblies:0,placements:0};function Ht(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=Nt.get(l);if(void 0!==d&&d.outlineVersion===o&&d.capKey===h&&(e.stillServes?.(d)??1))return Vt.placements++,d.cap;let u=function(e,t,i,r,s){let{points:n,ends:a}=Rt(e,t);return Pt.assemble_cap(n,a,i,r,0,Math.max(1,Math.floor(s)),.4,40)}(i,r,s,n,a);Vt.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 Nt.set(l,{outlineVersion:o,capKey:h,assembledAt:s,cap:e}),e}finally{u.free()}}var qt=class extends pe{constructor(e,t,i=0,r=12,s=3,n,a){if(super(),this.type="ShapeGeometry",this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0,void 0===Pt)throw new Error("bevel-wasm is not loaded");this._shape=e,this._uvPitch=a,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&&Yt(this._effectiveBevel,e)&&Yt(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=Ht({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:e=>Yt(e.cap.rise,this._depth)&&Yt(e.cap.rise,e.assembledAt)}),t=function(e,t,i,r,s){let n=r.positions.length/3,a=i-r.rise,o=r.rise,{points:l,ends:h}=Rt(e,t),d=1/0,u=1/0,p=-1/0,c=-1/0;for(let e=0;e<l.length;e+=2)l[e]<d&&(d=l[e]),l[e]>p&&(p=l[e]),l[e+1]<u&&(u=l[e+1]),l[e+1]>c&&(c=l[e+1]);let g=s??p-d,m=s??c-u,f=[],y=0;for(let e of h)f.push({at:y,count:e-y}),y=e;let v=0;for(let e of f)v+=e.count;let b=2*n+4*v,x=new Float32Array(3*b),w=new Float32Array(3*b),S=new Float32Array(2*b),M=new Uint32Array(2*r.indices.length+6*v),O=new Uint8Array(b),A=0,P=void 0===s?void 0:(e,t)=>[e/s,t/s],_={positions:x,normals:w,uvs:S,indices:M};Tt(r,_,0,0,Ft.makeTranslation(0,0,a),P),Tt(r,_,n,r.indices.length,kt.makeTranslation(0,0,o).multiply(jt),P),O.fill(1,0,n);let D=2*n,C=2*r.indices.length;for(let e=0;e<f.length;e++){let{at:t,count:i}=f[e],r=l.subarray(2*t,2*(t+i)),s=Mt(r,e>0),n=Ot(r,g,m),h=n.u;A=n.vScale;for(let e=0;e<i;e++){let t=(e+1)%i,[n,l]=s[e],d=D;for(let[i,s,d,u,p,c]of[[r[2*e],r[2*e+1],n,a,h[e],2],[r[2*t],r[2*t+1],l,a,h[e+1],2],[r[2*t],r[2*t+1],l,o,h[e+1],0],[r[2*e],r[2*e+1],n,o,h[e],0]]){let e=3*D;x[e]=i,x[e+1]=s,x[e+2]=u,w[e]=d[0],w[e+1]=d[1],w[e+2]=0,S[2*D]=p,S[2*D+1]=0===A?0:(u-o)/A,O[D]=c,D++}M[C++]=d,M[C++]=d+1,M[C++]=d+2,M[C++]=d,M[C++]=d+2,M[C++]=d+3}}return At(x,w,M),{positions:x,normals:w,uvs:S,indices:M,nearSide:O,vScale:A}}(this._shape,this._curveSegments,this._depth,e,this._uvPitch);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 he(t.positions,3)),this.setAttribute("normal",new he(t.normals,3)),this.setAttribute("uv",new he(t.uvs,2)),this.setIndex(new he(t.indices,1))}clone(){let e=new qt(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId);return e.userData=u(this.userData),e}};function Wt(e,t,i,r,s){if(void 0!==Pt&&t>0)return Ht({owner:s,shape:e,curveSegments:r,assembledAt:2*t,bevel:t,bevelSegments:i})}function Yt(e,t){return.5*t>1.001*e}var Xt=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:we.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 St?(i=o,(i.width!==s||i.height!==n)&&i.applySize(s,n)):i=new St(s,n).fromJSON(o),void 0!==e.parameters?.roundness&&e.parameters?.roundness>0&&i.update());let h=i??new St(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}=e.parameters;return e.shape.roundness=a,i<=0?t=new Ut(e.shape,n,{windingRule:o}):r<=0?t=new It(e.shape,i,n,o,l):void 0!==Pt?t=new qt(e.shape,i,r,n,s,e.ownerId,l):(console.error("[extrude] engine not loaded — extruding without a bevel"),t=new It(e.shape,i,n,o,l)),Object.assign(t,{userData:{...e,type:"VectorGeometry"}})}};function $t(){let e=new pe;return e.setAttribute("position",new he(new Float32Array([]),3)),e.setIndex(new he(new Uint16Array([]),1)),e}var Zt,Kt,Jt,Qt,ei,ti,ii=$t().attributes,ri=class extends pe{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,ii),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}=e,u=f.getDisplayedValue(l),p=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?u.toUpperCase():3===h?u.toLowerCase():u,t),{shapes:c,charWidths:g,charCoords:m}=i.generateShapes(p,e,t),y=.5*("number"==typeof r?r:Number(t.getVariable(r))),v=.5*("number"==typeof s?s:Number(t.getVariable(s))),b=c.map(e=>(new St).fromShape(e,!0));this.vectorShapes=b;let x=b.map(e=>Xt.create({shape:e,parameters:{depth:n,extrudeBevelSegments:o,extrudeBevelSize:a,uvPitch:d,windingRule:n<=0?we.NONZERO:we.ODD,subdivisions:this.isLowResolution&&n>0?1:12}})),w=x.length?ve(x):$t();w.translate(-y,v,0),this.dispose(),this.wrappedText=p,this.charCoords=m,this.charWidths=g,this.deleteAttribute("extrudeNormal"),Object.entries(w.attributes).forEach(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(w.index),this.adoptNearSide(x,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&&Yt(this._effectiveBevel,e)&&Yt(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 pe,ri.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??""}},si="webgl",ni=!1;function ai(e){si=e}function oi(){return si}function li(e){Zt=e}function hi(e){Kt=e}function di(){if("webgpu"===si){if(void 0!==Zt)return Zt;ni||(ni=!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===Kt)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 Kt}function ui(e,t){return di().createRootMaterial(e,t)}function pi(e,t,i){return di().createSharedMaterial(e,t,i)}function ci(e){return void 0===e.getLayersOfType&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function gi(e){Jt=e}function mi(e){Qt=e}function fi(e){ei=e}function yi(){return ei}function vi(e){ti=e}function bi(e,t){return void 0!==ti&&ti(e,t)}var xi=[3,4,8,9];function wi(e){for(let t of xi)e.enable(t)}var Si,Mi=5,Oi=3,Ai=32,Pi=.98,_i=class extends ee{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}},Di=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}},Ci=class extends Di{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}};function Ei(){Si&&Si.disposeAll()}var Ii=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}},Ui=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}},Li=class extends fe{constructor(e){super(e),this.type=C}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]=oe.toHalfFloat(Math.min(e[t+0]*n,65504)),i[r+1]=oe.toHalfFloat(Math.min(e[t+1]*n,65504)),i[r+2]=oe.toHalfFloat(Math.min(e[t+2]*n,65504)),i[r+3]=oe.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 D: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=D;break;case C: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=C;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:V,minFilter:ge,magFilter:ge,generateMipmaps:!1,flipY:!0}}setDataType(e){return this.type=e,this}};function Bi(e){return e.length>2&&35===e[0]&&63===e[1]}function zi(e){return"object"==typeof e&&null!==e&&!0===e.isSplineHdr}function Ri(e){let t=new ce(e.data,e.width,e.height,N,C);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var Gi=0,Ti=class extends Ii{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.instanceId=++Gi,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?Bi(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&&Bi(i)?function(e){try{let t=(new Li).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=>oe.toHalfFloat(Math.pow(Math.max(oe.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:(Si||(Si=new Ci),Si.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 ye(this.img,void 0,e,e):this.isHdr?(r=Ri(this.img),r.wrapS=e,r.wrapT=e,r.magFilter=i,r.minFilter=t):r=new k(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()}},Fi=class extends Ti{},ki=2*Math.PI;function ji({x:e,y:t},i,r,s,n){return{x:e*i+s,y:t*r+n}}function Ni(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 Vi(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 Hi=2*Math.PI,qi=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=E.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof St?e.shape:new St,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}=e.parameters,d=e.shape,u=function(e,t,i,r,s,n){if(r>=Hi)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(Xi(s-t,n,s-t,n-l,s-t,n+l)),e.addPoint(Xi(s,n+i,s-o,n+i,s+o,n+i)),e.addPoint(Xi(s+t,n,s+t,n+l,s+t,n-l)),e.addPoint(Xi(s,n-i,s+o,n-i,s-o,n-i)),r>0&&Zi(e,t,i,r)}(e,t,i,n),Math.round(s/4)):Wi(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=Vi(1,0,b,x),O=Vi(b,x,w,S);return!h&&O>0&&(O-=ki),h&&O<0&&(O+=ki),{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)/(ki/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(Ni(c,g)),c+=g;return l.map(e=>{let{x:t,y:i}=ji(e[0],s,n,m,f),{x:r,y:a}=ji(e[1],s,n,m,f),{x:o,y:l}=ji(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(Yi(t,i));for(let t=0,i=r.length;t<i;t++){let i=r[t],s=e.points[t],n=Yi(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?$i(e,n,a,o):e.addPoint(Yi(0,0)),l}(e,a.x,a.y,h,s,t,i,n):Wi(e,r,s,t,i,n)}(d,.5*i,.5*r,n*Math.PI/180,s,a);return d.isClosed=!0,d.update(),0===n?(t=new pe,t.setAttribute("position",new de([],3))):t=Xt.create({shape:d,parameters:{subdivisions:u,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}};function Wi(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(Yi(n,o))}return t<Hi?n>0?$i(e,r,s,n):e.addPoint(Yi(0,0)):(e.removePoint(e.points[e.points.length-1]),n>0&&Zi(e,r,s,n)),1}function Yi(e,t){return new qe(E.generateUUID(),new I(e,t))}function Xi(e,t,i,r,s,n){let a=Yi(e,t);return a.controls[0].position.set(i,r),a.controls[1].position.set(s,n),a}function $i(e,t,i,r){Ki(e,t,i,r).forEach(t=>e.addPoint(t))}function Zi(e,t,i,r){let s=Ki(e,t,i,r),n=new St;s.forEach(e=>n.addPoint(e)),n.isClosed=!0,e.shapeHoles.push(n)}function Ki(e,t,i,r){let s=r*t/100,n=s*(Math.abs(i)/Math.abs(t)),a=new I(s/t,n/i),o=e.points.map(e=>{let t=e.clone();return t.uuid=E.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 Ji,Qi,er=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 St?e.shape:new St,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}=e.parameters,l=e.shape,h=.5*t,d=.5*i,u=2*Math.PI/r;for(let e=0;e<r;e++){let t=u*e,i=0+Math.sin(t)*h,r=0+Math.cos(t)*d;l.addPoint(l.createPoint(i,r))}l.isClosed=!0;for(let e=0,t=l.points.length;e<t;e++)l.points[e].roundness=s;l.roundness=s,l.update();let p=Xt.create({shape:l,parameters:{roundness:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o}});return Object.assign(p,{userData:{...e,type:"PolygonGeometry"}})}},tr=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 St?e.shape:new St,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}=e.parameters,h={x:.5*i,y:.5*r},d={x:-h.x,y:-h.y},u={x:h.x,y:h.y};function p(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 c=[];c[0]=0===s[0]?0:p(s[0],s[0]+s[3],s[0]+s[1]),c[1]=0===s[1]?0:p(s[1],s[1]+s[2],s[1]+s[0]),c[2]=0===s[2]?0:p(s[2],s[2]+s[1],s[2]+s[3]),c[3]=0===s[3]?0:p(s[3],s[3]+s[0],s[3]+s[2]);let g=d.x,m=u.x,f=u.y,y=d.y;t.addPoint(t.createPoint(g,f)),t.addPoint(t.createPoint(m,f)),t.addPoint(t.createPoint(m,y)),t.addPoint(t.createPoint(g,y)),t.isClosed=!0;let v=!0;for(let e=0,i=t.points.length;e<i;e++)t.points[e].roundness=c[e],e>0&&c[e]!==c[e-1]&&(v=!1);v&&(t.roundness=c[0]),t.useCubicForRoundedCorners=1!==n,t.update();let b=Xt.create({shape:t,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(b,{userData:{...e,type:"RectangleGeometry"}})}},ir=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 St?e.shape:new St,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}=e.parameters,d=e.shape,u=.5*t,p=.5*i,c=a*Math.PI/360/s,g=Math.PI/2*3*-1,m=u*r/100,f=p*r/100;if(3===s&&50===r){c=2*Math.PI/s;for(let e=0;e<s;e++){let t=c*e,i=0+Math.sin(t)*u,r=0+Math.cos(t)*p;d.addPoint(d.createPoint(i,r))}}else for(let e=0;e<s;e++){let e=0+Math.cos(g)*u,t=0+Math.sin(g)*p;d.addPoint(d.createPoint(e,t)),g+=c,e=0+Math.cos(g)*m,t=0+Math.sin(g)*f,d.addPoint(d.createPoint(e,t)),g+=c}d.isClosed=!0;for(let e=0,t=d.points.length;e<t;e++)d.points[e].roundness=n;d.roundness=n,d.update();let y=Xt.create({shape:d,parameters:{roundness:n,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}});return Object.assign(y,{userData:{...e,type:"StarGeometry"}})}},rr=new Promise(e=>{Ji=e}),sr=!1;function nr(e){if(!sr)return Qi||(Qi=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.64/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});Ji(a),sr=!0}())}var ar=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=E.clamp(s.thetaLength,0,360),s.hollow=E.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 pe,t.setAttribute("position",new de([],3))):t=p||g?new lr(d,u,s,n,a,o,l,h*Math.PI/180,p,p,c,g):new z(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 or(e){return new I(e.y,-e.x)}var lr=class extends pe{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 I(e,c),m=new I(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),D=Math.tan(A/2),C=_+D,E=u?C:D,U=u?C:_;if(l=Math.min(l,(e-S)/E,x.length()/C),h=Math.min(h,(t-M)/U,x.length()/C),l>0){let e=l/_;f=g.clone().sub(new I(e,l)),u&&(v=f.clone(),v.x-=w-C*l),g.sub(x.clone().setLength(e))}if(h>0){let e=h/D;y=m.clone().sub(new I(e,-h)),m.add(x.clone().setLength(e)),u&&(b=y.clone(),b.x-=w-C*h,O.sub(x.clone().setLength(e)))}x=g.clone().sub(m);let L=x.length()<.5,B=[],z=[],R=[],G=[],T=[],F=[],k=(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;B.push(h*t+r.x),z.push(p),R.push(h),G.push(u),T.push(.5+p/i),F.push(!1)}},j=(e,t,i)=>{let r=[e,t];i<0&&r.reverse();for(let e of r)B.push(e),z.push(c*i),R.push(0),G.push(i),T.push(.5),F.push(!0)};if(b&&y?(k(A,h,b,-1,!0),k(P,h,y,-1,!1)):y?(j(y.x,0,-1),k(P,h,y,-1,!1)):n||j(t,M,-1),!L){let e=or(x).normalize();for(let t=0;t<=s;t++){let r=t/s,n=x.y*r+m.y;B.push(x.x*r+m.x),z.push(n),R.push(e.x),G.push(e.y),T.push(.5+n/i),F.push(!1)}}if(v&&f?(k(A,l,f,1,!1),k(P,l,v,1,!0)):f?(k(A,l,f,1,!1),j(f.x,0,1)):n||j(e,S,1),u&&!L){let e=or(x).multiplyScalar(-1).normalize();for(let t=0;t<=s;t++){let r=t/s,n=x.y*-r+O.y;B.push(x.x*-r+O.x),z.push(n),R.push(e.x),G.push(e.y),T.push(.5+n/i),F.push(!1)}}let N=B.length,V=N+(u&&!n?1:0),H=(e,t)=>e*N+(t===N?0:t),q=o<2*Math.PI,W=(r+1)*N+(q?2*(1+V):0),Y=new Float32Array(3*W),X=new Float32Array(3*W),$=new Float32Array(2*W),Z=W-1>65535?new Uint32Array(r*Math.max(0,V-1)*6+(q?2*(V+1)*3:0)):new Uint16Array(r*Math.max(0,V-1)*6+(q?2*(V+1)*3:0)),K=0,J=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*J,r=2*J,a=B[e],o=R[e];Y[i]=a*s,Y[i+1]=z[e],Y[i+2]=a*n,X[i]=o*s,X[i+1]=G[e],X[i+2]=o*n,F[e]?($[r]=.5,$[r+1]=.5):($[r]=t,$[r+1]=T[e]),J++}}for(let e=0;e<r;e++)for(let t=0;t<V-1;t++){if(n&&u&&t==s)continue;let i=H(e,t),r=H(e+1,t),a=H(e+1,t+1),o=H(e,t+1),l=Y[3*a+0],h=Y[3*a+2];Z[K++]=i,Z[K++]=r,Z[K++]=o,(0!=l||0!=h)&&(Z[K++]=r,Z[K++]=a,Z[K++]=o)}function Q(i,r,s){let n=Math.sin(s),a=Math.cos(s),o=-a,l=n,h=i<0?(e,t,i)=>{Z[K++]=e,Z[K++]=t,Z[K++]=i}:(e,t,i)=>{Z[K++]=e,Z[K++]=i,Z[K++]=t},d=(e+t+S+M)/4,u=3*J,p=2*J;Y[u]=d*n,Y[u+1]=0,Y[u+2]=d*a,X[u]=o,X[u+1]=0,X[u+2]=l,$[p]=.5,$[p+1]=.5;let c=J++;for(let e=0;e<V;e++){let t=3*(r+(e===N?0:e));u=3*J,p=2*J,Y[u]=Y[t],Y[u+1]=Y[t+1],Y[u+2]=Y[t+2],X[u]=o,X[u+1]=0,X[u+2]=l;let i=t/3*2|0;$[p]=$[i],$[p+1]=$[i+1],J++}for(let e=c+1;e<J-1;e++)h(c,e,e+1);h(c,J-1,c+1)}q&&(Q(-1,0,a),Q(1,r*N,a+o)),this.setIndex(new he(Z.slice(0,K),1)),this.setAttribute("position",new he(Y,3)),this.setAttribute("normal",new he(X,3)),this.setAttribute("uv",new he($,2))}},hr=Math.PI/2,dr=class extends pe{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*hr;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 B(e/2,t/2,i/2);r.subScalar(a);let s=0;for(let e=0;e<=o;e++){let t=hr*(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+=hr/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 B;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 B,C=new B;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 D(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),D(1,1,1),D(-1,1,1),D(1,-1,1),D(-1,-1,1),D(1,1,-1),D(-1,1,-1),D(1,-1,-1),D(-1,-1,-1)),this.setIndex(new he(f,1)),this.setAttribute("position",new he(c,3)),this.setAttribute("normal",new he(g,3)),this.setAttribute("uv",new he(m,2))}},ur=class extends pe{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 B,p=u.clone(),c=new se,g=s*r,m=r-g,f=n+1,y=new B,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 B).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),U=new Float64Array(2*C),L=b(2*d*f,()=>new B),z=b(n*Math.max(0,n-1)/2,()=>new B),R=u.clone(),G=u.clone(),T=u.clone(),F=u.clone(),k=u.clone(),j=[],N=b(x.length,()=>b(d,()=>u.clone()));for(let e=0;e<x.length;e++){u.copy(x[e]).normalize(),R.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(R,N[e][i])}let i=0,r=[],s=[],b=new B;0==n&&[...N[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=N[e][o],h=N[e][t];u.copy(l).sub(R),p.copy(h).sub(R);let c=R.angleTo(u),x=u.angleTo(p),w=Math.cos(c)*g;0==n?G.copy(b):G.copy(R).setLength(m+w),r.push(w);let S=[G,l,h];for(let e=0;e<2;e++){let t=S[e],r=S[e+1];F.subVectors(t,R),k.subVectors(r,R),T.crossVectors(F,k).normalize();for(let r=0;r<f;r++){let s=[c,x][e]*r/f;u.copy(F).applyAxisAngle(T,s).add(R),L[i++].copy(u),e&&(v(u,R),a.push([0==r?t:u.clone(),y.clone()]))}e&&(v(r,R),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=[L[t]];for(let a=1;a<f;a++){let o=L[t+a],l=L[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(R).setLength(r[e]).add(R),n.push(z[s++].copy(u));n.push(l)}for(let e=0;e<f;e++)n.push(L[e+f+t]);n.push(L[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,R),I[i]=y.x,I[i+1]=y.y,I[i+2]=y.z,U[r]=Math.atan2(t.z,-t.x)/2/Math.PI+.5,U[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]=U[i],l[r+1]=U[i+1],h+=3}}}let V=[];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)}V.push(s[0][0],n[f][0],s[f][0],n[0][0])}}for(;V.length;){let e,t,i,[r,s]=V.splice(0,2);e=s;let n=[r];for(;r!=e;)n.push(e),t=V.indexOf(e),i=t%2,e=V.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 B,t=new B,i=new B,r=new B,s=new I,n=new I,o=new I,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 he(new Float32Array(a.subarray(0,h)),3)),this.setAttribute("normal",new he(new Float32Array(o.subarray(0,h)),3)),void this.setAttribute("uv",new he(new Float32Array(l.subarray(0,h/3*2)),2))}static fromJSON(e){return new ur(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}},pr=class extends ur{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 pr(e.radius,e.corner,e.cornerSides)}},cr=class extends ur{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 cr(e.radius,e.corner,e.cornerSides)}},gr=1e4;function mr(e,t){return Math.abs(t-e)/2+Math.min(e,t)}var fr=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*gr),d=Math.round(r*gr),u=Math.round(s*gr),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=yr(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 pe;c.setAttribute("position",new he(d,3)),h>0&&(c.setAttribute("normal",new he(u,3)),c.setAttribute("color",new he(new Float32Array(3*h).fill(1),3))),null!==p&&c.setAttribute("uv",new he(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 yr(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=mr(i,n),d=mr(r,a),u=mr(n,o),p=mr(a,l),c=mr(i,o),g=mr(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 vr=new B;function br(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}var xr=new B,wr=new B;function Sr(e,t,i,r,s,n){let a=xr.copy(t).sub(e),o=wr.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 Mr(e,t,i){let r=e.clone().sub(t),s=i.clone().sub(t);return r.projectOnVector(s),r.add(t)}var Or=class extends pe{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 B(0,-c,0),x=new B(0,c,0),w=new I(e,-c),S=new I(m,-c),M=new I(0,x.y).sub(S),O=new I(0,x.y).sub(w),A=new I(M.y,-M.x).normalize(),P=new I(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 B(A.x,A.y,0),t=new B(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 B;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;br(r,new I(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 U=[];{let e=new B,t=new B,r=new B,s=new B,c=new B,m=new B;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 I(Math.sin(y),Math.cos(y)),_=new I(Math.sin(v),Math.cos(v)),E=new I(Math.sin(S),Math.cos(S));br(w,O,t),br(w,E,r),br(A,_,e),Sr(x,t,r,C,C,s),h.push(s.x,s.y,s.z),Sr(t,x,r,C,D,c),h.push(c.x,c.y,c.z),Sr(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 R=p++,G=p++,T=p++;if(l.push(R,G,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 B;br(P,E,e);let t=m.clone().add(s).multiplyScalar(.5);t=Mr(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 B(0,-1,0),r=t.clone().cross(i);z(e,t,i,r)}U.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 B,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 B,f=new B,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 z(e,t,i,r){let s=Math.PI/2,o=O.angle()-s,c=[],g=new B,m=new B;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 de(h,3)),this.setAttribute("normal",new de(d,3)),this.setAttribute("uv",new de(u,2))}},Ar=class extends pe{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 B(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 U=Math.sin(I/2)*D*2,L=d.length-1,z=d[0][0].distanceTo(d[1][0]),R=z+U*n+d[L-1][0].distanceTo(d[L][0]);d[0].push(1);for(let e=0;e<=n;e++)d[e+1].push(1-(z+e*U)/R);d[L].push(0);let G,T,F,[k,j,N]=d[0];for(let e=1;e<d.length;e++)[G,T,F]=d[e],a.push(v,k.y,k.z,v,G.y,G.z,b,k.y,k.z,b,k.y,k.z,v,G.y,G.z,b,G.y,G.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,N,0,F,1,N,1,N,0,F,1,F),[k,j,N]=[G,T,F];this.setAttribute("position",new de(a,3)),this.setAttribute("normal",new de(o,3)),this.setAttribute("uv",new de(l,2))}},Pr={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=E.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 pe,t.setAttribute("position",new de([],3))):t=d>0||u>0||h<360?new lr(0,i/2,s,n,a,o,l,h*Math.PI/180,d,u,p,0,!0):new G(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 L(i,r,s,n,a,o):new dr(i,r,s,n,a,o,l,h),Object.assign(t,{userData:{...e,type:"CubeGeometry"}})}},CylinderGeometry:ar,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 pr(.5*t,n,a):new T(.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:qi,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 cr(.5*t,n,a):new te(.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 Q;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 ie(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 pe).copy(new L(100,100,100));void 0===t?(r.computeBoundingBox(),r.boundingBox.getSize(vr),i={width:vr.x,height:vr.y,depth:vr.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 pe).copy(new L(100,100,100)),a=n.userData.parameters;void 0===a?(n.boundingBox=function(e){let t=new ae,i=e.attributes.position;return i?(t.setFromBufferAttribute(i),t):(t.makeEmpty(),t)}(n),n.boundingBox.getSize(vr)):vr.set(a.width,a.height,a.depth),(t!==vr.x||i!==vr.y||r!==vr.z)&&n.scale(0===vr.x?1:t/vr.x,0===vr.y?1:i/vr.y,0===vr.z?1:r/vr.z);let o=n.originalGeometry;try{s>0?(void 0===o||a?.subdivisions!==s)&&(void 0===o&&(o=n),n=new fr(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 F(i).load(e,e=>{let i=this.normalizeInputs({geometry:e});e.boundingBox.getSize(vr);let r=100/vr.x;Object.assign(i.parameters,{width:100,height:vr.y*r,depth:vr.z*r}),t(this.build(i))})}},PolygonGeometry:er,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 Or(.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:tr,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=E.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 pe,t.setAttribute("position",new de([],3))):t=new ne(.5*i,n,a,o,l,h,d*E.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 re(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 Ar(t,i,r,s,n,a);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},StarGeometry:ir,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 re(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=E.clamp(s/360,0,1);if(0===p){let e=new pe;return e.setAttribute("position",new de([],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 le(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 St?e.shape:new St,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}=e.parameters,l=e.shape,h=.5*t,d=.5*i;o?(l.addPoint(l.createPoint(-h,d)),l.addPoint(l.createPoint(h,-d)),l.addPoint(l.createPoint(-h,-d))):(l.addPoint(l.createPoint(0,d)),l.addPoint(l.createPoint(h,-d)),l.addPoint(l.createPoint(-h,-d))),l.isClosed=!0;for(let e=0,t=l.points.length;e<t;e++)l.points[e].roundness=r;l.roundness=r,l.update();let u=Xt.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:n,extrudeBevelSegments:a}});return Object.assign(u,{userData:{...e,type:"TriangleGeometry"}})}},VectorGeometry:Xt},_r=e=>{let t=Pr[e.type]??g(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)},Dr=["font"];function Cr(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];v(n)&&!Dr.includes(s)&&(i[s]=t.getVariable(n,[r.uuid,"geometry",...e,s]),v(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=St.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 F).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 Nr(n,i);return t.data=e,t}if("TextGeometry"===n.type||"InputGeometry"===n.type){let e=g(n.type);if(e)return e.create(n,t);c("text",`a ${n.type}`);let i=St.createFromState(M.defaultData(),100,100);return _r({...n,shape:i,type:"VectorGeometry"})}if("UIGeometry"===n.type)return tr.create({parameters:{width:n.width,height:n.height,cornerRadius:n.cornerRadius,cornerType:n.cornerType}})}try{o=_r(l)}catch(e){console.error(e),console.error(`Error generating geometry with inputs: ${l}`);let t=St.createFromState(M.defaultData(),100,100);l.shape=t,l.type="VectorGeometry",o=_r(l)}return o}var Er=new $;function Ir(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 Ur(e,t,i,r){let s,n,a,o=e.position.array,l=e.normal.array,h=Er.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 Lr,Br=new ae,zr=new B;rr.then(e=>{Lr=e});var Rr=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Gr=new Uint32Array([0,1,2,3]),Tr=new Uint8Array([4]);function Fr(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===e?t:-1}function kr(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=Fr(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 jr(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===Fr(e)),r=0;for(let e of t){let t=Fr(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 Nr=class extends pe{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=m.div(t.map(e=>"number"==typeof e?e:0),i);if(r.every(e=>1===e))return;this.subdividedGeometry&&Ur(this.subdividedGeometry.attributes,...r),this.originalGeometry&&Ur(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(zr.fromArray(r));let n=zr.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=Nr.allocate(e),i=Nr.buildRefined(r,e.subdivisions,t)}catch(t){console.error(t,e)}finally{r&&Nr.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}=Nr.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new L(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&&(Nr.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new ue,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;Br.setFromBufferAttribute(t),Br.getCenter(i),e.boundingSphere.radius=i.distanceTo(Br.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Br.getSize(zr);let r={width:zr.x,height:zr.y,depth:zr.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&&(Lr.free_bvh(t),Lr.free_subdivision_surface(t));try{s=Nr.allocate(e,r)}catch(t){console.error(t,e),s=Nr.allocate({positionWASM:Rr,indexWASM:Gr,verticesPerFaceWASM:Tr},r)}Lr.set_destination_refinement_level(s,0);let o=Nr.buildLevel(s,!0,a);return n=e.subdivisions>0?Nr.buildRefined(s,e.subdivisions,a):null,{subdivPointer:s,originalGeometry:o,subdividedGeometry:n}}static buildRefined(e,t,i){try{return Lr.set_destination_refinement_level(e,t),Nr.buildLevel(e,!1,i)??null}catch{try{return Lr.set_destination_refinement_level(e,t-1),Nr.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:Cr(e,i,!1,t);r=l(e)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let n,{positions:a,triIndices:o,triOriginals:h}=Hr(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]){qr.set(e[3*t[u]],e[3*t[u]+1],e[3*t[u]+2]),Wr.set(e[3*t[u+1]],e[3*t[u+1]+1],e[3*t[u+1]+2]),Yr.set(e[3*t[u+4]],e[3*t[u+4]+1],e[3*t[u+4]+2]),Xr.set(e[3*t[u+5]],e[3*t[u+5]+1],e[3*t[u+5]+2]),Wr.sub(qr).normalize(),Yr.sub(qr).normalize(),Xr.sub(qr).normalize();let i=Wr.cross(Yr).dot(Xr),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=kr(e.positionWASM),l=kr(e.indexWASM),h=kr(e.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!h?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology — positionWASM ${jr(e.positionWASM)}, indexWASM ${jr(e.indexWASM)}, verticesPerFaceWASM ${jr(e.verticesPerFaceWASM)}`);i=o,r=l,s=h;let t=kr(e.uvWASM);Lr.alloc_subdivision_surface_uvs&&t&&t.length===2*r.length&&(a=t)}else i=Rr,r=Gr,s=Tr;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=Lr._malloc(m);if(!y)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${m}) failed`);let v,b=new Float32Array(Lr.HEAPF32.buffer,y,c),x=new Uint32Array(Lr.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 $).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?Lr.alloc_subdivision_surface_uvs2(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,w,a.length,v.elements):Lr.alloc_subdivision_surface_uvs(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,w,a.length):v?Lr.alloc_subdivision_surface2(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,v.elements):Lr.alloc_subdivision_surface(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p);return Lr._free(y),S}static buildLevel(e,t,i,r,s,n=!1){let a=s?Lr.get_mesh_data2(e,t?Lr.Level.CONTROL:Lr.Level.REFINED,i,s.elements):Lr.get_mesh_data(e,t?Lr.Level.CONTROL:Lr.Level.REFINED,i),o=Lr.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),h=0,d=Lr.HEAPU32[o[h]>>2],u=Lr.HEAPF32.subarray(d>>2,(d>>2)+l[h]);h++;let p=Lr.HEAPU32[o[h]>>2],c=Lr.HEAPF32.subarray(p>>2,(p>>2)+l[h]);h++;let g=Lr.HEAPU32[o[h]>>2],m=Lr.HEAPU32.subarray(g>>2,(g>>2)+l[h]);h++;let f,y=Lr.HEAPU32[o[h]>>2],v=Lr.HEAPU32.subarray(y>>2,(y>>2)+l[h]);if(h++,Lr.alloc_subdivision_surface_uvs){let e=o[9];if(e>0){let t=Lr.HEAPU32[o[8]>>2];f=Lr.HEAPF32.subarray(t>>2,(t>>2)+e)}}if(void 0===r){let e=new pe;if(e.setIndex(new _(v,1)),e.setAttribute("position",new de(u,3)),e.setAttribute("normal",new de(c,3)),f&&e.setAttribute("uv",new de(f,2)),t){e.setAttribute("faceMap",new _(m,1));let t=new Float32Array(c.length/3*4).fill(0);e.setAttribute("color",new he(t,4))}return Lr.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),Lr.free_mesh_data(a)}static freeSubdivPointer(e){Lr.free_bvh(e),Lr.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=Lr.get_wireframe_data_for_base_level(e),s=Lr.HEAPU32.subarray(r>>2,4+(r>>2)),n=s.subarray(2,4),a=0,o=Lr.HEAPU32[s[a]>>2],l=Lr.HEAPF32.subarray(o>>2,(o>>2)+n[a]);a++;let h=Lr.HEAPU32[s[a]>>2],d=Lr.HEAPU32.subarray(h>>2,(h>>2)+n[a]);if(void 0===t){let e=new pe;e.setAttribute("position",new de(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 he(t,3)),e.setIndex(new _(d,1)),Lr.free_wireframe_data_for_base_level(r),e}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,Lr.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=0===t;r||Lr.set_destination_refinement_level(e,t);let s=i?Lr.get_topological_data2(e,r?Lr.Level.CONTROL:Lr.Level.REFINED,i.elements):Lr.get_topological_data(e,r?Lr.Level.CONTROL:Lr.Level.REFINED),n=Lr.HEAPU32.subarray(s>>2,8+(s>>2)),a=n.subarray(3,6),o=0,l=Lr.HEAPU32[n[o]>>2],h=new Float32Array(Lr.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let d=Lr.HEAPU32[n[o]>>2],u=new Uint32Array(Lr.HEAPU32.subarray(d>>2,(d>>2)+a[o]));o++;let p,c=Lr.HEAPU32[n[o]>>2],g=new Uint8Array(Lr.HEAPU32.subarray(c>>2,(c>>2)+a[o]));if(Lr.alloc_subdivision_surface_uvs){let e=n[7];if(e>0){let t=Lr.HEAPU32[n[6]>>2];p=new Float32Array(Lr.HEAPF32.subarray(t>>2,(t>>2)+e))}}return Lr.free_topological_data(s),{positions:h,indices:u,verticesPerFace:g,uvs:p}}};function Vr(e){let t=Object.keys(e);return 1===t.length&&"subdivisions"===t[0]}function Hr(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 qr=new B,Wr=new B,Yr=new B,Xr=new B;function $r(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 Zr=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable("number"==typeof e?100*e:e,i)??100)/100))??1,Kr=(e,t,i)=>"number"==typeof e?e:t.getVariable(e,i);function Jr(e){let t="string"==typeof e?e:e.type;return"texture"===t||"video"===t||"displace_map"===t||"matcap"===t}function Qr(e){return"string"==typeof e||"number"==typeof e&&0!==e}var es={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"]},ts={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]},is=class extends(n(J)){},rs=class extends is{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}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 rs(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix,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){}},ss=class extends _i{},ns=class{constructor(){this.objects=new Map,this.unreachable=new Set}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.createObject(e,t,i),this.objects.set(e,r)):r.isShared=!0,r}forceDelete(e){let t=this.objects.get(e);t&&(this.disposeObject(t),this.objects.delete(e))}adopt(e,t){this.objects.set(e,t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&!0!==i.isShared)return this.objects.delete(e),this.objects.set(t,i),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=>{this.disposeObject(this.objects.get(e)),this.objects.delete(e)}),this.unreachable.clear()}dispose(){this.objects.forEach(e=>{this.disposeObject(e)}),this.objects.clear()}},as=class extends ns{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Cr(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}},os={markNeedsUpdateRendererDirty:()=>{}};function ls(e){return"variable_"+e}var hs=new $,ds=new B,us=new U,ps=new B,cs=new K,gs=class extends Ui{constructor(e){super(),this.shared=e}create(e){return new Ti(e,this.shared)}},ms=new Set,fs=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new as(!0),this.geometryCache2=new as(!1),this.imageHolderCache=new gs(this),this.thisContext={scene:os,shared:this},this.deletedImage=new Fi(p.emptyImage,this),this.deletedVideo=new Fi(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=pi(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(void 0===t.layers&&(t={...t,layers:S.defaultTwoLayerData("phong").layers}),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=pi(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):(void 0===e.layers&&(e={...e,layers:S.defaultTwoLayerData("phong").layers}),ui(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 Fi(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 Fi(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 Fi(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 ss(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 _i(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 _i(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=Oe;null!==i?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):c("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(ls(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(ls(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*E.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}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>fs.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}`;ms.has(i)||(ms.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 rs(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.hiddenMatrix.copy(e.hiddenMatrix),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 _i(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 ss?e.setValue(t,new _i(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||$r(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=es[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]}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("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?.(hs))return hs.decompose(ds,us,ps),"position"===e[1]?ds[e[2]]:(cs.setFromQuaternion(us,t.rotation.order),cs[e[2]]*E.RAD2DEG);for(let i=1;i<e.length;i++)t=t[e[i]];return"rotation"===e[1]&&(t*=E.RAD2DEG),t}for(let e in this.variables){if(void 0===t)break;let i=this.variables[e],r=i.locations?.findIndex(e=>P.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?(c("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=e(r,i,this),!1)}{let t=e();return null===t?(c("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?(c("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}},ys=fs;function vs(e){return!0===e?.isClassicNodeMaterial}function bs(e){return vs(e)||!0===e?.isTSLNodeMaterial}ys.MAX_TRANSIENT_VERTICES=6e4,new ys(y.emptyData());var xs=class extends d{setMaterialOverride(e,t){this.materialOverride=ci(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&&xs.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"===si&&void 0!==Jt?Jt:Qt;return void 0===e?null:ci(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){bs(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=>{xs.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}},ws=new B,Ss=new H,Ms=new H,Os=new B,As=new $,Ps=class extends xs{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 $).fromArray(t.bindMatrix),this.bindMatrixInverse=new $)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return!0!==e.isTextGeometry}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof pe&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(void 0===this.localGeometry)return this.geometryCreateDeleyed instanceof pe?this.geometryCreateDeleyed:void 0}get geometry(){if(void 0!==this.localGeometry)return this.localGeometry;if(this.geometryCreateDeleyed instanceof ys){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 A.is2DParametricMesh(e.type)&&0===e.depth}get is2DType(){return A.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){Nt.delete(e)}(this.uuid)}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=Cr(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&&Ur(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 i=Cr({...this.data.geometry,...e},t,this.data.flatShading,this);void 0!==this.localGeometry&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&Ir(this.localGeometry,i)?i.dispose():(this.localGeometry?.dispose(),this.localGeometry=i)}}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 Nr&&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&&Vr(e.props)&&this.geometryCreateDeleyed instanceof Nr&&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 pe&&!(this.geometryCreateDeleyed instanceof Nr)&&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=Cr(n,e,this.data.flatShading,this);Ir(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 pe&&!(this.geometryCreateDeleyed instanceof Nr)&&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=Cr(r,i,this.data.flatShading,this);return Ir(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.geometry.userData.parameters;this.is2DType||this.isTextType?e.set(0,0,.5*i.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?e.fromArray(i.centerOffset):e.setScalar(0),t.set(i.width,i.height,i.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 H,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;Ss.fromBufferAttribute(r.attributes.skinIndex,e),Ms.fromBufferAttribute(r.attributes.skinWeight,e),ws.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=Ms.getComponent(e);if(0!==r){let s=Ss.getComponent(e);As.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(Os.copy(ws).applyMatrix4(As),r)}}return t.applyMatrix4(this.bindMatrixInverse)}};export{ve as a,xe as b,wi as c,Mi as d,Oi as e,Ai as f,Pi as g,vs as h,_i as i,ss as j,Ei as k,zi as l,Ri as m,Fi as n,Ae as o,Pe as p,ar as q,we as r,Me as s,je as t,Dt as u,Ct as v,Et as w,Lt as x,zt as y,Tt as z,Wt as A,qi as B,er as C,tr as D,ir as E,ri as F,rr as G,nr as H,Nr as I,Vr as J,Hr as K,Pr as L,Cr as M,ai as N,oi as O,li as P,hi as Q,ui as R,gi as S,mi as T,fi as U,yi as V,vi as W,bi as X,$r as Y,Zr as Z,Kr as _,Jr as $,Qr as aa,es as ba,ts as ca,rs as da,ls as ea,ys as fa,bs as ga,xs as ha,Ps as ia};
|
|
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-WB3J5FJI.js";import{c as u}from"./runtime-chunk-RTLL6WIB.js";import{b as p}from"./runtime-chunk-EFBUAWKV.js";import{c,i as g}from"./runtime-chunk-TZCHGFVF.js";import{A as m,Ga as f,Ha as y,I as v,U as b,a as x,c as w,ea as S,ha as M,k as O,ma as A,n as P}from"./runtime-chunk-K3UQCG3P.js";import{$c as _,Aa as D,Ba as C,Cc as E,Dc as I,Ec as U,Ed as L,Fc as B,Fd as z,Gc as G,Gd as R,Hd as T,He as F,Ic as k,Id as j,Ja as N,Jb as V,Jc as H,Jd as q,Ld as W,Md as Y,Nd as X,Oc as $,Od as Z,Pc as K,Rc as J,Rd as Q,Tc as ee,Td as te,Ud as ie,Vd as re,Wc as se,Wd as ne,Xc as ae,Yc as oe,Yd as le,Zc as he,bd as de,cd as ue,dd as pe,nd as ce,qa as ge,rd as me,se as fe,yd as ye}from"./runtime-chunk-BVVSZMXD.js";function ve(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 pe,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=be(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=be(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 be(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 he(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 xe(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 we,Se,Me,Oe=null;function Ae(e){Oe=e}function Pe(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 _e(e,t){if(!e)throw t||"Assertion Failed!"}(Se=we||(we={}))[Se.ODD=0]="ODD",Se[Se.NONZERO=1]="NONZERO",Se[Se.POSITIVE=2]="POSITIVE",Se[Se.NEGATIVE=3]="NEGATIVE",Se[Se.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"}(Me||(Me={}));var De=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){_e(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){_e(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){_e(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){_e(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}(),Ce=function(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1},Ee=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}(),Ie=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},Ue=function(){function e(){var e=new Ie,t=new Ce,i=new Ee(0),r=new Ee(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 Ee(0),i=new Ee(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;_e(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;_e(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 Ie,t=new Ie,i=new Ce,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 Ie;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!i){var n=new Ce;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 Ce;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 Ie;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 Ce;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&&De.vertCCW(i.Lprev.Org,i.Org,s.Lnext.Lnext.Org)&&De.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){_e(e.prev===t),s=e.anEdge;do{_e(s.Sym!==s),_e(s.Sym.Sym===s),_e(s.Lnext.Onext.Sym===s),_e(s.Onext.Sym.Lnext===s),_e(s.Lface===e),s=s.Lnext}while(s!==e.anEdge)}for(_e(e.prev===t&&null===e.anEdge),r=o,r=o;(i=r.next)!==o;r=i){_e(i.prev===r),s=i.anEdge;do{_e(s.Sym!==s),_e(s.Sym.Sym===s),_e(s.Lnext.Onext.Sym===s),_e(s.Onext.Sym.Lnext===s),_e(s.Org===i),s=s.Onext}while(s!==i.anEdge)}for(_e(i.prev===r&&null===i.anEdge),n=l,n=l;(s=n.next)!==l;n=s)_e(s.Sym.next===n.Sym),_e(s.Sym!==s),_e(s.Sym.Sym===s),_e(null!==s.Org),_e(null!==s.Dst),_e(s.Lnext.Onext.Sym===s),_e(s.Onext.Sym.Lnext===s);_e(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}(),Le=function(){this.handle=null},Be=function(){this.key=null,this.node=0},ze=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 Le,this.handles[i]=new Be;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,_e(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 Le;for(s=this.handles.length,this.handles.length=this.max+1,r=s;r<this.handles.length;r++)this.handles[r]=new Be}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;_e(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}(),Ge=function(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1},Re=function(){this.key=null,this.next=null,this.prev=null},Te=function(){function e(e,t){this.frame=e,this.leq=t,this.head=new Re,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 Re;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}(),Fe=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?De.vertLeq(s.Org,n.Org)?De.edgeSign(n.Dst,s.Org,n.Org)<=0:De.edgeSign(s.Dst,n.Org,s.Org)>=0:De.edgeSign(n.Dst,r,n.Org)<=0:n.Dst===r?De.edgeSign(s.Dst,r,s.Org)>=0:De.edgeEval(s.Dst,r,s.Org)>=De.edgeEval(n.Dst,r,n.Org)},e.deleteRegion=function(e,t){t.fixUpperEdge&&_e(0===t.eUp.winding),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},e.fixUpperEdge=function(e,t,i){_e(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 Ge;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 we.ODD:return!!(1&t);case we.NONZERO:return 0!==t;case we.POSITIVE:return t>0;case we.NEGATIVE:return t<0;case we.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{_e(De.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,_e(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=De.vertL1dist(t,e),s=De.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(De.vertLeq(s.Org,n.Org)){if(De.edgeSign(n.Dst,s.Org,n.Org)>0)return!1;De.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(De.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(_e(!De.vertEq(n.Dst,a.Dst)),De.vertLeq(n.Dst,a.Dst)){if(De.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(De.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 Ie;if(_e(!De.vertEq(u,d)),_e(De.edgeSign(d,t.event,l)<=0),_e(De.edgeSign(u,t.event,h)>=0),_e(l!==t.event&&h!==t.event),_e(!i.fixUpperEdge&&!n.fixUpperEdge),l===h||Math.min(l.t,d.t)>Math.max(h.t,u.t))return!1;if(De.vertLeq(l,h)){if(De.edgeSign(u,l,h)>0)return!1}else if(De.edgeSign(d,h,l)<0)return!1;return e.debugEvent(t),De.intersect(d,l,u,h,p),_e(Math.min(l.t,d.t)<=p.t),_e(p.t<=Math.max(h.t,u.t)),_e(Math.min(u.s,d.s)<=p.s),_e(p.s<=Math.max(h.s,l.s)),De.vertLeq(p,t.event)&&(p.s=t.event.s,p.t=t.event.t),r=De.vertLeq(l,h)?l:h,De.vertLeq(r,p)&&(p.s=r.s,p.t=r.t),De.vertEq(p,l)||De.vertEq(p,h)?(e.checkForRightSplice(t,i),!1):!De.vertEq(d,t.event)&&De.edgeSign(d,t.event,p)>=0||!De.vertEq(u,t.event)&&De.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):(De.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),De.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),De.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),De.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=De.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,De.vertEq(s.Org,r)?(_e(!1),void e.spliceMergeVertices(t,s,r.anEdge)):De.vertEq(s.Dst,r)?(_e(!1),i=e.topRightRegion(i),n=o=(a=(l=e.regionBelow(i)).eUp.Sym).Onext,l.fixUpperEdge&&(_e(n!==a),e.deleteRegion(t,l),t.mesh.delete(a),a=n.Oprev),t.mesh.splice(r.anEdge,a),De.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 Ge;if(h.eUp=i.anEdge.Sym,r=t.dict.search(h).key,s=e.regionBelow(r)){if(a=r.eUp,o=s.eUp,0===De.edgeSign(a.Dst,i,a.Org))return void e.connectLeftDegenerate(t,r,i);n=De.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);_e(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 Ge,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 Te(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||(_e(i.fixUpperEdge),_e(1===++r)),_e(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,De.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 ze(s,De.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,_e((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())&&De.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}(),ke=function(){function e(){this.mesh=new Ue,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=we.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(;De.vertLeq(i.Dst,i.Org);i=i.Lprev);for(;De.vertLeq(i.Org,i.Dst);i=i.Lnext);for(r=i.Lprev;i.Lnext!==r;)if(De.vertLeq(i.Dst,r.Org)){for(;r.Lnext!==i&&(De.edgeGoesLeft(r.Lnext)||De.edgeSign(r.Org,r.Dst,r.Lnext.Dst)<=0);)r=e.connect(r.Lnext,r).Sym;r=r.Lprev}else{for(;r.Lnext!==i&&(De.edgeGoesRight(i.Lprev)||De.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===Me.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===Me.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 Ue),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=we.ODD),void 0===t&&(t=Me.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_(),Fe.computeInterior(this,n);var a=this.mesh;return t===Me.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),n&&a.check(),t===Me.BOUNDARY_CONTOURS?this.outputContours_(a,r):this.outputPolymesh_(a,t,i,r),!0},e}();function je(e){var t=e.windingRule,i=void 0===t?we.ODD:t,r=e.elementType,s=void 0===r?Me.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 ke;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}}}we.ODD,we.NONZERO,we.POSITIVE,we.NEGATIVE,we.ABS_GEQ_TWO,Me.POLYGONS,Me.CONNECTED_POLYGONS,Me.BOUNDARY_CONTOURS;var Ne=1e-12,Ve=class{constructor(e){this.position=new I,this.startPosition=new I,this.uuid=E.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 Ve(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},He=class extends Ve{constructor(e){super(e.position),this.parent=e}copy(e){return super.copy(e),this}clone(){return new He(this.parent).copy(this)}},qe=class extends Ve{constructor(e,t){super(t),this.controls=[],this.roundness=0,this.areControlsDirectionsMirrored=!0,this.uuid=e,this.controls.push(new He(this),new He(this))}static create(e,t){let i=new qe(e,new I(...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 qe(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 I,t=new I){let[i,r]=this.computeTangents();return i&&r&&(We(i,e),We(r,t)),[e,t]}computeTangent(e=new I){let[t,i]=this.computeTangents();return t&&i&&e.copy(t).add(i).normalize(),e}computeNormal(e=new I){let[t,i]=this.computeNormals();return e.copy(t).add(i).normalize(),e}};function We(e,t=new I){let i=e.length();return t.set(-e.y/i,e.x/i)}var Ye=e=>e,Xe=new I,$e=new I,Ze=new I,Ke=new I,Je=new I,Qe=new I,et=new B,tt=new B;function it(e){let t=new I;t.addVectors(e.v0,Xe.subVectors(e.v1,e.v0).multiplyScalar(2/3));let i=new I;return i.addVectors(e.v2,$e.subVectors(e.v1,e.v2).multiplyScalar(2/3)),new q(e.v0,t,i,e.v2)}function rt(e,t,i=Number.EPSILON){return Math.abs(e-t)<i}function st(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function nt(e,t,i=Number.EPSILON){return e.distanceTo(t)<i}function at(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 ot(e,t,i){return ct(e,t)&&ct(t,i)&<(e.position,t.position,i.position)}function lt(e,t,i){return 0===Xe.copy(t).sub(e).cross($e.copy(i).sub(e))}function ht(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 dt(e,t,i){return e.distanceTo(i)<t.distanceTo(i)?t:e}function ut(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 at(t,e,i)>Math.PI&&(u*=-1),a=rt(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 pt(e,t){return e.position.equals(e.controls[1].position)&&t.position.equals(t.controls[0].position)}function ct(e,t){return lt(e.position,e.controls[1].position,t.position)&<(e.position,t.controls[0].position,t.position)}function gt(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*mt(n.roundedCurveCorner,t);s>0&&(r[s-1]+=e),a+=e}void 0!==n.curveAfter&&(a+=mt(n.curveAfter,t)),r.push(a)}return e.length>0&&i&&void 0!==e[0].roundedCurveCorner&&(r[e.length-1]+=.5*mt(e[0].roundedCurveCorner,t)),r}function mt(e,t=12){return e&&e instanceof j?2*t:e&&(e instanceof W||e instanceof Y)?1:e&&e instanceof Z?t*e.points.length:t}var ft=new I,yt=new I,vt=new I,bt=new I,xt=new I,wt=new I,St=class extends Q{constructor(e=100,t=100){super(),this.points=[],this.shapeHoles=[],this.plane=new me(new B(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=E.generateUUID(),this.needsUpdate=!1,this.roundedCurves=[],this._width=e,this._height=t}static createFromState(e,t,i){let r=new St;return r.isClosed=e.isClosed,r.points=e.points.map(e=>qe.create(e.id,e.data)),"number"==typeof e.roundness&&(r.roundness=e.roundness),r.shapeHoles=e.shapeHoles.map(e=>St.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=ft.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=E.generateUUID()){let r;r=e instanceof I?e:new I(e,t);let s=new qe(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=tt.set(0,0,0),a=0,o=[];for(let r=0;r<t.length;r++){let l=Ye(t[r]),h=Xe,d=mt(l,i);o.push(d);for(let t=0;t<=d;t++)if(l instanceof q||l instanceof X||l instanceof W){if(l.getPoint(t/d,h),n.set(h.x,h.y,0),void 0!==s&&nt(s,n))continue;void 0===s&&(s=et),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=gt(this.points,e,!1),this.roundedCurveDivisions=gt(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,i=12){return 2*function(e,t,i,r=12,s=!0){let n=tt.set(0,0,0),a=0,o=[];for(let s=0;s<t.length;s++){if(!1===i[s])continue;let l,h=Ye(t[s]),d=Xe,u=mt(h,r);o.push(u);for(let t=0;t<=u;t++)if(h instanceof q||h instanceof X||h instanceof W){if(h.getPoint(t/u,d),n.set(d.x,d.y,0),l?.equals(n))continue;void 0===l?l=et:(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=Ye(t[r]),o=mt(a,i),l=Xe;for(let t=0;t<=o;t++)if(a instanceof q||a instanceof X||a instanceof W){if(a.getPoint(t/o,l),void 0!==s&&st(s,l,Ne))continue;void 0===s&&(s=$e),s.copy(l),e.push(l.x,l.y),n++}}return rt(e[0],e[e.length-2],Ne)&&rt(e[1],e[e.length-1],Ne)&&(e.pop(),e.pop()),r&&n>1&&!(rt(e[n-1],e[1],Ne)&&rt(e[n-2],e[0],Ne))&&(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*mt(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(pt(r,s)){let e=r.position.distanceTo(s.position);return r.position.distanceTo(ft.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){pt(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&&ot(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 W?r.v1.distanceTo(r.v2):r.getLength(),d=s instanceof W?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,ft),y=s.getPointAt(m,yt);if(this._subSplitCurve(r,o,g,f,void 0),this._subSplitCurve(s,l,m,void 0,y),this.useCubicForRoundedCorners){let e=at(f,i.position,y)/2,t=Math.tan(e)*f.distanceTo(i.position),[r,s]=ht(f,y,t,vt,bt),n=dt(r,s,i.position),[o,l]=ut(n,f,y,t,xt,wt);a=new q(f.clone(),o.clone(),l.clone(),y.clone())}else a=new X(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 W)){let n=e,a=t,o=n.getUtoTmapping(i,0),l=function(e,t,i,r,s=.5){let n=Xe.subVectors(t,e).multiplyScalar(s).add(e),a=$e.subVectors(i,t).multiplyScalar(s).add(t),o=Ze.subVectors(r,i).multiplyScalar(s).add(i),l=n,h=Ke.subVectors(a,n).multiplyScalar(s).add(n),d=Je.subVectors(o,a).multiplyScalar(s).add(a),u=o,p=Qe.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 St(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 qe(E.generateUUID(),new I(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 St;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 q&&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 X&&(e[t]=it(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 q?(r=this.createPoint(n.v0),r.controls[1].position.copy(n.v1)):n instanceof W&&(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 q?n.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(n.v2),a=!0):n instanceof W&&n.v2.equals(s[0].position)&&(a=!0),this.isClosed=a,s})(e.curves),e instanceof Q&&(this.shapeHoles=e.holes.map(e=>{let t=new St;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 Mt(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 Ot(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 At(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 Pt,_t,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},It=class extends pe{constructor(e,t,i=12,r=we.ODD,s){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=s;let n,a=[e.extractShapePointsToFlatArray([],i),...e.shapeHoles.map(e=>e.extractShapePointsToFlatArray([],i))];try{n=je({contours:a,windingRule:r,elementType:Me.POLYGONS,polySize:3,vertexSize:2,strict:!0})}catch{n=Et}let o=n?.vertexCount??0,l=n?.elementCount??0,h=1/0,d=1/0,u=-1/0,p=-1/0;for(let e of a)for(let t=0;t<e.length;t+=2)e[t]<h&&(h=e[t]),e[t]>u&&(u=e[t]),e[t+1]<d&&(d=e[t+1]),e[t+1]>p&&(p=e[t+1]);let c=this._uvPitch,g=c??(u-h||1),m=c??(p-d||1),f=void 0===c?h:0,y=void 0===c?d:0,v=a.map((e,t)=>Mt(e,t>0)),b=0;for(let e of v)b+=e.length;let x=2*o+4*b,w=3*l*2+6*b,S=new Float32Array(3*x),M=new Float32Array(3*x),O=new Float32Array(2*x),A=new Uint32Array(w),P=new Uint8Array(x),_=0,D=0,C=0,E=!1,I=(e,i,r,s,n,a,o=(e-f)/g,l=(i-y)/m)=>{let h=3*D;S[h]=e,S[h+1]=i,S[h+2]=r,M[h]=s,M[h+1]=n,M[h+2]=a,P[D]=r===t?E?2:1:0,O[2*D]=o,O[2*D+1]=l,D++};if(void 0!==n)for(let[e,i]of[[t,1],[0,-1]]){let t=D;for(let t=0;t<o;t++)I(n.vertices[2*t],n.vertices[2*t+1],e,0,0,i);for(let e=0;e<l;e++){let[r,s,a]=[n.elements[3*e],n.elements[3*e+1],n.elements[3*e+2]];A[C++]=t+r,A[C++]=t+(i>0?s:a),A[C++]=t+(i>0?a:s)}}E=!0;for(let e=0;e<a.length;e++){let i=a[e],r=v[e],s=i.length/2,{u:n,vScale:o}=Ot(i,g,m);_=o;let l=0===o?0:t/o;for(let e=0;e<r.length;e++){let a=(e+1)%s,[o,h]=r[e],[d,u]=[n[e],n[e+1]],p=D;I(i[2*e],i[2*e+1],t,o[0],o[1],0,d,l),I(i[2*e],i[2*e+1],0,o[0],o[1],0,d,0),I(i[2*a],i[2*a+1],t,h[0],h[1],0,u,l),I(i[2*a],i[2*a+1],0,h[0],h[1],0,u,0),A[C++]=p,A[C++]=p+1,A[C++]=p+2,A[C++]=p+3,A[C++]=p+2,A[C++]=p+1}}At(S,M,A),this.setAttribute("position",new he(S,3)),this.setAttribute("normal",new he(M,3)),this.setAttribute("uv",new he(O,2)),this.setIndex(new he(A,1)),this._nearSide=P,this._vScale=_}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 It(this._shape,this._depth,this._curveSegments,this._windingRule);return e.userData=u(this.userData),e}},Ut=class extends pe{constructor(e,t=12,i={}){super(),this.type="ShapeGeometry",this.windingRule=we.ODD,this.elementType=Me.POLYGONS,this.polySize=3,this.vertexSize=2,this.strict=!0,this._shape=e,this._curveSegments=t,this._triangulationOptions=Object.assign({windingRule:we.ODD,elementType:Me.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=je({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 he(new Float32Array(3*d),3),this._normalAttribute=new he(new Float32Array(3*d),3),this._uvAttribute=new he(new Float32Array(2*d),2),this._indexAttribute=new he(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 Ut(this._shape,this._curveSegments);return e.userData=u(this.userData),e}};function Lt(e){return _t||(_t=async function(){let t=e??"https://unpkg.com/@splinetool/runtime@2.0.65/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}),Pt=r}())}var Bt=new Set(["VectorGeometry","TextGeometry","InputGeometry","PolygonGeometry","RectangleGeometry","StarGeometry","TriangleGeometry","EllipseGeometry"]);function zt(e){let t=!1;return e.scene.objects.traverse((e,i)=>{let r=i.geometry;if(void 0!==r&&(Bt.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 Gt(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 Rt=new G;function Tt(e,t,i,r,s,n){let a=e.positions.length/3,o=s.elements,l=Rt.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]);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 Ft=new $,kt=new $,jt=(new $).makeScale(1,1,-1),Nt=new Map,Vt={assemblies:0,placements:0};function Ht(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=Nt.get(l);if(void 0!==d&&d.outlineVersion===o&&d.capKey===h&&(e.stillServes?.(d)??1))return Vt.placements++,d.cap;let u=function(e,t,i,r,s){let{points:n,ends:a}=Gt(e,t);return Pt.assemble_cap(n,a,i,r,0,Math.max(1,Math.floor(s)),.4,40)}(i,r,s,n,a);Vt.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 Nt.set(l,{outlineVersion:o,capKey:h,assembledAt:s,cap:e}),e}finally{u.free()}}var qt=class extends pe{constructor(e,t,i=0,r=12,s=3,n,a){if(super(),this.type="ShapeGeometry",this._nearSide=new Uint8Array(0),this._effectiveBevel=0,this._vScale=0,void 0===Pt)throw new Error("bevel-wasm is not loaded");this._shape=e,this._uvPitch=a,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&&Yt(this._effectiveBevel,e)&&Yt(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=Ht({owner:this._ownerId,shape:this._shape,curveSegments:this._curveSegments,assembledAt:this._depth,bevel:this._bevel,bevelSegments:this._bevelSegments,stillServes:e=>Yt(e.cap.rise,this._depth)&&Yt(e.cap.rise,e.assembledAt)}),t=function(e,t,i,r,s){let n=r.positions.length/3,a=i-r.rise,o=r.rise,{points:l,ends:h}=Gt(e,t),d=1/0,u=1/0,p=-1/0,c=-1/0;for(let e=0;e<l.length;e+=2)l[e]<d&&(d=l[e]),l[e]>p&&(p=l[e]),l[e+1]<u&&(u=l[e+1]),l[e+1]>c&&(c=l[e+1]);let g=s??p-d,m=s??c-u,f=[],y=0;for(let e of h)f.push({at:y,count:e-y}),y=e;let v=0;for(let e of f)v+=e.count;let b=2*n+4*v,x=new Float32Array(3*b),w=new Float32Array(3*b),S=new Float32Array(2*b),M=new Uint32Array(2*r.indices.length+6*v),O=new Uint8Array(b),A=0,P=void 0===s?void 0:(e,t)=>[e/s,t/s],_={positions:x,normals:w,uvs:S,indices:M};Tt(r,_,0,0,Ft.makeTranslation(0,0,a),P),Tt(r,_,n,r.indices.length,kt.makeTranslation(0,0,o).multiply(jt),P),O.fill(1,0,n);let D=2*n,C=2*r.indices.length;for(let e=0;e<f.length;e++){let{at:t,count:i}=f[e],r=l.subarray(2*t,2*(t+i)),s=Mt(r,e>0),n=Ot(r,g,m),h=n.u;A=n.vScale;for(let e=0;e<i;e++){let t=(e+1)%i,[n,l]=s[e],d=D;for(let[i,s,d,u,p,c]of[[r[2*e],r[2*e+1],n,a,h[e],2],[r[2*t],r[2*t+1],l,a,h[e+1],2],[r[2*t],r[2*t+1],l,o,h[e+1],0],[r[2*e],r[2*e+1],n,o,h[e],0]]){let e=3*D;x[e]=i,x[e+1]=s,x[e+2]=u,w[e]=d[0],w[e+1]=d[1],w[e+2]=0,S[2*D]=p,S[2*D+1]=0===A?0:(u-o)/A,O[D]=c,D++}M[C++]=d,M[C++]=d+1,M[C++]=d+2,M[C++]=d,M[C++]=d+2,M[C++]=d+3}}return At(x,w,M),{positions:x,normals:w,uvs:S,indices:M,nearSide:O,vScale:A}}(this._shape,this._curveSegments,this._depth,e,this._uvPitch);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 he(t.positions,3)),this.setAttribute("normal",new he(t.normals,3)),this.setAttribute("uv",new he(t.uvs,2)),this.setIndex(new he(t.indices,1))}clone(){let e=new qt(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegments,this._ownerId);return e.userData=u(this.userData),e}};function Wt(e,t,i,r,s){if(void 0!==Pt&&t>0)return Ht({owner:s,shape:e,curveSegments:r,assembledAt:2*t,bevel:t,bevelSegments:i})}function Yt(e,t){return.5*t>1.001*e}var Xt=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:we.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 St?(i=o,(i.width!==s||i.height!==n)&&i.applySize(s,n)):i=new St(s,n).fromJSON(o),void 0!==e.parameters?.roundness&&e.parameters?.roundness>0&&i.update());let h=i??new St(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}=e.parameters;return e.shape.roundness=a,i<=0?t=new Ut(e.shape,n,{windingRule:o}):r<=0?t=new It(e.shape,i,n,o,l):void 0!==Pt?t=new qt(e.shape,i,r,n,s,e.ownerId,l):(console.error("[extrude] engine not loaded — extruding without a bevel"),t=new It(e.shape,i,n,o,l)),Object.assign(t,{userData:{...e,type:"VectorGeometry"}})}};function $t(){let e=new pe;return e.setAttribute("position",new he(new Float32Array([]),3)),e.setIndex(new he(new Uint16Array([]),1)),e}var Zt,Kt,Jt,Qt,ei,ti,ii=$t().attributes,ri=class extends pe{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,ii),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}=e,u=f.getDisplayedValue(l),p=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?u.toUpperCase():3===h?u.toLowerCase():u,t),{shapes:c,charWidths:g,charCoords:m}=i.generateShapes(p,e,t),y=.5*("number"==typeof r?r:Number(t.getVariable(r))),v=.5*("number"==typeof s?s:Number(t.getVariable(s))),b=c.map(e=>(new St).fromShape(e,!0));this.vectorShapes=b;let x=b.map(e=>Xt.create({shape:e,parameters:{depth:n,extrudeBevelSegments:o,extrudeBevelSize:a,uvPitch:d,windingRule:n<=0?we.NONZERO:we.ODD,subdivisions:this.isLowResolution&&n>0?1:12}})),w=x.length?ve(x):$t();w.translate(-y,v,0),this.dispose(),this.wrappedText=p,this.charCoords=m,this.charWidths=g,this.deleteAttribute("extrudeNormal"),Object.entries(w.attributes).forEach(([e,t])=>{this.setAttribute(e,t)}),this.setIndex(w.index),this.adoptNearSide(x,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&&Yt(this._effectiveBevel,e)&&Yt(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 pe,ri.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??""}},si="webgl",ni=!1;function ai(e){si=e}function oi(){return si}function li(e){Zt=e}function hi(e){Kt=e}function di(){if("webgpu"===si){if(void 0!==Zt)return Zt;ni||(ni=!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===Kt)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 Kt}function ui(e,t){return di().createRootMaterial(e,t)}function pi(e,t,i){return di().createSharedMaterial(e,t,i)}function ci(e){return void 0===e.getLayersOfType&&Object.assign(e,{layers:[],getLayersOfType:()=>[],hasAO:!1,assetsLoaded:()=>!0}),e}function gi(e){Jt=e}function mi(e){Qt=e}function fi(e){ei=e}function yi(){return ei}function vi(e){ti=e}function bi(e,t){return void 0!==ti&&ti(e,t)}var xi=[3,4,8,9];function wi(e){for(let t of xi)e.enable(t)}var Si,Mi=5,Oi=3,Ai=32,Pi=.98,_i=class extends ee{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}},Di=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}},Ci=class extends Di{create(e){return URL.createObjectURL(new Blob([e]))}dispose(e,t){URL.revokeObjectURL(t)}};function Ei(){Si&&Si.disposeAll()}var Ii=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}},Ui=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}},Li=class extends fe{constructor(e){super(e),this.type=C}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]=oe.toHalfFloat(Math.min(e[t+0]*n,65504)),i[r+1]=oe.toHalfFloat(Math.min(e[t+1]*n,65504)),i[r+2]=oe.toHalfFloat(Math.min(e[t+2]*n,65504)),i[r+3]=oe.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 D: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=D;break;case C: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=C;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:V,minFilter:ge,magFilter:ge,generateMipmaps:!1,flipY:!0}}setDataType(e){return this.type=e,this}};function Bi(e){return e.length>2&&35===e[0]&&63===e[1]}function zi(e){return"object"==typeof e&&null!==e&&!0===e.isSplineHdr}function Gi(e){let t=new ce(e.data,e.width,e.height,N,C);return t.flipY=!1,t.image.isSplineHdr=!0,t.needsUpdate=!0,t}var Ri=0,Ti=class extends Ii{constructor(e,t){super(e,t.imageHolderCache),this.data=e,this.shared=t,this.instanceId=++Ri,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?Bi(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&&Bi(i)?function(e){try{let t=(new Li).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=>oe.toHalfFloat(Math.pow(Math.max(oe.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:(Si||(Si=new Ci),Si.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 ye(this.img,void 0,e,e):this.isHdr?(r=Gi(this.img),r.wrapS=e,r.wrapT=e,r.magFilter=i,r.minFilter=t):r=new k(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()}},Fi=class extends Ti{},ki=2*Math.PI;function ji({x:e,y:t},i,r,s,n){return{x:e*i+s,y:t*r+n}}function Ni(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 Vi(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 Hi=2*Math.PI,qi=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=E.clamp(i.angle,0,360),{shape:e.shape&&e.shape instanceof St?e.shape:new St,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}=e.parameters,d=e.shape,u=function(e,t,i,r,s,n){if(r>=Hi)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(Xi(s-t,n,s-t,n-l,s-t,n+l)),e.addPoint(Xi(s,n+i,s-o,n+i,s+o,n+i)),e.addPoint(Xi(s+t,n,s+t,n+l,s+t,n-l)),e.addPoint(Xi(s,n-i,s+o,n-i,s-o,n-i)),r>0&&Zi(e,t,i,r)}(e,t,i,n),Math.round(s/4)):Wi(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=Vi(1,0,b,x),O=Vi(b,x,w,S);return!h&&O>0&&(O-=ki),h&&O<0&&(O+=ki),{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)/(ki/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(Ni(c,g)),c+=g;return l.map(e=>{let{x:t,y:i}=ji(e[0],s,n,m,f),{x:r,y:a}=ji(e[1],s,n,m,f),{x:o,y:l}=ji(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(Yi(t,i));for(let t=0,i=r.length;t<i;t++){let i=r[t],s=e.points[t],n=Yi(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?$i(e,n,a,o):e.addPoint(Yi(0,0)),l}(e,a.x,a.y,h,s,t,i,n):Wi(e,r,s,t,i,n)}(d,.5*i,.5*r,n*Math.PI/180,s,a);return d.isClosed=!0,d.update(),0===n?(t=new pe,t.setAttribute("position",new de([],3))):t=Xt.create({shape:d,parameters:{subdivisions:u,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}}),Object.assign(t,{userData:{...e,type:"EllipseGeometry"}})}};function Wi(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(Yi(n,o))}return t<Hi?n>0?$i(e,r,s,n):e.addPoint(Yi(0,0)):(e.removePoint(e.points[e.points.length-1]),n>0&&Zi(e,r,s,n)),1}function Yi(e,t){return new qe(E.generateUUID(),new I(e,t))}function Xi(e,t,i,r,s,n){let a=Yi(e,t);return a.controls[0].position.set(i,r),a.controls[1].position.set(s,n),a}function $i(e,t,i,r){Ki(e,t,i,r).forEach(t=>e.addPoint(t))}function Zi(e,t,i,r){let s=Ki(e,t,i,r),n=new St;s.forEach(e=>n.addPoint(e)),n.isClosed=!0,e.shapeHoles.push(n)}function Ki(e,t,i,r){let s=r*t/100,n=s*(Math.abs(i)/Math.abs(t)),a=new I(s/t,n/i),o=e.points.map(e=>{let t=e.clone();return t.uuid=E.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 Ji,Qi,er=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 St?e.shape:new St,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}=e.parameters,l=e.shape,h=.5*t,d=.5*i,u=2*Math.PI/r;for(let e=0;e<r;e++){let t=u*e,i=0+Math.sin(t)*h,r=0+Math.cos(t)*d;l.addPoint(l.createPoint(i,r))}l.isClosed=!0;for(let e=0,t=l.points.length;e<t;e++)l.points[e].roundness=s;l.roundness=s,l.update();let p=Xt.create({shape:l,parameters:{roundness:s,depth:n,extrudeBevelSize:a,extrudeBevelSegments:o}});return Object.assign(p,{userData:{...e,type:"PolygonGeometry"}})}},tr=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 St?e.shape:new St,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}=e.parameters,h={x:.5*i,y:.5*r},d={x:-h.x,y:-h.y},u={x:h.x,y:h.y};function p(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 c=[];c[0]=0===s[0]?0:p(s[0],s[0]+s[3],s[0]+s[1]),c[1]=0===s[1]?0:p(s[1],s[1]+s[2],s[1]+s[0]),c[2]=0===s[2]?0:p(s[2],s[2]+s[1],s[2]+s[3]),c[3]=0===s[3]?0:p(s[3],s[3]+s[0],s[3]+s[2]);let g=d.x,m=u.x,f=u.y,y=d.y;t.addPoint(t.createPoint(g,f)),t.addPoint(t.createPoint(m,f)),t.addPoint(t.createPoint(m,y)),t.addPoint(t.createPoint(g,y)),t.isClosed=!0;let v=!0;for(let e=0,i=t.points.length;e<i;e++)t.points[e].roundness=c[e],e>0&&c[e]!==c[e-1]&&(v=!1);v&&(t.roundness=c[0]),t.useCubicForRoundedCorners=1!==n,t.update();let b=Xt.create({shape:t,parameters:{depth:a,extrudeBevelSize:o,extrudeBevelSegments:l}});return Object.assign(b,{userData:{...e,type:"RectangleGeometry"}})}},ir=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 St?e.shape:new St,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}=e.parameters,d=e.shape,u=.5*t,p=.5*i,c=a*Math.PI/360/s,g=Math.PI/2*3*-1,m=u*r/100,f=p*r/100;if(3===s&&50===r){c=2*Math.PI/s;for(let e=0;e<s;e++){let t=c*e,i=0+Math.sin(t)*u,r=0+Math.cos(t)*p;d.addPoint(d.createPoint(i,r))}}else for(let e=0;e<s;e++){let e=0+Math.cos(g)*u,t=0+Math.sin(g)*p;d.addPoint(d.createPoint(e,t)),g+=c,e=0+Math.cos(g)*m,t=0+Math.sin(g)*f,d.addPoint(d.createPoint(e,t)),g+=c}d.isClosed=!0;for(let e=0,t=d.points.length;e<t;e++)d.points[e].roundness=n;d.roundness=n,d.update();let y=Xt.create({shape:d,parameters:{roundness:n,depth:o,extrudeBevelSize:l,extrudeBevelSegments:h}});return Object.assign(y,{userData:{...e,type:"StarGeometry"}})}},rr=new Promise(e=>{Ji=e}),sr=!1;function nr(e){if(!sr)return Qi||(Qi=async function(){let t=e??"https://cdn.spline.design/@splinetool/runtime@2.0.65/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});Ji(a),sr=!0}())}var ar=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=E.clamp(s.thetaLength,0,360),s.hollow=E.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 pe,t.setAttribute("position",new de([],3))):t=p||g?new lr(d,u,s,n,a,o,l,h*Math.PI/180,p,p,c,g):new z(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 or(e){return new I(e.y,-e.x)}var lr=class extends pe{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 I(e,c),m=new I(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),D=Math.tan(A/2),C=_+D,E=u?C:D,U=u?C:_;if(l=Math.min(l,(e-S)/E,x.length()/C),h=Math.min(h,(t-M)/U,x.length()/C),l>0){let e=l/_;f=g.clone().sub(new I(e,l)),u&&(v=f.clone(),v.x-=w-C*l),g.sub(x.clone().setLength(e))}if(h>0){let e=h/D;y=m.clone().sub(new I(e,-h)),m.add(x.clone().setLength(e)),u&&(b=y.clone(),b.x-=w-C*h,O.sub(x.clone().setLength(e)))}x=g.clone().sub(m);let L=x.length()<.5,B=[],z=[],G=[],R=[],T=[],F=[],k=(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;B.push(h*t+r.x),z.push(p),G.push(h),R.push(u),T.push(.5+p/i),F.push(!1)}},j=(e,t,i)=>{let r=[e,t];i<0&&r.reverse();for(let e of r)B.push(e),z.push(c*i),G.push(0),R.push(i),T.push(.5),F.push(!0)};if(b&&y?(k(A,h,b,-1,!0),k(P,h,y,-1,!1)):y?(j(y.x,0,-1),k(P,h,y,-1,!1)):n||j(t,M,-1),!L){let e=or(x).normalize();for(let t=0;t<=s;t++){let r=t/s,n=x.y*r+m.y;B.push(x.x*r+m.x),z.push(n),G.push(e.x),R.push(e.y),T.push(.5+n/i),F.push(!1)}}if(v&&f?(k(A,l,f,1,!1),k(P,l,v,1,!0)):f?(k(A,l,f,1,!1),j(f.x,0,1)):n||j(e,S,1),u&&!L){let e=or(x).multiplyScalar(-1).normalize();for(let t=0;t<=s;t++){let r=t/s,n=x.y*-r+O.y;B.push(x.x*-r+O.x),z.push(n),G.push(e.x),R.push(e.y),T.push(.5+n/i),F.push(!1)}}let N=B.length,V=N+(u&&!n?1:0),H=(e,t)=>e*N+(t===N?0:t),q=o<2*Math.PI,W=(r+1)*N+(q?2*(1+V):0),Y=new Float32Array(3*W),X=new Float32Array(3*W),$=new Float32Array(2*W),Z=W-1>65535?new Uint32Array(r*Math.max(0,V-1)*6+(q?2*(V+1)*3:0)):new Uint16Array(r*Math.max(0,V-1)*6+(q?2*(V+1)*3:0)),K=0,J=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*J,r=2*J,a=B[e],o=G[e];Y[i]=a*s,Y[i+1]=z[e],Y[i+2]=a*n,X[i]=o*s,X[i+1]=R[e],X[i+2]=o*n,F[e]?($[r]=.5,$[r+1]=.5):($[r]=t,$[r+1]=T[e]),J++}}for(let e=0;e<r;e++)for(let t=0;t<V-1;t++){if(n&&u&&t==s)continue;let i=H(e,t),r=H(e+1,t),a=H(e+1,t+1),o=H(e,t+1),l=Y[3*a+0],h=Y[3*a+2];Z[K++]=i,Z[K++]=r,Z[K++]=o,(0!=l||0!=h)&&(Z[K++]=r,Z[K++]=a,Z[K++]=o)}function Q(i,r,s){let n=Math.sin(s),a=Math.cos(s),o=-a,l=n,h=i<0?(e,t,i)=>{Z[K++]=e,Z[K++]=t,Z[K++]=i}:(e,t,i)=>{Z[K++]=e,Z[K++]=i,Z[K++]=t},d=(e+t+S+M)/4,u=3*J,p=2*J;Y[u]=d*n,Y[u+1]=0,Y[u+2]=d*a,X[u]=o,X[u+1]=0,X[u+2]=l,$[p]=.5,$[p+1]=.5;let c=J++;for(let e=0;e<V;e++){let t=3*(r+(e===N?0:e));u=3*J,p=2*J,Y[u]=Y[t],Y[u+1]=Y[t+1],Y[u+2]=Y[t+2],X[u]=o,X[u+1]=0,X[u+2]=l;let i=t/3*2|0;$[p]=$[i],$[p+1]=$[i+1],J++}for(let e=c+1;e<J-1;e++)h(c,e,e+1);h(c,J-1,c+1)}q&&(Q(-1,0,a),Q(1,r*N,a+o)),this.setIndex(new he(Z.slice(0,K),1)),this.setAttribute("position",new he(Y,3)),this.setAttribute("normal",new he(X,3)),this.setAttribute("uv",new he($,2))}},hr=Math.PI/2,dr=class extends pe{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*hr;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 B(e/2,t/2,i/2);r.subScalar(a);let s=0;for(let e=0;e<=o;e++){let t=hr*(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+=hr/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 B;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 B,C=new B;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 D(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),D(1,1,1),D(-1,1,1),D(1,-1,1),D(-1,-1,1),D(1,1,-1),D(-1,1,-1),D(1,-1,-1),D(-1,-1,-1)),this.setIndex(new he(f,1)),this.setAttribute("position",new he(c,3)),this.setAttribute("normal",new he(g,3)),this.setAttribute("uv",new he(m,2))}},ur=class extends pe{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 B,p=u.clone(),c=new se,g=s*r,m=r-g,f=n+1,y=new B,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 B).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),U=new Float64Array(2*C),L=b(2*d*f,()=>new B),z=b(n*Math.max(0,n-1)/2,()=>new B),G=u.clone(),R=u.clone(),T=u.clone(),F=u.clone(),k=u.clone(),j=[],N=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,N[e][i])}let i=0,r=[],s=[],b=new B;0==n&&[...N[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=N[e][o],h=N[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];F.subVectors(t,G),k.subVectors(r,G),T.crossVectors(F,k).normalize();for(let r=0;r<f;r++){let s=[c,x][e]*r/f;u.copy(F).applyAxisAngle(T,s).add(G),L[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=[L[t]];for(let a=1;a<f;a++){let o=L[t+a],l=L[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(z[s++].copy(u));n.push(l)}for(let e=0;e<f;e++)n.push(L[e+f+t]);n.push(L[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,U[r]=Math.atan2(t.z,-t.x)/2/Math.PI+.5,U[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]=U[i],l[r+1]=U[i+1],h+=3}}}let V=[];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)}V.push(s[0][0],n[f][0],s[f][0],n[0][0])}}for(;V.length;){let e,t,i,[r,s]=V.splice(0,2);e=s;let n=[r];for(;r!=e;)n.push(e),t=V.indexOf(e),i=t%2,e=V.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 B,t=new B,i=new B,r=new B,s=new I,n=new I,o=new I,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 he(new Float32Array(a.subarray(0,h)),3)),this.setAttribute("normal",new he(new Float32Array(o.subarray(0,h)),3)),void this.setAttribute("uv",new he(new Float32Array(l.subarray(0,h/3*2)),2))}static fromJSON(e){return new ur(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}},pr=class extends ur{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 pr(e.radius,e.corner,e.cornerSides)}},cr=class extends ur{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 cr(e.radius,e.corner,e.cornerSides)}},gr=1e4;function mr(e,t){return Math.abs(t-e)/2+Math.min(e,t)}var fr=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*gr),d=Math.round(r*gr),u=Math.round(s*gr),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=yr(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 pe;c.setAttribute("position",new he(d,3)),h>0&&(c.setAttribute("normal",new he(u,3)),c.setAttribute("color",new he(new Float32Array(3*h).fill(1),3))),null!==p&&c.setAttribute("uv",new he(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 yr(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=mr(i,n),d=mr(r,a),u=mr(n,o),p=mr(a,l),c=mr(i,o),g=mr(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 vr=new B;function br(e,t,i){i.x=e.x*t.x,i.y=e.y,i.z=e.x*t.y}var xr=new B,wr=new B;function Sr(e,t,i,r,s,n){let a=xr.copy(t).sub(e),o=wr.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 Mr(e,t,i){let r=e.clone().sub(t),s=i.clone().sub(t);return r.projectOnVector(s),r.add(t)}var Or=class extends pe{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 B(0,-c,0),x=new B(0,c,0),w=new I(e,-c),S=new I(m,-c),M=new I(0,x.y).sub(S),O=new I(0,x.y).sub(w),A=new I(M.y,-M.x).normalize(),P=new I(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 B(A.x,A.y,0),t=new B(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 B;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;br(r,new I(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 U=[];{let e=new B,t=new B,r=new B,s=new B,c=new B,m=new B;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 I(Math.sin(y),Math.cos(y)),_=new I(Math.sin(v),Math.cos(v)),E=new I(Math.sin(S),Math.cos(S));br(w,O,t),br(w,E,r),br(A,_,e),Sr(x,t,r,C,C,s),h.push(s.x,s.y,s.z),Sr(t,x,r,C,D,c),h.push(c.x,c.y,c.z),Sr(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 B;br(P,E,e);let t=m.clone().add(s).multiplyScalar(.5);t=Mr(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 B(0,-1,0),r=t.clone().cross(i);z(e,t,i,r)}U.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 B,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 B,f=new B,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 z(e,t,i,r){let s=Math.PI/2,o=O.angle()-s,c=[],g=new B,m=new B;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 de(h,3)),this.setAttribute("normal",new de(d,3)),this.setAttribute("uv",new de(u,2))}},Ar=class extends pe{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 B(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 U=Math.sin(I/2)*D*2,L=d.length-1,z=d[0][0].distanceTo(d[1][0]),G=z+U*n+d[L-1][0].distanceTo(d[L][0]);d[0].push(1);for(let e=0;e<=n;e++)d[e+1].push(1-(z+e*U)/G);d[L].push(0);let R,T,F,[k,j,N]=d[0];for(let e=1;e<d.length;e++)[R,T,F]=d[e],a.push(v,k.y,k.z,v,R.y,R.z,b,k.y,k.z,b,k.y,k.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,N,0,F,1,N,1,N,0,F,1,F),[k,j,N]=[R,T,F];this.setAttribute("position",new de(a,3)),this.setAttribute("normal",new de(o,3)),this.setAttribute("uv",new de(l,2))}},Pr={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=E.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 pe,t.setAttribute("position",new de([],3))):t=d>0||u>0||h<360?new lr(0,i/2,s,n,a,o,l,h*Math.PI/180,d,u,p,0,!0):new R(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 L(i,r,s,n,a,o):new dr(i,r,s,n,a,o,l,h),Object.assign(t,{userData:{...e,type:"CubeGeometry"}})}},CylinderGeometry:ar,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 pr(.5*t,n,a):new T(.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:qi,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 cr(.5*t,n,a):new te(.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 Q;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 ie(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 pe).copy(new L(100,100,100));void 0===t?(r.computeBoundingBox(),r.boundingBox.getSize(vr),i={width:vr.x,height:vr.y,depth:vr.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 pe).copy(new L(100,100,100)),a=n.userData.parameters;void 0===a?(n.boundingBox=function(e){let t=new ae,i=e.attributes.position;return i?(t.setFromBufferAttribute(i),t):(t.makeEmpty(),t)}(n),n.boundingBox.getSize(vr)):vr.set(a.width,a.height,a.depth),(t!==vr.x||i!==vr.y||r!==vr.z)&&n.scale(0===vr.x?1:t/vr.x,0===vr.y?1:i/vr.y,0===vr.z?1:r/vr.z);let o=n.originalGeometry;try{s>0?(void 0===o||a?.subdivisions!==s)&&(void 0===o&&(o=n),n=new fr(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 F(i).load(e,e=>{let i=this.normalizeInputs({geometry:e});e.boundingBox.getSize(vr);let r=100/vr.x;Object.assign(i.parameters,{width:100,height:vr.y*r,depth:vr.z*r}),t(this.build(i))})}},PolygonGeometry:er,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 Or(.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:tr,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=E.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 pe,t.setAttribute("position",new de([],3))):t=new ne(.5*i,n,a,o,l,h,d*E.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 re(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 Ar(t,i,r,s,n,a);return Object.assign(o,{userData:{...e,type:"BackdropGeometry"}})}},StarGeometry:ir,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 re(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=E.clamp(s/360,0,1);if(0===p){let e=new pe;return e.setAttribute("position",new de([],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 le(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 St?e.shape:new St,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}=e.parameters,l=e.shape,h=.5*t,d=.5*i;o?(l.addPoint(l.createPoint(-h,d)),l.addPoint(l.createPoint(h,-d)),l.addPoint(l.createPoint(-h,-d))):(l.addPoint(l.createPoint(0,d)),l.addPoint(l.createPoint(h,-d)),l.addPoint(l.createPoint(-h,-d))),l.isClosed=!0;for(let e=0,t=l.points.length;e<t;e++)l.points[e].roundness=r;l.roundness=r,l.update();let u=Xt.create({shape:l,parameters:{roundness:r,depth:s,extrudeBevelSize:n,extrudeBevelSegments:a}});return Object.assign(u,{userData:{...e,type:"TriangleGeometry"}})}},VectorGeometry:Xt},_r=e=>{let t=Pr[e.type]??g(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)},Dr=["font"];function Cr(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];v(n)&&!Dr.includes(s)&&(i[s]=t.getVariable(n,[r.uuid,"geometry",...e,s]),v(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=St.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 F).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 Nr(n,i);return t.data=e,t}if("TextGeometry"===n.type||"InputGeometry"===n.type){let e=g(n.type);if(e)return e.create(n,t);c("text",`a ${n.type}`);let i=St.createFromState(M.defaultData(),100,100);return _r({...n,shape:i,type:"VectorGeometry"})}if("UIGeometry"===n.type)return tr.create({parameters:{width:n.width,height:n.height,cornerRadius:n.cornerRadius,cornerType:n.cornerType}})}try{o=_r(l)}catch(e){console.error(e),console.error(`Error generating geometry with inputs: ${l}`);let t=St.createFromState(M.defaultData(),100,100);l.shape=t,l.type="VectorGeometry",o=_r(l)}return o}var Er=new $;function Ir(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 Ur(e,t,i,r){let s,n,a,o=e.position.array,l=e.normal.array,h=Er.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 Lr,Br=new ae,zr=new B;rr.then(e=>{Lr=e});var Gr=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),Rr=new Uint32Array([0,1,2,3]),Tr=new Uint8Array([4]);function Fr(e){let t=Number(e);return Number.isInteger(t)&&t>=0&&String(t)===e?t:-1}function kr(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=Fr(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 jr(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===Fr(e)),r=0;for(let e of t){let t=Fr(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 Nr=class extends pe{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=m.div(t.map(e=>"number"==typeof e?e:0),i);if(r.every(e=>1===e))return;this.subdividedGeometry&&Ur(this.subdividedGeometry.attributes,...r),this.originalGeometry&&Ur(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(zr.fromArray(r));let n=zr.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=Nr.allocate(e),i=Nr.buildRefined(r,e.subdivisions,t)}catch(t){console.error(t,e)}finally{r&&Nr.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}=Nr.build(this.data,void 0,!this.flatShading,void 0))}catch{e=new L(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&&(Nr.freeSubdivPointer(this.subdivPointer),this.subdivPointer=0)}dispose(){super.dispose(),this.freeSubdivPointer()}calcBoundingBox(){let e=this.originalGeometry;null===e.boundingSphere&&(e.boundingSphere=new ue,this.subdividedGeometry&&(this.subdividedGeometry.boundingSphere=e.boundingSphere));let t=e.attributes.position,i=e.boundingSphere.center;Br.setFromBufferAttribute(t),Br.getCenter(i),e.boundingSphere.radius=i.distanceTo(Br.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Br.getSize(zr);let r={width:zr.x,height:zr.y,depth:zr.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&&(Lr.free_bvh(t),Lr.free_subdivision_surface(t));try{s=Nr.allocate(e,r)}catch(t){console.error(t,e),s=Nr.allocate({positionWASM:Gr,indexWASM:Rr,verticesPerFaceWASM:Tr},r)}Lr.set_destination_refinement_level(s,0);let o=Nr.buildLevel(s,!0,a);return n=e.subdivisions>0?Nr.buildRefined(s,e.subdivisions,a):null,{subdivPointer:s,originalGeometry:o,subdividedGeometry:n}}static buildRefined(e,t,i){try{return Lr.set_destination_refinement_level(e,t),Nr.buildLevel(e,!1,i)??null}catch{try{return Lr.set_destination_refinement_level(e,t-1),Nr.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:Cr(e,i,!1,t);r=l(e)?s.getClosedTorusIndicesForBooleanOrSubdiv():s.getIndex();let n,{positions:a,triIndices:o,triOriginals:h}=Hr(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]){qr.set(e[3*t[u]],e[3*t[u]+1],e[3*t[u]+2]),Wr.set(e[3*t[u+1]],e[3*t[u+1]+1],e[3*t[u+1]+2]),Yr.set(e[3*t[u+4]],e[3*t[u+4]+1],e[3*t[u+4]+2]),Xr.set(e[3*t[u+5]],e[3*t[u+5]+1],e[3*t[u+5]+2]),Wr.sub(qr).normalize(),Yr.sub(qr).normalize(),Xr.sub(qr).normalize();let i=Wr.cross(Yr).dot(Xr),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=kr(e.positionWASM),l=kr(e.indexWASM),h=kr(e.verticesPerFaceWASM);if(o&&o.length>0){if(!l?.length||!h?.length)throw new Error(`SubdivGeometry.allocate: unusable cage topology — positionWASM ${jr(e.positionWASM)}, indexWASM ${jr(e.indexWASM)}, verticesPerFaceWASM ${jr(e.verticesPerFaceWASM)}`);i=o,r=l,s=h;let t=kr(e.uvWASM);Lr.alloc_subdivision_surface_uvs&&t&&t.length===2*r.length&&(a=t)}else i=Gr,r=Rr,s=Tr;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=Lr._malloc(m);if(!y)throw new Error(`SubdivGeometry.allocate: wasm _malloc(${m}) failed`);let v,b=new Float32Array(Lr.HEAPF32.buffer,y,c),x=new Uint32Array(Lr.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 $).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?Lr.alloc_subdivision_surface_uvs2(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,w,a.length,v.elements):Lr.alloc_subdivision_surface_uvs(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,w,a.length):v?Lr.alloc_subdivision_surface2(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p,v.elements):Lr.alloc_subdivision_surface(y,d,y+f,u,y+f+r.length*Uint32Array.BYTES_PER_ELEMENT,p);return Lr._free(y),S}static buildLevel(e,t,i,r,s,n=!1){let a=s?Lr.get_mesh_data2(e,t?Lr.Level.CONTROL:Lr.Level.REFINED,i,s.elements):Lr.get_mesh_data(e,t?Lr.Level.CONTROL:Lr.Level.REFINED,i),o=Lr.HEAPU32.subarray(a>>2,10+(a>>2)),l=o.subarray(4,8),h=0,d=Lr.HEAPU32[o[h]>>2],u=Lr.HEAPF32.subarray(d>>2,(d>>2)+l[h]);h++;let p=Lr.HEAPU32[o[h]>>2],c=Lr.HEAPF32.subarray(p>>2,(p>>2)+l[h]);h++;let g=Lr.HEAPU32[o[h]>>2],m=Lr.HEAPU32.subarray(g>>2,(g>>2)+l[h]);h++;let f,y=Lr.HEAPU32[o[h]>>2],v=Lr.HEAPU32.subarray(y>>2,(y>>2)+l[h]);if(h++,Lr.alloc_subdivision_surface_uvs){let e=o[9];if(e>0){let t=Lr.HEAPU32[o[8]>>2];f=Lr.HEAPF32.subarray(t>>2,(t>>2)+e)}}if(void 0===r){let e=new pe;if(e.setIndex(new _(v,1)),e.setAttribute("position",new de(u,3)),e.setAttribute("normal",new de(c,3)),f&&e.setAttribute("uv",new de(f,2)),t){e.setAttribute("faceMap",new _(m,1));let t=new Float32Array(c.length/3*4).fill(0);e.setAttribute("color",new he(t,4))}return Lr.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),Lr.free_mesh_data(a)}static freeSubdivPointer(e){Lr.free_bvh(e),Lr.free_subdivision_surface(e)}static buildControlCageWireframe(e,t,i){let r=Lr.get_wireframe_data_for_base_level(e),s=Lr.HEAPU32.subarray(r>>2,4+(r>>2)),n=s.subarray(2,4),a=0,o=Lr.HEAPU32[s[a]>>2],l=Lr.HEAPF32.subarray(o>>2,(o>>2)+n[a]);a++;let h=Lr.HEAPU32[s[a]>>2],d=Lr.HEAPU32.subarray(h>>2,(h>>2)+n[a]);if(void 0===t){let e=new pe;e.setAttribute("position",new de(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 he(t,3)),e.setIndex(new _(d,1)),Lr.free_wireframe_data_for_base_level(r),e}t.getAttribute("position").copyArray(l),t.attributes.position.needsUpdate=!0,Lr.free_wireframe_data_for_base_level(r)}static updateCollabMesh(e,t,i){let r=0===t;r||Lr.set_destination_refinement_level(e,t);let s=i?Lr.get_topological_data2(e,r?Lr.Level.CONTROL:Lr.Level.REFINED,i.elements):Lr.get_topological_data(e,r?Lr.Level.CONTROL:Lr.Level.REFINED),n=Lr.HEAPU32.subarray(s>>2,8+(s>>2)),a=n.subarray(3,6),o=0,l=Lr.HEAPU32[n[o]>>2],h=new Float32Array(Lr.HEAPF32.subarray(l>>2,(l>>2)+a[o]));o++;let d=Lr.HEAPU32[n[o]>>2],u=new Uint32Array(Lr.HEAPU32.subarray(d>>2,(d>>2)+a[o]));o++;let p,c=Lr.HEAPU32[n[o]>>2],g=new Uint8Array(Lr.HEAPU32.subarray(c>>2,(c>>2)+a[o]));if(Lr.alloc_subdivision_surface_uvs){let e=n[7];if(e>0){let t=Lr.HEAPU32[n[6]>>2];p=new Float32Array(Lr.HEAPF32.subarray(t>>2,(t>>2)+e))}}return Lr.free_topological_data(s),{positions:h,indices:u,verticesPerFace:g,uvs:p}}};function Vr(e){let t=Object.keys(e);return 1===t.length&&"subdivisions"===t[0]}function Hr(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 qr=new B,Wr=new B,Yr=new B,Xr=new B;function $r(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 Zr=(e,t,i)=>Math.max(0,Math.min(1,Number(t.getVariable("number"==typeof e?100*e:e,i)??100)/100))??1,Kr=(e,t,i)=>"number"==typeof e?e:t.getVariable(e,i);function Jr(e){let t="string"==typeof e?e:e.type;return"texture"===t||"video"===t||"displace_map"===t||"matcap"===t}function Qr(e){return"string"==typeof e||"number"==typeof e&&0!==e}var es={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"]},ts={depth:["colors"],gradient:["colors","steps"],toon:["colors","steps"]},is=class extends(n(J)){},rs=class extends is{constructor(e){super(),this.object=e,this.isClone=!0,this.matrixAutoUpdate=!1,this.hasNonUniformScale=e.hasNonUniformScale}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 rs(t),this.add(i),this.children.splice(e,0,this.children.pop()),i.matrixWorldNeedsUpdate=!0,i.matrixAutoUpdate=!1,i.matrix=t.matrix,i.hiddenMatrix=t.hiddenMatrix,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){}},ss=class extends _i{},ns=class{constructor(){this.objects=new Map,this.unreachable=new Set}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.createObject(e,t,i),this.objects.set(e,r)):r.isShared=!0,r}forceDelete(e){let t=this.objects.get(e);t&&(this.disposeObject(t),this.objects.delete(e))}adopt(e,t){this.objects.set(e,t)}mutateIfUnique(e,t){let i=this.objects.get(e);if(i&&!0!==i.isShared)return this.objects.delete(e),this.objects.set(t,i),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=>{this.disposeObject(this.objects.get(e)),this.objects.delete(e)}),this.unreachable.clear()}dispose(){this.objects.forEach(e=>{this.disposeObject(e)}),this.objects.clear()}},as=class extends ns{constructor(e){super(),this.flatShading=e}disposeObject(e){e.dispose()}createObject(e,t,i){let r=Cr(e,t,this.flatShading,i);return r.computeBoundingSphere(),r}},os={markNeedsUpdateRendererDirty:()=>{}};function ls(e){return"variable_"+e}var hs=new $,ds=new B,us=new U,ps=new B,cs=new K,gs=class extends Ui{constructor(e){super(),this.shared=e}create(e){return new Ti(e,this.shared)}},ms=new Set,fs=class{constructor(e,t={},i=!0,r=!1){if(this.data=e,this.needsJitter=i,this.enableLocalStorageForPersistentVariables=r,this.geometryCache=new as(!0),this.geometryCache2=new as(!1),this.imageHolderCache=new gs(this),this.thisContext={scene:os,shared:this},this.deletedImage=new Fi(p.emptyImage,this),this.deletedVideo=new Fi(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=pi(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(void 0===t.layers&&(t={...t,layers:S.defaultTwoLayerData("phong").layers}),this.materials[e]){let i=this.materials[e];i.reset(t,this.thisContext),i.dispose()}else{let i=pi(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):(void 0===e.layers&&(e={...e,layers:S.defaultTwoLayerData("phong").layers}),ui(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 Fi(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 Fi(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 Fi(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 ss(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 _i(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 _i(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=Oe;null!==i?(this.fonts[e]=new i(t),this.fonts[e].loadingPromise.then(()=>this.requestRender())):c("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(ls(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(ls(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*E.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}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>fs.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}`;ms.has(i)||(ms.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 rs(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.hiddenMatrix.copy(e.hiddenMatrix),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 _i(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 ss?e.setValue(t,new _i(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||$r(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=es[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]}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("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?.(hs))return hs.decompose(ds,us,ps),"position"===e[1]?ds[e[2]]:(cs.setFromQuaternion(us,t.rotation.order),cs[e[2]]*E.RAD2DEG);for(let i=1;i<e.length;i++)t=t[e[i]];return"rotation"===e[1]&&(t*=E.RAD2DEG),t}for(let e in this.variables){if(void 0===t)break;let i=this.variables[e],r=i.locations?.findIndex(e=>P.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?(c("ai-assistant","a voice-assistant integration"),!1):(this.openAIRealtime=e(r,i,this),!1)}{let t=e();return null===t?(c("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?(c("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}},ys=fs;function vs(e){return!0===e?.isClassicNodeMaterial}function bs(e){return vs(e)||!0===e?.isTSLNodeMaterial}ys.MAX_TRANSIENT_VERTICES=6e4,new ys(y.emptyData());var xs=class extends d{setMaterialOverride(e,t){this.materialOverride=ci(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&&xs.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"===si&&void 0!==Jt?Jt:Qt;return void 0===e?null:ci(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){bs(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=>{xs.disposeOneMaterial(e)})}dispose(){this.disposeMaterial(),this.shadowCatcherMaterial?.dispose(),super.dispose()}},ws=new B,Ss=new H,Ms=new H,Os=new B,As=new $,Ps=class extends xs{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 $).fromArray(t.bindMatrix),this.bindMatrixInverse=new $)}chooseGeoemtryCache(e){return e.geometryCache}supportsInPlaceGeometryUpdate(e){return!0!==e.isTextGeometry}markGeometryAsReachable(e){this.geometryCreateDeleyed instanceof pe&&this.chooseGeoemtryCache(e).markAsReachable(this.dataPatched.geometry,this.geometryCreateDeleyed)}get builtSharedGeometry(){if(void 0===this.localGeometry)return this.geometryCreateDeleyed instanceof pe?this.geometryCreateDeleyed:void 0}get geometry(){if(void 0!==this.localGeometry)return this.localGeometry;if(this.geometryCreateDeleyed instanceof ys){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 A.is2DParametricMesh(e.type)&&0===e.depth}get is2DType(){return A.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){Nt.delete(e)}(this.uuid)}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=Cr(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&&Ur(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 i=Cr({...this.data.geometry,...e},t,this.data.flatShading,this);void 0!==this.localGeometry&&this.supportsInPlaceGeometryUpdate(this.localGeometry)&&Ir(this.localGeometry,i)?i.dispose():(this.localGeometry?.dispose(),this.localGeometry=i)}}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 Nr&&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&&Vr(e.props)&&this.geometryCreateDeleyed instanceof Nr&&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 pe&&!(this.geometryCreateDeleyed instanceof Nr)&&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=Cr(n,e,this.data.flatShading,this);Ir(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 pe&&!(this.geometryCreateDeleyed instanceof Nr)&&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=Cr(r,i,this.data.flatShading,this);return Ir(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.geometry.userData.parameters;this.is2DType||this.isTextType?e.set(0,0,.5*i.depth):this.isNonParametric?(e.setScalar(0),this.geometry.boundingSphere&&e.copy(this.geometry.boundingSphere.center),t.set(i.width,i.height,i.depth??0).multiplyScalar(.5)):i.centerOffset?e.fromArray(i.centerOffset):e.setScalar(0),t.set(i.width,i.height,i.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 H,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;Ss.fromBufferAttribute(r.attributes.skinIndex,e),Ms.fromBufferAttribute(r.attributes.skinWeight,e),ws.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let e=0;e<4;e++){let r=Ms.getComponent(e);if(0!==r){let s=Ss.getComponent(e);As.multiplyMatrices(i.bones[s].matrixWorld,i.boneInverses[s]),t.addScaledVector(Os.copy(ws).applyMatrix4(As),r)}}return t.applyMatrix4(this.bindMatrixInverse)}};export{ve as a,xe as b,wi as c,Mi as d,Oi as e,Ai as f,Pi as g,vs as h,_i as i,ss as j,Ei as k,zi as l,Gi as m,Fi as n,Ae as o,Pe as p,ar as q,we as r,Me as s,je as t,Dt as u,Ct as v,Et as w,Lt as x,zt as y,Tt as z,Wt as A,qi as B,er as C,tr as D,ir as E,ri as F,rr as G,nr as H,Nr as I,Vr as J,Hr as K,Pr as L,Cr as M,ai as N,oi as O,li as P,hi as Q,ui as R,gi as S,mi as T,fi as U,yi as V,vi as W,bi as X,$r as Y,Zr as Z,Kr as _,Jr as $,Qr as aa,es as ba,ts as ca,rs as da,ls as ea,ys as fa,bs as ga,xs as ha,Ps as ia};
|