@splinetool/runtime 2.0.8 → 2.0.9

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.
Files changed (275) hide show
  1. package/build/hana-ui.js +82 -32
  2. package/build/hana-ui.js.br +0 -0
  3. package/build/hana-ui.js.gz +0 -0
  4. package/build/hana-ui.wasm +0 -0
  5. package/build/hana-ui.wasm.br +0 -0
  6. package/build/hana-ui.wasm.gz +0 -0
  7. package/build/{runtime-chunk-KNL33WN7.js → runtime-chunk-2SOMTXZZ.js} +1 -1
  8. package/build/runtime-chunk-2SOMTXZZ.js.br +0 -0
  9. package/build/runtime-chunk-2SOMTXZZ.js.gz +0 -0
  10. package/build/{runtime-chunk-YULW5JRE.js → runtime-chunk-33KX2TOT.js} +1 -1
  11. package/build/runtime-chunk-33KX2TOT.js.br +0 -0
  12. package/build/runtime-chunk-33KX2TOT.js.gz +0 -0
  13. package/build/{runtime-chunk-DK66VKWP.js → runtime-chunk-3D6ELLRB.js} +1 -1
  14. package/build/runtime-chunk-3D6ELLRB.js.br +0 -0
  15. package/build/runtime-chunk-3D6ELLRB.js.gz +0 -0
  16. package/build/{runtime-chunk-32KZP4YN.js → runtime-chunk-44F5FA4N.js} +1 -1
  17. package/build/runtime-chunk-44F5FA4N.js.br +0 -0
  18. package/build/runtime-chunk-44F5FA4N.js.gz +0 -0
  19. package/build/{runtime-chunk-5RXW5MNJ.js → runtime-chunk-4FRVTTCF.js} +1 -1
  20. package/build/runtime-chunk-4FRVTTCF.js.br +0 -0
  21. package/build/runtime-chunk-4FRVTTCF.js.gz +0 -0
  22. package/build/{runtime-chunk-5JEZ42OM.js → runtime-chunk-5MDYMRYM.js} +1 -1
  23. package/build/runtime-chunk-5MDYMRYM.js.br +0 -0
  24. package/build/runtime-chunk-5MDYMRYM.js.gz +0 -0
  25. package/build/{runtime-chunk-23QXG35G.js → runtime-chunk-5RKK7JBF.js} +1 -1
  26. package/build/runtime-chunk-5RKK7JBF.js.br +0 -0
  27. package/build/runtime-chunk-5RKK7JBF.js.gz +0 -0
  28. package/build/{runtime-chunk-HZ6FL5GH.js → runtime-chunk-CUH4PXNR.js} +1 -1
  29. package/build/runtime-chunk-CUH4PXNR.js.br +0 -0
  30. package/build/runtime-chunk-CUH4PXNR.js.gz +0 -0
  31. package/build/{runtime-chunk-USGQ26QU.js → runtime-chunk-CXBK7LPG.js} +1 -1
  32. package/build/runtime-chunk-CXBK7LPG.js.br +0 -0
  33. package/build/runtime-chunk-CXBK7LPG.js.gz +0 -0
  34. package/build/{runtime-chunk-RLYG5YBB.js → runtime-chunk-EPFYNTQQ.js} +1 -1
  35. package/build/runtime-chunk-EPFYNTQQ.js.br +0 -0
  36. package/build/runtime-chunk-EPFYNTQQ.js.gz +0 -0
  37. package/build/{runtime-chunk-AELTGHV2.js → runtime-chunk-FJZAL2GU.js} +1 -1
  38. package/build/runtime-chunk-FJZAL2GU.js.br +0 -0
  39. package/build/runtime-chunk-FJZAL2GU.js.gz +0 -0
  40. package/build/{runtime-chunk-KE6HNYUL.js → runtime-chunk-HRGNIGSC.js} +1 -1
  41. package/build/runtime-chunk-HRGNIGSC.js.br +0 -0
  42. package/build/{runtime-chunk-KE6HNYUL.js.gz → runtime-chunk-HRGNIGSC.js.gz} +0 -0
  43. package/build/{runtime-chunk-557KVSJL.js → runtime-chunk-KJLTN6RE.js} +1 -1
  44. package/build/runtime-chunk-KJLTN6RE.js.br +0 -0
  45. package/build/runtime-chunk-KJLTN6RE.js.gz +0 -0
  46. package/build/{runtime-chunk-E3IEBR27.js → runtime-chunk-KRQKRJPD.js} +1 -1
  47. package/build/runtime-chunk-KRQKRJPD.js.br +0 -0
  48. package/build/runtime-chunk-KRQKRJPD.js.gz +0 -0
  49. package/build/{runtime-chunk-BMA5KYBS.js → runtime-chunk-LVFNCYIC.js} +1 -1
  50. package/build/runtime-chunk-LVFNCYIC.js.br +0 -0
  51. package/build/runtime-chunk-LVFNCYIC.js.gz +0 -0
  52. package/build/{runtime-chunk-CKT62HES.js → runtime-chunk-R3V4RB3X.js} +1 -1
  53. package/build/runtime-chunk-R3V4RB3X.js.br +0 -0
  54. package/build/runtime-chunk-R3V4RB3X.js.gz +0 -0
  55. package/build/{runtime-chunk-OUXEWX5Z.js → runtime-chunk-ROGQC3YL.js} +1 -1
  56. package/build/runtime-chunk-ROGQC3YL.js.br +0 -0
  57. package/build/runtime-chunk-ROGQC3YL.js.gz +0 -0
  58. package/build/{runtime-chunk-GZ7C2GJM.js → runtime-chunk-RYIFGI7L.js} +1 -1
  59. package/build/runtime-chunk-RYIFGI7L.js.br +0 -0
  60. package/build/runtime-chunk-RYIFGI7L.js.gz +0 -0
  61. package/build/{runtime-chunk-TAY7IXEZ.js → runtime-chunk-SOL2NZB4.js} +1 -1
  62. package/build/runtime-chunk-SOL2NZB4.js.br +0 -0
  63. package/build/runtime-chunk-SOL2NZB4.js.gz +0 -0
  64. package/build/{runtime-chunk-DHWGP6NU.js → runtime-chunk-U7JVP2TI.js} +1 -1
  65. package/build/runtime-chunk-U7JVP2TI.js.br +0 -0
  66. package/build/runtime-chunk-U7JVP2TI.js.gz +0 -0
  67. package/build/{runtime-chunk-HK23JJVH.js → runtime-chunk-UFFTT5MI.js} +1 -1
  68. package/build/runtime-chunk-UFFTT5MI.js.br +0 -0
  69. package/build/runtime-chunk-UFFTT5MI.js.gz +0 -0
  70. package/build/{runtime-chunk-F3ZACLZW.js → runtime-chunk-VJPN4EM6.js} +1 -1
  71. package/build/runtime-chunk-VJPN4EM6.js.br +0 -0
  72. package/build/runtime-chunk-VJPN4EM6.js.gz +0 -0
  73. package/build/{runtime-chunk-UIM3XKIT.js → runtime-chunk-WFTAZCXD.js} +1 -1
  74. package/build/runtime-chunk-WFTAZCXD.js.br +0 -0
  75. package/build/runtime-chunk-WFTAZCXD.js.gz +0 -0
  76. package/build/{runtime-chunk-EJJZJ5MV.js → runtime-chunk-YANJNJO2.js} +1 -1
  77. package/build/runtime-chunk-YANJNJO2.js.br +0 -0
  78. package/build/runtime-chunk-YANJNJO2.js.gz +0 -0
  79. package/build/{runtime-chunk-3GRN37GY.js → runtime-chunk-YNTJMLA5.js} +1 -1
  80. package/build/runtime-chunk-YNTJMLA5.js.br +0 -0
  81. package/build/runtime-chunk-YNTJMLA5.js.gz +0 -0
  82. package/build/{runtime-chunk-PDASWDVC.js → runtime-chunk-ZTHLLGVX.js} +1 -1
  83. package/build/{runtime-chunk-PDASWDVC.js.br → runtime-chunk-ZTHLLGVX.js.br} +0 -0
  84. package/build/runtime-chunk-ZTHLLGVX.js.gz +0 -0
  85. package/build/{runtime-classicRuntime-U672GAGM.js → runtime-classicRuntime-7YZ7NLMG.js} +1 -1
  86. package/build/runtime-classicRuntime-7YZ7NLMG.js.br +0 -0
  87. package/build/runtime-classicRuntime-7YZ7NLMG.js.gz +0 -0
  88. package/build/{runtime-cloners-2AC7OZRC.js → runtime-cloners-H554LSFU.js} +1 -1
  89. package/build/runtime-cloners-H554LSFU.js.br +0 -0
  90. package/build/runtime-cloners-H554LSFU.js.gz +0 -0
  91. package/build/{runtime-components-L63NUGAO.js → runtime-components-ZCELGDQ5.js} +1 -1
  92. package/build/runtime-components-ZCELGDQ5.js.br +0 -0
  93. package/build/runtime-components-ZCELGDQ5.js.gz +0 -0
  94. package/build/{runtime-createDestroy-QHHQ6LYS.js → runtime-createDestroy-FK2ZKK66.js} +1 -1
  95. package/build/runtime-createDestroy-FK2ZKK66.js.br +0 -0
  96. package/build/runtime-createDestroy-FK2ZKK66.js.gz +0 -0
  97. package/build/{runtime-dragDrop-YBSWK3ET.js → runtime-dragDrop-E4OSDFGY.js} +1 -1
  98. package/build/runtime-dragDrop-E4OSDFGY.js.br +0 -0
  99. package/build/runtime-dragDrop-E4OSDFGY.js.gz +0 -0
  100. package/build/{runtime-gameControls-DSJRSTW5.js → runtime-gameControls-A3BST7FA.js} +1 -1
  101. package/build/runtime-gameControls-A3BST7FA.js.br +0 -0
  102. package/build/runtime-gameControls-A3BST7FA.js.gz +0 -0
  103. package/build/{runtime-hair-V4RTCES2.js → runtime-hair-W5WKY4OE.js} +1 -1
  104. package/build/runtime-hair-W5WKY4OE.js.br +2 -0
  105. package/build/runtime-hair-W5WKY4OE.js.gz +0 -0
  106. package/build/{runtime-mergeStaticGeometries-VXENKMD4.js → runtime-mergeStaticGeometries-5FS3LGQQ.js} +1 -1
  107. package/build/runtime-mergeStaticGeometries-5FS3LGQQ.js.br +0 -0
  108. package/build/runtime-mergeStaticGeometries-5FS3LGQQ.js.gz +0 -0
  109. package/build/{runtime-miscActions-RPUPHHGJ.js → runtime-miscActions-F72HQZ5I.js} +1 -1
  110. package/build/runtime-miscActions-F72HQZ5I.js.br +0 -0
  111. package/build/runtime-miscActions-F72HQZ5I.js.gz +0 -0
  112. package/build/{runtime-mouseHover-HG6AHA2L.js → runtime-mouseHover-44D2CVLI.js} +1 -1
  113. package/build/runtime-mouseHover-44D2CVLI.js.br +0 -0
  114. package/build/runtime-mouseHover-44D2CVLI.js.gz +0 -0
  115. package/build/{runtime-particles-ZHE2MC33.js → runtime-particles-5BBDNO44.js} +1 -1
  116. package/build/runtime-particles-5BBDNO44.js.br +0 -0
  117. package/build/runtime-particles-5BBDNO44.js.gz +0 -0
  118. package/build/{runtime-paths-GN6E6ZYL.js → runtime-paths-YF5SB3I3.js} +1 -1
  119. package/build/runtime-paths-YF5SB3I3.js.br +0 -0
  120. package/build/runtime-paths-YF5SB3I3.js.gz +0 -0
  121. package/build/{runtime-resize-LACR4RFK.js → runtime-resize-ZORLCUGS.js} +1 -1
  122. package/build/runtime-resize-ZORLCUGS.js.br +0 -0
  123. package/build/runtime-resize-ZORLCUGS.js.gz +0 -0
  124. package/build/{runtime-sceneTransition-QLPFYHHY.js → runtime-sceneTransition-EEJJDLOW.js} +1 -1
  125. package/build/runtime-sceneTransition-EEJJDLOW.js.br +0 -0
  126. package/build/runtime-sceneTransition-EEJJDLOW.js.gz +0 -0
  127. package/build/{runtime-scroll-WZZBT2XR.js → runtime-scroll-HSHQUB6P.js} +1 -1
  128. package/build/runtime-scroll-HSHQUB6P.js.br +0 -0
  129. package/build/runtime-scroll-HSHQUB6P.js.gz +0 -0
  130. package/build/runtime-shapeBlends-5ND6NZVA.js +1 -0
  131. package/build/runtime-shapeBlends-5ND6NZVA.js.br +3 -0
  132. package/build/runtime-shapeBlends-5ND6NZVA.js.gz +0 -0
  133. package/build/{runtime-text-UADJSRL4.js → runtime-text-UGIMBR6B.js} +1 -1
  134. package/build/runtime-text-UGIMBR6B.js.br +0 -0
  135. package/build/runtime-text-UGIMBR6B.js.gz +0 -0
  136. package/build/{runtime-textInputs-7U3TTJ4X.js → runtime-textInputs-HE2LSUKB.js} +1 -1
  137. package/build/runtime-textInputs-HE2LSUKB.js.br +0 -0
  138. package/build/runtime-textInputs-HE2LSUKB.js.gz +0 -0
  139. package/build/{runtime-timeline-JXKHKUAC.js → runtime-timeline-ZY2DQMB7.js} +1 -1
  140. package/build/runtime-timeline-ZY2DQMB7.js.br +0 -0
  141. package/build/runtime-timeline-ZY2DQMB7.js.gz +0 -0
  142. package/build/{runtime-tracking-MC74576T.js → runtime-tracking-WYI7223D.js} +1 -1
  143. package/build/runtime-tracking-WYI7223D.js.br +0 -0
  144. package/build/runtime-tracking-WYI7223D.js.gz +0 -0
  145. package/build/{runtime-transitions-S22YS7E6.js → runtime-transitions-ISGRYHHG.js} +1 -1
  146. package/build/runtime-transitions-ISGRYHHG.js.br +0 -0
  147. package/build/runtime-transitions-ISGRYHHG.js.gz +0 -0
  148. package/build/{runtime-ui2d-EX3RBXPP.js → runtime-ui2d-K7CMSG7Q.js} +1 -1
  149. package/build/runtime-ui2d-K7CMSG7Q.js.br +0 -0
  150. package/build/runtime-ui2d-K7CMSG7Q.js.gz +0 -0
  151. package/build/{runtime-vectorShapes-J5Y3LMND.js → runtime-vectorShapes-TE66F2C6.js} +1 -1
  152. package/build/runtime-vectorShapes-TE66F2C6.js.br +0 -0
  153. package/build/runtime-vectorShapes-TE66F2C6.js.gz +0 -0
  154. package/build/{runtime-webgpu-LDZ3N2D5.js → runtime-webgpu-JHHLEDVG.js} +1 -1
  155. package/build/runtime-webgpu-JHHLEDVG.js.br +0 -0
  156. package/build/runtime-webgpu-JHHLEDVG.js.gz +0 -0
  157. package/build/runtime.cjs +5 -5
  158. package/build/runtime.js +1 -1
  159. package/build/runtime.js.br +0 -0
  160. package/build/runtime.js.gz +0 -0
  161. package/build/runtime.standalone.js +1 -1
  162. package/build/runtime.standalone.js.br +0 -0
  163. package/build/runtime.standalone.js.gz +0 -0
  164. package/build/runtime.standalone.webgl.js +1 -1
  165. package/build/runtime.standalone.webgl.js.br +0 -0
  166. package/build/runtime.standalone.webgl.js.gz +0 -0
  167. package/build/runtime.standalone.webgpu.js +1 -1
  168. package/build/runtime.standalone.webgpu.js.br +0 -0
  169. package/build/runtime.standalone.webgpu.js.gz +0 -0
  170. package/build/runtime.standalone.webgpu.micro.js +1 -1
  171. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  172. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  173. package/build/runtime.standalone.webgpu.min.js +1 -1
  174. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  175. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  176. package/package.json +1 -1
  177. package/build/runtime-chunk-23QXG35G.js.br +0 -0
  178. package/build/runtime-chunk-23QXG35G.js.gz +0 -0
  179. package/build/runtime-chunk-32KZP4YN.js.br +0 -0
  180. package/build/runtime-chunk-32KZP4YN.js.gz +0 -0
  181. package/build/runtime-chunk-3GRN37GY.js.br +0 -0
  182. package/build/runtime-chunk-3GRN37GY.js.gz +0 -0
  183. package/build/runtime-chunk-557KVSJL.js.br +0 -0
  184. package/build/runtime-chunk-557KVSJL.js.gz +0 -0
  185. package/build/runtime-chunk-5JEZ42OM.js.br +0 -0
  186. package/build/runtime-chunk-5JEZ42OM.js.gz +0 -0
  187. package/build/runtime-chunk-5RXW5MNJ.js.br +0 -0
  188. package/build/runtime-chunk-5RXW5MNJ.js.gz +0 -0
  189. package/build/runtime-chunk-AELTGHV2.js.br +0 -0
  190. package/build/runtime-chunk-AELTGHV2.js.gz +0 -0
  191. package/build/runtime-chunk-BMA5KYBS.js.br +0 -0
  192. package/build/runtime-chunk-BMA5KYBS.js.gz +0 -0
  193. package/build/runtime-chunk-CKT62HES.js.br +0 -0
  194. package/build/runtime-chunk-CKT62HES.js.gz +0 -0
  195. package/build/runtime-chunk-DHWGP6NU.js.br +0 -0
  196. package/build/runtime-chunk-DHWGP6NU.js.gz +0 -0
  197. package/build/runtime-chunk-DK66VKWP.js.br +0 -0
  198. package/build/runtime-chunk-DK66VKWP.js.gz +0 -0
  199. package/build/runtime-chunk-E3IEBR27.js.br +0 -0
  200. package/build/runtime-chunk-E3IEBR27.js.gz +0 -0
  201. package/build/runtime-chunk-EJJZJ5MV.js.br +0 -0
  202. package/build/runtime-chunk-EJJZJ5MV.js.gz +0 -0
  203. package/build/runtime-chunk-F3ZACLZW.js.br +0 -0
  204. package/build/runtime-chunk-F3ZACLZW.js.gz +0 -0
  205. package/build/runtime-chunk-GZ7C2GJM.js.br +0 -0
  206. package/build/runtime-chunk-GZ7C2GJM.js.gz +0 -0
  207. package/build/runtime-chunk-HK23JJVH.js.br +0 -0
  208. package/build/runtime-chunk-HK23JJVH.js.gz +0 -0
  209. package/build/runtime-chunk-HZ6FL5GH.js.br +0 -0
  210. package/build/runtime-chunk-HZ6FL5GH.js.gz +0 -0
  211. package/build/runtime-chunk-KE6HNYUL.js.br +0 -0
  212. package/build/runtime-chunk-KNL33WN7.js.br +0 -0
  213. package/build/runtime-chunk-KNL33WN7.js.gz +0 -0
  214. package/build/runtime-chunk-OUXEWX5Z.js.br +0 -0
  215. package/build/runtime-chunk-OUXEWX5Z.js.gz +0 -0
  216. package/build/runtime-chunk-PDASWDVC.js.gz +0 -0
  217. package/build/runtime-chunk-RLYG5YBB.js.br +0 -1
  218. package/build/runtime-chunk-RLYG5YBB.js.gz +0 -0
  219. package/build/runtime-chunk-TAY7IXEZ.js.br +0 -0
  220. package/build/runtime-chunk-TAY7IXEZ.js.gz +0 -0
  221. package/build/runtime-chunk-UIM3XKIT.js.br +0 -0
  222. package/build/runtime-chunk-UIM3XKIT.js.gz +0 -0
  223. package/build/runtime-chunk-USGQ26QU.js.br +0 -0
  224. package/build/runtime-chunk-USGQ26QU.js.gz +0 -0
  225. package/build/runtime-chunk-YULW5JRE.js.br +0 -0
  226. package/build/runtime-chunk-YULW5JRE.js.gz +0 -0
  227. package/build/runtime-classicRuntime-U672GAGM.js.br +0 -0
  228. package/build/runtime-classicRuntime-U672GAGM.js.gz +0 -0
  229. package/build/runtime-cloners-2AC7OZRC.js.br +0 -0
  230. package/build/runtime-cloners-2AC7OZRC.js.gz +0 -0
  231. package/build/runtime-components-L63NUGAO.js.br +0 -0
  232. package/build/runtime-components-L63NUGAO.js.gz +0 -0
  233. package/build/runtime-createDestroy-QHHQ6LYS.js.br +0 -0
  234. package/build/runtime-createDestroy-QHHQ6LYS.js.gz +0 -0
  235. package/build/runtime-dragDrop-YBSWK3ET.js.br +0 -0
  236. package/build/runtime-dragDrop-YBSWK3ET.js.gz +0 -0
  237. package/build/runtime-gameControls-DSJRSTW5.js.br +0 -0
  238. package/build/runtime-gameControls-DSJRSTW5.js.gz +0 -0
  239. package/build/runtime-hair-V4RTCES2.js.br +0 -2
  240. package/build/runtime-hair-V4RTCES2.js.gz +0 -0
  241. package/build/runtime-mergeStaticGeometries-VXENKMD4.js.br +0 -0
  242. package/build/runtime-mergeStaticGeometries-VXENKMD4.js.gz +0 -0
  243. package/build/runtime-miscActions-RPUPHHGJ.js.br +0 -0
  244. package/build/runtime-miscActions-RPUPHHGJ.js.gz +0 -0
  245. package/build/runtime-mouseHover-HG6AHA2L.js.br +0 -0
  246. package/build/runtime-mouseHover-HG6AHA2L.js.gz +0 -0
  247. package/build/runtime-particles-ZHE2MC33.js.br +0 -0
  248. package/build/runtime-particles-ZHE2MC33.js.gz +0 -0
  249. package/build/runtime-paths-GN6E6ZYL.js.br +0 -0
  250. package/build/runtime-paths-GN6E6ZYL.js.gz +0 -0
  251. package/build/runtime-resize-LACR4RFK.js.br +0 -0
  252. package/build/runtime-resize-LACR4RFK.js.gz +0 -0
  253. package/build/runtime-sceneTransition-QLPFYHHY.js.br +0 -0
  254. package/build/runtime-sceneTransition-QLPFYHHY.js.gz +0 -0
  255. package/build/runtime-scroll-WZZBT2XR.js.br +0 -0
  256. package/build/runtime-scroll-WZZBT2XR.js.gz +0 -0
  257. package/build/runtime-shapeBlends-O6ATLCCA.js +0 -1
  258. package/build/runtime-shapeBlends-O6ATLCCA.js.br +0 -0
  259. package/build/runtime-shapeBlends-O6ATLCCA.js.gz +0 -0
  260. package/build/runtime-text-UADJSRL4.js.br +0 -0
  261. package/build/runtime-text-UADJSRL4.js.gz +0 -0
  262. package/build/runtime-textInputs-7U3TTJ4X.js.br +0 -0
  263. package/build/runtime-textInputs-7U3TTJ4X.js.gz +0 -0
  264. package/build/runtime-timeline-JXKHKUAC.js.br +0 -0
  265. package/build/runtime-timeline-JXKHKUAC.js.gz +0 -0
  266. package/build/runtime-tracking-MC74576T.js.br +0 -0
  267. package/build/runtime-tracking-MC74576T.js.gz +0 -0
  268. package/build/runtime-transitions-S22YS7E6.js.br +0 -0
  269. package/build/runtime-transitions-S22YS7E6.js.gz +0 -0
  270. package/build/runtime-ui2d-EX3RBXPP.js.br +0 -0
  271. package/build/runtime-ui2d-EX3RBXPP.js.gz +0 -0
  272. package/build/runtime-vectorShapes-J5Y3LMND.js.br +0 -0
  273. package/build/runtime-vectorShapes-J5Y3LMND.js.gz +0 -0
  274. package/build/runtime-webgpu-LDZ3N2D5.js.br +0 -0
  275. package/build/runtime-webgpu-LDZ3N2D5.js.gz +0 -0
@@ -1 +1 @@
1
- import{a as t}from"./runtime-chunk-5JEZ42OM.js";import{a as e}from"./runtime-chunk-5RXW5MNJ.js";import{d as n,e as s,f as i,g as r,h as a}from"./runtime-chunk-HZ6FL5GH.js";import{a as o,b as l}from"./runtime-chunk-F3ZACLZW.js";import{b as d,e as c,f as h,g as p}from"./runtime-chunk-YULW5JRE.js";import{a as u}from"./runtime-chunk-UIM3XKIT.js";import{a as m}from"./runtime-chunk-32KZP4YN.js";import{a as f}from"./runtime-chunk-RLYG5YBB.js";import{b as y}from"./runtime-chunk-E3IEBR27.js";import{a as g,b as x}from"./runtime-chunk-EJJZJ5MV.js";import{a as v}from"./runtime-chunk-USGQ26QU.js";import{d as A}from"./runtime-chunk-AELTGHV2.js";import{K as b,da as w,ea as C,g as I}from"./runtime-chunk-DK66VKWP.js";import{b as M,c as P,e as S,h as B,v as D}from"./runtime-chunk-CKT62HES.js";import{a as E,b as R,c as z,d as O,f as j,i as W,j as T}from"./runtime-chunk-2PT2WH66.js";import{c as _,e as k,g as U}from"./runtime-chunk-TZCHGFVF.js";import{Da as N,K as G,Ka as V,a as F,b as L,n as Y,o as q,w as Q,xa as Z}from"./runtime-chunk-VPEJ5BFD.js";import{Aa as X,Ba as K,Dc as H,Ec as J,Fc as $,Gc as tt,Ge as et,Ja as nt,Oa as st,Oc as it,Ra as rt,Tc as at,Vc as ot,Xc as lt,Yc as dt,Zc as ct,bd as ht,cd as pt,ce as ut,dd as mt,kd as ft,l as yt,ld as gt,mc as xt,md as vt,n as At,nd as bt,od as wt,pd as Ct,qd as It,za as Mt}from"./runtime-chunk-VGN7YHB7.js";import{c as Pt}from"./runtime-chunk-ML3Z74BL.js";var St=null;function Bt(t){St=t}var Dt=new WeakMap,Et=1;function Rt(t){let e=Dt.get(t);return void 0===e&&(e=Et++,Dt.set(t,e)),e}function zt(t,e,n,s){let i=t,r=e;return[Rt(n),Rt(s),i.layers?.mask??0,i.renderOrder??0,!0===(i.castShadow??r.castShadow)?1:0,!0===(i.receiveShadow??r.receiveShadow)?1:0].join(":")}var Ot=[8,32,128,512],jt=Ot[Ot.length-1],Wt=(new it).makeScale(0,0,0),Tt=class extends It{constructor(t,e,n,s){super(t,e,n),this.isInstanceGroup=!0,this.members=new Array(n).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(s);for(let t=0;t<n;t++)this.setMatrixAt(t,Wt);this.instanceMatrix.needsUpdate=!0}adoptPassState(t){this.layers.mask=t.layers.mask,this.renderOrder=t.renderOrder,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow}assign(t,e){this.members[t]=e}writeSlot(t,e,n){return!1===n?(this.setMatrixAt(t,Wt),!1):(this.setMatrixAt(t,e.matrixWorld),!0)}park(t){this.members[t]=null,this.setMatrixAt(t,Wt)}get memberCount(){let t=0;for(let e of this.members)null!==e&&t++;return t}};function _t(t,e){let n=e.get(t);if(void 0!==n)return n;let s=t.visible&&(null===t.parent||_t(t.parent,e));return e.set(t,s),s}var kt=8,Ut=class{constructor(t=8){this.minGroupSize=t,this.groups=[],this.groupKeys=new WeakMap,this.placements=new Map,this.visibilityMemo=new Map,this.page=null,this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}}}update(t,e){this.page!==t&&(this.teardown(),this.page=t,e=!0),!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh()}reconcile(t){let e={},n=new Map;t.traverse(t=>{if(!0===t.isInstanceGroup)return;let s=function(t){if(!0!==t.isMesh)return"not-a-mesh";if(z(t)||j(t)||R(t)||E(t))return"excluded-type";let e=function(t){let e=W(t)?t.object:t;return void 0!==e.geometry?e:void 0}(t);if(void 0===e)return"not-a-mesh";let n=e.material;if(void 0===n)return"not-a-mesh";if(Array.isArray(n))return"array-material";let s=e.builtSharedGeometry;if(void 0===s)return"unrealized-geometry";if(!function(t){return!0===t.isShared}(s))return"unshared-geometry";if(void 0===s.attributes.position)return"empty-geometry";if(void 0!==s.morphAttributes.position)return"morph";if(!0===e.isSkinnedMesh)return"skinned";let i=e.morphTargetInfluences;if(void 0!==i&&i.length>0)return"morph";if(0!==s.drawRange.start||s.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let r=n;return null!=r.positionNode||null!=r.castShadowPositionNode?"position-node":!0===r.transparent?"transparent":void 0!==e.userData?.__splinePlanarMirror?"reflection":function(t){let e=t;for(;null!==e;){let t=e.states;if(void 0!==t&&Object.keys(t).length>0)return!0;e=e.parent}return!1}(e)?"interaction-states":{object:t,owner:e,geometry:s,material:n,key:zt(t,e,s,n)}}(t);if("string"==typeof s)return void(e[s]=(e[s]??0)+1);let i=n.get(s.key);void 0===i?n.set(s.key,[s]):i.push(s)});let s=new Map;for(let[t,e]of n)for(let n of e)s.set(n.object,t);let i=!1;for(let[t,e]of this.placements)s.get(t)!==this.groupKeys.get(e.group)&&this.parkPlacement(t,e);for(let t=this.groups.length-1;t>=0;t--){let e=this.groups[t];e.memberCount>=this.minGroupSize||(this.destroyGroup(e),this.groups.splice(t,1),i=!0)}for(let[e,s]of n){let n=s.filter(t=>!this.placements.has(t.object));if(0===n.length)continue;let r=0;for(let t of this.groups){if(r>=n.length)break;if(this.groupKeys.get(t)!==e)continue;let{members:s}=t;for(let e=0;e<s.length&&r<n.length;e++)null===s[e]&&this.place(t,e,n[r++].object)}for(;n.length-r>=this.minGroupSize;){let s=n.slice(r,r+jt);this.groups.push(this.createGroup(t,e,s)),r+=s.length,i=!0}}i&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=e}createGroup(t,e,n){let s=n[0],i=new Tt(s.geometry,s.material,function(t){for(let e of Ot)if(t<=e)return e;return jt}(n.length),s.object);this.groupKeys.set(i,e);for(let t=0;t<n.length;t++)this.place(i,t,n[t].object);return t.add(i),i}destroyGroup(t){for(let e=0;e<t.members.length;e++){let n=t.members[e];null!==n&&this.parkPlacement(n,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,n){t.assign(e,n),this.placements.set(n,{group:t,slot:e}),n.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(){this.visibilityMemo.clear();for(let t of this.groups){let{members:e}=t,n=null;for(let s=0;s<e.length;s++){let i=e[s];null!==i&&(null===n&&(n=i),t.writeSlot(s,i,_t(i,this.visibilityMemo)))}null!==n&&(t.adoptPassState(n),t.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null}publishGroupStats(){let t=0;for(let e of this.groups){let n=e.memberCount;n>0&&(t+=n-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}},Nt=function(){let t=new Float32Array(1),e=new Int32Array(t.buffer);return function(n){return t[0]=n,e[0]}}(),Gt=function(t,e,n,s){return t+(e<<8)+(n<<16)+(s<<24)},Vt=new H;function Ft(t){let e=!1;return t.scene.objects.traverse((t,n)=>{if(!1===n.visible)return!0;"Splat"===n.type&&(e=!0)}),e}var Lt,Yt,qt=class extends gt{constructor(t,e,n,s,i=!1,r=1,a,o){super(n,s),this.splatCount=e,this.meshIndexIntervals=a,this.meshMatrixWorlds=o,this.splatBuffers=t,this.geometry=n,this.material=s,this.splatDataTextures=null,this.halfPrecisionCovariancesOnGPU=i,this.devicePixelRatio=r,this.resetLocalSplatDataAndTexturesFromSplatBuffer()}static buildMesh(t,e,n=!1,s=1,i,r){let a=qt.buildGeomtery(e),o=qt.buildMaterial(i);return new qt(t,e,a,o,n,s,i,r)}static buildMaterial(t){if("webgpu"===b()&&St)return St.createSplatMaterial(t);let e={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:t},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new H},viewport:{type:"v2",value:new H},basisViewport:{type:"v2",value:new H},debugColor:{type:"v3",value:new at},covariancesTextureSize:{type:"v2",value:new H(1024,1024)},centersColorsTextureSize:{type:"v2",value:new H(1024,1024)},orthoZoom:{type:"f",value:-1}};return new ut({uniforms:e,vertexShader:"\n precision highp float;\n #include <common>\n\n attribute uint splatIndex;\n\n uniform highp sampler2D covariancesTexture;\n uniform highp usampler2D centersColorsTexture;\n uniform vec2 focal;\n uniform vec2 viewport;\n uniform vec2 basisViewport;\n uniform vec2 covariancesTextureSize;\n uniform vec2 centersColorsTextureSize;\n\t\t\t\t\t\tuniform highp sampler2D meshMatrixWorldsTexture;\n\t\t\t\t\t\tuniform uint meshIndexIntervals[257];\n\t\t\t\t\t\tuniform float orthoZoom;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\n const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));\n const uvec4 shift4 = uvec4(0, 8, 16, 24);\n vec4 uintToRGBAVec (uint u) {\n uvec4 urgba = mask4 & u;\n urgba = urgba >> shift4;\n vec4 rgba = vec4(urgba) * encodeNorm4;\n return rgba;\n }\n\n vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n void main () {\n uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));\n vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));\n vColor = uintToRGBAVec(sampledCenterColor.r);\n\n vPosition = position.xy * 2.0;\n\n\t\t\t\t\t\t\t\tuint meshIndex;\n\t\t\t\t\t\t\t\tfor (int i = 1; i < 257; i++) {\n\t\t\t\t\t\t\t\t\tif (splatIndex < meshIndexIntervals[i]) {\n\t\t\t\t\t\t\t\t\t\tmeshIndex = uint(i - 1);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tfloat strideMulmeshIndex = float(4u*meshIndex);\n\t\t\t\t\t\t\t\tfloat meshMatrixWorldsTextureLength = float(256*4);\n\n\t\t\t\t\t\t\t\tmat4 modelMat = mat4(\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0))\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tmat4 modelViewMat = viewMatrix * modelMat;\n\t\t\t\t\t\t\t\tvec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); \n vec4 clipCenter = projectionMatrix * viewCenter;\n\n vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg;\n vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg;\n vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg;\n\n vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r);\n vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg);\n\n \n mat3 Vrk = mat3(\n cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,\n cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,\n cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z\n );\n float s = 1.0 / (viewCenter.z * viewCenter.z);\n\n mat3 W = transpose(mat3(modelViewMat));\n mat3 T = orthoZoom > 0.0 ? W : W * mat3(\n\t\t\t\t\t\t\t\t\tfocal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,\n\t\t\t\t\t\t\t\t\t0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,\n\t\t\t\t\t\t\t\t\t0., 0., 0.\n\t\t\t\t\t\t\t\t);\n mat3 cov2Dm = transpose(T) * Vrk * T;\n cov2Dm[0][0] += 0.3;\n cov2Dm[1][1] += 0.3;\n\n \n \n \n \n vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);\n\n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n \n \n \n \n \n \n \n \n float a = cov2Dv.x;\n float d = cov2Dv.z;\n float b = cov2Dv.y;\n float D = a * d - b * b;\n float trace = a + d;\n float traceOver2 = 0.5 * trace;\n float term2 = sqrt(trace * trace / 4.0 - D);\n float eigenValue1 = traceOver2 + term2;\n\t\t\t\t\t\t\t\tfloat eigenValue2 = max(traceOver2 - term2, 0.00); \n\n const float maxSplatSize = 1024.0;\n vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));\n \n vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);\n vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize);\n vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize);\n\n vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport;\n\n\t\t\t\t\t\t\t\tif (orthoZoom > 0.0) {\n\t\t\t\t\t\t\t\t\tndcOffset *= orthoZoom;\n\t\t\t\t\t\t\t\t}\n\n gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);\n }",fragmentShader:"\n precision highp float;\n #include <common>\n\n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\t\t\t\t\t\tlayout(location = 1) out vec4 gVelocity; \n\n void main () {\n \n \n float A = -dot(vPosition, vPosition);\n if (A < -4.0) discard;\n vec3 color = vColor.rgb;\n A = exp(A) * vColor.a;\n gl_FragColor = vec4(color.rgb, A);\n\t\t\t\t\t\t\t\tgVelocity = vec4(0.0); \n }",transparent:!0,alphaTest:1,blending:At,depthTest:!0,depthWrite:!1,side:yt})}static buildGeomtery(t){let e=new mt;e.setIndex([0,1,2,0,2,3]);let n=new Float32Array(12),s=new ct(n,3);e.setAttribute("position",s),s.setXYZ(0,-1,-1,0),s.setXYZ(1,-1,1,0),s.setXYZ(2,1,1,0),s.setXYZ(3,1,-1,0),s.needsUpdate=!0;let i=(new et).copy(e),r=new Uint32Array(t),a=new Ct(r,1,!1);return a.setUsage(xt),i.setAttribute("splatIndex",a),i.instanceCount=t,i}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(t=>t.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let t=0,e=0,n=0;for(let s of this.splatBuffers){let i=s.nsplats;this.colors.subarray(t,t+4*i).set(s.colorsA),t+=4*i,this.centers.subarray(e,e+3*i).set(s.decoded.xyz.denormDequant().data),e+=3*i,this.covariances.subarray(n,n+6*i).set(new Float32Array(s.precomputedCovarianceBufferData)),n+=6*i}}allocateAndStoreLocalSplatDataInTextures(){let t=this.splatCount,e=new H(4096,1024);for(;e.x*e.y*2<6*t;)e.y*=2;let n,s,i=new H(4096,1024);for(;i.x*i.y*4<4*t;)i.y*=2;if(this.halfPrecisionCovariancesOnGPU){s=new Uint16Array(e.x*e.y*2);for(let t=0;t<this.covariances.length;t++)s[t]=dt.toHalfFloat(this.covariances[t]);n=new bt(s,e.x,e.y,st,K)}else s=new Float32Array(e.x*e.y*2),s.set(this.covariances),n=new bt(s,e.x,e.y,st,X);n.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=n,this.material.uniforms.covariancesTextureSize.value.copy(e);let r=new Uint32Array(i.x*i.y*4);for(let e=0;e<t;e++){let t=4*e,n=3*e,s=4*e;r[s]=Gt(this.colors[t],this.colors[t+1],this.colors[t+2],this.colors[t+3]),r[s+1]=Nt(this.centers[n]),r[s+2]=Nt(this.centers[n+1]),r[s+3]=Nt(this.centers[n+2])}let a=new bt(r,i.x,i.y,rt,Mt);"webgpu"!==b()&&(a.internalFormat="RGBA32UI"),a.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=a,this.material.uniforms.centersColorsTextureSize.value.copy(i);let o=new Float32Array(4096);for(let t=0;t<this.meshMatrixWorlds.length;t++)o.set(this.meshMatrixWorlds[t].elements,16*t);let l=new bt(o,1024,1,nt,X);l.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=l,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:s,texture:n,size:e},centerColors:{data:r,texture:a,size:i},meshMatrixWorlds:{data:o,texture:l}}}updateIndexes(t){let e=this.geometry;e.attributes.splatIndex.set(t),e.attributes.splatIndex.needsUpdate=!0,e.instanceCount=t.length}updateUniforms(t,e,n,s){this.splatCount>0&&(Vt.set(t.x*this.devicePixelRatio,t.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(Vt),this.material.uniforms.basisViewport.value.set(2/Vt.x,2/Vt.y),this.material.uniforms.focal.value.set(e,n),this.material.uniforms.orthoZoom.value=s,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}},Qt=new Promise(t=>{Lt=t}),Zt=!1;function Xt(){if(!Zt)return Yt||(Yt=async function(){let t=await import("./gaussian-splat-compression.js");Lt(t),Zt=!0}())}var Kt=new it,Ht=new tt,Jt=new $,$t=new $,te=new $,ee=new $,ne=new $,se=new $;function ie(t,e,n){n.length=0;let{axis:s,sign:i,limit:r}=e;for(let e=0;e<t.length;e++){let a=t[e],o=t[(e+1)%t.length],l=(0===s?a.px:1===s?a.py:a.pz)*i-r,d=(0===s?o.px:1===s?o.py:o.pz)*i-r,c=l<=0,h=d<=0;if(c&&n.push(a),c!==h){let t=l/(l-d);n.push({px:a.px+(o.px-a.px)*t,py:a.py+(o.py-a.py)*t,pz:a.pz+(o.pz-a.pz)*t,nx:a.nx+(o.nx-a.nx)*t,ny:a.ny+(o.ny-a.ny)*t,nz:a.nz+(o.nz-a.nz)*t})}}return n}function re(t,e,n,s,i,r,a,o,l){let d=t.geometry,c=d.getAttribute("position");if(void 0===c||0===c.count)return!0;let h=d.getAttribute("normal"),p=d.getIndex(),u=null!==p?p.count:c.count;if(u>15e5)return!0;let m=d.drawRange.start,f=m+(d.drawRange.count===1/0?u-m:Math.min(d.drawRange.count,u-m));Kt.copy(t.objectToDecal),Ht.getNormalMatrix(Kt);let y=[],g=[];for(let t=m;t+2<f;t+=3){let d=null!==p?p.getX(t):t,u=null!==p?p.getX(t+1):t+1,m=null!==p?p.getX(t+2):t+2;if(Jt.fromBufferAttribute(c,d).applyMatrix4(Kt),$t.fromBufferAttribute(c,u).applyMatrix4(Kt),te.fromBufferAttribute(c,m).applyMatrix4(Kt),Jt.z>n&&$t.z>n&&te.z>n||Jt.z<-n&&$t.z<-n&&te.z<-n)continue;ee.subVectors($t,Jt),ne.subVectors(te,Jt),se.crossVectors(ee,ne);let f=se.length();if(!(0===f||se.z/f<=.01)){if(y.length=0,void 0!==h)ee.fromBufferAttribute(h,d).applyMatrix3(Ht),y.push({px:Jt.x,py:Jt.y,pz:Jt.z,nx:ee.x,ny:ee.y,nz:ee.z}),ee.fromBufferAttribute(h,u).applyMatrix3(Ht),y.push({px:$t.x,py:$t.y,pz:$t.z,nx:ee.x,ny:ee.y,nz:ee.z}),ee.fromBufferAttribute(h,m).applyMatrix3(Ht),y.push({px:te.x,py:te.y,pz:te.z,nx:ee.x,ny:ee.y,nz:ee.z});else{se.divideScalar(f);for(let t of[Jt,$t,te])y.push({px:t.x,py:t.y,pz:t.z,nx:se.x,ny:se.y,nz:se.z})}for(let t of e){if(0===y.length)break;let e=ie(y,t,g);g=y,y=e}if(!(y.length<3)){if(a.length/3+3*(y.length-2)>3e5)return!1;for(let t=1;t+1<y.length;t++)for(let e of[y[0],y[t],y[t+1]]){l.push(e.px*s+.5,e.py*i+.5);let t=e.nx,n=e.ny,d=e.nz,c=Math.hypot(t,n,d);c>0?(t/=c,n/=c,d/=c):(t=0,n=0,d=1),a.push(e.px+t*r,e.py+n*r,e.pz+d*r),o.push(t,n,d)}}}}return!0}var ae=new lt,oe=new lt,le=new it,de=new $,ce=class extends w{constructor(t,e,n){super(t,e),this.data=e,this.geometry=new mt,this.lastSignature=[],this.nextSignature=[],this.scanned=[],this.lastParams={width:0,height:0,depth:0,offset:0},this.context=n;let s=this.data.geometry;this.lastParams={width:this.resolveNumber(s.width,0),height:this.resolveNumber(s.height,0),depth:this.resolveNumber(s.depth,0),offset:s.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(t,e){if("number"==typeof t)return t;let n=Number(this.context.shared.getVariable(t));return Number.isFinite(n)?n:e}currentParams(){let t=this.dataPatched.geometry;return{width:this.resolveNumber(t.width,this.lastParams.width),height:this.resolveNumber(t.height,this.lastParams.height),depth:this.resolveNumber(t.depth,this.lastParams.depth),offset:t.offset??0}}projectionRoot(){let t=this.parent;for(;null!==t&&B.is(t);){if("Page"===t.data?.type)return t;t=t.parent}return this.context.scene}scanTargets(t,e,n){let s=this.scanned;s.length=0;let i=this.projectionRoot();if(null===i)return s;ae.makeEmpty();for(let s=0;s<8;s++)de.set((1&s?.5:-.5)*t,(2&s?.5:-.5)*e,(4&s?.5:-.5)*n).applyMatrix4(this.matrixWorld),ae.expandByPoint(de);return i.traverse(t=>{if(t===this||!B.is(t)||!(t instanceof D)||t instanceof ce||"Mesh"!==t.dataPatched?.type||!t.visible||t.destroyedInAction||512&t.layers.mask)return;let e=t.geometry,n=e?.getAttribute("position");void 0===n||0===n.count||0!==e.drawRange.count&&(null===e.boundingBox&&e.computeBoundingBox(),oe.copy(e.boundingBox).applyMatrix4(t.matrixWorld),ae.intersectsBox(oe)&&s.push(t))}),s}collectSignature(t,e,n){t.length=0,t.push(n.width,n.height,n.depth,n.offset);for(let e of this.matrixWorld.elements)t.push(e);for(let n of e){t.push(n.id,n.geometry.id);let e=n.geometry.getAttribute("position");t.push(void 0===e?-1:"version"in e?e.version:e.data.version);let s=n.geometry.getIndex();t.push(null!==s?s.version:-1),t.push(n.geometry.drawRange.count===1/0?-1:n.geometry.drawRange.count);for(let e of n.matrixWorld.elements)t.push(e)}}signaturesEqual(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let t=this.currentParams(),e=this.scanTargets(t.width,t.height,t.depth);if(this.collectSignature(this.nextSignature,e,t),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let n=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=n,this.lastParams=t,le.copy(this.matrixWorld).invert();let s=e.map(t=>({geometry:t.geometry,objectToDecal:(new it).multiplyMatrices(le,t.matrixWorld)}));return this.geometry.dispose(),this.geometry=function(t,e){let n=Math.max(Math.abs(e.width),1e-6),s=Math.max(Math.abs(e.height),1e-6),i=Math.max(Math.abs(e.depth),1e-6),r=[{axis:0,sign:1,limit:n/2},{axis:0,sign:-1,limit:n/2},{axis:1,sign:1,limit:s/2},{axis:1,sign:-1,limit:s/2},{axis:2,sign:1,limit:i/2},{axis:2,sign:-1,limit:i/2}],a=[],o=[],l=[];for(let d of t)if(!re(d,r,i/2,1/n,1/s,e.offset,a,o,l))break;let d=new mt;return d.setAttribute("position",new ht(a,3)),d.setAttribute("normal",new ht(o,3)),d.setAttribute("uv",new ht(l,2)),0===a.length?(d.setDrawRange(0,0),d.boundingSphere=new pt):d.computeBoundingSphere(),d}(s,t),this.geometry.userData={type:"DecalGeometry",parameters:{width:t.width,height:t.height,depth:t.depth}},g(this),x(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(t,e,n){super.updateByPatchedOp(t,e,n),M(t.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(t,e){let n=this.currentParams();t.setScalar(0),e.set(n.width,n.height,n.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}},he=class extends(A(vt,v)){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}},pe=function(){try{let t=window.location.href;if(t.includes("reducesubdiv=")){let e=t.indexOf("reducesubdiv=")+13;return parseInt(t.slice(e,e+1))}}catch{}}();function ue(n,s,i){if(console.assert(void 0!==s.type),"Mesh"===s.type)return function(t,e,n){let s;if(void 0!==pe&&e?.geometry&&"subdivisions"in e.geometry&&(e.geometry.subdivisions??0)>pe&&Object.assign(e.geometry,{subdivisions:pe}),"TextGeometry"===e.geometry.type||"InputGeometry"===e.geometry.type){let s=U(e.geometry.type);return s?s(t,e,n):(_("InputGeometry"===e.geometry.type?"textinputs":"text",`a Mesh with ${e.geometry.type}`),new C(t,e,n))}if("SubdivGeometry"===e.geometry.type)s=new y(t,e,n);else if("PathGeometry"===e.geometry.type||"VectorGeometry"===e.geometry.type||"ShapeBlendGeometry"===e.geometry.type){let i=U(e.geometry.type);i?s=i(t,e,n):(_("ShapeBlendGeometry"===e.geometry.type?"shape-blends":"PathGeometry"===e.geometry.type?"3d-paths":"vector-shapes",`a Mesh with ${e.geometry.type}`),s=new C(t,e,n))}else if("BooleanGeometry"===e.geometry.type)s=new d(t,e,n);else if("DecalGeometry"===e.geometry.type)s=new ce(t,e,n);else if("UIGeometry"===e.geometry.type){let i=U("UIGeometry");i?s=i(t,e,n):(_("ui-2d","a Mesh with UIGeometry"),s=new C(t,e,n))}else s=new C(t,e,n);return s}(n,s,i);if("Empty"===s.type)return new e(n,s);if("Particle"===s.type){let t=k("Particle");return t?t(n,s,i):(_("particles","a Particle system"),new e(n,s))}if("ParticleCollider"===s.type)return new f(n,s,i);if("Hair"===s.type){let t=k("Hair");return t?t(n,s,i):(_("hair","a Hair System"),new e(n,s))}if("Splat"===s.type)return new e(n,s);if("Bone"===s.type)return new he(n,s);if("Page"===s.type)return new a(n,s,i);if("PointLight"===s.type)return new t(n,s,i);if("SpotLight"===s.type)return new l(n,s,i);if("DirectionalLight"===s.type)return new o(n,s,i);if("Component"===s.type||"Instance"===s.type){let t=k(s.type);return t?t(n,s,i):(_("components",`a ${s.type}`),new e(n,s))}return G.is(s.type)?new m(n,s):(console.error(s),new e(n,s))}P.createEntity=ue,P.changeEntityProptotype=function(t,e,n){let s=ue(t.identity,e,n),i=t.children,r=t.attachedPaths,a=t.parent,o=t.component,l=t.instances,d=t.overrideData,c=t.uuid,h=t.stateSelection;t.dispose();for(let e of Object.keys(t))delete t[e];Object.setPrototypeOf(t,Object.getPrototypeOf(s));for(let e of Object.keys(s))t[e]=s[e];t.children=[...t.children,...i],t.attachedPaths=r,t.parent=a,t.component=o,t.instances=l,t.uuid=c,t.overrideData=d,t.updateState(t.data,n),h&&t.changeSelectedState(h,n),t.resetBBoxNeedsUpdate()};var me,fe=class{constructor(){this._constraints=new Map}setConstraint(t,e){null===e?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((n,s)=>{let i=[s,n],r=n;for(;this._constraints.has(r);){if(r=this._constraints.get(r),i.includes(r)){console.warn(`circular dependency detected: ${i.join(" -> ")}`);break}e.has(r)||i.push(r)}for(let n=i.length-2;n>=0;n--)if(!e.has(i[n])){let s=t.find(i[n]);s?s.applyPathSnapping(t):console.warn(`missing entity ${i[n]}`),e.add(i[n])}})}findDependency(t,e){let n=t;for(;this._constraints.has(n);)if(n=this._constraints.get(n),n===e)return!0;return!1}},ye=class{};Pt(ye,"DepthMapRange",65536),Pt(ye,"MemoryPageSize",65536),Pt(ye,"BytesPerFloat",4),Pt(ye,"BytesPerInt",4),Qt.then(t=>me=t);var ge=class{constructor(t={}){Pt(this,"updateView",function(){let t=new it,e=[],n=new $(0,0,-1),s=new $(0,0,-1),i=new $,r=new $;return function(a=!1,o){let l=this.updateMatrixWorldsInWorkerIfNeeded(),d=this.cropsChanged();if(!a){s.set(0,0,-1).applyQuaternion(o.quaternion);let t=!1,e=!1;if(s.dot(n)<=.95&&(t=!0),r.copy(o.position).sub(i).length()>=1&&(e=!0),!(t||e||l||d||this.needsInitialRender))return}this.needsInitialRender=!1,i.copy(o.position),n.copy(s),t.copy(o.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),e[0]=o.position.x,e[1]=o.position.y,e[2]=o.position.z;let c={sort:{view:t.elements,cameraPosition:e,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...l?{newMatrixWorlds:this.meshMatrixWorlds}:{},...d?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=c:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(c))}}()),this.scene=t.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=(new it).makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(t,e){let n=new H;null!==this.splatMesh&&this.splatMesh.getSplatCount()>0&&(t.getSize(n),this.cameraFocalLengthX=e.projectionMatrix.elements[0]*this.devicePixelRatio*n.x*.45,this.cameraFocalLengthY=e.projectionMatrix.elements[5]*this.devicePixelRatio*n.y*.45,this.splatMesh.updateUniforms(n,this.cameraFocalLengthX,this.cameraFocalLengthY,e.isPerspectiveCamera?-1:e.zoom*this.devicePixelRatio))}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=(new $).fromArray(t.position)),t.orientation&&(t.orientation=(new J).fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseVisibleEntity(t=>{"Splat"===t.data.type&&e.push(t)}),this.splatMesh&&this.splatMesh.dispose(),0===e.length)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(t=>t.matrixWorld),this.meshMatrixWorldsOld=e.map(t=>t.matrixWorld.clone()),this.cropsArray=e.map(t=>t.data.crops.map(t=>t.data)),this._splatBufferCache??(this._splatBufferCache=new WeakMap);let n=e.map(t=>{let e=this._splatBufferCache.get(t.data.buffer);return void 0===e&&(e=new me.GSplineBuffer(new Uint8Array(t.data.buffer).buffer),this._splatBufferCache.set(t.data.buffer,e)),e}),s=0,i=[0];for(let t of n)s+=t.getSplatCount(),i.push(s);return this.setupSplatMesh(n,s,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,i,this.meshMatrixWorlds),this.setupSortWorker(s),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,16*e);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((t,e)=>t.equals(this.meshMatrixWorldsOld[e]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(t=>t.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,n)=>{e.data.crops.forEach((e,s)=>{void 0===this.cropsArray[n][s]?(t=!0,this.cropsArray[n][s]=e.data):Object.entries(e.data).forEach(([e,i])=>{(Array.isArray(i)&&i.some((t,i)=>t!==this.cropsArray[n][s][e][i])||i!==this.cropsArray[n][s]?.[e])&&(t=!0,this.cropsArray[n][s][e]=i)})}),e.data.crops.length!==this.cropsArray[n]?.length&&(this.cropsArray[n].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,n=new $,s=new J,i=!1,r=1,a,o){this.splatMesh=qt.buildMesh(t,e,i,r,a,o),this.splatMesh.position.copy(n),this.splatMesh.quaternion.copy(s),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=e,this.splatMesh.onBeforeRender=(t,e,n)=>this.update(t,n)}setupSortWorker(t){this.sortWorker=function(t){let e=new Worker(URL.createObjectURL(new Blob(["(","\nfunction sortWorker(self) {\n\tlet wasmInstance;\n\tlet splatCount;\n\tlet splatRC;\n\tlet indexesOffset;\n\tlet positionsOffset;\n\tlet viewProjOffset;\n\tlet frequenciesOffset;\n\tlet indexesOutOffset;\n\tlet sortBuffersOffset;\n\tlet wasmMemory;\n\tlet positions;\n\n\tlet Constants;\n\tlet floatPositions;\n\tlet meshIndexIntervals;\n\tlet meshMatrixWorlds;\n\tlet cropsArray;\n\n\tfunction sort(viewProj) {\n\t\t// console.time('WASM SORT');\n\t\tconst viewProjArray = new Float64Array(wasmMemory, viewProjOffset, 16);\n\t\tfor (let i = 0; i < 16; i++) {\n\t\t\tviewProjArray[i] = viewProj[i];\n\t\t}\n\t\tlet indexesBuffer;\n\t\t// console.timeEnd('WASM SORT');\n\t\tif (splatRC > 1) {\n\t\t\twasmInstance.exports.sortIndexes(\n\t\t\t\tindexesOffset,\n\t\t\t\tpositionsOffset,\n\t\t\t\tsortBuffersOffset,\n\t\t\t\tviewProjOffset,\n\t\t\t\tfrequenciesOffset,\n\t\t\t\tindexesOutOffset,\n\t\t\t\tConstants.DepthMapRange,\n\t\t\t\tsplatRC\n\t\t\t);\n\t\t\tconst indexes = new Uint32Array(splatRC);\n\t\t\tindexesBuffer = indexes.buffer;\n\t\t\tindexes.set(new Uint32Array(wasmMemory, indexesOutOffset, splatRC));\n\t\t} else if (splatRC === 1) {\n\t\t\tconst indexes = new Uint32Array(splatRC);\n\t\t\tindexes[0] = new Uint32Array(wasmMemory, indexesOffset, splatCount)[0];\n\t\t\tindexesBuffer = indexes.buffer;\n\t\t} else {\n\t\t\tindexesBuffer = new ArrayBuffer(0);\n\t\t}\n\n\t\tself.postMessage(\n\t\t\t{\n\t\t\t\tsortDone: true,\n\t\t\t\tindexesBuffer,\n\t\t\t},\n\t\t\t[indexesBuffer]\n\t\t);\n\t}\n\tfunction updateRenderedSplats(\n\t\tmeshMatrixWorlds,\n\t\tcropsArray,\n\t\tmeshIndexIntervals\n\t) {\n\t\tconst renderedPositions = new Float32Array(\n\t\t\twasmMemory,\n\t\t\tpositionsOffset,\n\t\t\tsplatCount * 3\n\t\t);\n\t\tsplatRC = 0;\n\t\tconst wasmMemoryIndexes = new Uint32Array(\n\t\t\twasmMemory,\n\t\t\tindexesOffset,\n\t\t\tsplatCount\n\t\t);\n\t\tfor (let i = 0; i < meshIndexIntervals.length - 1; i++) {\n\t\t\tconst crops = cropsArray[i];\n\t\t\tconst matrixWorld = meshMatrixWorlds[i].elements;\n\t\t\tconst paramsIn = crops\n\t\t\t\t.filter((a) => a.enabled && a.mode === 'Include')\n\t\t\t\t.map((c) =>\n\t\t\t\t\tc.type === 'Box'\n\t\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t\t);\n\t\t\tconst paramsOut = crops\n\t\t\t\t.filter((a) => a.enabled && a.mode === 'Exclude')\n\t\t\t\t.map((c) =>\n\t\t\t\t\tc.type === 'Box'\n\t\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t\t);\n\t\t\tfor (let j = meshIndexIntervals[i]; j < meshIndexIntervals[i + 1]; j++) {\n\t\t\t\tconst x = floatPositions[j * 3];\n\t\t\t\tconst y = floatPositions[j * 3 + 1];\n\t\t\t\tconst z = floatPositions[j * 3 + 2];\n\t\t\t\tif (\n\t\t\t\t\t(paramsIn.length === 0 || isInBounds(x, y, z, paramsIn)) &&\n\t\t\t\t\t(paramsOut.length === 0 || !isInBounds(x, y, z, paramsOut))\n\t\t\t\t) {\n\t\t\t\t\tconst w =\n\t\t\t\t\t\t1 /\n\t\t\t\t\t\t(matrixWorld[3] * x +\n\t\t\t\t\t\t\tmatrixWorld[7] * y +\n\t\t\t\t\t\t\tmatrixWorld[11] * z +\n\t\t\t\t\t\t\tmatrixWorld[15]);\n\t\t\t\t\trenderedPositions[splatRC * 3] =\n\t\t\t\t\t\t(matrixWorld[0] * x +\n\t\t\t\t\t\t\tmatrixWorld[4] * y +\n\t\t\t\t\t\t\tmatrixWorld[8] * z +\n\t\t\t\t\t\t\tmatrixWorld[12]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\trenderedPositions[splatRC * 3 + 1] =\n\t\t\t\t\t\t(matrixWorld[1] * x +\n\t\t\t\t\t\t\tmatrixWorld[5] * y +\n\t\t\t\t\t\t\tmatrixWorld[9] * z +\n\t\t\t\t\t\t\tmatrixWorld[13]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\trenderedPositions[splatRC * 3 + 2] =\n\t\t\t\t\t\t(matrixWorld[2] * x +\n\t\t\t\t\t\t\tmatrixWorld[6] * y +\n\t\t\t\t\t\t\tmatrixWorld[10] * z +\n\t\t\t\t\t\t\tmatrixWorld[14]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\twasmMemoryIndexes[splatRC] = j;\n\t\t\t\t\tsplatRC++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction getOutOfBoundsIndexes(floatPositions, crops) {\n\t\tconst outOfBoundsIndexes = [];\n\t\tconst paramsIn = crops\n\t\t\t.filter((a) => a.enabled && a.mode === 'Include')\n\t\t\t.map((c) =>\n\t\t\t\tc.type === 'Box'\n\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t);\n\t\tconst paramsOut = crops\n\t\t\t.filter((a) => a.enabled && a.mode === 'Exclude')\n\t\t\t.map((c) =>\n\t\t\t\tc.type === 'Box'\n\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t);\n\n\t\tconst len = floatPositions.length;\n\t\tfor (let j = 0; j < len; j += 3) {\n\t\t\tconst x = floatPositions[j];\n\t\t\tconst y = floatPositions[j + 1];\n\t\t\tconst z = floatPositions[j + 2];\n\t\t\tif (\n\t\t\t\t(paramsIn.length === 0 || isInBounds(x, y, z, paramsIn)) &&\n\t\t\t\t(paramsOut.length === 0 || !isInBounds(x, y, z, paramsOut))\n\t\t\t) {\n\t\t\t\t// in bounds: intentionally skip\n\t\t\t} else {\n\t\t\t\toutOfBoundsIndexes.push(j / 3);\n\t\t\t}\n\t\t}\n\t\t// console.log(outOfBoundsIndexes);\n\t\treturn outOfBoundsIndexes;\n\t}\n\n\tfunction isInBounds(x, y, z, params, mode) {\n\t\treturn params[mode === 'Intersect' ? 'every' : 'some']((param) => {\n\t\t\tconst t = applyRotationMatrix(\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\tz,\n\t\t\t\tparam.invRotationMatrix,\n\t\t\t\tparam.cropCenter\n\t\t\t);\n\t\t\treturn Array.isArray(param)\n\t\t\t\t? isVertexInsideBoundingBox(t.x, t.y, t.z, param)\n\t\t\t\t: isPointInsideEllipsoid(t.x, t.y, t.z, param);\n\t\t});\n\t}\n\tfunction applyRotationMatrix(_x, _y, _z, e, pivot) {\n\t\tconst x = _x - pivot[0];\n\t\tconst y = _y - pivot[1];\n\t\tconst z = _z - pivot[2];\n\t\tconst w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\n\t\treturn {\n\t\t\tx: (e[0] * x + e[4] * y + e[8] * z + e[12]) * w + pivot[0],\n\t\t\ty: (e[1] * x + e[5] * y + e[9] * z + e[13]) * w + pivot[1],\n\t\t\tz: (e[2] * x + e[6] * y + e[10] * z + e[14]) * w + pivot[2],\n\t\t};\n\t}\n\tfunction computeBoundingBoxVertices(box) {\n\t\tconst halfSizeX = box.cropSize[0] / 2;\n\t\tconst halfSizeY = box.cropSize[1] / 2;\n\t\tconst halfSizeZ = box.cropSize[2] / 2;\n\t\tconst bounds = [\n\t\t\tbox.cropCenter[0] - halfSizeX,\n\t\t\tbox.cropCenter[1] - halfSizeY,\n\t\t\tbox.cropCenter[2] - halfSizeZ,\n\t\t\tbox.cropCenter[0] + halfSizeX,\n\t\t\tbox.cropCenter[1] + halfSizeY,\n\t\t\tbox.cropCenter[2] + halfSizeZ,\n\t\t];\n\t\tconst invRotationMatrix = getInvRotationMatrix(box.cropRotation);\n\t\treturn Object.assign(bounds, {\n\t\t\tinvRotationMatrix,\n\t\t\tcropCenter: box.cropCenter,\n\t\t});\n\t}\n\tfunction getInvRotationMatrix(_rotation) {\n\t\tconst te = [];\n\t\tconst x = (_rotation[0] * Math.PI) / 180,\n\t\t\ty = (_rotation[1] * Math.PI) / 180,\n\t\t\tz = (_rotation[2] * Math.PI) / 180;\n\t\tconst a = Math.cos(x),\n\t\t\tb = Math.sin(x);\n\t\tconst c = Math.cos(y),\n\t\t\td = Math.sin(y);\n\t\tconst e = Math.cos(z),\n\t\t\tf = Math.sin(z);\n\t\tconst ae = a * e,\n\t\t\taf = a * f,\n\t\t\tbe = b * e,\n\t\t\tbf = b * f;\n\n\t\tte[0] = c * e;\n\t\tte[1] = -c * f;\n\t\tte[2] = d;\n\n\t\tte[4] = af + be * d;\n\t\tte[5] = ae - bf * d;\n\t\tte[6] = -b * c;\n\n\t\tte[8] = bf - ae * d;\n\t\tte[9] = be + af * d;\n\t\tte[10] = a * c;\n\n\t\tte[12] = 0;\n\t\tte[13] = 0;\n\t\tte[14] = 0;\n\n\t\tte[3] = 0;\n\t\tte[7] = 0;\n\t\tte[11] = 0;\n\t\tte[15] = 1;\n\n\t\treturn te;\n\t}\n\tfunction isVertexInsideBoundingBox(x, y, z, bounds) {\n\t\treturn (\n\t\t\tx >= bounds[0] &&\n\t\t\tx <= bounds[3] &&\n\t\t\ty >= bounds[1] &&\n\t\t\ty <= bounds[4] &&\n\t\t\tz >= bounds[2] &&\n\t\t\tz <= bounds[5]\n\t\t);\n\t}\n\tfunction computeEllipsoidParams(ellipsoid) {\n\t\t// Precompute the scaling factors\n\t\tconst invRadiusX = 2 / ellipsoid.cropSize[0];\n\t\tconst invRadiusY = 2 / ellipsoid.cropSize[1];\n\t\tconst invRadiusZ = 2 / ellipsoid.cropSize[2];\n\t\tconst invRotationMatrix = getInvRotationMatrix(ellipsoid.cropRotation);\n\t\treturn {\n\t\t\tinvRadiusX,\n\t\t\tinvRadiusY,\n\t\t\tinvRadiusZ,\n\t\t\tcropCenter: ellipsoid.cropCenter,\n\t\t\tinvRotationMatrix,\n\t\t};\n\t}\n\tfunction isPointInsideEllipsoid(x, y, z, ellipsoidParams) {\n\t\tconst _x = (x - ellipsoidParams.cropCenter[0]) * ellipsoidParams.invRadiusX;\n\t\tconst _y = (y - ellipsoidParams.cropCenter[1]) * ellipsoidParams.invRadiusY;\n\t\tconst _z = (z - ellipsoidParams.cropCenter[2]) * ellipsoidParams.invRadiusZ;\n\t\treturn _x * _x + _y * _y + _z * _z <= 1;\n\t}\n\n\tself.onmessage = (e) => {\n\t\tif (e.data.getCroppedIndexes) {\n\t\t\tconst outOfBoundsIndexes = new Uint32Array(\n\t\t\t\tgetOutOfBoundsIndexes(new Float32Array(e.data.positions), e.data.crops)\n\t\t\t).buffer;\n\t\t\tself.postMessage(\n\t\t\t\t{\n\t\t\t\t\toutOfBoundsIndexes,\n\t\t\t\t},\n\t\t\t\t[outOfBoundsIndexes]\n\t\t\t);\n\t\t} else if (e.data.positions) {\n\t\t\tpositions = e.data.positions;\n\t\t\tfloatPositions = new Float32Array(positions);\n\t\t\tmeshMatrixWorlds = e.data.meshMatrixWorlds;\n\t\t\tcropsArray = e.data.cropsArray;\n\t\t\tmeshIndexIntervals = e.data.meshIndexIntervals;\n\t\t\tupdateRenderedSplats(meshMatrixWorlds, cropsArray, meshIndexIntervals);\n\t\t\tself.postMessage({\n\t\t\t\tsortSetupComplete: true,\n\t\t\t});\n\t\t} else if (e.data.sort || e.data.newMatrixWorlds || e.data.newCropsArray) {\n\t\t\tif (e.data.newMatrixWorlds || e.data.newCropsArray) {\n\t\t\t\tcropsArray = e.data.newCropsArray || cropsArray;\n\t\t\t\tmeshMatrixWorlds = e.data.newMatrixWorlds || meshMatrixWorlds;\n\t\t\t\tupdateRenderedSplats(meshMatrixWorlds, cropsArray, meshIndexIntervals);\n\t\t\t}\n\t\t\tsort(e.data.sort.view, e.data.sort.cameraPosition);\n\t\t} else if (e.data.init) {\n\t\t\t// Yep, this is super hacky and gross :(\n\t\t\tConstants = e.data.init.Constants;\n\n\t\t\tsplatCount = e.data.init.splatCount;\n\n\t\t\tconst INDEXES_BYTES_PER_ENTRY = Constants.BytesPerInt;\n\t\t\tconst POSITIONS_BYTES_PER_ENTRY = Constants.BytesPerFloat * 3;\n\n\t\t\tconst sorterWasmBytes = new Uint8Array(e.data.init.sorterWasmBytes);\n\t\t\tconst memoryBytesPerVertex =\n\t\t\t\tINDEXES_BYTES_PER_ENTRY + POSITIONS_BYTES_PER_ENTRY;\n\t\t\tconst memoryRequiredForVertices = splatCount * memoryBytesPerVertex;\n\t\t\tconst memoryRequiredForSortBuffers =\n\t\t\t\tsplatCount * Constants.BytesPerInt * 2 +\n\t\t\t\tConstants.DepthMapRange * Constants.BytesPerInt * 2;\n\t\t\tconst extraMemory = Constants.MemoryPageSize * 32;\n\t\t\tconst totalRequiredMemory =\n\t\t\t\tmemoryRequiredForVertices + memoryRequiredForSortBuffers + extraMemory;\n\t\t\tconst totalPagesRequired =\n\t\t\t\tMath.floor(totalRequiredMemory / Constants.MemoryPageSize) + 1;\n\t\t\tconst sorterWasmImport = {\n\t\t\t\tmodule: {},\n\t\t\t\tenv: {\n\t\t\t\t\tmemory: new WebAssembly.Memory({\n\t\t\t\t\t\tinitial: totalPagesRequired * 2,\n\t\t\t\t\t\tmaximum: totalPagesRequired * 3,\n\t\t\t\t\t\tshared: true,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t};\n\t\t\tWebAssembly.compile(sorterWasmBytes)\n\t\t\t\t.then((wasmModule) => {\n\t\t\t\t\treturn WebAssembly.instantiate(wasmModule, sorterWasmImport);\n\t\t\t\t})\n\t\t\t\t.then((instance) => {\n\t\t\t\t\twasmInstance = instance;\n\t\t\t\t\tindexesOffset = 0;\n\t\t\t\t\tpositionsOffset = splatCount * INDEXES_BYTES_PER_ENTRY;\n\t\t\t\t\tviewProjOffset =\n\t\t\t\t\t\tpositionsOffset + splatCount * POSITIONS_BYTES_PER_ENTRY;\n\t\t\t\t\tsortBuffersOffset = viewProjOffset + 16 * Constants.BytesPerFloat * 2;\n\t\t\t\t\tfrequenciesOffset =\n\t\t\t\t\t\tsortBuffersOffset + splatCount * Constants.BytesPerInt;\n\t\t\t\t\tindexesOutOffset =\n\t\t\t\t\t\tfrequenciesOffset + Constants.DepthMapRange * Constants.BytesPerInt;\n\t\t\t\t\twasmMemory = sorterWasmImport.env.memory.buffer;\n\t\t\t\t\tself.postMessage({\n\t\t\t\t\t\tsortSetupPhase1Complete: true,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t}\n\t};\n}\n",")(self)"],{type:"application/javascript"}))),n=atob("AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"),s=new Uint8Array(n.length);for(let t=0;t<n.length;t++)s[t]=n.charCodeAt(t);return e.postMessage({init:{sorterWasmBytes:s.buffer,splatCount:t,Constants:{BytesPerFloat:ye.BytesPerFloat,BytesPerInt:ye.BytesPerInt,DepthMapRange:ye.DepthMapRange,MemoryPageSize:ye.MemoryPageSize}}}),e}(t),this.sortWorker.onmessage=t=>{t.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(t.data.indexesBuffer)),this.lastSortTime=t.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):t.data.sortCanceled?this.sortRunning=!1:t.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):t.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(t,e){null!==this.splatMesh&&(this.updateSplatMeshUniforms(t,e),this.updateView(!1,e))}getSplatMesh(){return this.splatMesh}},xe=new ft;xe.wireframe=!0;var ve=new $,Ae=class extends ot{constructor(t,n){super(),this.data=t,this.sharedAssets=n,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this._normalPassNeeds={outline:!1,cavity:!1},this._needsReflection=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.hairInstances=[],this.shadowsDirty=!0,this.instanceGroupsDirty=!0,this._autoInstancing=null,this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new fe,this.invisibleObjects=new e("jflkdsafjasdifjaslk",{...Z.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(t,n),this.matrixAutoUpdate=!1,this.errorPage=new a("fdasfa",{...N.defaultData,name:""},{shared:n,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markShadowsDirty(){this.shadowsDirty=!0}markInstanceGroupsDirty(){this.instanceGroupsDirty=!0}get autoInstancing(){return this._autoInstancing}updateInstanceGroups(t,e){let n=this._autoInstancing;(null===n||n.minGroupSize!==e)&&(n?.dispose(),n=new Ut(e),this._autoInstancing=n);let s=this.instanceGroupsDirty;return this.instanceGroupsDirty=!1,n.update(t,s),n.stats}releaseInstanceGroups(){this._autoInstancing?.teardown(),this.instanceGroupsDirty=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this.shadowsDirty=!0,this.instanceGroupsDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=s(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._normalPassNeeds=n(this),this._needsNormal=this._normalPassNeeds.outline||this._normalPassNeeds.cavity,this.needsNormalDirty=!1),this._needsNormal}normalPassNeeds(){return this.needsNormal(),this._normalPassNeeds}needsReflection(){return this.needsReflectionDirty&&(this._needsReflection=i(this),this.needsReflectionDirty=!1),this._needsReflection}registerInstanceAndSetUuid(t){let e=t.identity.join("-"),n=this.entityIdentityToEntity[e];n&&(t.uuid=n.uuid),this.entityIdentityToEntity[e]=t,this.entityByUuid[t.uuid]=t}markPenumbraSizeDirty(){for(let t of this.children)t instanceof a&&(t.penumbraSizeArrayCache=null)}findInstance(t){return this.entityIdentityToEntity[t.join("-")]}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(t){let e=this.find(t);if(void 0===e)return;let n=[],s=e;for(;s!==this;){let t=s;s=s.parent;let e=s.children.indexOf(t);n.splice(0,0,e)}return{entity:e,sortKey:n}}getAllSorted(t){let e=[];for(let n of t){let t=this.getWithSortKey(n.id);void 0!==t&&e.push(t)}return e.sort((t,e)=>L(t.sortKey,e.sortKey)),e.map(t=>t.entity)}nonExistOrDescendantOf(t,e){let n=this.find(t);if(void 0===n)return!0;for(;n;){if(n.uuid===e)return!0;n=n.parent}return!1}find(t){if(this.activePage&&this.activePage.personalCamera.parent){if("f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera"===t)return this.activePage.personalCamera;if(t===Q)return this.activePage.personalCamera}if(""===t||void 0===t)return;let e=this.entityByUuid[t];return void 0===e?this.getObjectByProperty("uuid",t):e}find2D(t){for(let e of this.children)if(e instanceof a&&e.uiScene){let n=e.uiScene.find(t);if(n)return n}}findScene2DfromObject2D(t){for(let e of this.children)if(e instanceof a&&e.uiScene&&e.uiScene.find(t))return e.uiScene}find2DInUIObjects(t){let e;return this.traverseEntity(n=>{void 0===e&&j(n)&&(e=n.uiCanvas.find(t))}),e}traverse2D(t){for(let e of this.children)e instanceof a&&e.uiScene&&e.uiScene.traverse(t)}debugEnsureEntity(t){let e=this.find(t);e?Array.isArray(e.identity)&&void 0===this.findInstance(e.identity)&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(t){this.toExpandCloner.add(t)}addPendingUpdateCloner(t){this.toUpdateCloner.add(t)}markToExpandCloner(t){this.toExpandCloner.add(t),t.traverseEntityAncestors(t=>{this.toExpandCloner.add(t)})}doPendingExpandCloner(t){this.toExpandCloner.forEach(e=>{e.expandCloner(t)}),this.toExpandCloner.clear()}doPendingUpdateCloner(t){this.toUpdateCloner.forEach(e=>{e.cloner?.update(t)}),this.toUpdateCloner.clear()}doPendingUpdates(t){this.doPendingExpandCloner(t),this.doPendingUpdateCloner(t),this.applyPendingCommands()}addPendingCommand(t){this.pendingCommands.push(t)}applyPendingCommands(){this.pendingCommands.forEach(t=>t()),this.pendingCommands.length=0}updateByLibOp(t,e){1===t.path.length&&"components"===t.path[0]&&1===t.type&&this.createChildrenObjects([{...t.data.asset,id:t.id}],this.invisibleObjects,e)}updateTreeByOp(t,e){if(0===t.path.length&&7===t.type){let n=null===t.parent?this:this.find(t.parent);if(void 0===n)throw new Error(`scene tree add: parent ${t.parent} not found for object ${t.id}`);let s=this.createObject(t.id,t.data,t.children,n,t.localIndex,e);s.updateVisible(this),s.resetBBoxNeedsUpdate(),c(s)&&h(s.parent)&&(s.invalidateUpstreamBooleanData(),s.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(s),this.markToExpandCloner(s),this.markPenumbraSizeDirty(),s.updatePathSnapping()}else if(0===t.path.length&&8===t.type){let e=this.find(t.id);if(void 0===e)throw new Error(`scene tree delete: object ${t.id} not found`);e.traverseEntity(t=>{z(t)&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(e=>e!==t)),R(t)&&(this.hairInstances=this.hairInstances.filter(e=>e!==t))}),this.markToExpandCloner(e),e.resetBBoxNeedsUpdate(),this.unregisterObject(e);let n=e.parent;this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(e),this.markPenumbraSizeDirty(),e.parent.remove(e),h(e.parent)&&(e.parent.invalidateUpstreamBooleanData(),e.parent.invalidateDownstreamBooleanData().recomputeBoolean()),c(e)&&(e.freeBooleanPointer(),n instanceof d&&n.invalidateDownstreamBooleanData().recomputeBoolean()),O(e)&&e.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(e),this.pathConstraints.removeDependencies(e.uuid),e.updatePathSnapping()}else if(0===t.path.length&&9===t.type){let e=this.find(t.id);if(void 0===e)throw new Error(`scene tree move: object ${t.id} not found`);this.markNeedsRecomputeInstancesForChildren(e);let n=e.parent;this.markNeedsRecomputeInstancesForAncessors(n),e.cloner?.resetOnMove(),this.markToExpandCloner(e);let s=null===t.parent?this:this.find(t.parent);if(void 0===s)throw new Error(`scene tree move: new parent ${t.parent} not found for object ${t.id}`);s.add(e),this.markNeedsRecomputeInstancesForAncessors(s),this.markToExpandCloner(e),e.invalidateClonerTransform(e),e.updateVisible(this),e.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let i=t.localIndex;s.children.splice(i,0,s.children.pop()),c(e)&&(e.invalidateUpstreamBooleanData(),h(e.parent)?e.parent.invalidateDownstreamBooleanData().recomputeBoolean():n instanceof d&&n.invalidateDownstreamBooleanData().recomputeBoolean()),e.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(t){this.shadowsDirty=!0,this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let e of this.children)e instanceof a&&(e.visible=e.uuid===t,e.visible&&(this.activePage=e,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(t,e,n,s){if(this.shadowsDirty=!0,0===e.type){if(("overrides"in e.props||"component"in e.props)&&this.markNeedsRecomputeInstances(),"visible"in e.props&&this.markPenumbraSizeDirty(),e.path.includes("overrides")&&"states"in e.props){let{rest:t}=e.props;e={...e,props:t},this.markNeedsRecomputeInstances()}"pathSnapping"===e.path[0]&&void 0!==e.props.pathId&&this.pathConstraints.setConstraint(t,e.props.pathId)}let i=this.find(t);if(i)try{(function(t,e,n,s){t.updateByOp(e,n,s,!1)})(i,e,n,{scene:this,shared:s}),i instanceof C&&i.updateGeometryGroupsIfNeeded()}catch(t){console.error(t)}}updateEntity2DByOp(t,e,n,s,i,r=[]){t.updateEntityByOp(e,n,s,i),this.traverseEntity(t=>{(j(t)||t instanceof a)&&(r.includes(t.frameId??"")||t.frameId===e)&&t.updateEntity2DByOp(e,n,s,i)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(t){this.activePage.switchActiveCamera(t)}isInvisibleObjects(t){return t===this.invisibleObjects||t.hasAnccestor(this.invisibleObjects)}init(t,e){let n=Object.entries(e.data.lib.components).map((t,e)=>({data:t[1].asset.data,children:t[1].asset.children,id:t[0],fi:e}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:e}),this.add(this.invisibleObjects),this.createChildrenObjects(n,this.invisibleObjects,e),this.createChildrenObjects(t.objects,this,e),this.updatePage(t.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(e,!0),this.traverseEntity(t=>{t instanceof m&&t.updateUp()}),this.doPendingExpandCloner({scene:this,shared:e}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(t){t.traverseEntity(t=>{("Component"===t.data.type||"Instance"===t.data.type)&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(t){B.is(t)&&("Component"===t.data.type&&this.markNeedsRecomputeInstances(),t.traverseAncestors(t=>{B.is(t)&&"Component"===t.data.type&&this.markNeedsRecomputeInstances()}))}relativeizeInner(t,e,n,s,i,r,a){if(t){let o=s.find(t);o&&o!==s&&i.forInstancesRec(s=>{s.data=Y(s.data,i=>{let o=i.events.data(a.id),l=s.goUp(r);if(l){let s=[...F(l.identity),t].join("-"),i=this.entityIdentityToEntity[s];if(i){let t=i.uuid;q.zoom(o,e)[n]=t}else console.warn("cannot find instance")}}).data})}}rewriteActions(t,e,n,s,i,r){t.forEach(t=>{"Transition"===t.data.type||"Animation"===t.data.type?this.relativeizeInner(t.data.object,[...e,t.id],"object",n,s,i,r):"Conditional"===t.data.type&&(this.rewriteActions(t.data.ifActions,[...e,t.id,"ifActions"],n,s,i,r),this.rewriteActions(t.data.elseActions,[...e,t.id,"elseActions"],n,s,i,r))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(t=>{if(T(t)&&"string"==typeof t.identity&&"Component"===t.data.type)return t.traverseEntity((e,n)=>{e.data.events.forEach(s=>{if("GameControl"===s.data.type){let i=!1;if(e.forInstancesRec(t=>{t.data=Y(t.data,e=>{t.isInstanceRoot||(e.events.delete(s.id),i=!0)}).data}),!1===i)for(let i of V.list)this.rewriteActions(s.data.gameActions[i],["gameActions",i],t,e,n,s)}else"Conditional"===s.data.type?("Distance"===s.data.condition.type?(this.relativeizeInner(s.data.condition.fromObject,["condition"],"fromObject",t,e,n,s),this.relativeizeInner(s.data.condition.toObject,["condition"],"toObject",t,e,n,s)):"State"===s.data.condition.type?this.relativeizeInner(s.data.condition.object,["condition"],"object",t,e,n,s):"Comparison"===s.data.condition.type&&("Property"===s.data.condition.lOperand.type&&this.relativeizeInner(s.data.condition.lOperand.value[0],["condition","lOperand","value"],0,t,e,n,s),"Property"===s.data.condition.rOperand.type&&this.relativeizeInner(s.data.condition.rOperand.value[0],["condition","rOperand","value"],0,t,e,n,s)),this.rewriteActions(s.data.inActions,["inActions"],t,e,n,s),this.rewriteActions(s.data.outActions,["outActions"],t,e,n,s)):"actions"in s.data&&this.rewriteActions(s.data.actions,["actions"],t,e,n,s)})}),!0})}expandInstances(t,e,n){let s=new Set;this.traverseEntity(i=>{if(T(i)&&i.isInstanceRoot)return i.expandInstanceChildren({scene:this,shared:t,pendingDeletes:s}),e||i.resetBBoxNeedsUpdate(),n&&i.traverseEntity(t=>{n.addClip(t)}),!0});for(let t of s)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(t),u(t)}recomputeInstances(t,e){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(t=>{T(t)&&t.isInstanceRoot&&(t.component=void 0)}),this.expandInstances(t,!1,e))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(t){t.traverseEntity(t=>{let e="string"==typeof t.identity?t.identity:t.identity.join("-");this.entityIdentityToEntity[e]===t&&(delete this.entityByUuid[t.uuid],delete this.entityIdentityToEntity[e]),t.dispose()})}clearScene(){this._autoInstancing?.dispose(),this._autoInstancing=null,this.instanceGroupsDirty=!0;for(let t of this.children)B.is(t)&&t.disposeRecursively();this.children.length=0}resetAfterClear(t,e){this.init(t,e)}raycast(t){return this.raycast1(t,!1)}raycast1(t,e){let n=[],s=i=>{for(let a of i.children){let i=a.cloner;if(B.is(a)&&!a.raycastLock&&(a.visible||i?.object.data.visible))if(!0===e&&a.isInstanceRoot){let e=[];if(t.intersectObject(a,!0,e),e.length){let t=e[0];t.object=a,t.point.applyMatrix4(t.object.matrixWorld);let s=a.matrixWorld.clone().invert();t.point.applyMatrix4(s),n.push(t)}}else(c(a)||p(a)&&this.enableHelpers&&a.objectHelper.visible)&&(t.intersectObject(a,!1,n),r(a,t,n)),s(a)}};return s(this.activePage),n}raycastWithClones(t){let e=[],n=s=>{for(let i of s.children){let s=i.cloner;B.is(i)&&(i.visible||s?.object.data.visible)&&((c(i)||p(i)&&this.enableHelpers&&i.objectHelper.visible)&&(t.intersectObject(i,!1,e),r(i,t,e,!0)),n(i))}};return n(this),e}forEachEntity(t){for(let e of this.children)B.is(e)&&t(e)}traverseConcreteEntity(t){for(let e of this.children)B.is(e)&&e.isConcreteEntity&&e.traverseEntity(t)}traverseEntity(t){for(let e of this.children)B.is(e)&&e.traverseEntity(t)}updateFont(t,e){this.traverseEntity(n=>{if(n instanceof C&&"Mesh"===n.data.type&&("TextGeometry"===n.data.geometry.type||"InputGeometry"===n.data.geometry.type)&&n.data.geometry.font===t){let s=n.geometry,i=n.data.geometry;s.updateFont(t,e).then(()=>{s.update(i,e);let t=n.invalidateDownstreamBooleanData();h(t)&&t.recomputeBoolean()})}})}traverseObject(t){for(let e of this.children)S.is(e)&&e.traverseObject(t)}traverseVisibleEntity(t){for(let e of this.children)B.is(e)&&e.visible&&e.traverseVisibleEntity(t)}dispose(){this.clearScene()}createChildrenObjects(t,e,n){let s=0;for(let i of t)this.createObject(i.id,i.data,i.children,e,s,n),s+=1}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let e of t.children)this.unregisterObject(e)}createObject(t,e,n,s,i,r){let a={scene:this,shared:r},o=ue(t,e,a);return z(o)&&this.shapeBlendIntances.push(o),R(o)&&this.hairInstances.push(o),o&&(this.entityByUuid[t]=o,s.add(o),s.children.splice(i,0,s.children.pop()),n.length>0&&(o.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(n,o,r)),o.updateState(e,a),o instanceof C&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),e.pathSnapping?.pathId&&this.pathConstraints.setConstraint(t,e.pathSnapping.pathId)),"Empty"===e.type&&e.animations&&o.traverseEntity(t=>{let e=t.dataPatched;if(t instanceof C&&e.bones&&e.boneInverses){let n=e.bones.map(t=>this.find(t)),s=e.boneInverses.map(t=>(new it).fromArray(t)),i=new wt(n,s);t.bind(i,t.bindMatrix)}else t.matrixAutoUpdate=!0}),o}getCenter(t){let e=[];for(let n=0,s=t.length;n<s;++n){let{id:s,recursive:i}=t[n],r=this.find(s),a=i?r.recursiveBBox:r.singleBBox;e.push(...a.vertices)}let n=new lt;return n.setFromPoints(e),n.getCenter(ve),ve}copyMatrixWorld(t,e){if(null===t)return void e.identity();let n=this.find(t);n?(n.updateWorldMatrix(!0,!1),e.copy(n.matrixWorld)):e.identity()}copyParentMatrixWorld(t,e){if(null===t)return void e.identity();let n=this.find(t)?.parent;n?(n.updateWorldMatrix(!0,!1),e.copy(n.matrixWorld)):e.identity()}traverseMaterial(t){this.traverseEntity(e=>{if(e instanceof D)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)I(e.material[n])&&t(e.material[n]);else I(e.material)&&t(e.material)})}updateViewPlaneSize(t,e,n=!1){this.traverseConcreteEntity(s=>{s instanceof m&&s.setViewplaneSize(t,e,n)})}initializeSplatViewer(){this.splatViewer=new ge({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}};export{kt as a,Bt as b,Ft as c,Xt as d,xe as e,Ae as f};
1
+ import{a as t}from"./runtime-chunk-5MDYMRYM.js";import{a as e}from"./runtime-chunk-4FRVTTCF.js";import{d as n,e as s,f as i,g as r,h as a}from"./runtime-chunk-CUH4PXNR.js";import{a as o,b as l}from"./runtime-chunk-VJPN4EM6.js";import{b as d,e as c,f as h,g as p}from"./runtime-chunk-33KX2TOT.js";import{a as u}from"./runtime-chunk-WFTAZCXD.js";import{a as m}from"./runtime-chunk-44F5FA4N.js";import{a as f}from"./runtime-chunk-EPFYNTQQ.js";import{b as y}from"./runtime-chunk-KRQKRJPD.js";import{a as g,b as x}from"./runtime-chunk-YANJNJO2.js";import{a as v}from"./runtime-chunk-CXBK7LPG.js";import{d as A}from"./runtime-chunk-FJZAL2GU.js";import{K as b,da as C,ea as w,g as I}from"./runtime-chunk-3D6ELLRB.js";import{b as M,c as P,e as S,h as B,v as D}from"./runtime-chunk-R3V4RB3X.js";import{a as R,b as E,c as z,d as O,f as j,i as W,j as T}from"./runtime-chunk-2PT2WH66.js";import{c as _,e as k,g as N}from"./runtime-chunk-TZCHGFVF.js";import{Da as U,K as G,Ka as V,a as F,b as Y,n as L,o as q,w as Q,xa as X}from"./runtime-chunk-VPEJ5BFD.js";import{Aa as Z,Ba as K,Dc as H,Ec as J,Fc as $,Gc as tt,Ge as et,Ja as nt,Oa as st,Oc as it,Ra as rt,Tc as at,Vc as ot,Xc as lt,Yc as dt,Zc as ct,bd as ht,cd as pt,ce as ut,dd as mt,kd as ft,l as yt,ld as gt,mc as xt,md as vt,n as At,nd as bt,od as Ct,pd as wt,qd as It,za as Mt}from"./runtime-chunk-VGN7YHB7.js";import{c as Pt}from"./runtime-chunk-ML3Z74BL.js";var St=null;function Bt(t){St=t}var Dt=new WeakMap,Rt=1;function Et(t){let e=Dt.get(t);return void 0===e&&(e=Rt++,Dt.set(t,e)),e}function zt(t,e,n,s){let i=t,r=e;return[Et(n),Et(s),i.layers?.mask??0,i.renderOrder??0,!0===(i.castShadow??r.castShadow)?1:0,!0===(i.receiveShadow??r.receiveShadow)?1:0].join(":")}var Ot=[8,32,128,512],jt=Ot[Ot.length-1],Wt=(new it).makeScale(0,0,0),Tt=class extends It{constructor(t,e,n,s){super(t,e,n),this.isInstanceGroup=!0,this.members=new Array(n).fill(null),this.raycast=()=>{},this.matrixAutoUpdate=!1,this.frustumCulled=!1,this.adoptPassState(s);for(let t=0;t<n;t++)this.setMatrixAt(t,Wt);this.instanceMatrix.needsUpdate=!0}adoptPassState(t){this.layers.mask=t.layers.mask,this.renderOrder=t.renderOrder,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow}assign(t,e){this.members[t]=e}writeSlot(t,e,n){return!1===n?(this.setMatrixAt(t,Wt),!1):(this.setMatrixAt(t,e.matrixWorld),!0)}park(t){this.members[t]=null,this.setMatrixAt(t,Wt)}get memberCount(){let t=0;for(let e of this.members)null!==e&&t++;return t}};function _t(t,e){let n=e.get(t);if(void 0!==n)return n;let s=t.visible&&(null===t.parent||_t(t.parent,e));return e.set(t,s),s}var kt=8,Nt=class{constructor(t=8){this.minGroupSize=t,this.groups=[],this.groupKeys=new WeakMap,this.placements=new Map,this.visibilityMemo=new Map,this.page=null,this.stats={instancingGroups:0,instancedDrawsSaved:0,instancingRegroups:0,instancingParks:0,instancingIneligible:{}}}update(t,e){this.page!==t&&(this.teardown(),this.page=t,e=!0),!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),e&&this.reconcile(t),this.refresh()}reconcile(t){let e={},n=new Map;t.traverse(t=>{if(!0===t.isInstanceGroup)return;let s=function(t){if(!0!==t.isMesh)return"not-a-mesh";if(z(t)||j(t)||E(t)||R(t))return"excluded-type";let e=function(t){let e=W(t)?t.object:t;return void 0!==e.geometry?e:void 0}(t);if(void 0===e)return"not-a-mesh";let n=e.material;if(void 0===n)return"not-a-mesh";if(Array.isArray(n))return"array-material";let s=e.builtSharedGeometry;if(void 0===s)return"unrealized-geometry";if(!function(t){return!0===t.isShared}(s))return"unshared-geometry";if(void 0===s.attributes.position)return"empty-geometry";if(void 0!==s.morphAttributes.position)return"morph";if(!0===e.isSkinnedMesh)return"skinned";let i=e.morphTargetInfluences;if(void 0!==i&&i.length>0)return"morph";if(0!==s.drawRange.start||s.drawRange.count!==Number.POSITIVE_INFINITY)return"draw-range";let r=n;return null!=r.positionNode||null!=r.castShadowPositionNode?"position-node":!0===r.transparent?"transparent":void 0!==e.userData?.__splinePlanarMirror?"reflection":function(t){let e=t;for(;null!==e;){let t=e.states;if(void 0!==t&&Object.keys(t).length>0)return!0;e=e.parent}return!1}(e)?"interaction-states":{object:t,owner:e,geometry:s,material:n,key:zt(t,e,s,n)}}(t);if("string"==typeof s)return void(e[s]=(e[s]??0)+1);let i=n.get(s.key);void 0===i?n.set(s.key,[s]):i.push(s)});let s=new Map;for(let[t,e]of n)for(let n of e)s.set(n.object,t);let i=!1;for(let[t,e]of this.placements)s.get(t)!==this.groupKeys.get(e.group)&&this.parkPlacement(t,e);for(let t=this.groups.length-1;t>=0;t--){let e=this.groups[t];e.memberCount>=this.minGroupSize||(this.destroyGroup(e),this.groups.splice(t,1),i=!0)}for(let[e,s]of n){let n=s.filter(t=>!this.placements.has(t.object));if(0===n.length)continue;let r=0;for(let t of this.groups){if(r>=n.length)break;if(this.groupKeys.get(t)!==e)continue;let{members:s}=t;for(let e=0;e<s.length&&r<n.length;e++)null===s[e]&&this.place(t,e,n[r++].object)}for(;n.length-r>=this.minGroupSize;){let s=n.slice(r,r+jt);this.groups.push(this.createGroup(t,e,s)),r+=s.length,i=!0}}i&&this.stats.instancingRegroups++,this.publishGroupStats(),this.stats.instancingIneligible=e}createGroup(t,e,n){let s=n[0],i=new Tt(s.geometry,s.material,function(t){for(let e of Ot)if(t<=e)return e;return jt}(n.length),s.object);this.groupKeys.set(i,e);for(let t=0;t<n.length;t++)this.place(i,t,n[t].object);return t.add(i),i}destroyGroup(t){for(let e=0;e<t.members.length;e++){let n=t.members[e];null!==n&&this.parkPlacement(n,{group:t,slot:e})}t.removeFromParent(),t.dispose()}place(t,e,n){t.assign(e,n),this.placements.set(n,{group:t,slot:e}),n.isDrawSuppressed=!0}parkPlacement(t,e){e.group.park(e.slot),e.group.instanceMatrix.needsUpdate=!0,this.placements.delete(t),t.isDrawSuppressed=!1,this.stats.instancingParks++}refresh(){this.visibilityMemo.clear();for(let t of this.groups){let{members:e}=t,n=null;for(let s=0;s<e.length;s++){let i=e[s];null!==i&&(null===n&&(n=i),t.writeSlot(s,i,_t(i,this.visibilityMemo)))}null!==n&&(t.adoptPassState(n),t.instanceMatrix.needsUpdate=!0)}}teardown(){for(let t of this.groups)this.destroyGroup(t);this.groups.length=0;for(let t of this.placements.keys())t.isDrawSuppressed=!1;this.placements.clear(),this.publishGroupStats()}dispose(){this.teardown(),this.page=null}publishGroupStats(){let t=0;for(let e of this.groups){let n=e.memberCount;n>0&&(t+=n-1)}this.stats.instancingGroups=this.groups.length,this.stats.instancedDrawsSaved=t}},Ut=function(){let t=new Float32Array(1),e=new Int32Array(t.buffer);return function(n){return t[0]=n,e[0]}}(),Gt=function(t,e,n,s){return t+(e<<8)+(n<<16)+(s<<24)},Vt=new H;function Ft(t){let e=!1;return t.scene.objects.traverse((t,n)=>{if(!1===n.visible)return!0;"Splat"===n.type&&(e=!0)}),e}var Yt,Lt,qt=class extends gt{constructor(t,e,n,s,i=!1,r=1,a,o){super(n,s),this.splatCount=e,this.meshIndexIntervals=a,this.meshMatrixWorlds=o,this.splatBuffers=t,this.geometry=n,this.material=s,this.splatDataTextures=null,this.halfPrecisionCovariancesOnGPU=i,this.devicePixelRatio=r,this.resetLocalSplatDataAndTexturesFromSplatBuffer()}static buildMesh(t,e,n=!1,s=1,i,r){let a=qt.buildGeomtery(e),o=qt.buildMaterial(i);return new qt(t,e,a,o,n,s,i,r)}static buildMaterial(t){if("webgpu"===b()&&St)return St.createSplatMaterial(t);let e={covariancesTexture:{type:"t",value:null},centersColorsTexture:{type:"t",value:null},meshIndexIntervals:{value:t},meshMatrixWorldsTexture:{type:"t",value:null},focal:{type:"v2",value:new H},viewport:{type:"v2",value:new H},basisViewport:{type:"v2",value:new H},debugColor:{type:"v3",value:new at},covariancesTextureSize:{type:"v2",value:new H(1024,1024)},centersColorsTextureSize:{type:"v2",value:new H(1024,1024)},orthoZoom:{type:"f",value:-1}};return new ut({uniforms:e,vertexShader:"\n precision highp float;\n #include <common>\n\n attribute uint splatIndex;\n\n uniform highp sampler2D covariancesTexture;\n uniform highp usampler2D centersColorsTexture;\n uniform vec2 focal;\n uniform vec2 viewport;\n uniform vec2 basisViewport;\n uniform vec2 covariancesTextureSize;\n uniform vec2 centersColorsTextureSize;\n\t\t\t\t\t\tuniform highp sampler2D meshMatrixWorldsTexture;\n\t\t\t\t\t\tuniform uint meshIndexIntervals[257];\n\t\t\t\t\t\tuniform float orthoZoom;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\n const vec4 encodeNorm4 = vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0);\n const uvec4 mask4 = uvec4(uint(0x000000FF), uint(0x0000FF00), uint(0x00FF0000), uint(0xFF000000));\n const uvec4 shift4 = uvec4(0, 8, 16, 24);\n vec4 uintToRGBAVec (uint u) {\n uvec4 urgba = mask4 & u;\n urgba = urgba >> shift4;\n vec4 rgba = vec4(urgba) * encodeNorm4;\n return rgba;\n }\n\n vec2 getDataUV(in int stride, in int offset, in vec2 dimensions) {\n vec2 samplerUV = vec2(0.0, 0.0);\n float d = float(splatIndex * uint(stride) + uint(offset)) / dimensions.x;\n samplerUV.y = float(floor(d)) / dimensions.y;\n samplerUV.x = fract(d);\n return samplerUV;\n }\n\n void main () {\n uvec4 sampledCenterColor = texture(centersColorsTexture, getDataUV(1, 0, centersColorsTextureSize));\n vec3 splatCenter = uintBitsToFloat(uvec3(sampledCenterColor.gba));\n vColor = uintToRGBAVec(sampledCenterColor.r);\n\n vPosition = position.xy * 2.0;\n\n\t\t\t\t\t\t\t\tuint meshIndex;\n\t\t\t\t\t\t\t\tfor (int i = 1; i < 257; i++) {\n\t\t\t\t\t\t\t\t\tif (splatIndex < meshIndexIntervals[i]) {\n\t\t\t\t\t\t\t\t\t\tmeshIndex = uint(i - 1);\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tfloat strideMulmeshIndex = float(4u*meshIndex);\n\t\t\t\t\t\t\t\tfloat meshMatrixWorldsTextureLength = float(256*4);\n\n\t\t\t\t\t\t\t\tmat4 modelMat = mat4(\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+0.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+1.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+2.0)/meshMatrixWorldsTextureLength, 0)),\n\t\t\t\t\t\t\t\t\ttexture(meshMatrixWorldsTexture, vec2((strideMulmeshIndex+3.0)/meshMatrixWorldsTextureLength, 0))\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tmat4 modelViewMat = viewMatrix * modelMat;\n\t\t\t\t\t\t\t\tvec4 viewCenter = modelViewMat * vec4(splatCenter, 1.0); \n vec4 clipCenter = projectionMatrix * viewCenter;\n\n vec2 sampledCovarianceA = texture(covariancesTexture, getDataUV(3, 0, covariancesTextureSize)).rg;\n vec2 sampledCovarianceB = texture(covariancesTexture, getDataUV(3, 1, covariancesTextureSize)).rg;\n vec2 sampledCovarianceC = texture(covariancesTexture, getDataUV(3, 2, covariancesTextureSize)).rg;\n\n vec3 cov3D_M11_M12_M13 = vec3(sampledCovarianceA.rg, sampledCovarianceB.r);\n vec3 cov3D_M22_M23_M33 = vec3(sampledCovarianceB.g, sampledCovarianceC.rg);\n\n \n mat3 Vrk = mat3(\n cov3D_M11_M12_M13.x, cov3D_M11_M12_M13.y, cov3D_M11_M12_M13.z,\n cov3D_M11_M12_M13.y, cov3D_M22_M23_M33.x, cov3D_M22_M23_M33.y,\n cov3D_M11_M12_M13.z, cov3D_M22_M23_M33.y, cov3D_M22_M23_M33.z\n );\n float s = 1.0 / (viewCenter.z * viewCenter.z);\n\n mat3 W = transpose(mat3(modelViewMat));\n mat3 T = orthoZoom > 0.0 ? W : W * mat3(\n\t\t\t\t\t\t\t\t\tfocal.x / viewCenter.z, 0., -(focal.x * viewCenter.x) * s,\n\t\t\t\t\t\t\t\t\t0., focal.y / viewCenter.z, -(focal.y * viewCenter.y) * s,\n\t\t\t\t\t\t\t\t\t0., 0., 0.\n\t\t\t\t\t\t\t\t);\n mat3 cov2Dm = transpose(T) * Vrk * T;\n cov2Dm[0][0] += 0.3;\n cov2Dm[1][1] += 0.3;\n\n \n \n \n \n vec3 cov2Dv = vec3(cov2Dm[0][0], cov2Dm[0][1], cov2Dm[1][1]);\n\n vec3 ndcCenter = clipCenter.xyz / clipCenter.w;\n\n \n \n \n \n \n \n \n \n float a = cov2Dv.x;\n float d = cov2Dv.z;\n float b = cov2Dv.y;\n float D = a * d - b * b;\n float trace = a + d;\n float traceOver2 = 0.5 * trace;\n float term2 = sqrt(trace * trace / 4.0 - D);\n float eigenValue1 = traceOver2 + term2;\n\t\t\t\t\t\t\t\tfloat eigenValue2 = max(traceOver2 - term2, 0.00); \n\n const float maxSplatSize = 1024.0;\n vec2 eigenVector1 = normalize(vec2(b, eigenValue1 - a));\n \n vec2 eigenVector2 = vec2(eigenVector1.y, -eigenVector1.x);\n vec2 basisVector1 = eigenVector1 * min(sqrt(2.0 * eigenValue1), maxSplatSize);\n vec2 basisVector2 = eigenVector2 * min(sqrt(2.0 * eigenValue2), maxSplatSize);\n\n vec2 ndcOffset = vec2(vPosition.x * basisVector1 + vPosition.y * basisVector2) * basisViewport;\n\n\t\t\t\t\t\t\t\tif (orthoZoom > 0.0) {\n\t\t\t\t\t\t\t\t\tndcOffset *= orthoZoom;\n\t\t\t\t\t\t\t\t}\n\n gl_Position = vec4(ndcCenter.xy + ndcOffset, ndcCenter.z, 1.0);\n }",fragmentShader:"\n precision highp float;\n #include <common>\n\n uniform vec3 debugColor;\n\n varying vec4 vColor;\n varying vec2 vUv;\n\n varying vec2 vPosition;\n\t\t\t\t\t\tlayout(location = 1) out vec4 gVelocity; \n\n void main () {\n \n \n float A = -dot(vPosition, vPosition);\n if (A < -4.0) discard;\n vec3 color = vColor.rgb;\n A = exp(A) * vColor.a;\n gl_FragColor = vec4(color.rgb, A);\n\t\t\t\t\t\t\t\tgVelocity = vec4(0.0); \n }",transparent:!0,alphaTest:1,blending:At,depthTest:!0,depthWrite:!1,side:yt})}static buildGeomtery(t){let e=new mt;e.setIndex([0,1,2,0,2,3]);let n=new Float32Array(12),s=new ct(n,3);e.setAttribute("position",s),s.setXYZ(0,-1,-1,0),s.setXYZ(1,-1,1,0),s.setXYZ(2,1,1,0),s.setXYZ(3,1,-1,0),s.needsUpdate=!0;let i=(new et).copy(e),r=new Uint32Array(t),a=new wt(r,1,!1);return a.setUsage(xt),i.setAttribute("splatIndex",a),i.instanceCount=t,i}resetLocalSplatDataAndTexturesFromSplatBuffer(){this.updateLocalSplatDataFromSplatBuffer(),this.allocateAndStoreLocalSplatDataInTextures()}updateLocalSplatDataFromSplatBuffer(){this.splatBuffers.forEach(t=>t.buildPreComputedBuffers()),this.covariances=new Float32Array(6*this.splatCount),this.colors=new Uint8Array(4*this.splatCount),this.centers=new Float32Array(3*this.splatCount);let t=0,e=0,n=0;for(let s of this.splatBuffers){let i=s.nsplats;this.colors.subarray(t,t+4*i).set(s.colorsA),t+=4*i,this.centers.subarray(e,e+3*i).set(s.decoded.xyz.denormDequant().data),e+=3*i,this.covariances.subarray(n,n+6*i).set(new Float32Array(s.precomputedCovarianceBufferData)),n+=6*i}}allocateAndStoreLocalSplatDataInTextures(){let t=this.splatCount,e=new H(4096,1024);for(;e.x*e.y*2<6*t;)e.y*=2;let n,s,i=new H(4096,1024);for(;i.x*i.y*4<4*t;)i.y*=2;if(this.halfPrecisionCovariancesOnGPU){s=new Uint16Array(e.x*e.y*2);for(let t=0;t<this.covariances.length;t++)s[t]=dt.toHalfFloat(this.covariances[t]);n=new bt(s,e.x,e.y,st,K)}else s=new Float32Array(e.x*e.y*2),s.set(this.covariances),n=new bt(s,e.x,e.y,st,Z);n.needsUpdate=!0,this.material.uniforms.covariancesTexture.value=n,this.material.uniforms.covariancesTextureSize.value.copy(e);let r=new Uint32Array(i.x*i.y*4);for(let e=0;e<t;e++){let t=4*e,n=3*e,s=4*e;r[s]=Gt(this.colors[t],this.colors[t+1],this.colors[t+2],this.colors[t+3]),r[s+1]=Ut(this.centers[n]),r[s+2]=Ut(this.centers[n+1]),r[s+3]=Ut(this.centers[n+2])}let a=new bt(r,i.x,i.y,rt,Mt);"webgpu"!==b()&&(a.internalFormat="RGBA32UI"),a.needsUpdate=!0,this.material.uniforms.centersColorsTexture.value=a,this.material.uniforms.centersColorsTextureSize.value.copy(i);let o=new Float32Array(4096);for(let t=0;t<this.meshMatrixWorlds.length;t++)o.set(this.meshMatrixWorlds[t].elements,16*t);let l=new bt(o,1024,1,nt,Z);l.needsUpdate=!0,this.material.uniforms.meshMatrixWorldsTexture.value=l,this.material.uniformsNeedUpdate=!0,this.splatDataTextures={covariances:{data:s,texture:n,size:e},centerColors:{data:r,texture:a,size:i},meshMatrixWorlds:{data:o,texture:l}}}updateIndexes(t){let e=this.geometry;e.attributes.splatIndex.set(t),e.attributes.splatIndex.needsUpdate=!0,e.instanceCount=t.length}updateUniforms(t,e,n,s){this.splatCount>0&&(Vt.set(t.x*this.devicePixelRatio,t.y*this.devicePixelRatio),this.material.uniforms.viewport.value.copy(Vt),this.material.uniforms.basisViewport.value.set(2/Vt.x,2/Vt.y),this.material.uniforms.focal.value.set(e,n),this.material.uniforms.orthoZoom.value=s,this.material.uniformsNeedUpdate=!0)}getSplatDataTextures(){return this.splatDataTextures}getSplatCount(){return this.splatCount}getCenters(){return this.centers}getColors(){return this.colors}getCovariances(){return this.covariances}dispose(){this.geometry.dispose(),this.material.dispose(),this.splatDataTextures&&(this.splatDataTextures.covariances.texture.dispose(),this.splatDataTextures.centerColors.texture.dispose(),this.splatDataTextures.meshMatrixWorlds.texture.dispose()),this.removeFromParent()}},Qt=new Promise(t=>{Yt=t}),Xt=!1;function Zt(){if(!Xt)return Lt||(Lt=async function(){let t=await import("./gaussian-splat-compression.js");Yt(t),Xt=!0}())}var Kt=new it,Ht=new tt,Jt=new $,$t=new $,te=new $,ee=new $,ne=new $,se=new $;function ie(t,e,n){n.length=0;let{axis:s,sign:i,limit:r}=e;for(let e=0;e<t.length;e++){let a=t[e],o=t[(e+1)%t.length],l=(0===s?a.px:1===s?a.py:a.pz)*i-r,d=(0===s?o.px:1===s?o.py:o.pz)*i-r,c=l<=0,h=d<=0;if(c&&n.push(a),c!==h){let t=l/(l-d);n.push({px:a.px+(o.px-a.px)*t,py:a.py+(o.py-a.py)*t,pz:a.pz+(o.pz-a.pz)*t,nx:a.nx+(o.nx-a.nx)*t,ny:a.ny+(o.ny-a.ny)*t,nz:a.nz+(o.nz-a.nz)*t})}}return n}function re(t,e,n,s,i,r,a,o,l){let d=t.geometry,c=d.getAttribute("position");if(void 0===c||0===c.count)return!0;let h=d.getAttribute("normal"),p=d.getIndex(),u=null!==p?p.count:c.count;if(u>15e5)return!0;let m=d.drawRange.start,f=m+(d.drawRange.count===1/0?u-m:Math.min(d.drawRange.count,u-m));Kt.copy(t.objectToDecal),Ht.getNormalMatrix(Kt);let y=[],g=[];for(let t=m;t+2<f;t+=3){let d=null!==p?p.getX(t):t,u=null!==p?p.getX(t+1):t+1,m=null!==p?p.getX(t+2):t+2;if(Jt.fromBufferAttribute(c,d).applyMatrix4(Kt),$t.fromBufferAttribute(c,u).applyMatrix4(Kt),te.fromBufferAttribute(c,m).applyMatrix4(Kt),Jt.z>n&&$t.z>n&&te.z>n||Jt.z<-n&&$t.z<-n&&te.z<-n)continue;ee.subVectors($t,Jt),ne.subVectors(te,Jt),se.crossVectors(ee,ne);let f=se.length();if(!(0===f||se.z/f<=.01)){if(y.length=0,void 0!==h)ee.fromBufferAttribute(h,d).applyMatrix3(Ht),y.push({px:Jt.x,py:Jt.y,pz:Jt.z,nx:ee.x,ny:ee.y,nz:ee.z}),ee.fromBufferAttribute(h,u).applyMatrix3(Ht),y.push({px:$t.x,py:$t.y,pz:$t.z,nx:ee.x,ny:ee.y,nz:ee.z}),ee.fromBufferAttribute(h,m).applyMatrix3(Ht),y.push({px:te.x,py:te.y,pz:te.z,nx:ee.x,ny:ee.y,nz:ee.z});else{se.divideScalar(f);for(let t of[Jt,$t,te])y.push({px:t.x,py:t.y,pz:t.z,nx:se.x,ny:se.y,nz:se.z})}for(let t of e){if(0===y.length)break;let e=ie(y,t,g);g=y,y=e}if(!(y.length<3)){if(a.length/3+3*(y.length-2)>3e5)return!1;for(let t=1;t+1<y.length;t++)for(let e of[y[0],y[t],y[t+1]]){l.push(e.px*s+.5,e.py*i+.5);let t=e.nx,n=e.ny,d=e.nz,c=Math.hypot(t,n,d);c>0?(t/=c,n/=c,d/=c):(t=0,n=0,d=1),a.push(e.px+t*r,e.py+n*r,e.pz+d*r),o.push(t,n,d)}}}}return!0}var ae=new lt,oe=new lt,le=new it,de=new $,ce=class extends C{constructor(t,e,n){super(t,e),this.data=e,this.geometry=new mt,this.lastSignature=[],this.nextSignature=[],this.scanned=[],this.lastParams={width:0,height:0,depth:0,offset:0},this.context=n;let s=this.data.geometry;this.lastParams={width:this.resolveNumber(s.width,0),height:this.resolveNumber(s.height,0),depth:this.resolveNumber(s.depth,0),offset:s.offset??0},this.geometry.userData={type:"DecalGeometry",parameters:{...this.lastParams}}}get isLOD(){return this.updateDecal(),!1}get isDecalObject(){return!0}resolveNumber(t,e){if("number"==typeof t)return t;let n=Number(this.context.shared.getVariable(t));return Number.isFinite(n)?n:e}currentParams(){let t=this.dataPatched.geometry;return{width:this.resolveNumber(t.width,this.lastParams.width),height:this.resolveNumber(t.height,this.lastParams.height),depth:this.resolveNumber(t.depth,this.lastParams.depth),offset:t.offset??0}}projectionRoot(){let t=this.parent;for(;null!==t&&B.is(t);){if("Page"===t.data?.type)return t;t=t.parent}return this.context.scene}scanTargets(t,e,n){let s=this.scanned;s.length=0;let i=this.projectionRoot();if(null===i)return s;ae.makeEmpty();for(let s=0;s<8;s++)de.set((1&s?.5:-.5)*t,(2&s?.5:-.5)*e,(4&s?.5:-.5)*n).applyMatrix4(this.matrixWorld),ae.expandByPoint(de);return i.traverse(t=>{if(t===this||!B.is(t)||!(t instanceof D)||t instanceof ce||"Mesh"!==t.dataPatched?.type||!t.visible||t.destroyedInAction||512&t.layers.mask)return;let e=t.geometry,n=e?.getAttribute("position");void 0===n||0===n.count||0!==e.drawRange.count&&(null===e.boundingBox&&e.computeBoundingBox(),oe.copy(e.boundingBox).applyMatrix4(t.matrixWorld),ae.intersectsBox(oe)&&s.push(t))}),s}collectSignature(t,e,n){t.length=0,t.push(n.width,n.height,n.depth,n.offset);for(let e of this.matrixWorld.elements)t.push(e);for(let n of e){t.push(n.id,n.geometry.id);let e=n.geometry.getAttribute("position");t.push(void 0===e?-1:"version"in e?e.version:e.data.version);let s=n.geometry.getIndex();t.push(null!==s?s.version:-1),t.push(n.geometry.drawRange.count===1/0?-1:n.geometry.drawRange.count);for(let e of n.matrixWorld.elements)t.push(e)}}signaturesEqual(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}updateDecal(){if(this.disposed)return!1;this.updateWorldMatrix(!0,!1);let t=this.currentParams(),e=this.scanTargets(t.width,t.height,t.depth);if(this.collectSignature(this.nextSignature,e,t),this.signaturesEqual(this.nextSignature,this.lastSignature))return!1;let n=this.lastSignature;this.lastSignature=this.nextSignature,this.nextSignature=n,this.lastParams=t,le.copy(this.matrixWorld).invert();let s=e.map(t=>({geometry:t.geometry,objectToDecal:(new it).multiplyMatrices(le,t.matrixWorld)}));return this.geometry.dispose(),this.geometry=function(t,e){let n=Math.max(Math.abs(e.width),1e-6),s=Math.max(Math.abs(e.height),1e-6),i=Math.max(Math.abs(e.depth),1e-6),r=[{axis:0,sign:1,limit:n/2},{axis:0,sign:-1,limit:n/2},{axis:1,sign:1,limit:s/2},{axis:1,sign:-1,limit:s/2},{axis:2,sign:1,limit:i/2},{axis:2,sign:-1,limit:i/2}],a=[],o=[],l=[];for(let d of t)if(!re(d,r,i/2,1/n,1/s,e.offset,a,o,l))break;let d=new mt;return d.setAttribute("position",new ht(a,3)),d.setAttribute("normal",new ht(o,3)),d.setAttribute("uv",new ht(l,2)),0===a.length?(d.setDrawRange(0,0),d.boundingSphere=new pt):d.computeBoundingSphere(),d}(s,t),this.geometry.userData={type:"DecalGeometry",parameters:{width:t.width,height:t.height,depth:t.depth}},g(this),x(this),this.resetBBoxNeedsUpdate(),!0}updateByPatchedOp(t,e,n){super.updateByPatchedOp(t,e,n),M(t.path,["geometry"])&&this.resetBBoxNeedsUpdate()}updateEntityBoxSize(t,e){let n=this.currentParams();t.setScalar(0),e.set(n.width,n.height,n.depth).multiplyScalar(.5)}dispose(){super.dispose(),this.geometry.dispose()}},he=class extends(A(vt,v)){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),this.matrixAutoUpdate=!0}updateState(t,e){this.updateState_Entity(t,e)}},pe=function(){try{let t=window.location.href;if(t.includes("reducesubdiv=")){let e=t.indexOf("reducesubdiv=")+13;return parseInt(t.slice(e,e+1))}}catch{}}();function ue(n,s,i){if(console.assert(void 0!==s.type),"Mesh"===s.type)return function(t,e,n){let s;if(void 0!==pe&&e?.geometry&&"subdivisions"in e.geometry&&(e.geometry.subdivisions??0)>pe&&Object.assign(e.geometry,{subdivisions:pe}),"TextGeometry"===e.geometry.type||"InputGeometry"===e.geometry.type){let s=N(e.geometry.type);return s?s(t,e,n):(_("InputGeometry"===e.geometry.type?"textinputs":"text",`a Mesh with ${e.geometry.type}`),new w(t,e,n))}if("SubdivGeometry"===e.geometry.type)s=new y(t,e,n);else if("PathGeometry"===e.geometry.type||"VectorGeometry"===e.geometry.type||"ShapeBlendGeometry"===e.geometry.type){let i=N(e.geometry.type);i?s=i(t,e,n):(_("ShapeBlendGeometry"===e.geometry.type?"shape-blends":"PathGeometry"===e.geometry.type?"3d-paths":"vector-shapes",`a Mesh with ${e.geometry.type}`),s=new w(t,e,n))}else if("BooleanGeometry"===e.geometry.type)s=new d(t,e,n);else if("DecalGeometry"===e.geometry.type)s=new ce(t,e,n);else if("UIGeometry"===e.geometry.type){let i=N("UIGeometry");i?s=i(t,e,n):(_("ui-2d","a Mesh with UIGeometry"),s=new w(t,e,n))}else s=new w(t,e,n);return s}(n,s,i);if("Empty"===s.type)return new e(n,s);if("Particle"===s.type){let t=k("Particle");return t?t(n,s,i):(_("particles","a Particle system"),new e(n,s))}if("ParticleCollider"===s.type)return new f(n,s,i);if("Hair"===s.type){let t=k("Hair");return t?t(n,s,i):(_("hair","a Hair System"),new e(n,s))}if("Splat"===s.type)return new e(n,s);if("Bone"===s.type)return new he(n,s);if("Page"===s.type)return new a(n,s,i);if("PointLight"===s.type)return new t(n,s,i);if("SpotLight"===s.type)return new l(n,s,i);if("DirectionalLight"===s.type)return new o(n,s,i);if("Component"===s.type||"Instance"===s.type){let t=k(s.type);return t?t(n,s,i):(_("components",`a ${s.type}`),new e(n,s))}return G.is(s.type)?new m(n,s):(console.error(s),new e(n,s))}P.createEntity=ue,P.changeEntityProptotype=function(t,e,n){let s=ue(t.identity,e,n),i=t.children,r=t.attachedPaths,a=t.parent,o=t.component,l=t.instances,d=t.overrideData,c=t.uuid,h=t.stateSelection;t.dispose();for(let e of Object.keys(t))delete t[e];Object.setPrototypeOf(t,Object.getPrototypeOf(s));for(let e of Object.keys(s))t[e]=s[e];t.children=[...t.children,...i],t.attachedPaths=r,t.parent=a,t.component=o,t.instances=l,t.uuid=c,t.overrideData=d,t.updateState(t.data,n),h&&t.changeSelectedState(h,n),t.resetBBoxNeedsUpdate()};var me,fe=class{constructor(){this._constraints=new Map}setConstraint(t,e){null===e?this._constraints.delete(t):this._constraints.set(t,e)}removeDependencies(t){this._constraints.delete(t)}applyConstraints(t){let e=new Set;this._constraints.forEach((n,s)=>{let i=[s,n],r=n;for(;this._constraints.has(r);){if(r=this._constraints.get(r),i.includes(r)){console.warn(`circular dependency detected: ${i.join(" -> ")}`);break}e.has(r)||i.push(r)}for(let n=i.length-2;n>=0;n--)if(!e.has(i[n])){let s=t.find(i[n]);s?s.applyPathSnapping(t):console.warn(`missing entity ${i[n]}`),e.add(i[n])}})}findDependency(t,e){let n=t;for(;this._constraints.has(n);)if(n=this._constraints.get(n),n===e)return!0;return!1}},ye=class{};Pt(ye,"DepthMapRange",65536),Pt(ye,"MemoryPageSize",65536),Pt(ye,"BytesPerFloat",4),Pt(ye,"BytesPerInt",4),Qt.then(t=>me=t);var ge=class{constructor(t={}){Pt(this,"updateView",function(){let t=new it,e=[],n=new $(0,0,-1),s=new $(0,0,-1),i=new $,r=new $;return function(a=!1,o){let l=this.updateMatrixWorldsInWorkerIfNeeded(),d=this.cropsChanged();if(!a){s.set(0,0,-1).applyQuaternion(o.quaternion);let t=!1,e=!1;if(s.dot(n)<=.95&&(t=!0),r.copy(o.position).sub(i).length()>=1&&(e=!0),!(t||e||l||d||this.needsInitialRender))return}this.needsInitialRender=!1,i.copy(o.position),n.copy(s),t.copy(o.matrixWorld).invert(),t.premultiply(this.dummyPerspectiveMatrix),e[0]=o.position.x,e[1]=o.position.y,e[2]=o.position.z;let c={sort:{view:t.elements,cameraPosition:e,splatRenderCount:this.splatRenderCount,splatSortCount:this.splatRenderCount},...l?{newMatrixWorlds:this.meshMatrixWorlds}:{},...d?{newCropsArray:this.cropsArray}:{}};this.sortRunning?this.queuedMessage=c:(this.queuedMessage=null,this.sortRunning=!0,this.sortWorker.postMessage(c))}}()),this.scene=t.scene,this.currentPage=null,this.devicePixelRatio=window.devicePixelRatio,this.sortWorker=null,this.splatRenderCount=0,this.splatSortCount=0,this.splatMesh=null,this.sortRunning=!1,this.meshMatrixWorlds=null,this.meshMatrixWorldsOld=null,this.cropsArray=null,this.splatEntries=null,this.queuedMessage=null,this.needsInitialRender=!0,this.dummyPerspectiveMatrix=(new it).makePerspective(-1,1,-1,1,.1,1e3)}updateSplatMeshUniforms(t,e){let n=new H;null!==this.splatMesh&&this.splatMesh.getSplatCount()>0&&(t.getSize(n),this.cameraFocalLengthX=e.projectionMatrix.elements[0]*this.devicePixelRatio*n.x*.45,this.cameraFocalLengthY=e.projectionMatrix.elements[5]*this.devicePixelRatio*n.y*.45,this.splatMesh.updateUniforms(n,this.cameraFocalLengthX,this.cameraFocalLengthY,e.isPerspectiveCamera?-1:e.zoom*this.devicePixelRatio))}loadSplat(t={}){this.activePage=this.scene.activePage,t.position&&(t.position=(new $).fromArray(t.position)),t.orientation&&(t.orientation=(new J).fromArray(t.orientation)),t.halfPrecisionCovariances=!!t.halfPrecisionCovariances;let e=[];if(this.splatEntries=e,this.activePage.traverseVisibleEntity(t=>{"Splat"===t.data.type&&e.push(t)}),this.splatMesh&&this.splatMesh.dispose(),0===e.length)return this.splatMesh=null,!1;this.meshMatrixWorlds=e.map(t=>t.matrixWorld),this.meshMatrixWorldsOld=e.map(t=>t.matrixWorld.clone()),this.cropsArray=e.map(t=>t.data.crops.map(t=>t.data)),this._splatBufferCache??(this._splatBufferCache=new WeakMap);let n=e.map(t=>{let e=this._splatBufferCache.get(t.data.buffer);return void 0===e&&(e=new me.GSplineBuffer(new Uint8Array(t.data.buffer).buffer),this._splatBufferCache.set(t.data.buffer,e)),e}),s=0,i=[0];for(let t of n)s+=t.getSplatCount(),i.push(s);return this.setupSplatMesh(n,s,t.position,t.orientation,t.halfPrecisionCovariances,this.devicePixelRatio,i,this.meshMatrixWorlds),this.setupSortWorker(s),!0}updateMatrixWorldsInWorkerIfNeeded(){let t=this.splatDataTextures.meshMatrixWorlds.data;for(let e=0;e<this.meshMatrixWorlds.length;e++)t.set(this.meshMatrixWorlds[e].elements,16*e);return this.splatDataTextures.meshMatrixWorlds.texture.needsUpdate=!0,!this.meshMatrixWorlds.every((t,e)=>t.equals(this.meshMatrixWorldsOld[e]))&&(this.meshMatrixWorldsOld=this.meshMatrixWorlds.map(t=>t.clone()),!0)}cropsChanged(){let t=!1;return this.splatEntries.forEach((e,n)=>{e.data.crops.forEach((e,s)=>{void 0===this.cropsArray[n][s]?(t=!0,this.cropsArray[n][s]=e.data):Object.entries(e.data).forEach(([e,i])=>{(Array.isArray(i)&&i.some((t,i)=>t!==this.cropsArray[n][s][e][i])||i!==this.cropsArray[n][s]?.[e])&&(t=!0,this.cropsArray[n][s][e]=i)})}),e.data.crops.length!==this.cropsArray[n]?.length&&(this.cropsArray[n].length=e.data.crops.length,t=!0)}),t}setupSplatMesh(t,e,n=new $,s=new J,i=!1,r=1,a,o){this.splatMesh=qt.buildMesh(t,e,i,r,a,o),this.splatMesh.position.copy(n),this.splatMesh.quaternion.copy(s),this.splatMesh.frustumCulled=!1,this.splatMesh.renderOrder=99999,this.splatRenderCount=e,this.splatMesh.onBeforeRender=(t,e,n)=>this.update(t,n)}setupSortWorker(t){this.sortWorker=function(t){let e=new Worker(URL.createObjectURL(new Blob(["(","\nfunction sortWorker(self) {\n\tlet wasmInstance;\n\tlet splatCount;\n\tlet splatRC;\n\tlet indexesOffset;\n\tlet positionsOffset;\n\tlet viewProjOffset;\n\tlet frequenciesOffset;\n\tlet indexesOutOffset;\n\tlet sortBuffersOffset;\n\tlet wasmMemory;\n\tlet positions;\n\n\tlet Constants;\n\tlet floatPositions;\n\tlet meshIndexIntervals;\n\tlet meshMatrixWorlds;\n\tlet cropsArray;\n\n\tfunction sort(viewProj) {\n\t\t// console.time('WASM SORT');\n\t\tconst viewProjArray = new Float64Array(wasmMemory, viewProjOffset, 16);\n\t\tfor (let i = 0; i < 16; i++) {\n\t\t\tviewProjArray[i] = viewProj[i];\n\t\t}\n\t\tlet indexesBuffer;\n\t\t// console.timeEnd('WASM SORT');\n\t\tif (splatRC > 1) {\n\t\t\twasmInstance.exports.sortIndexes(\n\t\t\t\tindexesOffset,\n\t\t\t\tpositionsOffset,\n\t\t\t\tsortBuffersOffset,\n\t\t\t\tviewProjOffset,\n\t\t\t\tfrequenciesOffset,\n\t\t\t\tindexesOutOffset,\n\t\t\t\tConstants.DepthMapRange,\n\t\t\t\tsplatRC\n\t\t\t);\n\t\t\tconst indexes = new Uint32Array(splatRC);\n\t\t\tindexesBuffer = indexes.buffer;\n\t\t\tindexes.set(new Uint32Array(wasmMemory, indexesOutOffset, splatRC));\n\t\t} else if (splatRC === 1) {\n\t\t\tconst indexes = new Uint32Array(splatRC);\n\t\t\tindexes[0] = new Uint32Array(wasmMemory, indexesOffset, splatCount)[0];\n\t\t\tindexesBuffer = indexes.buffer;\n\t\t} else {\n\t\t\tindexesBuffer = new ArrayBuffer(0);\n\t\t}\n\n\t\tself.postMessage(\n\t\t\t{\n\t\t\t\tsortDone: true,\n\t\t\t\tindexesBuffer,\n\t\t\t},\n\t\t\t[indexesBuffer]\n\t\t);\n\t}\n\tfunction updateRenderedSplats(\n\t\tmeshMatrixWorlds,\n\t\tcropsArray,\n\t\tmeshIndexIntervals\n\t) {\n\t\tconst renderedPositions = new Float32Array(\n\t\t\twasmMemory,\n\t\t\tpositionsOffset,\n\t\t\tsplatCount * 3\n\t\t);\n\t\tsplatRC = 0;\n\t\tconst wasmMemoryIndexes = new Uint32Array(\n\t\t\twasmMemory,\n\t\t\tindexesOffset,\n\t\t\tsplatCount\n\t\t);\n\t\tfor (let i = 0; i < meshIndexIntervals.length - 1; i++) {\n\t\t\tconst crops = cropsArray[i];\n\t\t\tconst matrixWorld = meshMatrixWorlds[i].elements;\n\t\t\tconst paramsIn = crops\n\t\t\t\t.filter((a) => a.enabled && a.mode === 'Include')\n\t\t\t\t.map((c) =>\n\t\t\t\t\tc.type === 'Box'\n\t\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t\t);\n\t\t\tconst paramsOut = crops\n\t\t\t\t.filter((a) => a.enabled && a.mode === 'Exclude')\n\t\t\t\t.map((c) =>\n\t\t\t\t\tc.type === 'Box'\n\t\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t\t);\n\t\t\tfor (let j = meshIndexIntervals[i]; j < meshIndexIntervals[i + 1]; j++) {\n\t\t\t\tconst x = floatPositions[j * 3];\n\t\t\t\tconst y = floatPositions[j * 3 + 1];\n\t\t\t\tconst z = floatPositions[j * 3 + 2];\n\t\t\t\tif (\n\t\t\t\t\t(paramsIn.length === 0 || isInBounds(x, y, z, paramsIn)) &&\n\t\t\t\t\t(paramsOut.length === 0 || !isInBounds(x, y, z, paramsOut))\n\t\t\t\t) {\n\t\t\t\t\tconst w =\n\t\t\t\t\t\t1 /\n\t\t\t\t\t\t(matrixWorld[3] * x +\n\t\t\t\t\t\t\tmatrixWorld[7] * y +\n\t\t\t\t\t\t\tmatrixWorld[11] * z +\n\t\t\t\t\t\t\tmatrixWorld[15]);\n\t\t\t\t\trenderedPositions[splatRC * 3] =\n\t\t\t\t\t\t(matrixWorld[0] * x +\n\t\t\t\t\t\t\tmatrixWorld[4] * y +\n\t\t\t\t\t\t\tmatrixWorld[8] * z +\n\t\t\t\t\t\t\tmatrixWorld[12]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\trenderedPositions[splatRC * 3 + 1] =\n\t\t\t\t\t\t(matrixWorld[1] * x +\n\t\t\t\t\t\t\tmatrixWorld[5] * y +\n\t\t\t\t\t\t\tmatrixWorld[9] * z +\n\t\t\t\t\t\t\tmatrixWorld[13]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\trenderedPositions[splatRC * 3 + 2] =\n\t\t\t\t\t\t(matrixWorld[2] * x +\n\t\t\t\t\t\t\tmatrixWorld[6] * y +\n\t\t\t\t\t\t\tmatrixWorld[10] * z +\n\t\t\t\t\t\t\tmatrixWorld[14]) *\n\t\t\t\t\t\tw;\n\t\t\t\t\twasmMemoryIndexes[splatRC] = j;\n\t\t\t\t\tsplatRC++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tfunction getOutOfBoundsIndexes(floatPositions, crops) {\n\t\tconst outOfBoundsIndexes = [];\n\t\tconst paramsIn = crops\n\t\t\t.filter((a) => a.enabled && a.mode === 'Include')\n\t\t\t.map((c) =>\n\t\t\t\tc.type === 'Box'\n\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t);\n\t\tconst paramsOut = crops\n\t\t\t.filter((a) => a.enabled && a.mode === 'Exclude')\n\t\t\t.map((c) =>\n\t\t\t\tc.type === 'Box'\n\t\t\t\t\t? computeBoundingBoxVertices(c)\n\t\t\t\t\t: computeEllipsoidParams(c)\n\t\t\t);\n\n\t\tconst len = floatPositions.length;\n\t\tfor (let j = 0; j < len; j += 3) {\n\t\t\tconst x = floatPositions[j];\n\t\t\tconst y = floatPositions[j + 1];\n\t\t\tconst z = floatPositions[j + 2];\n\t\t\tif (\n\t\t\t\t(paramsIn.length === 0 || isInBounds(x, y, z, paramsIn)) &&\n\t\t\t\t(paramsOut.length === 0 || !isInBounds(x, y, z, paramsOut))\n\t\t\t) {\n\t\t\t\t// in bounds: intentionally skip\n\t\t\t} else {\n\t\t\t\toutOfBoundsIndexes.push(j / 3);\n\t\t\t}\n\t\t}\n\t\t// console.log(outOfBoundsIndexes);\n\t\treturn outOfBoundsIndexes;\n\t}\n\n\tfunction isInBounds(x, y, z, params, mode) {\n\t\treturn params[mode === 'Intersect' ? 'every' : 'some']((param) => {\n\t\t\tconst t = applyRotationMatrix(\n\t\t\t\tx,\n\t\t\t\ty,\n\t\t\t\tz,\n\t\t\t\tparam.invRotationMatrix,\n\t\t\t\tparam.cropCenter\n\t\t\t);\n\t\t\treturn Array.isArray(param)\n\t\t\t\t? isVertexInsideBoundingBox(t.x, t.y, t.z, param)\n\t\t\t\t: isPointInsideEllipsoid(t.x, t.y, t.z, param);\n\t\t});\n\t}\n\tfunction applyRotationMatrix(_x, _y, _z, e, pivot) {\n\t\tconst x = _x - pivot[0];\n\t\tconst y = _y - pivot[1];\n\t\tconst z = _z - pivot[2];\n\t\tconst w = 1 / (e[3] * x + e[7] * y + e[11] * z + e[15]);\n\t\treturn {\n\t\t\tx: (e[0] * x + e[4] * y + e[8] * z + e[12]) * w + pivot[0],\n\t\t\ty: (e[1] * x + e[5] * y + e[9] * z + e[13]) * w + pivot[1],\n\t\t\tz: (e[2] * x + e[6] * y + e[10] * z + e[14]) * w + pivot[2],\n\t\t};\n\t}\n\tfunction computeBoundingBoxVertices(box) {\n\t\tconst halfSizeX = box.cropSize[0] / 2;\n\t\tconst halfSizeY = box.cropSize[1] / 2;\n\t\tconst halfSizeZ = box.cropSize[2] / 2;\n\t\tconst bounds = [\n\t\t\tbox.cropCenter[0] - halfSizeX,\n\t\t\tbox.cropCenter[1] - halfSizeY,\n\t\t\tbox.cropCenter[2] - halfSizeZ,\n\t\t\tbox.cropCenter[0] + halfSizeX,\n\t\t\tbox.cropCenter[1] + halfSizeY,\n\t\t\tbox.cropCenter[2] + halfSizeZ,\n\t\t];\n\t\tconst invRotationMatrix = getInvRotationMatrix(box.cropRotation);\n\t\treturn Object.assign(bounds, {\n\t\t\tinvRotationMatrix,\n\t\t\tcropCenter: box.cropCenter,\n\t\t});\n\t}\n\tfunction getInvRotationMatrix(_rotation) {\n\t\tconst te = [];\n\t\tconst x = (_rotation[0] * Math.PI) / 180,\n\t\t\ty = (_rotation[1] * Math.PI) / 180,\n\t\t\tz = (_rotation[2] * Math.PI) / 180;\n\t\tconst a = Math.cos(x),\n\t\t\tb = Math.sin(x);\n\t\tconst c = Math.cos(y),\n\t\t\td = Math.sin(y);\n\t\tconst e = Math.cos(z),\n\t\t\tf = Math.sin(z);\n\t\tconst ae = a * e,\n\t\t\taf = a * f,\n\t\t\tbe = b * e,\n\t\t\tbf = b * f;\n\n\t\tte[0] = c * e;\n\t\tte[1] = -c * f;\n\t\tte[2] = d;\n\n\t\tte[4] = af + be * d;\n\t\tte[5] = ae - bf * d;\n\t\tte[6] = -b * c;\n\n\t\tte[8] = bf - ae * d;\n\t\tte[9] = be + af * d;\n\t\tte[10] = a * c;\n\n\t\tte[12] = 0;\n\t\tte[13] = 0;\n\t\tte[14] = 0;\n\n\t\tte[3] = 0;\n\t\tte[7] = 0;\n\t\tte[11] = 0;\n\t\tte[15] = 1;\n\n\t\treturn te;\n\t}\n\tfunction isVertexInsideBoundingBox(x, y, z, bounds) {\n\t\treturn (\n\t\t\tx >= bounds[0] &&\n\t\t\tx <= bounds[3] &&\n\t\t\ty >= bounds[1] &&\n\t\t\ty <= bounds[4] &&\n\t\t\tz >= bounds[2] &&\n\t\t\tz <= bounds[5]\n\t\t);\n\t}\n\tfunction computeEllipsoidParams(ellipsoid) {\n\t\t// Precompute the scaling factors\n\t\tconst invRadiusX = 2 / ellipsoid.cropSize[0];\n\t\tconst invRadiusY = 2 / ellipsoid.cropSize[1];\n\t\tconst invRadiusZ = 2 / ellipsoid.cropSize[2];\n\t\tconst invRotationMatrix = getInvRotationMatrix(ellipsoid.cropRotation);\n\t\treturn {\n\t\t\tinvRadiusX,\n\t\t\tinvRadiusY,\n\t\t\tinvRadiusZ,\n\t\t\tcropCenter: ellipsoid.cropCenter,\n\t\t\tinvRotationMatrix,\n\t\t};\n\t}\n\tfunction isPointInsideEllipsoid(x, y, z, ellipsoidParams) {\n\t\tconst _x = (x - ellipsoidParams.cropCenter[0]) * ellipsoidParams.invRadiusX;\n\t\tconst _y = (y - ellipsoidParams.cropCenter[1]) * ellipsoidParams.invRadiusY;\n\t\tconst _z = (z - ellipsoidParams.cropCenter[2]) * ellipsoidParams.invRadiusZ;\n\t\treturn _x * _x + _y * _y + _z * _z <= 1;\n\t}\n\n\tself.onmessage = (e) => {\n\t\tif (e.data.getCroppedIndexes) {\n\t\t\tconst outOfBoundsIndexes = new Uint32Array(\n\t\t\t\tgetOutOfBoundsIndexes(new Float32Array(e.data.positions), e.data.crops)\n\t\t\t).buffer;\n\t\t\tself.postMessage(\n\t\t\t\t{\n\t\t\t\t\toutOfBoundsIndexes,\n\t\t\t\t},\n\t\t\t\t[outOfBoundsIndexes]\n\t\t\t);\n\t\t} else if (e.data.positions) {\n\t\t\tpositions = e.data.positions;\n\t\t\tfloatPositions = new Float32Array(positions);\n\t\t\tmeshMatrixWorlds = e.data.meshMatrixWorlds;\n\t\t\tcropsArray = e.data.cropsArray;\n\t\t\tmeshIndexIntervals = e.data.meshIndexIntervals;\n\t\t\tupdateRenderedSplats(meshMatrixWorlds, cropsArray, meshIndexIntervals);\n\t\t\tself.postMessage({\n\t\t\t\tsortSetupComplete: true,\n\t\t\t});\n\t\t} else if (e.data.sort || e.data.newMatrixWorlds || e.data.newCropsArray) {\n\t\t\tif (e.data.newMatrixWorlds || e.data.newCropsArray) {\n\t\t\t\tcropsArray = e.data.newCropsArray || cropsArray;\n\t\t\t\tmeshMatrixWorlds = e.data.newMatrixWorlds || meshMatrixWorlds;\n\t\t\t\tupdateRenderedSplats(meshMatrixWorlds, cropsArray, meshIndexIntervals);\n\t\t\t}\n\t\t\tsort(e.data.sort.view, e.data.sort.cameraPosition);\n\t\t} else if (e.data.init) {\n\t\t\t// Yep, this is super hacky and gross :(\n\t\t\tConstants = e.data.init.Constants;\n\n\t\t\tsplatCount = e.data.init.splatCount;\n\n\t\t\tconst INDEXES_BYTES_PER_ENTRY = Constants.BytesPerInt;\n\t\t\tconst POSITIONS_BYTES_PER_ENTRY = Constants.BytesPerFloat * 3;\n\n\t\t\tconst sorterWasmBytes = new Uint8Array(e.data.init.sorterWasmBytes);\n\t\t\tconst memoryBytesPerVertex =\n\t\t\t\tINDEXES_BYTES_PER_ENTRY + POSITIONS_BYTES_PER_ENTRY;\n\t\t\tconst memoryRequiredForVertices = splatCount * memoryBytesPerVertex;\n\t\t\tconst memoryRequiredForSortBuffers =\n\t\t\t\tsplatCount * Constants.BytesPerInt * 2 +\n\t\t\t\tConstants.DepthMapRange * Constants.BytesPerInt * 2;\n\t\t\tconst extraMemory = Constants.MemoryPageSize * 32;\n\t\t\tconst totalRequiredMemory =\n\t\t\t\tmemoryRequiredForVertices + memoryRequiredForSortBuffers + extraMemory;\n\t\t\tconst totalPagesRequired =\n\t\t\t\tMath.floor(totalRequiredMemory / Constants.MemoryPageSize) + 1;\n\t\t\tconst sorterWasmImport = {\n\t\t\t\tmodule: {},\n\t\t\t\tenv: {\n\t\t\t\t\tmemory: new WebAssembly.Memory({\n\t\t\t\t\t\tinitial: totalPagesRequired * 2,\n\t\t\t\t\t\tmaximum: totalPagesRequired * 3,\n\t\t\t\t\t\tshared: true,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t};\n\t\t\tWebAssembly.compile(sorterWasmBytes)\n\t\t\t\t.then((wasmModule) => {\n\t\t\t\t\treturn WebAssembly.instantiate(wasmModule, sorterWasmImport);\n\t\t\t\t})\n\t\t\t\t.then((instance) => {\n\t\t\t\t\twasmInstance = instance;\n\t\t\t\t\tindexesOffset = 0;\n\t\t\t\t\tpositionsOffset = splatCount * INDEXES_BYTES_PER_ENTRY;\n\t\t\t\t\tviewProjOffset =\n\t\t\t\t\t\tpositionsOffset + splatCount * POSITIONS_BYTES_PER_ENTRY;\n\t\t\t\t\tsortBuffersOffset = viewProjOffset + 16 * Constants.BytesPerFloat * 2;\n\t\t\t\t\tfrequenciesOffset =\n\t\t\t\t\t\tsortBuffersOffset + splatCount * Constants.BytesPerInt;\n\t\t\t\t\tindexesOutOffset =\n\t\t\t\t\t\tfrequenciesOffset + Constants.DepthMapRange * Constants.BytesPerInt;\n\t\t\t\t\twasmMemory = sorterWasmImport.env.memory.buffer;\n\t\t\t\t\tself.postMessage({\n\t\t\t\t\t\tsortSetupPhase1Complete: true,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t}\n\t};\n}\n",")(self)"],{type:"application/javascript"}))),n=atob("AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAETA2AAAGAIf39/f39/f38AYAABfwISAQNlbnYGbWVtb3J5AgMAgIAEAwQDAAECBzkDEV9fd2FzbV9jYWxsX2N0b3JzAAALc29ydEluZGV4ZXMAARNlbXNjcmlwdGVuX3Rsc19pbml0AAIK3gMDAwABC9IDAwF/BnwBfgJAIAdFDQAgAysDUCEMIAMrAzAhDSADKwMQIQ5BACEDRP///////+9/IQtEAAAAAAAAEAAhCgNAIAIgA0ECdGoCfyAOIAEgA0EMbGoiCCoCALuiIA0gCCoCBLuioCAMIAgqAgi7oqBEAAAAAAAAsECiIgmZRAAAAAAAAOBBYwRAIAmqDAELQYCAgIB4CzYCACAJIAsgCSALYxshCyAJIAogCSAKZBshCiADQQFqIgMgB0cNAAsgB0UNACAGuCAKIAuhoyEJQQAhAwNAAn8gCSACIANBAnRqIgEoAgC3IAuhoiIKmUQAAAAAAADgQWMEQCAKqgwBC0GAgICAeAshCCABIAg2AgAgBCAIQQJ0aiIBIAEoAgBBAWo2AgAgA0EBaiIDIAdHDQALCyAGQQJPBEAgBCgCACEIQQEhAwNAIAQgA0ECdGoiASABKAIAIAhqIgg2AgAgA0EBaiIDIAZHDQALCyAHQQFrIgGtIQ8DQCAEIAIgD6dBAnQiA2ooAgBBAnRqIgcgBygCAEEBayIHNgIAIAUgASAHa0ECdGogACADaigCADYCACAPUCEDIA9CAX0hDyADRQ0ACyAGBEAgBEEAIAZBAnT8CwALCwQAQQAL"),s=new Uint8Array(n.length);for(let t=0;t<n.length;t++)s[t]=n.charCodeAt(t);return e.postMessage({init:{sorterWasmBytes:s.buffer,splatCount:t,Constants:{BytesPerFloat:ye.BytesPerFloat,BytesPerInt:ye.BytesPerInt,DepthMapRange:ye.DepthMapRange,MemoryPageSize:ye.MemoryPageSize}}}),e}(t),this.sortWorker.onmessage=t=>{t.data.sortDone?(this.sortRunning=!1,this.splatMesh?.updateIndexes(new Uint32Array(t.data.indexesBuffer)),this.lastSortTime=t.data.sortTime,this.queuedMessage&&(this.sortWorker.postMessage(this.queuedMessage),this.queuedMessage=null)):t.data.sortCanceled?this.sortRunning=!1:t.data.sortSetupPhase1Complete?this.sortWorker.postMessage({positions:this.splatMesh.getCenters().buffer,meshMatrixWorlds:this.splatMesh.meshMatrixWorlds,meshIndexIntervals:this.splatMesh.meshIndexIntervals,cropsArray:this.cropsArray}):t.data.sortSetupComplete&&(this.splatDataTextures=this.splatMesh.getSplatDataTextures(),this.scene.activePage.add(this.splatMesh),this.needsInitialRender=!0)}}update(t,e){null!==this.splatMesh&&(this.updateSplatMeshUniforms(t,e),this.updateView(!1,e))}getSplatMesh(){return this.splatMesh}},xe=new ft;xe.wireframe=!0;var ve=new $,Ae=class extends ot{constructor(t,n){super(),this.data=t,this.sharedAssets=n,this.enableHelpers=!1,this.wireframeState=!1,this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this._needsTransmission=!1,this._needsNormal=!1,this._normalPassNeeds={outline:!1,cavity:!1},this._needsReflection=!1,this.geometryCacheChanged=!1,this.splatViewer=null,this.shapeBlendIntances=[],this.hairInstances=[],this.shadowsDirty=!0,this.instanceGroupsDirty=!0,this._autoInstancing=null,this.entityByUuid={},this.entityIdentityToEntity={},this.toExpandCloner=new Set,this.toUpdateCloner=new Set,this.pendingCommands=[],this.pathConstraints=new fe,this.invisibleObjects=new e("jflkdsafjasdifjaslk",{...X.defaultData,visible:!1,name:"buildin invisible"}),this.needsRecomputeInstances=!1,this.init(t,n),this.matrixAutoUpdate=!1,this.errorPage=new a("fdasfa",{...U.defaultData,name:""},{shared:n,scene:this})}markGeometryCacheDirty(){this.geometryCacheChanged=!0}markShadowsDirty(){this.shadowsDirty=!0}markInstanceGroupsDirty(){this.instanceGroupsDirty=!0}get autoInstancing(){return this._autoInstancing}updateInstanceGroups(t,e){let n=this._autoInstancing;(null===n||n.minGroupSize!==e)&&(n?.dispose(),n=new Nt(e),this._autoInstancing=n);let s=this.instanceGroupsDirty;return this.instanceGroupsDirty=!1,n.update(t,s),n.stats}releaseInstanceGroups(){this._autoInstancing?.teardown(),this.instanceGroupsDirty=!0}markNeedsUpdateRendererDirty(){this.needsTransmissionDirty=!0,this.needsNormalDirty=!0,this.needsReflectionDirty=!0,this.shadowsDirty=!0,this.instanceGroupsDirty=!0}needsTransmission(){return this.needsTransmissionDirty&&(this._needsTransmission=s(this),this.needsTransmissionDirty=!1),this._needsTransmission}needsNormal(){return this.needsNormalDirty&&(this._normalPassNeeds=n(this),this._needsNormal=this._normalPassNeeds.outline||this._normalPassNeeds.cavity,this.needsNormalDirty=!1),this._needsNormal}normalPassNeeds(){return this.needsNormal(),this._normalPassNeeds}needsReflection(){return this.needsReflectionDirty&&(this._needsReflection=i(this),this.needsReflectionDirty=!1),this._needsReflection}registerInstanceAndSetUuid(t){let e=t.identity.join("-"),n=this.entityIdentityToEntity[e];n&&(t.uuid=n.uuid),this.entityIdentityToEntity[e]=t,this.entityByUuid[t.uuid]=t}markPenumbraSizeDirty(){for(let t of this.children)t instanceof a&&(t.penumbraSizeArrayCache=null)}findInstance(t){return this.entityIdentityToEntity[t.join("-")]}get bgColor(){return this.activePage.bgColor}get postprocessing(){return this.activePage.data.postprocessing}getWithSortKey(t){let e=this.find(t);if(void 0===e)return;let n=[],s=e;for(;s!==this;){let t=s;s=s.parent;let e=s.children.indexOf(t);n.splice(0,0,e)}return{entity:e,sortKey:n}}getAllSorted(t){let e=[];for(let n of t){let t=this.getWithSortKey(n.id);void 0!==t&&e.push(t)}return e.sort((t,e)=>Y(t.sortKey,e.sortKey)),e.map(t=>t.entity)}nonExistOrDescendantOf(t,e){let n=this.find(t);if(void 0===n)return!0;for(;n;){if(n.uuid===e)return!0;n=n.parent}return!1}find(t){if(this.activePage&&this.activePage.personalCamera.parent){if("f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera"===t)return this.activePage.personalCamera;if(t===Q)return this.activePage.personalCamera}if(""===t||void 0===t)return;let e=this.entityByUuid[t];return void 0===e?this.getObjectByProperty("uuid",t):e}find2D(t){for(let e of this.children)if(e instanceof a&&e.uiScene){let n=e.uiScene.find(t);if(n)return n}}findScene2DfromObject2D(t){for(let e of this.children)if(e instanceof a&&e.uiScene&&e.uiScene.find(t))return e.uiScene}find2DInUIObjects(t){let e;return this.traverseEntity(n=>{void 0===e&&j(n)&&(e=n.uiCanvas.find(t))}),e}traverse2D(t){for(let e of this.children)e instanceof a&&e.uiScene&&e.uiScene.traverse(t)}debugEnsureEntity(t){let e=this.find(t);e?Array.isArray(e.identity)&&void 0===this.findInstance(e.identity)&&console.error("not found instance"):console.error("not found")}addPendingExpandCloner(t){this.toExpandCloner.add(t)}addPendingUpdateCloner(t){this.toUpdateCloner.add(t)}markToExpandCloner(t){this.toExpandCloner.add(t),t.traverseEntityAncestors(t=>{this.toExpandCloner.add(t)})}doPendingExpandCloner(t){this.toExpandCloner.forEach(e=>{e.expandCloner(t)}),this.toExpandCloner.clear()}doPendingUpdateCloner(t){this.toUpdateCloner.forEach(e=>{e.cloner?.update(t)}),this.toUpdateCloner.clear()}doPendingUpdates(t){this.doPendingExpandCloner(t),this.doPendingUpdateCloner(t),this.applyPendingCommands()}addPendingCommand(t){this.pendingCommands.push(t)}applyPendingCommands(){this.pendingCommands.forEach(t=>t()),this.pendingCommands.length=0}updateByLibOp(t,e){1===t.path.length&&"components"===t.path[0]&&1===t.type&&this.createChildrenObjects([{...t.data.asset,id:t.id}],this.invisibleObjects,e)}updateTreeByOp(t,e){if(0===t.path.length&&7===t.type){let n=null===t.parent?this:this.find(t.parent);if(void 0===n)throw new Error(`scene tree add: parent ${t.parent} not found for object ${t.id}`);let s=this.createObject(t.id,t.data,t.children,n,t.localIndex,e);s.updateVisible(this),s.resetBBoxNeedsUpdate(),c(s)&&h(s.parent)&&(s.invalidateUpstreamBooleanData(),s.parent.invalidateDownstreamBooleanData().recomputeBoolean()),this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(s),this.markToExpandCloner(s),this.markPenumbraSizeDirty(),s.updatePathSnapping()}else if(0===t.path.length&&8===t.type){let e=this.find(t.id);if(void 0===e)throw new Error(`scene tree delete: object ${t.id} not found`);e.traverseEntity(t=>{z(t)&&(this.shapeBlendIntances=this.shapeBlendIntances.filter(e=>e!==t)),E(t)&&(this.hairInstances=this.hairInstances.filter(e=>e!==t))}),this.markToExpandCloner(e),e.resetBBoxNeedsUpdate(),this.unregisterObject(e);let n=e.parent;this.markNeedsRecomputeInstancesForAncessors(n),this.markNeedsRecomputeInstancesForChildren(e),this.markPenumbraSizeDirty(),e.parent.remove(e),h(e.parent)&&(e.parent.invalidateUpstreamBooleanData(),e.parent.invalidateDownstreamBooleanData().recomputeBoolean()),c(e)&&(e.freeBooleanPointer(),n instanceof d&&n.invalidateDownstreamBooleanData().recomputeBoolean()),O(e)&&e.detachShape(),this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(e),this.pathConstraints.removeDependencies(e.uuid),e.updatePathSnapping()}else if(0===t.path.length&&9===t.type){let e=this.find(t.id);if(void 0===e)throw new Error(`scene tree move: object ${t.id} not found`);this.markNeedsRecomputeInstancesForChildren(e);let n=e.parent;this.markNeedsRecomputeInstancesForAncessors(n),e.cloner?.resetOnMove(),this.markToExpandCloner(e);let s=null===t.parent?this:this.find(t.parent);if(void 0===s)throw new Error(`scene tree move: new parent ${t.parent} not found for object ${t.id}`);s.add(e),this.markNeedsRecomputeInstancesForAncessors(s),this.markToExpandCloner(e),e.invalidateClonerTransform(e),e.updateVisible(this),e.resetBBoxNeedsUpdate(),this.markPenumbraSizeDirty();let i=t.localIndex;s.children.splice(i,0,s.children.pop()),c(e)&&(e.invalidateUpstreamBooleanData(),h(e.parent)?e.parent.invalidateDownstreamBooleanData().recomputeBoolean():n instanceof d&&n.invalidateDownstreamBooleanData().recomputeBoolean()),e.updatePathSnapping()}this.markNeedsUpdateRendererDirty(),this.markGeometryCacheDirty()}get playPage(){return this.find(this.data.publish.playPage)??this.errorPage}updatePage(t){this.shadowsDirty=!0,this.activePage&&this.activePage.onDeactive(),this.activePage=this.errorPage;for(let e of this.children)e instanceof a&&(e.visible=e.uuid===t,e.visible&&(this.activePage=e,this.activePage.onActive(this)));this.activePage!==this.splatViewer?.activePage&&this.reloadSplats()}updateEntityByOp(t,e,n,s){if(this.shadowsDirty=!0,0===e.type){if(("overrides"in e.props||"component"in e.props)&&this.markNeedsRecomputeInstances(),"visible"in e.props&&this.markPenumbraSizeDirty(),e.path.includes("overrides")&&"states"in e.props){let{rest:t}=e.props;e={...e,props:t},this.markNeedsRecomputeInstances()}"pathSnapping"===e.path[0]&&void 0!==e.props.pathId&&this.pathConstraints.setConstraint(t,e.props.pathId)}let i=this.find(t);if(i)try{(function(t,e,n,s){t.updateByOp(e,n,s,!1)})(i,e,n,{scene:this,shared:s}),i instanceof w&&i.updateGeometryGroupsIfNeeded()}catch(t){console.error(t)}}updateEntity2DByOp(t,e,n,s,i,r=[]){t.updateEntityByOp(e,n,s,i),this.traverseEntity(t=>{(j(t)||t instanceof a)&&(r.includes(t.frameId??"")||t.frameId===e)&&t.updateEntity2DByOp(e,n,s,i)})}get activeCamera(){return this.activePage.activeCamera}switchActiveCamera(t){this.activePage.switchActiveCamera(t)}isInvisibleObjects(t){return t===this.invisibleObjects||t.hasAnccestor(this.invisibleObjects)}init(t,e){let n=Object.entries(e.data.lib.components).map((t,e)=>({data:t[1].asset.data,children:t[1].asset.children,id:t[0],fi:e}));this.invisibleObjects.updateState(this.invisibleObjects.data,{scene:this,shared:e}),this.add(this.invisibleObjects),this.createChildrenObjects(n,this.invisibleObjects,e),this.createChildrenObjects(t.objects,this,e),this.updatePage(t.publish.playPage),this.activePage.switchToPlayCamera(),this.expandInstances(e,!0),this.traverseEntity(t=>{t instanceof m&&t.updateUp()}),this.doPendingExpandCloner({scene:this,shared:e}),this.applyPendingCommands()}markNeedsRecomputeInstances(){this.needsRecomputeInstances=!0}markNeedsRecomputeInstancesForChildren(t){t.traverseEntity(t=>{("Component"===t.data.type||"Instance"===t.data.type)&&this.markNeedsRecomputeInstances()})}markNeedsRecomputeInstancesForAncessors(t){B.is(t)&&("Component"===t.data.type&&this.markNeedsRecomputeInstances(),t.traverseAncestors(t=>{B.is(t)&&"Component"===t.data.type&&this.markNeedsRecomputeInstances()}))}relativeizeInner(t,e,n,s,i,r,a){if(t){let o=s.find(t);o&&o!==s&&i.forInstancesRec(s=>{s.data=L(s.data,i=>{let o=i.events.data(a.id),l=s.goUp(r);if(l){let s=[...F(l.identity),t].join("-"),i=this.entityIdentityToEntity[s];if(i){let t=i.uuid;q.zoom(o,e)[n]=t}else console.warn("cannot find instance")}}).data})}}rewriteActions(t,e,n,s,i,r){t.forEach(t=>{"Transition"===t.data.type||"Animation"===t.data.type?this.relativeizeInner(t.data.object,[...e,t.id],"object",n,s,i,r):"Conditional"===t.data.type&&(this.rewriteActions(t.data.ifActions,[...e,t.id,"ifActions"],n,s,i,r),this.rewriteActions(t.data.elseActions,[...e,t.id,"elseActions"],n,s,i,r))})}rewriteEventsBeforeGoToPlayMode(){this.traverseEntity(t=>{if(T(t)&&"string"==typeof t.identity&&"Component"===t.data.type)return t.traverseEntity((e,n)=>{e.data.events.forEach(s=>{if("GameControl"===s.data.type){let i=!1;if(e.forInstancesRec(t=>{t.data=L(t.data,e=>{t.isInstanceRoot||(e.events.delete(s.id),i=!0)}).data}),!1===i)for(let i of V.list)this.rewriteActions(s.data.gameActions[i],["gameActions",i],t,e,n,s)}else"Conditional"===s.data.type?("Distance"===s.data.condition.type?(this.relativeizeInner(s.data.condition.fromObject,["condition"],"fromObject",t,e,n,s),this.relativeizeInner(s.data.condition.toObject,["condition"],"toObject",t,e,n,s)):"State"===s.data.condition.type?this.relativeizeInner(s.data.condition.object,["condition"],"object",t,e,n,s):"Comparison"===s.data.condition.type&&("Property"===s.data.condition.lOperand.type&&this.relativeizeInner(s.data.condition.lOperand.value[0],["condition","lOperand","value"],0,t,e,n,s),"Property"===s.data.condition.rOperand.type&&this.relativeizeInner(s.data.condition.rOperand.value[0],["condition","rOperand","value"],0,t,e,n,s)),this.rewriteActions(s.data.inActions,["inActions"],t,e,n,s),this.rewriteActions(s.data.outActions,["outActions"],t,e,n,s)):"actions"in s.data&&this.rewriteActions(s.data.actions,["actions"],t,e,n,s)})}),!0})}expandInstances(t,e,n){let s=new Set;this.traverseEntity(i=>{if(T(i)&&i.isInstanceRoot)return i.expandInstanceChildren({scene:this,shared:t,pendingDeletes:s}),e||i.resetBBoxNeedsUpdate(),n&&i.traverseEntity(t=>{n.addClip(t)}),!0});for(let t of s)this.disposeAndUnregisterEntityRecursivelyIfNotReregistered(t),u(t)}recomputeInstances(t,e){this.needsRecomputeInstances&&(this.needsRecomputeInstances=!1,this.traverseEntity(t=>{T(t)&&t.isInstanceRoot&&(t.component=void 0)}),this.expandInstances(t,!1,e))}disposeAndUnregisterEntityRecursivelyIfNotReregistered(t){t.traverseEntity(t=>{let e="string"==typeof t.identity?t.identity:t.identity.join("-");this.entityIdentityToEntity[e]===t&&(delete this.entityByUuid[t.uuid],delete this.entityIdentityToEntity[e]),t.dispose()})}clearScene(){this._autoInstancing?.dispose(),this._autoInstancing=null,this.instanceGroupsDirty=!0;for(let t of this.children)B.is(t)&&t.disposeRecursively();this.children.length=0}resetAfterClear(t,e){this.init(t,e)}raycast(t){return this.raycast1(t,!1)}raycast1(t,e){let n=[],s=i=>{for(let a of i.children){let i=a.cloner;if(B.is(a)&&!a.raycastLock&&(a.visible||i?.object.data.visible))if(!0===e&&a.isInstanceRoot){let e=[];if(t.intersectObject(a,!0,e),e.length){let t=e[0];t.object=a,t.point.applyMatrix4(t.object.matrixWorld);let s=a.matrixWorld.clone().invert();t.point.applyMatrix4(s),n.push(t)}}else(c(a)||p(a)&&this.enableHelpers&&a.objectHelper.visible)&&(t.intersectObject(a,!1,n),r(a,t,n)),s(a)}};return s(this.activePage),n}raycastWithClones(t){let e=[],n=s=>{for(let i of s.children){let s=i.cloner;B.is(i)&&(i.visible||s?.object.data.visible)&&((c(i)||p(i)&&this.enableHelpers&&i.objectHelper.visible)&&(t.intersectObject(i,!1,e),r(i,t,e,!0)),n(i))}};return n(this),e}forEachEntity(t){for(let e of this.children)B.is(e)&&t(e)}traverseConcreteEntity(t){for(let e of this.children)B.is(e)&&e.isConcreteEntity&&e.traverseEntity(t)}traverseEntity(t){for(let e of this.children)B.is(e)&&e.traverseEntity(t)}updateFont(t,e){this.traverseEntity(n=>{if(n instanceof w&&"Mesh"===n.data.type&&("TextGeometry"===n.data.geometry.type||"InputGeometry"===n.data.geometry.type)&&n.data.geometry.font===t){let s=n.geometry,i=n.data.geometry;s.updateFont(t,e).then(()=>{s.update(i,e);let t=n.invalidateDownstreamBooleanData();h(t)&&t.recomputeBoolean()})}})}traverseObject(t){for(let e of this.children)S.is(e)&&e.traverseObject(t)}traverseVisibleEntity(t){for(let e of this.children)B.is(e)&&e.visible&&e.traverseVisibleEntity(t)}dispose(){this.clearScene()}createChildrenObjects(t,e,n){let s=0;for(let i of t)this.createObject(i.id,i.data,i.children,e,s,n),s+=1}registerObjectCreatedInLegacy(t){this.entityByUuid[t.uuid]=t}unregisterObject(t){delete this.entityByUuid[t.uuid];for(let e of t.children)this.unregisterObject(e)}createObject(t,e,n,s,i,r){let a={scene:this,shared:r},o=ue(t,e,a);return z(o)&&this.shapeBlendIntances.push(o),E(o)&&this.hairInstances.push(o),o&&(this.entityByUuid[t]=o,s.add(o),s.children.splice(i,0,s.children.pop()),n.length>0&&(o.isInstanceRoot?console.error("instance should not have children!"):this.createChildrenObjects(n,o,r)),o.updateState(e,a),o instanceof w&&o.updateGeometryGroupsIfNeeded(),o.updateVisible(this),o.cloner&&this.toExpandCloner.add(o),e.pathSnapping?.pathId&&this.pathConstraints.setConstraint(t,e.pathSnapping.pathId)),"Empty"===e.type&&e.animations&&o.traverseEntity(t=>{let e=t.dataPatched;if(t instanceof w&&e.bones&&e.boneInverses){let n=e.bones.map(t=>this.find(t)),s=e.boneInverses.map(t=>(new it).fromArray(t)),i=new Ct(n,s);t.bind(i,t.bindMatrix)}else t.matrixAutoUpdate=!0}),o}getCenter(t){let e=[];for(let n=0,s=t.length;n<s;++n){let{id:s,recursive:i}=t[n],r=this.find(s),a=i?r.recursiveBBox:r.singleBBox;e.push(...a.vertices)}let n=new lt;return n.setFromPoints(e),n.getCenter(ve),ve}copyMatrixWorld(t,e){if(null===t)return void e.identity();let n=this.find(t);n?(n.updateWorldMatrix(!0,!1),e.copy(n.matrixWorld)):e.identity()}copyParentMatrixWorld(t,e){if(null===t)return void e.identity();let n=this.find(t)?.parent;n?(n.updateWorldMatrix(!0,!1),e.copy(n.matrixWorld)):e.identity()}traverseMaterial(t){this.traverseEntity(e=>{if(e instanceof D)if(Array.isArray(e.material))for(let n=0;n<e.material.length;n++)I(e.material[n])&&t(e.material[n]);else I(e.material)&&t(e.material)})}updateViewPlaneSize(t,e,n=!1){this.traverseConcreteEntity(s=>{s instanceof m&&s.setViewplaneSize(t,e,n)})}initializeSplatViewer(){this.splatViewer=new ge({scene:this}),this.reloadSplats()}reloadSplats(){this.splatViewer?.loadSplat()}};export{kt as a,Bt as b,Ft as c,Zt as d,xe as e,Ae as f};
@@ -1 +1 @@
1
- import{h as t}from"./runtime-chunk-2PT2WH66.js";import{g as e}from"./runtime-chunk-4KZXQGUQ.js";import{c as i}from"./runtime-chunk-TZCHGFVF.js";import{Ba as r,C as s,Ca as a,Ea as n,K as o,j as l,k as h,l as p,o as d}from"./runtime-chunk-VPEJ5BFD.js";import{$c as c,Cc as u,Ec as m,Fc as f,Kd as y,Oc as g,Pc as v,Pd as x,Rc as S,Re as w,Xc as M,bd as b,cd as B,dd as P,kd as E,ld as A}from"./runtime-chunk-VGN7YHB7.js";var C={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}};function D(t,e){let i=[];if(e.length!==t.length)return null;{let r=0;for(;r<t.length;){if("*"===e[r])i.push(t[r]);else if(t[r]!==e[r])return null;r+=1}}return i}function O(t,e){let i=[];if(!(e.length<=t.length))return null;{let r=0;for(;r<e.length;){if("*"===e[r])i.push(t[r]);else if(t[r]!==e[r])return null;r+=1}}return i}var V=new f,W=new f,_=new g,T=[new f(-1,1,1),new f(-1,-1,1),new f(1,-1,1),new f(1,1,1),new f(-1,1,-1),new f(-1,-1,-1),new f(1,-1,-1),new f(1,1,-1)],U=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],R=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],z=(t,e,i)=>{t.updateEntityBoxSize(V,W),_.copy(e).multiply(t.matrixWorld),0===W.x&&0===W.y&&0===W.z?i.push(new f(V.x,V.y,V.z).applyMatrix4(_)):T.forEach(t=>{i.push(t.clone().multiply(W).add(V).applyMatrix4(_))})},I=class extends M{constructor(){super(...arguments),this.matrix=new g,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(t=>t.clone()),this.faces=t.faces.map(t=>t.clone()),this.edges=t.edges.map(t=>t.clone()),this.centerEdges=t.centerEdges.map(t=>t.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=(new g).copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let r=[];if(!0===i){let i=[];t.traverseEntity(t=>{if(t.visible||t.cloner&&t.data.visible){if(!("geometry"in t))return _.copy(e).multiply(t.matrixWorld),void i.push((new f).applyMatrix4(_));z(t,e,r)}}),0===r.length&&r.push(...i)}else z(t,e,r);return this.setFromPoints(r)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(_.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(W).multiplyScalar(.5),this.getCenter(V),_.copy(this.matrix).setPosition(V),this.vertices=T.map(t=>t.clone().multiply(W).applyMatrix4(_))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=U.map(([t,e])=>new w(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new f))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=R.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}},L=new f,N=new f,F=new f,j=new f,k=new f,q=new f,G=new g,H=1e-12,K=.01;function X(t){let e=t.elements;L.set(e[0],e[1],e[2]),N.set(e[4],e[5],e[6]),F.set(e[8],e[9],e[10])}function Z(){let t=Math.max(L.lengthSq(),N.lengthSq(),F.lengthSq());L.lengthSq()>H*t?j.copy(L).normalize():j.set(1,0,0),k.crossVectors(F,j),k.lengthSq()<=H*t&&(k.copy(N).addScaledVector(j,-N.dot(j)),k.lengthSq()<=H*t&&function(t,e){t.set(1,0,0).cross(e),t.lengthSq()<=H&&t.set(0,1,0).cross(e),t.normalize()}(k,j)),k.normalize(),q.crossVectors(j,k)}function Q(t){return X(t),Z(),G.makeBasis(j,k,q)}var Y,$=new g;(Y||(Y={})).is=function(t){return t&&t.__isSPEObject};var J=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new g,this.copyPreviousMatrix=!0,this.hiddenMatrix=new g,this.pivotMatrix=new g,this.matrixWorldRigid=new g,this.shearScale=new g,this.shearScaleInv=new g}get __isSPEObject(){return!0}getPhysicsLocalMatrix(t){return!!this.rigidBody?.isDynamic()&&(t.copy(this.matrixWorld),this.hasNonUniformScale&&t.multiply(this.shearScaleInv),this.parent&&t.premultiply($.copy(this.parent.matrixWorld).invert()),t.premultiply($.copy(this.hiddenMatrix).invert()),t.multiply($.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(t){t instanceof S&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(let e of this.children)e.updateMatrixWorld(t)}updateWorldMatrix(t,e){let i=this.parent;if(t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),e)for(let t of this.children)t.updateWorldMatrix(!1,!0)}traverseChildren(t,e=0){for(let i of this.children)Y.is(i)&&i.traverseObject(t,e+1)}traverseObject(t,e=0){if(!0!==t(this,e))for(let i of this.children)Y.is(i)&&i.traverseObject(t,e+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(t,e,i){return X(t),Z(),e.makeBasis(j,k,q),i.set(j.dot(L),j.dot(N),j.dot(F),0,k.dot(L),k.dot(N),k.dot(F),0,q.dot(L),q.dot(N),q.dot(F),0,0,0,0,1),function(){let t=L.length(),e=N.length(),i=F.length(),r=Math.max(t,e,i);if(r-t>K||r-e>K||r-i>K)return!0;let s=K*r*r;return Math.abs(L.dot(N))>s||Math.abs(L.dot(F))>s||Math.abs(N.dot(F))>s}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(t,e){this.updateWorldMatrix(!0,!1);let i=(new g).copy(this.matrixWorld).invert();return null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),i.multiply(t.parent.matrixWorld)),"hiddenMatrix"in t&&t.hiddenMatrix instanceof g?t.hiddenMatrix.premultiply(i):t.applyMatrix4(i),t.updateWorldMatrix(!1,!1),this.add(t),void 0!==e&&(this.children.pop(),this.children.splice(e,0,t)),this}copy(t,e=!1){return super.copy(t,e),this.hasNonUniformScale=t.hasNonUniformScale,this}onAfterRender(t,e,i,r,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}},tt=class extends x{constructor(){super()}getPoints(t=12){let e,i=[],r=this.getCurveLengths(),s=r[r.length-1]/r.length;for(let a=0,n=this.curves;a<n.length;a++){let o=n[a],l=0===a?r[a]:r[a]-r[a-1],h=Math.ceil(t*l/s),p=o.getPoints(h);for(let t=0;t<p.length;t++){let r=p[t];e&&e.equals(r)||(i.push(r),e=r)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},et=.001,it=new f,rt=new f,st=new f,at=new f,nt=new f,ot=new f,lt=new f,ht=new f,pt=new f;function dt(t,e,i){return it.subVectors(e,t),rt.subVectors(e,i),it.cross(rt).length()<=et}var ct,ut=new WeakMap;function mt(t){let e=ut.get(t.points);if(void 0!==e&&e.isClosed===t.isClosed)return e.curve;let i=function(t){let e=t.points,i=[e[0]],r=[new f(...e[0].data.position)];st.copy(r[0]);for(let t=0;t<e.length-1;t++)it.fromArray(e[t].data.position),rt.fromArray(e[t+1].data.position),nt.subVectors(it,st),lt.subVectors(it,rt),nt.cross(lt).length()>et&&(i.push(e[t]),r.push((new f).copy(it)),st.copy(it));let s=e[e.length-1];i.push(s),r.push(new f(...s.data.position));let a=t.isClosed,n=i.length-(a?0:1),o=i.length,l=[],h=[];for(let t=0;t<o;t++){let e=i[t].data;l.push(new f(...e.controlPrevious.position)),h.push(new f(...e.controlNext.position))}let p=[];for(let t=0;t<n;t++){let e=t===o-1?0:t+1;p.push(dt(r[t],h[t],r[e])&&dt(r[t],l[e],r[e]))}let d=[];for(let t=0;t<o;t++){let e=i[t].data,s=r[t],n={position:s,prevDir:void 0,nextDir:void 0,controlPrevious:l[t],controlNext:h[t],tan:void 0,baseRoundness:e.roundness,removedLength:0};if(d.push(n),0===e.roundness||!a&&(0===t||t===o-1))continue;let c=a&&0==t?o-1:t-1,u=a&&t==o-1?0:t+1,m=(new f).subVectors(r[c],s).normalize(),y=(new f).subVectors(r[u],s).normalize();n.prevDir=m,n.nextDir=y;let g=p[a&&0===t?o-1:t-1],v=p[t];if(g&&v){at.addVectors(m,y).normalize();let t=st.crossVectors(at,m).length()/m.dot(at);n.tan=t,n.removedLength=e.roundness/t}}for(let t=0;t<n;t++){let e=a&&t===o-1?0:t+1,i=d[t],r=d[e];if(0!==i.removedLength||0!==r.removedLength){let t=i.position.distanceTo(r.position);i.removedLength=Math.min(i.removedLength,t/2),r.removedLength=Math.min(r.removedLength,t/2)}}let c=new Array(2*o).fill(null);for(let t=0;t<n;t++){let e=a&&t===o-1?0:t+1,i=d[t],r=d[e],s=null;if(p[t]){let t=i.position.clone(),e=r.position.clone();(0!==i.removedLength||0!==r.removedLength)&&(i.nextDir&&t.add(st.copy(i.nextDir).setLength(i.removedLength)),r.prevDir&&e.add(st.copy(r.prevDir).setLength(r.removedLength))),t.distanceTo(e)>et&&(s=new y(t,t.clone().lerp(e,.3),e.clone().lerp(t,.3),e))}else i.position.distanceTo(r.position)>et&&(s=new y(i.position,i.controlNext,r.controlPrevious,r.position));c[2*t+1]=s}for(let t=0;t<o;t++){let e=d[t];if(0===e.removedLength)continue;let i=e.position,r=e.prevDir.clone().multiplyScalar(e.removedLength).add(i),s=e.nextDir.clone().multiplyScalar(e.removedLength).add(i),a=e.tan*e.removedLength;at.addVectors(e.prevDir,e.nextDir).normalize(),nt.copy(r).lerp(s,.5);let n=r.distanceTo(s)/2;pt.copy(at).multiplyScalar(Math.sqrt(Math.pow(a,2)-Math.pow(n,2))).add(nt),ot.copy(at).multiplyScalar(-a).add(pt);let o=i.distanceTo(ot)/i.distanceTo(nt);lt.copy(e.prevDir).multiplyScalar(o*i.distanceTo(r)).add(i),ht.copy(lt).lerp(ot,2);let l=r.clone().lerp(lt,4/3),h=s.clone().lerp(ht,4/3);c[2*t]=new y(r,l,h,s)}let u=new tt;for(let t=0;t<c.length;t++){let e=c[t];e&&u.add(e)}return u}(t);return ut.set(t.points,{isClosed:t.isClosed,curve:i}),i}(ct||(ct={})).is=function(t){return t&&t.__isEntity};var ft=t=>ct.is(t),yt={type:"completeState",isfromEntity:!0},gt=["x","y","z"],vt=new f,xt=new f(1,1,1),St=new m,wt=new v,Mt=(new f).set(0,1,0),bt=new g,Bt=new g,Pt=c=>class extends(J(c)){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new I,this._recursiveBBox=new I,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(t){let e=this.children[t];if(ct.is(e))return e}entityChildrenCount(){let t=this.children.length;for(;t--;)if(ct.is(this.children[t]))return t+1;return 0}get isConcreteEntity(){return"string"==typeof this.identity}get isVirtualEntity(){return"string"!=typeof this.identity}get isInstanceRoot(){return this.isConcreteEntity&&"Instance"===this.data.type}nearestInstanceSelfOrParent(){let t=this;for(;"Instance"!==t.data.type;){let e=t.parent;if(!ct.is(e))return;t=e}return t}forInstancesRec(t){this.instances.forEach(e=>{e.disposed||t(e),e.forInstancesRec(t)})}super_Entity(t,e){"string"==typeof t&&(this.uuid=t),this.identity=t,this.data=e,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(t,e,i=!1){if(0!==this.data.states.length||i){for(let t of this.data.states)n.toOps(this.data,t.data).forEach(t=>{let i=h.replaceProps(t,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,e)});if(null!==t){let i=this.data.states.data(t);i&&(this.dataPatched=n.patch(this.data,i),n.toOps(this.data,i).forEach(t=>{this.updateByPatchedOp(t,this.dataPatched,e)}))}i&&this.updateTransformState(this.dataPatched,e),this.stateSelection=t,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(t,e){t.setScalar(0),e.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{ft(t)&&t.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(t=>{t.resetBBoxNeedsUpdateSelf()})}find(t){let e;return this.traverseEntity(i=>{i.uuid===t&&(e=i)}),e}traverseSortNextHelper(){let t=this.parent;if(t){let e=t.children,i=e.indexOf(this)+1;if(ct.is(e[i]))return e[i];if(ct.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&ct.is(this.children[0])?t[0]:this.traverseSortNextHelper()}goUp(t){let e=this;for(;t>0&&null!==e;)e=e.parent,t-=1;return e}hasAnccestorOrSelf(t){return this===t||this.hasAnccestor(t)}hasAnccestor(t){let e=this.parent;for(;e;){if(t===e)return!0;e=e.parent}return!1}countToAccestor(t){let e=0,i=this;for(;i!==t;){if(null===i)return-1;i=i.parent,e+=1}return e}forEachEntity(t){for(let e of this.children)ft(e)&&t(e)}traverseEntityAncestors(t){this.traverseAncestors(e=>{ct.is(e)&&t(e)})}traverseConcreteEntity(t,e=0){if(!0!==t(this,e))for(let i of this.children)ft(i)&&i.isConcreteEntity&&i.traverseEntity(t,e+1)}traverseEntity(t,e=0){if(!0!==t(this,e))for(let i of this.children)ft(i)&&i.traverseEntity(t,e+1)}traverseVisibleEntity(t){t(this);for(let e of this.children)ft(e)&&e.visible&&e.traverseVisibleEntity(t)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(t){super.updateMatrixWorld(t),this.dispatchEvent({type:"updateMatrixWorld"})}copy(t,e=!1){return super.copy(t,e),this.dataPatched=t.dataPatched,this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),this}hasEntityChild(){return this.children.some(t=>ft(t))}isAncestorOf(t){if(this.uuid===t)return!1;let e=!1;return this.traverseEntity(i=>{i.uuid===t&&(e=!0)}),e}toObjectTransformState(t=[]){this.updateWorldMatrix(!0,!1);let i={position:this.position.toArray(),rotation:[this.rotation.x*u.RAD2DEG,this.rotation.y*u.RAD2DEG,this.rotation.z*u.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return e(i,t)}getTransformValues(t,e,i){return e[t].map((e,r)=>i?.shared.getVariable(e,[this.uuid,t,gt[r]])??e)}updateTransformState(t,e){let i=!1;if(t.position&&(this.position.fromArray(this.getTransformValues("position",t,e)),i=!0),t.rotation&&(vt.fromArray(this.getTransformValues("rotation",t,e)).multiplyScalar(u.DEG2RAD),this.rotation.setFromVector3(vt),i=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,e)),i=!0),void 0!==t.hiddenMatrix&&(i=!0,this.hiddenMatrix.fromArray(t.hiddenMatrix??s.identity)),void 0!==t.pivot||void 0!==t.pivotRotation)if(i=!0,void 0!==t.pivot&&void 0!==t.pivotRotation)this.pivotMatrix.compose(vt.fromArray(t.pivot).negate(),St.setFromEuler(wt.fromArray(t.pivotRotation.map(t=>t*u.DEG2RAD))).invert(),xt);else if(void 0!==t.pivot)this.pivotMatrix.setPosition(-t.pivot[0],-t.pivot[1],-t.pivot[2]);else if(void 0!==t.pivotRotation){let e=vt.setFromMatrixPosition(this.pivotMatrix);St.setFromEuler(wt.fromArray(t.pivotRotation.map(t=>t*u.DEG2RAD))).invert(),this.pivotMatrix.compose(e,St,xt)}return i&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(t=>{t.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&void 0!==t.hiddenMatrix&&this.updateWorldMatrix(!1,!0),i}onVariableUpdate(t=!1){t?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(t=>{t.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let t of this.children)ct.is(t)&&t.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(t=>{ct.is(t)&&t.disposeRecursively()})}toState(t=[]){let i={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(t)};return e(i,t)}updateByObjUpdateOp(t,e){void 0!==t&&this.updateByOp({type:0,props:t,path:[]},{...this.data,...t},e,!1)}updateByOp(t,e,i,s){let o=this.data;this.data=e;let h=t,c=O(t.path,["states","*"]);if(null!==c){if(0===t.type){let[e]=c;if(this?.stateSelection===e){let e={...t.props};if(delete e.name,Object.values(t.props).some(t=>void 0===t)){let i=this.data;if(void 0!==i){let r=d.zoom(i,t.path.slice(2));if(r)for(let i in t.props)void 0===t.props[i]&&i in r&&(e[i]=r[i])}}h={...t,props:e,path:t.path.slice(2)}}}}else if(0===t.type){let e=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==e){if(void 0!==t.props.name&&e.name){let{name:t,...i}=e;e=i}if(void 0!==t.props.material&&"material"in e){let{material:t,...i}=e;e=i}let i=d.removeOverridden(t.path,t.props,e);h={...t,props:i}}}if(this.updateByPatchedOpBase(h,n.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i),O(t.path,["overrides"])){let s=[],a=[...t.path];for(s.push(a[1]),a.splice(0,2);a.length>0&&"descendants"===a[0];)s.push(a[1]),a.splice(0,2);if(void 0===s[s.length-1]){if(0===t.type)for(let e of Object.keys(t.props)){s[s.length-1]=e;let r=i.scene.findInstance([this.uuid,...s]);r&&(r.overrideData=t.props[e],r.updateState(l.apply(r.component.data,r.overrideData),i))}}else{let n=i.scene.findInstance([this.uuid,...s]);if(n){let o=d.zoom(n.component.data,a);if(0===(t={...t,path:a}).type){let e=t.props;if(o)for(let[i,r]of Object.entries(t.props))void 0===r&&(e===t.props&&(e={...t.props}),e[i]=o[i]);t={...t,props:e}}n.overrideData=r.resolve(e.overrides,s),n.updateByOp(t,p.applySimple(n.data,t),i,!1)}}}else if(this.instances.length>0){let r;if(0===t.path.length&&0===t.type){let e;for(let i of a.rootOverrideProps)i in t.props&&(void 0===e&&(e={}),e[i]=t.props[i]);e&&(r={...t,props:e})}else for(let e of a.rootOverrideProps)if(O(t.path,[e])){r=t;break}void 0!==r&&this.instances.forEach(t=>{if(t.isInstanceRoot){let e=l.filterOp(t.overrideData,r);e&&t.updateByOp(e,p.applySimple(t.data,e),i,!0)}}),this.instances.forEach(r=>{if(!r.isInstanceRoot){let s=l.filterOp(r.overrideData,t);if(s){let a;a=o===r.data&&t===s?e:p.applySimple(r.data,s),r.updateByOp(s,a,i,!0)}}})}}updateByPatchedOpBase(t,e,i){if(this.dataPatched=e,0===t.path.length&&0===t.type)void 0!==t.props.type&&!o.is(t.props.type)&&C.changeEntityProptotype(this,e,i);else if(1===t.path.length&&"geometry"===t.path[0]&&0===t.type&&"type"in t.props){C.changeEntityProptotype(this,e,i);for(let t of this.children)ct.is(t)&&t.updateVisible(i.scene)}this.updateByPatchedOp(t,e,i)}updateByPatchedOp(t,e,i){if(0===t.path.length&&0===t.type?this.updateState(t.props,i):0===t.type&&("resolutionLevel"in t.props||"useChildrenColors"in t.props)&&this.updateState(e,i),"morphTargetInfluences"===t.path[0]&&0===t.type){let r=e.morphTargetInfluences.get(t.path[1])?.data.name;r&&this.updateMorphInfluences(r,i.shared.getVariable(t.props.value,[this.uuid,"morphTargetInfluences",r]))}if(null!==O(t.path,["pathSnapping"])&&this.updatePathSnapping(e.pathSnapping),null!==O(t.path,["cloner"])){let r=p.drop(t,1);0===r.path.length&&0===r.type&&!0===r.props.disabled?this.setFromClonerState(null,i):this.cloner?this.cloner.updateState(e.cloner,i):(this.setFromClonerState(e.cloner,i),this.expandCloner(i)),this.updateVisible(i.scene)}}updatePathSnapping(t=this.dataPatched.pathSnapping){this._updatedPathSnapping=t,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(t){if(!1===this._needApplyPathSnapping)return;let e=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,i=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(null===e)return;let a=t.find(e);if(!a)return;this._needApplyPathSnapping=!1;let n=a.data;if(n.geometry.path.points.length<=1)return;let o=mt(n.geometry.path),l=(i+r)%1;i+r===1&&0===l&&(l=1);let h=null;try{h=o.curves.length?o.getPointAt(l):null}catch(t){}if(null===h)return;a.updateMatrixWorld();let p=this.parent?bt.copy(this.parent.matrixWorld).invert():bt.identity();p.multiply(a.matrixWorld),h.applyMatrix4(p);let d={position:h.toArray(),rotation:n.rotation};if("tangential"===s){let t=Bt.extractRotation(a.matrixWorld),e=o.getTangentAt(l).applyMatrix4(t).add(h),i=Bt.lookAt(h,e,Mt),r=vt.setFromEuler(wt.setFromRotationMatrix(i)).multiplyScalar(u.RAD2DEG);d={...d,rotation:r.toArray()}}this.updateTransformState(d),this.traverseEntity(t=>{t._cameraType&&t.dispatchEvent(yt)})}updateVisible(t){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||!0!==this.dataPatched.cloner?.hideBase),!t)return;let e=!1;this.traverseEntity(t=>{if("Splat"===t.data.type)return e=!0,!0}),e&&t.reloadSplats()}updateState_Entity(t,e){void 0!==t.name&&(this.name=t.name),void 0!==t.raycastLock&&(this.raycastLock=t.raycastLock),void 0!==t.visible&&(this.updateVisible(e?.scene),this.resetBBoxNeedsUpdate()),e&&"cloner"in t&&void 0!==t.cloner&&(this.setFromClonerState(t.cloner,e),this.updateVisible(e.scene)),this.updateTransformState(t,e)}get attachedSurfaceCloners(){return this.children.filter(e=>t(e)&&"toObject"===e.parameters.type)}setFromClonerState(t,e){if(!this.disposed)if(null===t||t.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(void 0===this.cloner){if(null===C.Cloner)return void i("cloners","a cloner");this.cloner=new C.Cloner(this,t),e.scene.addPendingExpandCloner(this)}else this.cloner.updateState(t,e)}expandCloner(t){!this.disposed&&this.cloner&&this.cloner.expandClones(t)}invalidateClonerTransform(t){this.cloner&&this.cloner.invalidateTransform(t)}requestRender(){this.dispatchEvent({type:"requestRender"})}},Et=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),r=Math.abs(i.width),s=Math.abs(i.height??r),a=Math.abs(i.depth??r),n=Math.abs(Math.min(r,a))/2;return{parameters:Object.assign(i,{width:r,height:s,depth:a,radius:n,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:r,radius:s,revolutions:a,segments:n,pathRadius:o,pathType:l,pathSegments:h,cornerRadius:p,cornerSegments:d}=t.parameters,c=new Vt(!1,e,i,r,s,a,n,o,l,h,p,d);return Object.assign(c,{userData:{...t,type:"HelixGeometry"}})}},At=new c([0,0,0],1);function Ct(t){return"TorusGeometry"===t.type&&360===t.arc}var Dt,Ot,Vt=class extends P{constructor(t=!0,e=1,i=1,r=1,s=1,a=1,n=1,o=1,l=1,h=1,p=1,d=1){if(super(),0===a)return;let c=t&&1===a;c&&(d=0),p>100&&(p=100),0===p&&(d=0);let u,m,y,g,v,x,S,w,M=()=>new f,B=new f,P=M(),E=M(),A=M(),C=M(),D=M(),O=M(),V=M(),W=M(),_=M(),T=M(),U=M(),R=i-2*o+.001,z=R/a,I=Math.ceil(n*a),L=I+1,N=R/I,F=-R/2,j=h+1,k=2*Math.PI/h,q=Math.PI/2/d,G=Math.min((1-p/100)*o,o-.01),H=o-G,K=0,X=2*d+2,Z=j*X/2,Q=Z+j*L,Y=Math.max(0,j*(L+X)),[$,J,tt]=[3,3,2].map(t=>Array(Y*t).fill(0)),et=[],it=s-o;function rt(e,i){let r=Math.PI/2;x=i*N,w=2*Math.PI*(x%z)/z+r,x+=F,S=Math.sin(w)*it,v=Math.cos(w)*it,t?e.set(v,S,x):e.set(v,x,S)}rt(B,-1e-10),rt(P,0),C.copy(B),rt(B,1);let st=B.distanceTo(P),at=c?0:H+G,nt=st*I+2*at,ot=G,lt=nt-at;for(let e=0;e<=I;e++){rt(E,e),U.subVectors(E,C).normalize(),C.copy(E),_.copy(E).setComponent(+t+1,0).normalize(),T.crossVectors(U,_).normalize();let i=0===e,r=e===I,s=i?3*Math.PI/2:q,a=i?ot:lt,n=i?j:Q,l=i?0:Y-j,p=U.clone().multiplyScalar(i?-H:H).add(E),u=U.clone().multiplyScalar(i?-1:1).normalize();for(let t=0;t<j;t++){let m=t*k;if(D.addVectors(B.copy(_).multiplyScalar(o*Math.cos(m)),P.copy(T).multiplyScalar(o*Math.sin(m))),O.copy(D).normalize(),i||r){c||(K=l+t,[0,1,2].forEach(t=>{$[3*K+t]=p.getComponent(t),J[3*K+t]=u.getComponent(t)}),tt[2*K]=+r,tt[2*K+1]=t/h),P.copy(O).multiplyScalar(G),A.addVectors(E,P);for(let e=0;e<d;e++){let r=e*q+s;V.addVectors(B.copy(U).multiplyScalar(H*Math.sin(r)),P.copy(O).multiplyScalar(H*Math.cos(r))),W.copy(V).normalize(),P.addVectors(A,V),V.normalize(),K=n+e*j+t,[0,1,2].forEach(t=>{$[3*K+t]=P.getComponent(t),J[3*K+t]=W.getComponent(t)});let o=+i+Math.sin(r);tt[2*K]=(a+H*o)/nt,tt[2*K+1]=t/h}}P.addVectors(E,D),K=Z+e*j+t,[0,1,2].forEach(t=>{$[3*K+t]=P.getComponent(t),J[3*K+t]=O.getComponent(t)}),tt[2*K]=(at+e*st)/nt,tt[2*K+1]=t/h}}let ht=L+2*d+2,[pt,dt]=[+c,ht-1];for(let t=pt;t<=dt-1;t++){let e=c&&t===dt-1;for(let i=0;i<j-1;i++)u=t*j+i,m=u+1,y=(e?i:u)+j,g=(e?i+1:m)+j,0===t?et.push(m,g,y):t===ht-2?et.push(u,m,y):et.push(u,m,y,m,g,y)}this.setIndex(et),this.setAttribute("position",new b($,3)),this.setAttribute("normal",new b(J,3)),this.setAttribute("uv",new b(tt,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,r,s=this.userData.parameters,a=Math.ceil(s.tubularSegments),n=s.radialSegments,o=n+1,l=[];for(let s=1;s<a;s++)for(let a=0;a<n;a++)t=s*o+a,e=t+1,i=t+o,r=e+o,l.push(t,e,i,e,r,i);for(let s=0;s<n;s++)t=a*o+s,e=t+1,i=s+o,r=s+1+o,l.push(t,e,i,e,r,i);return At.array=new Uint32Array(l),At.count=l.length,At}},Wt=new Map,_t=0;function Tt(t){return Ot||(Ot=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.8/build",i=import("./boolean.js"),[r,s]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(t=>t.arrayBuffer())]);await r.default({module_or_path:s}),Dt=r}())}function Ut(){if(void 0===Dt)throw new Error("boolean-wasm is not loaded");return Dt}function Rt(t){let e=Wt.get(t);if(void 0===e)throw new Error("Unknown csg mesh set handle "+t);return e}function zt(t){return Wt.set(++_t,t),_t}var It={0:0,1:1,2:2};function Lt(t,e,i){if(void 0===Dt)return-1;let{positions:r,indices:s,normals:a}=function(t,e){if(e&&void 0!==t.userData.positions){let e=t.userData,i=[];for(let t=0,r=0;t<e.verticesPerFace.length;t++){let s=e.verticesPerFace[t];for(let t=1;t<s-1;t++)i.push(e.indices[r],e.indices[r+t],e.indices[r+t+1]);r+=s}return{positions:e.positions instanceof Float32Array?e.positions:new Float32Array(e.positions),indices:new Uint32Array(i)}}let i;i=Ct(t.userData.parameters)?t.getClosedTorusIndicesForBooleanOrSubdiv():t.getIndex();let r,s=t.getAttribute("position");if(null===i){r=new Uint32Array(s.count);for(let t=0;t<r.length;t++)r[t]=t}else r=i.array instanceof Uint32Array?i.array:new Uint32Array(i.array);let a=t.getAttribute("normal"),n=void 0!==a&&3===a.itemSize&&a.count===s.count&&a.array instanceof Float32Array&&!0!==a.isInterleavedBufferAttribute?a.array:void 0;return{positions:s.array,indices:r,normals:n}}(t,e);return zt(new Dt.CsgMesh(r,s,a))}function Nt(t,e){let i=Ut(),r=It[e];if(void 0===r)throw new Error("Unknown boolean operation "+e);let s=t.map(Rt);if(1===s.length)return i.clone_mesh(s[0]);let a,n=[];if(2===e&&s.length>2){let t=s[0];for(let e=1;e<s.length-1;e++)t=i.boolean_mesh(t,s[e],0),n.push(t);a=i.boolean_mesh(s[s.length-1],t,2)}else if(2===e)a=i.boolean_mesh(s[1],s[0],2);else{let t=s[s.length-1];for(let e=0;e<s.length-1&&(t=i.boolean_mesh(t,s[e],r),n.push(t),0!==t.tri_count());e++);a=t,n.pop()}for(let t of n)t.free();return a}function Ft(t,e,i,r){let s=Ut(),a=Nt(t,e),n=s.mesh_render_data(a,Math.max(r,0));if(i.setAttribute("position",new b(n.positions(),3)),i.setAttribute("normal",new b(n.normals(),3)),n.free(),null===i.boundingSphere&&(i.boundingSphere=new B),0===a.tri_count())i.boundingSphere.center.set(0,0,0),i.boundingSphere.radius=0,i.userData.parameters={width:0,height:0,depth:0};else{let t=a.bounds();i.boundingSphere.center.set(t[0],t[1],t[2]),i.boundingSphere.radius=(t[3]**2+t[4]**2+t[5]**2)**.5,i.userData.parameters={width:2*t[3],height:2*t[4],depth:2*t[5]}}return zt(a)}function jt(t,e){let i=Ut(),r=Nt(t,e),s=i.mesh_topological_data(r),a=s.positions(),n=s.indices();return s.free(),r.free(),{positions:a,indices:n,verticesPerFace:new Uint8Array(n.length/3).fill(3)}}function kt(t,e){Rt(t).transform(new Float32Array(e.elements))}function qt(t){let e=Wt.get(t);void 0!==e&&(e.free(),Wt.delete(t))}function Gt(t,e){return zt(Ut().instanced_union(Rt(t),e))}function Ht(t){return null!==t&&"booleanOp"in t}var Kt=class extends(Pt(A)){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new g}updateVisible(t){super.updateVisible(t),this.visible=!Ht(this.parent)&&this.visible,Ht(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Ht(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){-1!==this.booleanMeshSetAddress&&(qt(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Ht(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof Kt&&(t.freeBooleanPointer(),Ht(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&Ht(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),Ht(this.parent)&&this.invalidateDownstreamBooleanData(!0)}},Xt=new M;function Zt(t,e=0,i=t.count,r,s){let a=1/0,n=1/0,o=1/0,l=-1/0,h=-1/0,p=-1/0;for(let r=e;r<i;r++){let e=t.getX(r),i=t.getY(r),s=t.getZ(r);e<a&&(a=e),i<n&&(n=i),s<o&&(o=s),e>l&&(l=e),i>h&&(h=i),s>p&&(p=s)}Xt.min.set(a,n,o),Xt.max.set(l,h,p),Xt.getCenter(r),Xt.getSize(s).multiplyScalar(.5)}var Qt=new P,Yt=new E,$t=class extends Kt{constructor(t,e){super(Qt,Yt),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){super.raycast(t,e)}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");void 0!==i?Zt(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}};export{D as a,O as b,C as c,Q as d,Y as e,J as f,mt as g,ct as h,ft as i,Pt as j,Et as k,Ct as l,Vt as m,Tt as n,Lt as o,Ft as p,jt as q,kt as r,qt as s,Gt as t,Zt as u,$t as v};
1
+ import{h as t}from"./runtime-chunk-2PT2WH66.js";import{g as e}from"./runtime-chunk-4KZXQGUQ.js";import{c as i}from"./runtime-chunk-TZCHGFVF.js";import{Ba as r,C as s,Ca as a,Ea as n,K as o,j as l,k as h,l as p,o as d}from"./runtime-chunk-VPEJ5BFD.js";import{$c as c,Cc as u,Ec as m,Fc as f,Kd as y,Oc as g,Pc as v,Pd as x,Rc as S,Re as w,Xc as M,bd as b,cd as B,dd as P,kd as E,ld as A}from"./runtime-chunk-VGN7YHB7.js";var C={Cloner:null,changeEntityProptotype:()=>{},createEntity:()=>{}};function D(t,e){let i=[];if(e.length!==t.length)return null;{let r=0;for(;r<t.length;){if("*"===e[r])i.push(t[r]);else if(t[r]!==e[r])return null;r+=1}}return i}function O(t,e){let i=[];if(!(e.length<=t.length))return null;{let r=0;for(;r<e.length;){if("*"===e[r])i.push(t[r]);else if(t[r]!==e[r])return null;r+=1}}return i}var V=new f,W=new f,_=new g,T=[new f(-1,1,1),new f(-1,-1,1),new f(1,-1,1),new f(1,1,1),new f(-1,1,-1),new f(-1,-1,-1),new f(1,-1,-1),new f(1,1,-1)],U=[[0,3],[1,2],[5,6],[4,7],[0,1],[3,2],[7,6],[4,5],[0,4],[1,5],[2,6],[3,7]],R=[[0,2],[7,5],[4,1],[3,6],[4,3],[1,6]],z=(t,e,i)=>{t.updateEntityBoxSize(V,W),_.copy(e).multiply(t.matrixWorld),0===W.x&&0===W.y&&0===W.z?i.push(new f(V.x,V.y,V.z).applyMatrix4(_)):T.forEach(t=>{i.push(t.clone().multiply(W).add(V).applyMatrix4(_))})},I=class extends M{constructor(){super(...arguments),this.matrix=new g,this.vertices=[],this.faces=[],this.edges=[],this.centerEdges=[]}copy(t){return super.copy(t),this.matrix.copy(t.matrix),this.vertices=t.vertices.map(t=>t.clone()),this.faces=t.faces.map(t=>t.clone()),this.edges=t.edges.map(t=>t.clone()),this.centerEdges=t.centerEdges.map(t=>t.clone()),this}setFromObjectSize(t,e=!1){t.updateWorldMatrix(!1,e),this.makeEmpty(),this.matrix.copy(t.matrixWorld);let i=(new g).copy(t.matrixWorld).invert();return this.expandByObjectSize(t,i,e)}expandByObjectSize(t,e,i=!1){let r=[];if(!0===i){let i=[];t.traverseEntity(t=>{if(t.visible||t.cloner&&t.data.visible){if(!("geometry"in t))return _.copy(e).multiply(t.matrixWorld),void i.push((new f).applyMatrix4(_));z(t,e,r)}}),0===r.length&&r.push(...i)}else z(t,e,r);return this.setFromPoints(r)}getCenter(t){return(t=super.getCenter(t)).applyMatrix4(this.matrix),t}getPositionToCenter(t){return(t=super.getCenter(t)).applyMatrix4(_.copy(this.matrix).setPosition(0,0,0)),t}computeVertices(){this.getSize(W).multiplyScalar(.5),this.getCenter(V),_.copy(this.matrix).setPosition(V),this.vertices=T.map(t=>t.clone().multiply(W).applyMatrix4(_))}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=U.map(([t,e])=>new w(this.vertices[t],this.vertices[e])),this.centerEdges=this.edges.map(t=>t.getCenter(new f))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=R.map(([t,e])=>this.vertices[t].clone().add(this.vertices[e]).multiplyScalar(.5))}},L=new f,N=new f,F=new f,j=new f,k=new f,q=new f,G=new g,H=1e-12,K=.01;function X(t){let e=t.elements;L.set(e[0],e[1],e[2]),N.set(e[4],e[5],e[6]),F.set(e[8],e[9],e[10])}function Z(){let t=Math.max(L.lengthSq(),N.lengthSq(),F.lengthSq());L.lengthSq()>H*t?j.copy(L).normalize():j.set(1,0,0),k.crossVectors(F,j),k.lengthSq()<=H*t&&(k.copy(N).addScaledVector(j,-N.dot(j)),k.lengthSq()<=H*t&&function(t,e){t.set(1,0,0).cross(e),t.lengthSq()<=H&&t.set(0,1,0).cross(e),t.normalize()}(k,j)),k.normalize(),q.crossVectors(j,k)}function Q(t){return X(t),Z(),G.makeBasis(j,k,q)}var Y,$=new g;(Y||(Y={})).is=function(t){return t&&t.__isSPEObject};var J=t=>class extends t{constructor(){super(...arguments),this.previousModelViewMatrix=new g,this.copyPreviousMatrix=!0,this.hiddenMatrix=new g,this.pivotMatrix=new g,this.matrixWorldRigid=new g,this.shearScale=new g,this.shearScaleInv=new g}get __isSPEObject(){return!0}getPhysicsLocalMatrix(t){return!!this.rigidBody?.isDynamic()&&(t.copy(this.matrixWorld),this.hasNonUniformScale&&t.multiply(this.shearScaleInv),this.parent&&t.premultiply($.copy(this.parent.matrixWorld).invert()),t.premultiply($.copy(this.hiddenMatrix).invert()),t.multiply($.copy(this.pivotMatrix).invert()),!0)}isDescendantOf(t){t instanceof S&&(t=t.uuid);let e=this;for(;e.parent;){if(e.parent.uuid===t)return!0;e=e.parent}return!1}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(let e of this.children)e.updateMatrixWorld(t)}updateWorldMatrix(t,e){let i=this.parent;if(t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),e)for(let t of this.children)t.updateWorldMatrix(!1,!0)}traverseChildren(t,e=0){for(let i of this.children)Y.is(i)&&i.traverseObject(t,e+1)}traverseObject(t,e=0){if(!0!==t(this,e))for(let i of this.children)Y.is(i)&&i.traverseObject(t,e+1)}updateMatrixWorldRigid(){this.hasNonUniformScale=function(t,e,i){return X(t),Z(),e.makeBasis(j,k,q),i.set(j.dot(L),j.dot(N),j.dot(F),0,k.dot(L),k.dot(N),k.dot(F),0,q.dot(L),q.dot(N),q.dot(F),0,0,0,0,1),function(){let t=L.length(),e=N.length(),i=F.length(),r=Math.max(t,e,i);if(r-t>K||r-e>K||r-i>K)return!0;let s=K*r*r;return Math.abs(L.dot(N))>s||Math.abs(L.dot(F))>s||Math.abs(N.dot(F))>s}()}(this.matrixWorld,this.matrixWorldRigid,this.shearScale),this.matrixWorldRigid.copyPosition(this.matrixWorld),this.shearScaleInv.copy(this.shearScale).invert()}attach(t,e){this.updateWorldMatrix(!0,!1);let i=(new g).copy(this.matrixWorld).invert();return null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),i.multiply(t.parent.matrixWorld)),"hiddenMatrix"in t&&t.hiddenMatrix instanceof g?t.hiddenMatrix.premultiply(i):t.applyMatrix4(i),t.updateWorldMatrix(!1,!1),this.add(t),void 0!==e&&(this.children.pop(),this.children.splice(e,0,t)),this}copy(t,e=!1){return super.copy(t,e),this.hasNonUniformScale=t.hasNonUniformScale,this}onAfterRender(t,e,i,r,s,a){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}},tt=class extends x{constructor(){super()}getPoints(t=12){let e,i=[],r=this.getCurveLengths(),s=r[r.length-1]/r.length;for(let a=0,n=this.curves;a<n.length;a++){let o=n[a],l=0===a?r[a]:r[a]-r[a-1],h=Math.ceil(t*l/s),p=o.getPoints(h);for(let t=0;t<p.length;t++){let r=p[t];e&&e.equals(r)||(i.push(r),e=r)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}},et=.001,it=new f,rt=new f,st=new f,at=new f,nt=new f,ot=new f,lt=new f,ht=new f,pt=new f;function dt(t,e,i){return it.subVectors(e,t),rt.subVectors(e,i),it.cross(rt).length()<=et}var ct,ut=new WeakMap;function mt(t){let e=ut.get(t.points);if(void 0!==e&&e.isClosed===t.isClosed)return e.curve;let i=function(t){let e=t.points,i=[e[0]],r=[new f(...e[0].data.position)];st.copy(r[0]);for(let t=0;t<e.length-1;t++)it.fromArray(e[t].data.position),rt.fromArray(e[t+1].data.position),nt.subVectors(it,st),lt.subVectors(it,rt),nt.cross(lt).length()>et&&(i.push(e[t]),r.push((new f).copy(it)),st.copy(it));let s=e[e.length-1];i.push(s),r.push(new f(...s.data.position));let a=t.isClosed,n=i.length-(a?0:1),o=i.length,l=[],h=[];for(let t=0;t<o;t++){let e=i[t].data;l.push(new f(...e.controlPrevious.position)),h.push(new f(...e.controlNext.position))}let p=[];for(let t=0;t<n;t++){let e=t===o-1?0:t+1;p.push(dt(r[t],h[t],r[e])&&dt(r[t],l[e],r[e]))}let d=[];for(let t=0;t<o;t++){let e=i[t].data,s=r[t],n={position:s,prevDir:void 0,nextDir:void 0,controlPrevious:l[t],controlNext:h[t],tan:void 0,baseRoundness:e.roundness,removedLength:0};if(d.push(n),0===e.roundness||!a&&(0===t||t===o-1))continue;let c=a&&0==t?o-1:t-1,u=a&&t==o-1?0:t+1,m=(new f).subVectors(r[c],s).normalize(),y=(new f).subVectors(r[u],s).normalize();n.prevDir=m,n.nextDir=y;let g=p[a&&0===t?o-1:t-1],v=p[t];if(g&&v){at.addVectors(m,y).normalize();let t=st.crossVectors(at,m).length()/m.dot(at);n.tan=t,n.removedLength=e.roundness/t}}for(let t=0;t<n;t++){let e=a&&t===o-1?0:t+1,i=d[t],r=d[e];if(0!==i.removedLength||0!==r.removedLength){let t=i.position.distanceTo(r.position);i.removedLength=Math.min(i.removedLength,t/2),r.removedLength=Math.min(r.removedLength,t/2)}}let c=new Array(2*o).fill(null);for(let t=0;t<n;t++){let e=a&&t===o-1?0:t+1,i=d[t],r=d[e],s=null;if(p[t]){let t=i.position.clone(),e=r.position.clone();(0!==i.removedLength||0!==r.removedLength)&&(i.nextDir&&t.add(st.copy(i.nextDir).setLength(i.removedLength)),r.prevDir&&e.add(st.copy(r.prevDir).setLength(r.removedLength))),t.distanceTo(e)>et&&(s=new y(t,t.clone().lerp(e,.3),e.clone().lerp(t,.3),e))}else i.position.distanceTo(r.position)>et&&(s=new y(i.position,i.controlNext,r.controlPrevious,r.position));c[2*t+1]=s}for(let t=0;t<o;t++){let e=d[t];if(0===e.removedLength)continue;let i=e.position,r=e.prevDir.clone().multiplyScalar(e.removedLength).add(i),s=e.nextDir.clone().multiplyScalar(e.removedLength).add(i),a=e.tan*e.removedLength;at.addVectors(e.prevDir,e.nextDir).normalize(),nt.copy(r).lerp(s,.5);let n=r.distanceTo(s)/2;pt.copy(at).multiplyScalar(Math.sqrt(Math.pow(a,2)-Math.pow(n,2))).add(nt),ot.copy(at).multiplyScalar(-a).add(pt);let o=i.distanceTo(ot)/i.distanceTo(nt);lt.copy(e.prevDir).multiplyScalar(o*i.distanceTo(r)).add(i),ht.copy(lt).lerp(ot,2);let l=r.clone().lerp(lt,4/3),h=s.clone().lerp(ht,4/3);c[2*t]=new y(r,l,h,s)}let u=new tt;for(let t=0;t<c.length;t++){let e=c[t];e&&u.add(e)}return u}(t);return ut.set(t.points,{isClosed:t.isClosed,curve:i}),i}(ct||(ct={})).is=function(t){return t&&t.__isEntity};var ft=t=>ct.is(t),yt={type:"completeState",isfromEntity:!0},gt=["x","y","z"],vt=new f,xt=new f(1,1,1),St=new m,wt=new v,Mt=(new f).set(0,1,0),bt=new g,Bt=new g,Pt=c=>class extends(J(c)){constructor(){super(...arguments),this.raycastLock=!1,this.scaleLock=!1,this.disposed=!1,this.stateSelection=null,this.destroyedInAction=!1,this.instances=[],this.prevState=null,this.currentState=null,this.currentAnimationAction=null,this.reversibleToState=null,this.currentTransitionEvent=null,this.previousAction=null,this._singleBBox=new I,this._recursiveBBox=new I,this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this._needApplyPathSnapping=!0,this.attachedPaths=new Set}get __isEntity(){return!0}entityChildren(t){let e=this.children[t];if(ct.is(e))return e}entityChildrenCount(){let t=this.children.length;for(;t--;)if(ct.is(this.children[t]))return t+1;return 0}get isConcreteEntity(){return"string"==typeof this.identity}get isVirtualEntity(){return"string"!=typeof this.identity}get isInstanceRoot(){return this.isConcreteEntity&&"Instance"===this.data.type}nearestInstanceSelfOrParent(){let t=this;for(;"Instance"!==t.data.type;){let e=t.parent;if(!ct.is(e))return;t=e}return t}forInstancesRec(t){this.instances.forEach(e=>{e.disposed||t(e),e.forInstancesRec(t)})}super_Entity(t,e){"string"==typeof t&&(this.uuid=t),this.identity=t,this.data=e,this.matrixAutoUpdate=!1,this.dataPatched=this.data}changeSelectedState(t,e,i=!1){if(0!==this.data.states.length||i){for(let t of this.data.states)n.toOps(this.data,t.data).forEach(t=>{let i=h.replaceProps(t,this.data);this.dataPatched=this.data,this.updateByPatchedOp(i,this.data,e)});if(null!==t){let i=this.data.states.data(t);i&&(this.dataPatched=n.patch(this.data,i),n.toOps(this.data,i).forEach(t=>{this.updateByPatchedOp(t,this.dataPatched,e)}))}i&&this.updateTransformState(this.dataPatched,e),this.stateSelection=t,this.updatePathSnapping(this.dataPatched.pathSnapping)}}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}updateEntityBoxSize(t,e){t.setScalar(0),e.setScalar(0)}resetBBoxNeedsUpdateSelf(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0}resetBBoxNeedsUpdate(){this.resetBBoxNeedsUpdateSelf(),this.traverseAncestors(t=>{ft(t)&&t.resetBBoxNeedsUpdateSelf()}),this.traverseEntity(t=>{t.resetBBoxNeedsUpdateSelf()})}find(t){let e;return this.traverseEntity(i=>{i.uuid===t&&(e=i)}),e}traverseSortNextHelper(){let t=this.parent;if(t){let e=t.children,i=e.indexOf(this)+1;if(ct.is(e[i]))return e[i];if(ct.is(t))return t.traverseSortNextHelper()}}sortNext(){let t=this.children;return this.children.length>0&&ct.is(this.children[0])?t[0]:this.traverseSortNextHelper()}goUp(t){let e=this;for(;t>0&&null!==e;)e=e.parent,t-=1;return e}hasAnccestorOrSelf(t){return this===t||this.hasAnccestor(t)}hasAnccestor(t){let e=this.parent;for(;e;){if(t===e)return!0;e=e.parent}return!1}countToAccestor(t){let e=0,i=this;for(;i!==t;){if(null===i)return-1;i=i.parent,e+=1}return e}forEachEntity(t){for(let e of this.children)ft(e)&&t(e)}traverseEntityAncestors(t){this.traverseAncestors(e=>{ct.is(e)&&t(e)})}traverseConcreteEntity(t,e=0){if(!0!==t(this,e))for(let i of this.children)ft(i)&&i.isConcreteEntity&&i.traverseEntity(t,e+1)}traverseEntity(t,e=0){if(!0!==t(this,e))for(let i of this.children)ft(i)&&i.traverseEntity(t,e+1)}traverseVisibleEntity(t){t(this);for(let e of this.children)ft(e)&&e.visible&&e.traverseVisibleEntity(t)}updateMatrix(){super.updateMatrix(),this.cloner&&this.cloner.onObjUpdateMatrix(),this.dispatchEvent({type:"updateMatrix"})}updateMatrixWorld(t){super.updateMatrixWorld(t),this.dispatchEvent({type:"updateMatrixWorld"})}copy(t,e=!1){return super.copy(t,e),this.dataPatched=t.dataPatched,this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),this}hasEntityChild(){return this.children.some(t=>ft(t))}isAncestorOf(t){if(this.uuid===t)return!1;let e=!1;return this.traverseEntity(i=>{i.uuid===t&&(e=!0)}),e}toObjectTransformState(t=[]){this.updateWorldMatrix(!0,!1);let i={position:this.position.toArray(),rotation:[this.rotation.x*u.RAD2DEG,this.rotation.y*u.RAD2DEG,this.rotation.z*u.RAD2DEG],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray(),pivot:[0,0,0],pivotRotation:[0,0,0]};return e(i,t)}getTransformValues(t,e,i){return e[t].map((e,r)=>i?.shared.getVariable(e,[this.uuid,t,gt[r]])??e)}updateTransformState(t,e){let i=!1;if(t.position&&(this.position.fromArray(this.getTransformValues("position",t,e)),i=!0),t.rotation&&(vt.fromArray(this.getTransformValues("rotation",t,e)).multiplyScalar(u.DEG2RAD),this.rotation.setFromVector3(vt),i=!0),t.scale&&(this.scale.fromArray(this.getTransformValues("scale",t,e)),i=!0),void 0!==t.hiddenMatrix&&(i=!0,this.hiddenMatrix.fromArray(t.hiddenMatrix??s.identity)),void 0!==t.pivot||void 0!==t.pivotRotation)if(i=!0,void 0!==t.pivot&&void 0!==t.pivotRotation)this.pivotMatrix.compose(vt.fromArray(t.pivot).negate(),St.setFromEuler(wt.fromArray(t.pivotRotation.map(t=>t*u.DEG2RAD))).invert(),xt);else if(void 0!==t.pivot)this.pivotMatrix.setPosition(-t.pivot[0],-t.pivot[1],-t.pivot[2]);else if(void 0!==t.pivotRotation){let e=vt.setFromMatrixPosition(this.pivotMatrix);St.setFromEuler(wt.fromArray(t.pivotRotation.map(t=>t*u.DEG2RAD))).invert(),this.pivotMatrix.compose(e,St,xt)}return i&&(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(t=>{t.invalidateClonerTransform(this)})),t.position&&t.rotation&&t.scale&&void 0!==t.hiddenMatrix&&this.updateWorldMatrix(!1,!0),i}onVariableUpdate(t=!1){t?this.resetBBoxNeedsUpdate():(this.updateMatrix(),this.resetBBoxNeedsUpdate(),this.invalidateClonerTransform(this),this.traverseEntityAncestors(t=>{t.invalidateClonerTransform(this)}),this.requestRender())}dispose(){this.disposed=!0,this.cloner&&(this.cloner.dispose(),this.cloner=void 0)}disposeChildrenRecursively(){for(let t of this.children)ct.is(t)&&t.disposeRecursively()}disposeRecursively(){this.dispose(),this.children.forEach(t=>{ct.is(t)&&t.disposeRecursively()})}toState(t=[]){let i={name:this.name,visible:this.visible,raycastLock:this.raycastLock,...this.toObjectTransformState(t)};return e(i,t)}updateByObjUpdateOp(t,e){void 0!==t&&this.updateByOp({type:0,props:t,path:[]},{...this.data,...t},e,!1)}updateByOp(t,e,i,s){let o=this.data;this.data=e;let h=t,c=O(t.path,["states","*"]);if(null!==c){if(0===t.type){let[e]=c;if(this?.stateSelection===e){let e={...t.props};if(delete e.name,Object.values(t.props).some(t=>void 0===t)){let i=this.data;if(void 0!==i){let r=d.zoom(i,t.path.slice(2));if(r)for(let i in t.props)void 0===t.props[i]&&i in r&&(e[i]=r[i])}}h={...t,props:e,path:t.path.slice(2)}}}}else if(0===t.type){let e=this.stateSelection?this.data.states.data(this.stateSelection):void 0;if(void 0!==e){if(void 0!==t.props.name&&e.name){let{name:t,...i}=e;e=i}if(void 0!==t.props.material&&"material"in e){let{material:t,...i}=e;e=i}let i=d.removeOverridden(t.path,t.props,e);h={...t,props:i}}}if(this.updateByPatchedOpBase(h,n.patch(this.data,this.stateSelection?this.data.states.data(this.stateSelection):void 0),i),O(t.path,["overrides"])){let s=[],a=[...t.path];for(s.push(a[1]),a.splice(0,2);a.length>0&&"descendants"===a[0];)s.push(a[1]),a.splice(0,2);if(void 0===s[s.length-1]){if(0===t.type)for(let e of Object.keys(t.props)){s[s.length-1]=e;let r=i.scene.findInstance([this.uuid,...s]);r&&(r.overrideData=t.props[e],r.updateState(l.apply(r.component.data,r.overrideData),i))}}else{let n=i.scene.findInstance([this.uuid,...s]);if(n){let o=d.zoom(n.component.data,a);if(0===(t={...t,path:a}).type){let e=t.props;if(o)for(let[i,r]of Object.entries(t.props))void 0===r&&(e===t.props&&(e={...t.props}),e[i]=o[i]);t={...t,props:e}}n.overrideData=r.resolve(e.overrides,s),n.updateByOp(t,p.applySimple(n.data,t),i,!1)}}}else if(this.instances.length>0){let r;if(0===t.path.length&&0===t.type){let e;for(let i of a.rootOverrideProps)i in t.props&&(void 0===e&&(e={}),e[i]=t.props[i]);e&&(r={...t,props:e})}else for(let e of a.rootOverrideProps)if(O(t.path,[e])){r=t;break}void 0!==r&&this.instances.forEach(t=>{if(t.isInstanceRoot){let e=l.filterOp(t.overrideData,r);e&&t.updateByOp(e,p.applySimple(t.data,e),i,!0)}}),this.instances.forEach(r=>{if(!r.isInstanceRoot){let s=l.filterOp(r.overrideData,t);if(s){let a;a=o===r.data&&t===s?e:p.applySimple(r.data,s),r.updateByOp(s,a,i,!0)}}})}}updateByPatchedOpBase(t,e,i){if(this.dataPatched=e,0===t.path.length&&0===t.type)void 0!==t.props.type&&!o.is(t.props.type)&&C.changeEntityProptotype(this,e,i);else if(1===t.path.length&&"geometry"===t.path[0]&&0===t.type&&"type"in t.props){C.changeEntityProptotype(this,e,i);for(let t of this.children)ct.is(t)&&t.updateVisible(i.scene)}this.updateByPatchedOp(t,e,i)}updateByPatchedOp(t,e,i){if(0===t.path.length&&0===t.type?this.updateState(t.props,i):0===t.type&&("resolutionLevel"in t.props||"useChildrenColors"in t.props)&&this.updateState(e,i),"morphTargetInfluences"===t.path[0]&&0===t.type){let r=e.morphTargetInfluences.get(t.path[1])?.data.name;r&&this.updateMorphInfluences(r,i.shared.getVariable(t.props.value,[this.uuid,"morphTargetInfluences",r]))}if(null!==O(t.path,["pathSnapping"])&&this.updatePathSnapping(e.pathSnapping),null!==O(t.path,["cloner"])){let r=p.drop(t,1);0===r.path.length&&0===r.type&&!0===r.props.disabled?this.setFromClonerState(null,i):this.cloner?this.cloner.updateState(e.cloner,i):(this.setFromClonerState(e.cloner,i),this.expandCloner(i)),this.updateVisible(i.scene)}}updatePathSnapping(t=this.dataPatched.pathSnapping){this._updatedPathSnapping=t,this._needApplyPathSnapping=!0}get updatedPathSnapping(){return this._updatedPathSnapping}applyPathSnapping(t){if(!1===this._needApplyPathSnapping)return;let e=this._updatedPathSnapping?.pathId??this.dataPatched.pathSnapping.pathId,i=this._updatedPathSnapping?.slide??this.dataPatched.pathSnapping.slide??0,r=this._updatedPathSnapping?.offset??this.dataPatched.pathSnapping.offset??0,s=this._updatedPathSnapping?.orientation??this.dataPatched.pathSnapping.orientation;if(null===e)return;let a=t.find(e);if(!a)return;this._needApplyPathSnapping=!1;let n=a.data;if(n.geometry.path.points.length<=1)return;let o=mt(n.geometry.path),l=(i+r)%1;i+r===1&&0===l&&(l=1);let h=null;try{h=o.curves.length?o.getPointAt(l):null}catch(t){}if(null===h)return;a.updateMatrixWorld();let p=this.parent?bt.copy(this.parent.matrixWorld).invert():bt.identity();p.multiply(a.matrixWorld),h.applyMatrix4(p);let d={position:h.toArray(),rotation:n.rotation};if("tangential"===s){let t=Bt.extractRotation(a.matrixWorld),e=o.getTangentAt(l).applyMatrix4(t).add(h),i=Bt.lookAt(h,e,Mt),r=vt.setFromEuler(wt.setFromRotationMatrix(i)).multiplyScalar(u.RAD2DEG);d={...d,rotation:r.toArray()}}this.updateTransformState(d),this.traverseEntity(t=>{t._cameraType&&t.dispatchEvent(yt)})}updateVisible(t){if(this.visible=this.dataPatched.visible&&(!this.dataPatched.cloner||(this.dataPatched.cloner.disabled??!1)||!0!==this.dataPatched.cloner?.hideBase),!t)return;let e=!1;this.traverseEntity(t=>{if("Splat"===t.data.type)return e=!0,!0}),e&&t.reloadSplats()}updateState_Entity(t,e){void 0!==t.name&&(this.name=t.name),void 0!==t.raycastLock&&(this.raycastLock=t.raycastLock),void 0!==t.visible&&(this.updateVisible(e?.scene),this.resetBBoxNeedsUpdate()),e&&"cloner"in t&&void 0!==t.cloner&&(this.setFromClonerState(t.cloner,e),this.updateVisible(e.scene)),this.updateTransformState(t,e)}get attachedSurfaceCloners(){return this.children.filter(e=>t(e)&&"toObject"===e.parameters.type)}setFromClonerState(t,e){if(!this.disposed)if(null===t||t.disabled)this.cloner&&this.cloner.dispose(),this.cloner=void 0;else if(void 0===this.cloner){if(null===C.Cloner)return void i("cloners","a cloner");this.cloner=new C.Cloner(this,t),e.scene.addPendingExpandCloner(this)}else this.cloner.updateState(t,e)}expandCloner(t){!this.disposed&&this.cloner&&this.cloner.expandClones(t)}invalidateClonerTransform(t){this.cloner&&this.cloner.invalidateTransform(t)}requestRender(){this.dispatchEvent({type:"requestRender"})}},Et=class{static create(t){return this.build(this.normalizeInputs(t))}static normalizeInputs(t,e){let i=Object.assign({},e?.parameters??{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},t.parameters),r=Math.abs(i.width),s=Math.abs(i.height??r),a=Math.abs(i.depth??r),n=Math.abs(Math.min(r,a))/2;return{parameters:Object.assign(i,{width:r,height:s,depth:a,radius:n,segments:Math.round(i.segments),pathSegments:Math.round(i.pathSegments),cornerSegments:Math.round(i.cornerSegments)})}}static build(t){let{width:e,height:i,depth:r,radius:s,revolutions:a,segments:n,pathRadius:o,pathType:l,pathSegments:h,cornerRadius:p,cornerSegments:d}=t.parameters,c=new Vt(!1,e,i,r,s,a,n,o,l,h,p,d);return Object.assign(c,{userData:{...t,type:"HelixGeometry"}})}},At=new c([0,0,0],1);function Ct(t){return"TorusGeometry"===t.type&&360===t.arc}var Dt,Ot,Vt=class extends P{constructor(t=!0,e=1,i=1,r=1,s=1,a=1,n=1,o=1,l=1,h=1,p=1,d=1){if(super(),0===a)return;let c=t&&1===a;c&&(d=0),p>100&&(p=100),0===p&&(d=0);let u,m,y,g,v,x,S,w,M=()=>new f,B=new f,P=M(),E=M(),A=M(),C=M(),D=M(),O=M(),V=M(),W=M(),_=M(),T=M(),U=M(),R=i-2*o+.001,z=R/a,I=Math.ceil(n*a),L=I+1,N=R/I,F=-R/2,j=h+1,k=2*Math.PI/h,q=Math.PI/2/d,G=Math.min((1-p/100)*o,o-.01),H=o-G,K=0,X=2*d+2,Z=j*X/2,Q=Z+j*L,Y=Math.max(0,j*(L+X)),[$,J,tt]=[3,3,2].map(t=>Array(Y*t).fill(0)),et=[],it=s-o;function rt(e,i){let r=Math.PI/2;x=i*N,w=2*Math.PI*(x%z)/z+r,x+=F,S=Math.sin(w)*it,v=Math.cos(w)*it,t?e.set(v,S,x):e.set(v,x,S)}rt(B,-1e-10),rt(P,0),C.copy(B),rt(B,1);let st=B.distanceTo(P),at=c?0:H+G,nt=st*I+2*at,ot=G,lt=nt-at;for(let e=0;e<=I;e++){rt(E,e),U.subVectors(E,C).normalize(),C.copy(E),_.copy(E).setComponent(+t+1,0).normalize(),T.crossVectors(U,_).normalize();let i=0===e,r=e===I,s=i?3*Math.PI/2:q,a=i?ot:lt,n=i?j:Q,l=i?0:Y-j,p=U.clone().multiplyScalar(i?-H:H).add(E),u=U.clone().multiplyScalar(i?-1:1).normalize();for(let t=0;t<j;t++){let m=t*k;if(D.addVectors(B.copy(_).multiplyScalar(o*Math.cos(m)),P.copy(T).multiplyScalar(o*Math.sin(m))),O.copy(D).normalize(),i||r){c||(K=l+t,[0,1,2].forEach(t=>{$[3*K+t]=p.getComponent(t),J[3*K+t]=u.getComponent(t)}),tt[2*K]=+r,tt[2*K+1]=t/h),P.copy(O).multiplyScalar(G),A.addVectors(E,P);for(let e=0;e<d;e++){let r=e*q+s;V.addVectors(B.copy(U).multiplyScalar(H*Math.sin(r)),P.copy(O).multiplyScalar(H*Math.cos(r))),W.copy(V).normalize(),P.addVectors(A,V),V.normalize(),K=n+e*j+t,[0,1,2].forEach(t=>{$[3*K+t]=P.getComponent(t),J[3*K+t]=W.getComponent(t)});let o=+i+Math.sin(r);tt[2*K]=(a+H*o)/nt,tt[2*K+1]=t/h}}P.addVectors(E,D),K=Z+e*j+t,[0,1,2].forEach(t=>{$[3*K+t]=P.getComponent(t),J[3*K+t]=O.getComponent(t)}),tt[2*K]=(at+e*st)/nt,tt[2*K+1]=t/h}}let ht=L+2*d+2,[pt,dt]=[+c,ht-1];for(let t=pt;t<=dt-1;t++){let e=c&&t===dt-1;for(let i=0;i<j-1;i++)u=t*j+i,m=u+1,y=(e?i:u)+j,g=(e?i+1:m)+j,0===t?et.push(m,g,y):t===ht-2?et.push(u,m,y):et.push(u,m,y,m,g,y)}this.setIndex(et),this.setAttribute("position",new b($,3)),this.setAttribute("normal",new b(J,3)),this.setAttribute("uv",new b(tt,2))}getClosedTorusIndicesForBooleanOrSubdiv(){let t,e,i,r,s=this.userData.parameters,a=Math.ceil(s.tubularSegments),n=s.radialSegments,o=n+1,l=[];for(let s=1;s<a;s++)for(let a=0;a<n;a++)t=s*o+a,e=t+1,i=t+o,r=e+o,l.push(t,e,i,e,r,i);for(let s=0;s<n;s++)t=a*o+s,e=t+1,i=s+o,r=s+1+o,l.push(t,e,i,e,r,i);return At.array=new Uint32Array(l),At.count=l.length,At}},Wt=new Map,_t=0;function Tt(t){return Ot||(Ot=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.9/build",i=import("./boolean.js"),[r,s]=await Promise.all([i,fetch(`${e}/boolean.wasm`).then(t=>t.arrayBuffer())]);await r.default({module_or_path:s}),Dt=r}())}function Ut(){if(void 0===Dt)throw new Error("boolean-wasm is not loaded");return Dt}function Rt(t){let e=Wt.get(t);if(void 0===e)throw new Error("Unknown csg mesh set handle "+t);return e}function zt(t){return Wt.set(++_t,t),_t}var It={0:0,1:1,2:2};function Lt(t,e,i){if(void 0===Dt)return-1;let{positions:r,indices:s,normals:a}=function(t,e){if(e&&void 0!==t.userData.positions){let e=t.userData,i=[];for(let t=0,r=0;t<e.verticesPerFace.length;t++){let s=e.verticesPerFace[t];for(let t=1;t<s-1;t++)i.push(e.indices[r],e.indices[r+t],e.indices[r+t+1]);r+=s}return{positions:e.positions instanceof Float32Array?e.positions:new Float32Array(e.positions),indices:new Uint32Array(i)}}let i;i=Ct(t.userData.parameters)?t.getClosedTorusIndicesForBooleanOrSubdiv():t.getIndex();let r,s=t.getAttribute("position");if(null===i){r=new Uint32Array(s.count);for(let t=0;t<r.length;t++)r[t]=t}else r=i.array instanceof Uint32Array?i.array:new Uint32Array(i.array);let a=t.getAttribute("normal"),n=void 0!==a&&3===a.itemSize&&a.count===s.count&&a.array instanceof Float32Array&&!0!==a.isInterleavedBufferAttribute?a.array:void 0;return{positions:s.array,indices:r,normals:n}}(t,e);return zt(new Dt.CsgMesh(r,s,a))}function Nt(t,e){let i=Ut(),r=It[e];if(void 0===r)throw new Error("Unknown boolean operation "+e);let s=t.map(Rt);if(1===s.length)return i.clone_mesh(s[0]);let a,n=[];if(2===e&&s.length>2){let t=s[0];for(let e=1;e<s.length-1;e++)t=i.boolean_mesh(t,s[e],0),n.push(t);a=i.boolean_mesh(s[s.length-1],t,2)}else if(2===e)a=i.boolean_mesh(s[1],s[0],2);else{let t=s[s.length-1];for(let e=0;e<s.length-1&&(t=i.boolean_mesh(t,s[e],r),n.push(t),0!==t.tri_count());e++);a=t,n.pop()}for(let t of n)t.free();return a}function Ft(t,e,i,r){let s=Ut(),a=Nt(t,e),n=s.mesh_render_data(a,Math.max(r,0));if(i.setAttribute("position",new b(n.positions(),3)),i.setAttribute("normal",new b(n.normals(),3)),n.free(),null===i.boundingSphere&&(i.boundingSphere=new B),0===a.tri_count())i.boundingSphere.center.set(0,0,0),i.boundingSphere.radius=0,i.userData.parameters={width:0,height:0,depth:0};else{let t=a.bounds();i.boundingSphere.center.set(t[0],t[1],t[2]),i.boundingSphere.radius=(t[3]**2+t[4]**2+t[5]**2)**.5,i.userData.parameters={width:2*t[3],height:2*t[4],depth:2*t[5]}}return zt(a)}function jt(t,e){let i=Ut(),r=Nt(t,e),s=i.mesh_topological_data(r),a=s.positions(),n=s.indices();return s.free(),r.free(),{positions:a,indices:n,verticesPerFace:new Uint8Array(n.length/3).fill(3)}}function kt(t,e){Rt(t).transform(new Float32Array(e.elements))}function qt(t){let e=Wt.get(t);void 0!==e&&(e.free(),Wt.delete(t))}function Gt(t,e){return zt(Ut().instanced_union(Rt(t),e))}function Ht(t){return null!==t&&"booleanOp"in t}var Kt=class extends(Pt(A)){constructor(){super(...arguments),this.booleanMeshSetAddress=-1,this.booleanWasTransformed=!1,this.booleanMatrixInvOld=new g}updateVisible(t){super.updateVisible(t),this.visible=!Ht(this.parent)&&this.visible,Ht(this.parent)&&this.parent.invalidateDownstreamBooleanData()}onClonerLayoutUpdated(){Ht(this.parent)&&this.invalidateDownstreamBooleanData()}freeBooleanPointer(){-1!==this.booleanMeshSetAddress&&(qt(this.booleanMeshSetAddress),this.booleanMeshSetAddress=-1)}invalidateDownstreamBooleanData(t=!1){return t?this.booleanWasTransformed=!0:this.freeBooleanPointer(),Ht(this.parent)?this.parent.invalidateDownstreamBooleanData():this}invalidateUpstreamBooleanData(){this.freeBooleanPointer();for(let t of this.children)t instanceof Kt&&(t.freeBooleanPointer(),Ht(t)&&t.invalidateUpstreamBooleanData())}updateTransformState(t,e){let i=super.updateTransformState(t,e);return i&&Ht(this.parent)&&this.invalidateDownstreamBooleanData(!0),i}onVariableUpdate(t=!1){super.onVariableUpdate(t),Ht(this.parent)&&this.invalidateDownstreamBooleanData(!0)}},Xt=new M;function Zt(t,e=0,i=t.count,r,s){let a=1/0,n=1/0,o=1/0,l=-1/0,h=-1/0,p=-1/0;for(let r=e;r<i;r++){let e=t.getX(r),i=t.getY(r),s=t.getZ(r);e<a&&(a=e),i<n&&(n=i),s<o&&(o=s),e>l&&(l=e),i>h&&(h=i),s>p&&(p=s)}Xt.min.set(a,n,o),Xt.max.set(l,h,p),Xt.getCenter(r),Xt.getSize(s).multiplyScalar(.5)}var Qt=new P,Yt=new E,$t=class extends Kt{constructor(t,e){super(Qt,Yt),this.super_Entity(t,e)}updateState(t,e){this.updateState_Entity(t,e)}raycast(t,e){super.raycast(t,e)}updateEntityBoxSize(t,e){let i=this.geometry.getAttribute("position");void 0!==i?Zt(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,e):super.updateEntityBoxSize(t,e)}};export{D as a,O as b,C as c,Q as d,Y as e,J as f,mt as g,ct as h,ft as i,Pt as j,Et as k,Ct as l,Vt as m,Tt as n,Lt as o,Ft as p,jt as q,kt as r,qt as s,Gt as t,Zt as u,$t as v};