@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
package/build/hana-ui.js CHANGED
@@ -331,6 +331,12 @@ export class SceneController {
331
331
  const ret = wasm.scenecontroller_centerVectorData(this.__wbg_ptr);
332
332
  return takeObject(ret);
333
333
  }
334
+ /**
335
+ * Drop every export-time video frame override (see `setVideoExportFrame`).
336
+ */
337
+ clearVideoExportFrames() {
338
+ wasm.scenecontroller_clearVideoExportFrames(this.__wbg_ptr);
339
+ }
334
340
  /**
335
341
  * @param {any} network
336
342
  * @param {Float2} size
@@ -898,8 +904,11 @@ export class SceneController {
898
904
  return takeObject(ret);
899
905
  }
900
906
  /**
907
+ * Resolves to whether any video seeked backward (wrapped across its
908
+ * loop point) — the export loop renders throwaway frames after a wrap
909
+ * to keep cold-path video→RGB conversion transients off captured frames.
901
910
  * @param {number} dt
902
- * @returns {Promise<void>}
911
+ * @returns {Promise<boolean>}
903
912
  */
904
913
  seekVideos(dt) {
905
914
  const ret = wasm.scenecontroller_seekVideos(this.__wbg_ptr, dt);
@@ -983,6 +992,20 @@ export class SceneController {
983
992
  setVectorTool(tool) {
984
993
  wasm.scenecontroller_setVectorTool(this.__wbg_ptr, addHeapObject(tool));
985
994
  }
995
+ /**
996
+ * Register an export-time frame override for a video asset: the renderer
997
+ * uploads this WebCodecs frame instead of sampling the `<video>` element,
998
+ * and `seekVideos` leaves the element alone. The caller keeps ownership
999
+ * of the frame — it must stay unclosed until the override is replaced or
1000
+ * cleared, and `clearVideoExportFrames` must run before anything renders
1001
+ * outside the export loop. WebGPU backend only (`isWebgpu`); the WebGL
1002
+ * path still samples the element.
1003
+ * @param {ID} id
1004
+ * @param {VideoFrame} frame
1005
+ */
1006
+ setVideoExportFrame(id, frame) {
1007
+ wasm.scenecontroller_setVideoExportFrame(this.__wbg_ptr, addHeapObject(id), addHeapObject(frame));
1008
+ }
986
1009
  /**
987
1010
  * Snap a world-space resize handle position against other (non-selected) vertices.
988
1011
  * `snap_x`/`snap_y` indicate which axes may snap. Returns the snapped world position.
@@ -1191,6 +1214,26 @@ export class SceneController {
1191
1214
  vectorStopContinueSubpath() {
1192
1215
  wasm.scenecontroller_vectorStopContinueSubpath(this.__wbg_ptr);
1193
1216
  }
1217
+ /**
1218
+ * The video fills the export loop should decode with WebCodecs, as
1219
+ * `{ id, src }` objects (`src` is the loaded `<video>` element's object
1220
+ * URL). Enumerated from the start events' video actions — the exact set
1221
+ * `seekVideos` drives — so the WebCodecs path animates precisely the
1222
+ * fills the element path would: a fill without a play action stays a
1223
+ * static frame on both paths and both backends. Scoped to actions
1224
+ * targeting `frame_id`'s subtree on purpose: enumerating the whole
1225
+ * document put a live decoder behind every video in the file (74 in one
1226
+ * real doc), turning a 5s export into 74 decode streams. Videos still
1227
+ * loading are omitted, and videos outside the subtree stay on the
1228
+ * seek-driven element path — both remain correct, just less
1229
+ * stable/deterministic.
1230
+ * @param {ID} frame_id
1231
+ * @returns {Array<any>}
1232
+ */
1233
+ videoFillSources(frame_id) {
1234
+ const ret = wasm.scenecontroller_videoFillSources(this.__wbg_ptr, addHeapObject(frame_id));
1235
+ return takeObject(ret);
1236
+ }
1194
1237
  /**
1195
1238
  * @param {Float2} pos
1196
1239
  * @returns {Float2}
@@ -2410,7 +2453,7 @@ function __wbg_get_imports() {
2410
2453
  const a = state0.a;
2411
2454
  state0.a = 0;
2412
2455
  try {
2413
- return __wasm_bindgen_func_elem_14112(a, state0.b, arg0, arg1);
2456
+ return __wasm_bindgen_func_elem_14150(a, state0.b, arg0, arg1);
2414
2457
  } finally {
2415
2458
  state0.a = a;
2416
2459
  }
@@ -2456,7 +2499,7 @@ function __wbg_get_imports() {
2456
2499
  const a = state0.a;
2457
2500
  state0.a = 0;
2458
2501
  try {
2459
- return __wasm_bindgen_func_elem_14112(a, state0.b, arg0, arg1);
2502
+ return __wasm_bindgen_func_elem_14150(a, state0.b, arg0, arg1);
2460
2503
  } finally {
2461
2504
  state0.a = a;
2462
2505
  }
@@ -3313,6 +3356,13 @@ function __wbg_get_imports() {
3313
3356
  const ret = getObject(arg0).size;
3314
3357
  return ret;
3315
3358
  },
3359
+ __wbg_src_f0e9281991fbd919: function(arg0, arg1) {
3360
+ const ret = getObject(arg1).src;
3361
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
3362
+ const len1 = WASM_VECTOR_LEN;
3363
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
3364
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
3365
+ },
3316
3366
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
3317
3367
  const ret = getObject(arg1).stack;
3318
3368
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
@@ -3557,47 +3607,47 @@ function __wbg_get_imports() {
3557
3607
  }, arguments); },
3558
3608
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
3559
3609
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1052, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3560
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_14110);
3610
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_14148);
3561
3611
  return addHeapObject(ret);
3562
3612
  },
3563
3613
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
3564
3614
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 32, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3565
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_5086);
3615
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_5101);
3566
3616
  return addHeapObject(ret);
3567
3617
  },
3568
3618
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
3569
3619
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUComputePipeline")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3570
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070);
3620
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11107);
3571
3621
  return addHeapObject(ret);
3572
3622
  },
3573
3623
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
3574
3624
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDevice")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3575
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070_3);
3625
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11107_3);
3576
3626
  return addHeapObject(ret);
3577
3627
  },
3578
3628
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
3579
3629
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPUDeviceLostInfo")], shim_idx: 928, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3580
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11071);
3630
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11108);
3581
3631
  return addHeapObject(ret);
3582
3632
  },
3583
3633
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
3584
3634
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("GPURenderPipeline")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3585
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070_5);
3635
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11107_5);
3586
3636
  return addHeapObject(ret);
3587
3637
  },
3588
3638
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
3589
3639
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("any")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3590
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070_6);
3640
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11107_6);
3591
3641
  return addHeapObject(ret);
3592
3642
  },
3593
3643
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
3594
3644
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("undefined")], shim_idx: 927, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
3595
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11070_7);
3645
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_11107_7);
3596
3646
  return addHeapObject(ret);
3597
3647
  },
3598
3648
  __wbindgen_cast_0000000000000009: function(arg0, arg1) {
3599
3649
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1035, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3600
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12477);
3650
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12514);
3601
3651
  return addHeapObject(ret);
3602
3652
  },
3603
3653
  __wbindgen_cast_000000000000000a: function(arg0) {
@@ -3671,22 +3721,22 @@ function __wbg_get_imports() {
3671
3721
  };
3672
3722
  }
3673
3723
 
3674
- function __wasm_bindgen_func_elem_12477(arg0, arg1) {
3675
- wasm.__wasm_bindgen_func_elem_12477(arg0, arg1);
3724
+ function __wasm_bindgen_func_elem_12514(arg0, arg1) {
3725
+ wasm.__wasm_bindgen_func_elem_12514(arg0, arg1);
3676
3726
  }
3677
3727
 
3678
- function __wasm_bindgen_func_elem_5086(arg0, arg1, arg2) {
3679
- wasm.__wasm_bindgen_func_elem_5086(arg0, arg1, addHeapObject(arg2));
3728
+ function __wasm_bindgen_func_elem_5101(arg0, arg1, arg2) {
3729
+ wasm.__wasm_bindgen_func_elem_5101(arg0, arg1, addHeapObject(arg2));
3680
3730
  }
3681
3731
 
3682
- function __wasm_bindgen_func_elem_11071(arg0, arg1, arg2) {
3683
- wasm.__wasm_bindgen_func_elem_11071(arg0, arg1, addHeapObject(arg2));
3732
+ function __wasm_bindgen_func_elem_11108(arg0, arg1, arg2) {
3733
+ wasm.__wasm_bindgen_func_elem_11108(arg0, arg1, addHeapObject(arg2));
3684
3734
  }
3685
3735
 
3686
- function __wasm_bindgen_func_elem_14110(arg0, arg1, arg2) {
3736
+ function __wasm_bindgen_func_elem_14148(arg0, arg1, arg2) {
3687
3737
  try {
3688
3738
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3689
- wasm.__wasm_bindgen_func_elem_14110(retptr, arg0, arg1, addHeapObject(arg2));
3739
+ wasm.__wasm_bindgen_func_elem_14148(retptr, arg0, arg1, addHeapObject(arg2));
3690
3740
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3691
3741
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3692
3742
  if (r1) {
@@ -3697,10 +3747,10 @@ function __wasm_bindgen_func_elem_14110(arg0, arg1, arg2) {
3697
3747
  }
3698
3748
  }
3699
3749
 
3700
- function __wasm_bindgen_func_elem_11070(arg0, arg1, arg2) {
3750
+ function __wasm_bindgen_func_elem_11107(arg0, arg1, arg2) {
3701
3751
  try {
3702
3752
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3703
- wasm.__wasm_bindgen_func_elem_11070(retptr, arg0, arg1, addHeapObject(arg2));
3753
+ wasm.__wasm_bindgen_func_elem_11107(retptr, arg0, arg1, addHeapObject(arg2));
3704
3754
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3705
3755
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3706
3756
  if (r1) {
@@ -3711,10 +3761,10 @@ function __wasm_bindgen_func_elem_11070(arg0, arg1, arg2) {
3711
3761
  }
3712
3762
  }
3713
3763
 
3714
- function __wasm_bindgen_func_elem_11070_3(arg0, arg1, arg2) {
3764
+ function __wasm_bindgen_func_elem_11107_3(arg0, arg1, arg2) {
3715
3765
  try {
3716
3766
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3717
- wasm.__wasm_bindgen_func_elem_11070_3(retptr, arg0, arg1, addHeapObject(arg2));
3767
+ wasm.__wasm_bindgen_func_elem_11107_3(retptr, arg0, arg1, addHeapObject(arg2));
3718
3768
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3719
3769
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3720
3770
  if (r1) {
@@ -3725,10 +3775,10 @@ function __wasm_bindgen_func_elem_11070_3(arg0, arg1, arg2) {
3725
3775
  }
3726
3776
  }
3727
3777
 
3728
- function __wasm_bindgen_func_elem_11070_5(arg0, arg1, arg2) {
3778
+ function __wasm_bindgen_func_elem_11107_5(arg0, arg1, arg2) {
3729
3779
  try {
3730
3780
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3731
- wasm.__wasm_bindgen_func_elem_11070_5(retptr, arg0, arg1, addHeapObject(arg2));
3781
+ wasm.__wasm_bindgen_func_elem_11107_5(retptr, arg0, arg1, addHeapObject(arg2));
3732
3782
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3733
3783
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3734
3784
  if (r1) {
@@ -3739,10 +3789,10 @@ function __wasm_bindgen_func_elem_11070_5(arg0, arg1, arg2) {
3739
3789
  }
3740
3790
  }
3741
3791
 
3742
- function __wasm_bindgen_func_elem_11070_6(arg0, arg1, arg2) {
3792
+ function __wasm_bindgen_func_elem_11107_6(arg0, arg1, arg2) {
3743
3793
  try {
3744
3794
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3745
- wasm.__wasm_bindgen_func_elem_11070_6(retptr, arg0, arg1, addHeapObject(arg2));
3795
+ wasm.__wasm_bindgen_func_elem_11107_6(retptr, arg0, arg1, addHeapObject(arg2));
3746
3796
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3747
3797
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3748
3798
  if (r1) {
@@ -3753,10 +3803,10 @@ function __wasm_bindgen_func_elem_11070_6(arg0, arg1, arg2) {
3753
3803
  }
3754
3804
  }
3755
3805
 
3756
- function __wasm_bindgen_func_elem_11070_7(arg0, arg1, arg2) {
3806
+ function __wasm_bindgen_func_elem_11107_7(arg0, arg1, arg2) {
3757
3807
  try {
3758
3808
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
3759
- wasm.__wasm_bindgen_func_elem_11070_7(retptr, arg0, arg1, addHeapObject(arg2));
3809
+ wasm.__wasm_bindgen_func_elem_11107_7(retptr, arg0, arg1, addHeapObject(arg2));
3760
3810
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
3761
3811
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
3762
3812
  if (r1) {
@@ -3767,8 +3817,8 @@ function __wasm_bindgen_func_elem_11070_7(arg0, arg1, arg2) {
3767
3817
  }
3768
3818
  }
3769
3819
 
3770
- function __wasm_bindgen_func_elem_14112(arg0, arg1, arg2, arg3) {
3771
- wasm.__wasm_bindgen_func_elem_14112(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
3820
+ function __wasm_bindgen_func_elem_14150(arg0, arg1, arg2, arg3) {
3821
+ wasm.__wasm_bindgen_func_elem_14150(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
3772
3822
  }
3773
3823
 
3774
3824
 
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +1 @@
1
- import{b as t}from"./runtime-chunk-N2ZRGNPR.js";import{a as e,c as i}from"./runtime-chunk-VAVYZ35B.js";import{b as s,c as o,d as a,e as n}from"./runtime-chunk-FQNSP44B.js";import{a as r}from"./runtime-chunk-RLYG5YBB.js";import{G as h,a as l}from"./runtime-chunk-DK66VKWP.js";import{f as d,g as c}from"./runtime-chunk-EPHVY3XO.js";import{h as p}from"./runtime-chunk-CKT62HES.js";import{a as m,b as u,g as y,h as v,i as g}from"./runtime-chunk-2PT2WH66.js";import{a as f}from"./runtime-chunk-4KZXQGUQ.js";import{c as b}from"./runtime-chunk-TZCHGFVF.js";import{Fa as E}from"./runtime-chunk-VPEJ5BFD.js";import{Bc as P,Dc as C,Ec as M,Fc as x,Oc as T,Oe as S,Pc as D,Rc as w,Xc as R,b as j,bd as G,cd as L,dd as B}from"./runtime-chunk-VGN7YHB7.js";var A=200,W=null;function O(t){W=t}function I(){return W}function F(t){let e=!1;return t.scene.objects.forEach(i=>{"Page"===i.data.type&&!e&&i.data.publish.gameControlObject&&E.traverseModuleInstances(t,i.id,(t,i,s)=>{for(let t of s)"GameControl"===t.data.type&&t.data.navmesh.enabled&&(e=!0)})}),e}function k(t){return s?t.metaKey:t.ctrlKey}function V(t,e){return Math.abs(t+3*e)<=2||Math.abs(t+3*window.devicePixelRatio*e)<=2}var z={type:"change"},H={type:"start"},Z={type:"end",nonOrbit:!0},U={type:"end",nonOrbit:!1},Y={type:"end",isZoom:!0,nonOrbit:!0},X={type:"end",changed:!1},N={type:"cameraAnimatingInTimeline"},K=new M,_=new C,q=2*Math.PI,Q=new x,J=new C,$=new x,tt=new M,et=new T,it={type:"requestRender"},st=class extends P{constructor(t,i,s={isPlayMode:!1,isExport:!1},a){super(),this.object=t,this.domElement=i,this.options=s,this.timelineState=a,this.enabled=!0,this.useKeyEvents=!0,this.enableDamping=!1,this.enableZoom=!0,this.enableRotate=!0,this.enablePan=!0,this.autoRotate=!1,this.rotationLimitsMode=0,this.panLimitsMode=0,this.rotationSoftLimit=2,this.panSoftLimit=2,this.hoverRotatePanMode=0,this.zoomLimitsEnabled=!1,this.mouseButtons=[0,5],this.mouseButtonsPlay=[3,4,5],this.touches=[null,j.DOLLY_ROTATE,j.PAN],this.offset=new x,this.eye=new x,this.lastPosition=new x,this.lastQuaternion=new M,this.current=new C,this.overShoot=new C,this.overRatio=new C,this.spherical=new S,this.sphericalDelta=new S,this.panOffset=new x,this.panLeftV=new x,this.panUpV=new x,this.panV=new x,this.rotateStart=new C,this.rotateEnd=new C,this.rotateDelta=new C,this.panStart=new C,this.panEnd=new C,this.panDelta=new C,this.dollyStart=new C,this.dollyEnd=new C,this.dollyDelta=new C,this.rotationRangeFactor=new C,this.panRangeFactor=new C,this.state=-1,this.zoomChanged=!1,this.isPointerDown=!1,this.isThetaFlipped=!1,this.prevScale=0,this.scale=1,this.gesture=!1,this.lastTrackpadPanTime=-1/0,this.lastMouseWheelZoomTime=-1/0,this.timer=-1,this.timerHover=-1,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPhi=0,this.maxPhi=Math.PI,this.minTheta=-1/0,this.maxTheta=1/0,this.minH=0,this.maxH=Math.PI,this.minV=-1/0,this.maxV=1/0,this.autoRotateClockwise=!0,this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.resetHoverEffectOnPointerLeave=!1,this.hasChange=!1,this.useWindowEvents=!1,this.isTouchZoom=!0,this.autoRotateSpeed=2,this.dampingFactor=.125,this.zoomSpeed=2,this.rotateSpeed=1,this.rotateFactor=1,this.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=t=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=t.camera,this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)},this.update=()=>{this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose($,tt,Q),this.offset.copy($).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&-1===this.state&&this.rotateLeft((!0===this.autoRotateClockwise?1:-1)*this.getAutoRotationAngle()),0!==this.rotationLimitsMode&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),2!==this.rotationLimitsMode&&(this.spherical.phi+=this.sphericalDelta.phi),(1!==this.rotationLimitsMode||!0===this.autoRotate)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&this.object.isPerspectiveCamera&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),0!==this.panLimitsMode&&(this.target.applyQuaternion(K.copy(tt).invert()),this.panOffset.applyQuaternion(K),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(tt),this.panOffset.applyQuaternion(tt)),2===this.panLimitsMode&&(this.panOffset.y=0),1===this.panLimitsMode&&(this.panOffset.x=0),-1!==this.state||this.gesture?(this.target.add(this.panOffset),this.panOffset.set(0,0,0)):(this.panOffset.multiplyScalar(1-this.dampingFactor),this.target.add(this.panOffset)),this.offset.setFromSpherical(this.spherical),$.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(et.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(et));let t=this.spherical.phi%q;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(w.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),t>0&&t>Math.PI||t<0&&t>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),-1===this.state||!0===this.enableDamping){let t=1===this.hoverRotatePanMode?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-t,this.sphericalDelta.phi*=1-t}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8)return this.dispatchEvent(z),this.object.dispatchEvent(it),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),void(this.isCurrentlyDamping=!0);this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.isCurrentlyDamping=!1},this.onPointerDown=t=>{!1!==this.enabled&&("touch"===t.pointerType||"pen"===t.pointerType&&n?this.onPointerDownTouch(t):this.onPointerDownMouse(t),-1!==this.state&&(this.isPointerDown=!0,this.dispatchEvent(H),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&n||this.domElement.setPointerCapture(t.pointerId)))},this.onPointerLeave=t=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(1===this.hoverRotatePanMode?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,Q.subVectors(this.position0,this.target0),this.spherical.setFromVector3(Q),this.sphericalDelta.theta+=this.spherical.theta,this.sphericalDelta.phi+=this.spherical.phi,this.sphericalDelta.theta/=8,this.sphericalDelta.phi/=8):2===this.hoverRotatePanMode&&this.panOffset.subVectors(this.target0,this.target).divideScalar(8),this.update()):this.pointerLeaveEvent=t},this.onPointerEnter=t=>{this.resetHoverEffectOnPointerLeave||void 0===this.pointerLeaveEvent?J.set(t.clientX-this.domElement.clientWidth/2,t.clientY-this.domElement.clientHeight/2):J.set(t.clientX-this.pointerLeaveEvent.clientX,t.clientY-this.pointerLeaveEvent.clientY),1===this.hoverRotatePanMode?(this.rotateDelta.copy(J).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(_,-this.object.angleOffsetFromUp),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight),this.rotateStart.set(t.clientX,t.clientY)):2===this.hoverRotatePanMode&&(this.panDelta.copy(J).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(t.clientX,t.clientY)),this.update()},this.onPointerMove=t=>{this.timelineState?.isPlayingCameraAnimation?this.dispatchEvent(N):!1!==this.enabled&&(this.checkRaycastLock()||("touch"===t.pointerType||"pen"===t.pointerType&&n?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t),t.stopPropagation()))},this.onPointerUp=t=>{this.isPointerDown=!1,0===e.length&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),e.length>1&&t.preventDefault(),this.hasChange?this.dispatchEvent(0===this.state?U:Z):this.dispatchEvent(X),this.state=-1,t&&(t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&n||this.domElement.releasePointerCapture(t.pointerId))},this.onPointerDownMouse=t=>{let e;switch(e=this.useKeyEvents?this.mouseButtons[t.button]:this.mouseButtonsPlay[t.button],e){case 0:if(!0!==t.altKey||t.shiftKey||k(t)){if(" "===this.key){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 4:if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(k(t)||t.shiftKey){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(k(t)||t.shiftKey){if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}else{if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(!1===this.enableRotate)return;this.handleMouseMoveRotate(t);break;case 1:if(!1===this.enableZoom)return;this.handleMouseMoveDolly(t);break;case 2:if(!1===this.enablePan)return;this.handleMouseMovePan(t)}this.object.wasMovedByUser=!0},this.onPointerDownTouch=t=>{switch(e.length>1&&t.preventDefault(),this.touches[e.length-1]){case j.ROTATE:if(!1===this.enableRotate)return void(this.state=-1);this.handleTouchStartRotate(),this.state=3;break;case j.PAN:if(!1===this.enablePan)return void(this.state=-1);this.handleTouchStartPan(),this.state=4;break;case j.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(),this.state=5;break;case j.DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=t=>{switch(e.length>1&&t.preventDefault(),this.state){case 3:if(!1===this.enableRotate)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(!1===this.enablePan)return;this.handleTouchMovePan(t),this.update();break;case 5:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=f(()=>{this.zoomChanged?this.dispatchEvent(Y):this.dispatchEvent(Z),this.zoomChanged=!1},33),this.onMouseWheel=t=>{if(!1!==this.enabled&&(!1!==this.enableZoom||!1!==this.enablePan)&&!this.checkRaycastLock()){if(!this.options.isExport&&this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth&&t.preventDefault(),this.dispatchEvent(H),this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(N);this.handleMouseWheel(t),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0}},this.onGesture=t=>{if(t.preventDefault(),!1!==this.enabled&&!this.checkRaycastLock()&&!o){if(this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(N);if("gesturechange"===t.type){if(!1===this.enableZoom||!1===this.isTouchZoom)return;this.dispatchEvent(H),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(Z)}},this.onContextMenu=t=>{t.preventDefault()},this.onTouchEnd=t=>{t.preventDefault()},this.onKeyDown=t=>{!1!==this.enabled&&(this.key=t.key," "===t.key&&this.dispatchEvent(H))},this.onKeyUp=t=>{this.key=void 0,!1!==this.enabled&&(-1!==this.state&&"Alt"===t.key&&this.onPointerUp(e[0])," "===t.key&&this.dispatchEvent(Z))},this.onPointerHover=t=>{"mouse"!==t.pointerType||!1===this.enabled||-1!==this.state||2===this.hoverRotatePanMode&&this.isPanOverShoot||1===this.hoverRotatePanMode&&this.isRotateOverShoot||(this.isPointerDown=!0,2===this.hoverRotatePanMode?this.handleMouseMovePan(t,this.hoverRotatePanStrength):1===this.hoverRotatePanMode&&this.handleMouseMoveRotate(t,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=t=>{t.isfromEntity&&this.options.isPlayMode||(this.enabled=!0,this.needsUpdate=!0,this.object.updateUp(),this.object.getTarget(this.target))},this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat0=this.object.quaternion.clone(),this.isUpVectorFlipped0=this.object.isUpVectorFlipped,this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose($,tt,Q),this.offset.copy($).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.initialSphericalRadius=this.spherical.radius,this.addEventListenersToCamera()}dispatchEvent(t){"start"===t.type?this.hasChange=!1:this.hasChange=!0,super.dispatchEvent(t)}addEventListenersToCamera(){this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)}removeEventListenersFromCamera(){this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange)}updateUseWindowEvents(t){if(window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("pointermove",this.onPointerHover),this.useWindowEvents=t,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover)),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}}fromJSON(t,e){this.rotateFactor=t.rotationSpeed??1,this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.thetaIsFree=t.rotationHorizontalOffset.min===t.rotationHorizontalOffset.max&&t.rotationHorizontalOffset.min===Math.PI,this.phiIsFree=t.rotationVerticalOffset.min===t.rotationVerticalOffset.max&&t.rotationVerticalOffset.min===Math.PI,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.hoverRotateDamping=t.hoverRotateDamping??this.dampingFactor,this.useWindowEvents="window"===e,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=t.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,this.autoRotateSpeed=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let s=this.object.getTarget().applyQuaternion(K.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+s.y,this.maxV=t.panVerticalOffset.max+s.y,this.minH=-t.panHorizontalOffset.min+s.x,this.maxH=t.panHorizontalOffset.max+s.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=ot(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=ot(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=ot(ot(this.spherical.theta)-t.rotationHorizontalOffset.min),this.maxTheta=ot(ot(this.spherical.theta)+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,1===t.orbitTouches&&(this.touches[0]=j.ROTATE),1===t.panTouches&&(this.touches[0]=j.PAN),2===t.orbitTouches&&(this.touches[1]=j.DOLLY_ROTATE),2===t.panTouches&&(this.touches[1]=j.DOLLY_PAN),3===t.orbitTouches&&(this.touches[2]=j.ROTATE),3===t.panTouches&&(this.touches[2]=j.PAN),this.isTouchZoom=t.isTouchZoom,this.resetHoverEffectOnPointerLeave=t.resetHoverEffectOnPointerLeave??!1}connect(){if(this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture),this.domElement.addEventListener("touchend",this.onTouchEnd),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}this.pointerLeaveEvent=void 0}dispose(){this.removeEventListenersFromCamera(),this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,e,i,s,o,a,n,r){let h,l,d;this.overShoot.set(0,0),t instanceof x?(h=t.x,l=t.y,this.current.set(this.target.x,this.target.y),d=!0):(h=t.theta,l=t.phi,this.current.set(ot(this.spherical.theta),ot(this.spherical.phi)),d=!1),0===i&&(this.current.x+=h,this.current.y+=l),(3===e||2===e)&&(!d&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x)),(3===e||1===e)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<n&&(this.overShoot.y=n-this.current.y)),d||(this.overShoot.x=ot(this.overShoot.x),this.overShoot.y=ot(this.overShoot.y)),0!==i?(this.overRatio.copy(this.overShoot).divide(r),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),1===i&&(this.overRatio.x=at(Math.abs(this.overRatio.x)),this.overRatio.y=at(Math.abs(this.overRatio.y))),this.isPointerDown||1===i?2===i&&(this.overRatio.x>.9&&!this.thetaIsFree||this.overRatio.y>.9&&!this.phiIsFree)?this.isPointerDown=!1:(h*this.overShoot.x<0&&!this.thetaIsFree&&(h*=1-this.overRatio.x),l*this.overShoot.y<0&&!this.phiIsFree&&(l*=1-this.overRatio.y)):2===i&&(!d&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||d&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(h=.05*this.overShoot.x),this.phiIsFree||(l=.05*this.overShoot.y),d?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):d?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(h+=this.overShoot.x,l+=this.overShoot.y),t instanceof x?(t.x=h,t.y=l):(this.thetaIsFree||(t.theta=h),this.phiIsFree||(t.phi=l))}setEnableDampingSpeed(t){this.enableDamping=t,this.rotateSpeed=(!0===t?.2:1)*this.rotateFactor}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0,this.panOffset.set(0,0,0)}setTarget(t,e,i){this.stopDamping(),this.target.set(t,e,i)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,e){this.panLeftV.setFromMatrixColumn(e,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,e){this.panUpV.setFromMatrixColumn(e,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,e){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/i.clientHeight,this.object.matrixWorld),this.panUp(2*e*o/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(z)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(z)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(z)}setZoom(t){if(this.dispatchEvent(H),this.object.isPerspectiveCamera){let e=this.initialSphericalRadius/t/this.spherical.radius;this.scale=e}else this.object.isOrthographicCamera&&(this.object.zoom=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0);this.dispatchEvent(Z)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,e=1){void 0!==t.movementX?this.rotateDelta.set(t.movementX,t.movementY):(this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd)),this.rotateDelta.multiplyScalar(this.rotateSpeed*e).rotateAround(_,-this.object.angleOffsetFromUp);let i=this.domElement,s=this.useWindowEvents?window.innerHeight:i.clientHeight,o=2*Math.PI*this.rotateDelta.x/s,a=2*Math.PI*this.rotateDelta.y/s;this.rotateLeft(o),this.rotateUp(a),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,e=1){void 0!==t.movementX?this.panDelta.set(t.movementX,t.movementY):(this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panStart.copy(this.panEnd)),this.panDelta.multiplyScalar(this.panSpeed*e),this.pan(this.panDelta.x,this.panDelta.y),this.update()}handleMouseWheel(t){if(0===t.deltaX&&0===t.deltaY)return;let e=!0===t.ctrlKey||!0===k(t),i=!1===k(t)&&!0===(0===(r=t).wheelDeltaY||0===r.deltaY?!(s&&r.shiftKey&&Math.abs(r.wheelDeltaX)>=120)&&(r.wheelDeltaX?V(r.wheelDeltaX,r.deltaX):0===r.deltaMode):r.wheelDeltaY?V(r.wheelDeltaY,r.deltaY):0===r.deltaMode),o=!1===e&&(!0===this.gesture||t.timeStamp-this.lastTrackpadPanTime<300),n=!1===e&&!1===o&&t.timeStamp-this.lastMouseWheelZoomTime<300;var r;if(!1!==a||!1!==n||!0!==i&&!0!==o){if(!1===this.enableZoom)return;this.gesture&&(window.clearTimeout(this.timer),this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Z)),!1===e&&!1===i&&(this.lastMouseWheelZoomTime=t.timeStamp),0===t.deltaY?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}else{if(!1===this.enablePan)return;let e=!1===this.gesture&&!1===o;this.lastTrackpadPanTime=t.timeStamp,this.gesture||(this.gesture=!0,this.isPointerDown=!0),!1===e&&(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(this.panSpeed),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Z)},100)}}handleTouchStartRotate(){if(2===e.length){let t=.5*(e[0].pageX+e[1].pageX),i=.5*(e[0].pageY+e[1].pageY);this.rotateStart.set(t,i)}else this.rotateStart.set(e[0].pageX,e[0].pageY)}handleTouchStartPan(){if(2===e.length){let t=.5*(e[0].pageX+e[1].pageX),i=.5*(e[0].pageY+e[1].pageY);this.panStart.set(t,i)}else this.panStart.set(e[0].pageX,e[0].pageY)}handleTouchStartDolly(){let t=e[0].pageX-e[1].pageX,i=e[0].pageY-e[1].pageY,s=Math.sqrt(t*t+i*i);this.dollyStart.set(0,s)}handleTouchStartDollyPan(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(2===e.length){let e=i(t),s=.5*(t.pageX+e.x),o=.5*(t.pageY+e.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==e[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);let s=this.domElement;s&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/s.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/s.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(2===e.length){let e=i(t),s=.5*(t.pageX+e.x),o=.5*(t.pageY+e.y);this.panEnd.set(s,o)}else{if(t.pointerId!==e[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let e=i(t),s=t.pageX-e.x,o=t.pageY-e.y,a=Math.sqrt(s*s+o*o);this.dollyEnd.set(0,a),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}checkRaycastLock(){if(this.object.data.raycastLock){if(this.options.isPlayMode)return!1;{let t=this.options?.showCameraLock;return t&&t(),!0}}return!1}};function ot(t){let e=2*Math.PI;for(;t<=-Math.PI;)t+=e;for(;t>Math.PI;)t-=e;return t}function at(t){return 1-Math.pow(1-t,4)}var nt,rt,ht=new Promise(t=>{nt=t});function lt(t){return rt||(rt=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.8/build",i=import("./physics.js"),[s,o]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(t=>t.arrayBuffer())]);await s.init(o),nt(s)}())}function dt(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,s=e[4]**2+e[5]**2+e[6]**2,o=e[8]**2+e[9]**2+e[10]**2,a=e[0]**2+e[4]**2+e[8]**2,n=e[1]**2+e[5]**2+e[9]**2,r=e[2]**2+e[6]**2+e[10]**2,h=1e-8;return i<h||s<h||o<h||a<h||n<h||r<h}function ct(t,e){let i=new B;if(e&&dt(e))return i.setAttribute("position",new G([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new G([],3)),i.setIndex([]),i;let{positions:s,triIndices:o}=h(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new G(s,3)),i.setIndex(o),e&&i.applyMatrix4(e),i}var pt,mt=class{constructor(t,e,i,s,o,a){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=d(e,e.actions,s,o,a,i),this.target=e.target}disconnect(){c(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Animation.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},ut=class{constructor(t,e,i,s,o,a){this.id=t,this.data=e,this.object=i,this.page=s,this.currentIntersectedObjects=[],this.actions=d(e,e.actions,s,o,a,i),this.target=e.target,this.triggeringObjects=[];for(let t of e.triggeringObjects){let e=s.scene.find(t);e&&this.triggeringObjects.push(e)}}isValidTriggeringObject(t){return"all"===this.target||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){c(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.SwitchCamera.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};ht.then(t=>pt=t);var yt=new x,vt=new M,gt=new x,ft=(new D(0,0,0,"YXZ"),new D(0,0,0,"XYZ")),bt=new x,Et=new x,Pt=new x(1,1,1),Ct=new M,Mt=new T,xt=new T,Tt={type:"updateMatrix"},St=new M,Dt=new L,wt=.01,Rt={type:"beginEvent",eventName:"Collision"},jt={type:"beginEvent",eventName:"Trigger"};function Gt(t){if(E.physicsEnabled(t.scene.objects))return!0;let e=!1;return t.scene.objects.traverse((t,i)=>{if(i.events)if(Array.isArray(i.events)){for(let t of i.events)if(!0!==t.data.disabled&&"GameControl"===t.data.type&&t.data.collisionEnabled){e=!0;break}}else for(let t of Object.values(i.events))if(!0!==t.disabled&&"GameControl"===t.type&&t.collisionEnabled){e=!0;break}}),e}var Lt=t=>t.states.some(t=>void 0!==t.data.position||void 0!==t.data.rotation||void 0!==t.data.hiddenMatrix||void 0!==t.data.cloner||void 0!==t.data.pathSnapping);function Bt(t){return y(g(t)?t.object:t)}var At,Wt,Ot,It=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=t=>{if(t.bodyType()!==pt.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,i,s]=this.rigidBodyToMesh.get(t.handle);if(yt.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),vt.copy(t.rotation()),e.matrixWorld.compose(yt,vt,i),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(Tt),s){let t=e.cloner;if(t&&void 0===t.objectForSample){t.matrixWorld.copy(e.matrixWorld);for(let e of t.children)e.updateMatrixWorld(!0)}for(let t of e.children)t.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(t,e,i)=>{if(!1===i)return;let s,o;if(this.sensorToTriggerEvent[t]?(s=this.sensorToTriggerEvent[t],o=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(s=this.sensorToTriggerEvent[e],o=this.sharedGameControlGlobals.colliderToEntity.get(t)),s&&o&&s.isValidTriggeringObject(o))s.dispatch();else{for(let i=this.sharedGameControlGlobals.createdObjects.length-1;i>=0;i--){let s=this.sharedGameControlGlobals.createdObjects[i];if(s.userData.hasCollisionDestroy&&(s.rigidBody?.collider(0).handle===t||s.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(i,1),s.removeFromParent();let t=s.rigidBody;requestAnimationFrame(()=>{s.rigidBody===t&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(t),s.rigidBody=void 0)});break}}if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let t=this.sharedGameControlGlobals.colliderToEntity.get(e),i=this.sharedGameControlGlobals.entityToCollisionEvents[t.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,t,e)}else if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let e=this.sharedGameControlGlobals.colliderToEntity.get(t),i=this.sharedGameControlGlobals.entityToCollisionEvents[e.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,e,t)}else{let i=this.sharedGameControlGlobals.colliderToEntity.get(t),s=this.sharedGameControlGlobals.entityToCollisionEvents[i.uuid];if(void 0!==s)for(let e of s)"scene"===e.data.target&&this.dispatchCollisionEvent(e,i,t);let o=this.sharedGameControlGlobals.colliderToEntity.get(e),a=this.sharedGameControlGlobals.entityToCollisionEvents[o?.uuid];if(void 0!==a)for(let t of a)"scene"===t.data.target&&this.dispatchCollisionEvent(t,o,e)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events){if(!0===t.data.disabled)continue;let e=t.data.actions?.find(t=>"Destroy"===t.data.type)?.data;if(e)for(let t of e.objects){let e=this.page.scene.find(t);e&&(e.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events)if(!0!==t.data.disabled&&"DragDrop"===t.data.type)for(let e of t.data.objects){let t=this.page.scene.find(e);t&&(t.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return void 0===e&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(null===t())return void b("collision-bvh","trigger/collision detection");let e=[],i=[];if(this.page.traverseChildren(t=>{let s,o=t instanceof r,a=m(t);if(v(t)||o||a)return;s=g(t)?t.object:t;let n=s.dataPatched;if("visibility"===n.physics?.enabled?!n.visible:!n.physics?.enabled)return!0;let h=t.geometry,l=!0===s.userData.hasDestroy,d=!0===s.userData.hasDrag;if(Lt(n)||l||d||s.dataPatched.events.some(t=>!0!==t.data.disabled&&("GameControl"===t.data.type||"Follow"===t.data.type)))return t.updateMatrixWorldRigid(),this.addBoundsTree(t),!0;if(h){let s=h.getAttribute("position");if(void 0!==s&&s.count>0){e.push({geometry:h,matrixWorld:t.matrixWorld}),i.push(h.id,this._staticBVHIdOf(s),s.version,null!==h.index?this._staticBVHIdOf(h.index):-1,null!==h.index?h.index.version:-1);for(let e of t.matrixWorld.elements)i.push(e)}}return!!Bt(t)||void 0}),e.length>0){let s=this._staticBVHCache;if(void 0!==s&&s.signature.length===i.length&&s.signature.every((t,e)=>t===i[e]))return void(this.sharedGameControlGlobals.staticMeshBVH=s.bvh);let o=e.map(t=>ct(t.geometry,t.matrixWorld)),a=l(o,!1),n=new(t())(a);this._staticBVHCache={signature:i,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(t,e,i){if(dt(t.matrixWorld))return;let s=[],o="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(void 0!==o?.getAttribute("position")&&s.push(ct(o,t.shearScale)),a.physics.fusedBody){let e=this.gatherChildrenGeom(t,s);t.traverseObject(e),t.children.forEach(t=>t.updateMatrixWorld(!0));let i=t.cloner;i&&void 0===i.objectForSample&&"dynamic"===a.physics.rigidBody&&(i.traverseObject(e),i.children.forEach(t=>t.updateMatrixWorld(!0)))}if(s.length>0){let n,r=!1,h=!i.fromCreate&&"dynamic"===a.physics.rigidBody||i.fromCreate&&i.dynamic;h?(n=pt.RigidBodyDesc.dynamic(),n.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(n=pt.RigidBodyDesc.kinematicPositionBased(),r=!0):n=pt.RigidBodyDesc.fixed();let d=l(s);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(yt,vt,gt),t.position0=yt.clone().divideScalar(this.pixelsPerMeter),t.rotation0=vt.clone(),yt.divideScalar(this.pixelsPerMeter),n.setTranslation(yt.x,yt.y,yt.z).setRotation(vt),o?d?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):d?.scale(gt.x/this.pixelsPerMeter,gt.y/this.pixelsPerMeter,gt.z/this.pixelsPerMeter);let c=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n),p=!(void 0===a.geometry||"SubdivGeometry"===a.geometry.type||"NonParametricGeometry"===a.geometry.type||"BooleanGeometry"===a.geometry.type||"VectorGeometry"===a.geometry.type||"StarGeometry"===a.geometry.type||"RectangleGeometry"===a.geometry.type||"EllipseGeometry"===a.geometry.type||"TriangleGeometry"===a.geometry.type||"TorusGeometry"===a.geometry.type||"HelixGeometry"===a.geometry.type);try{this.addCollider(c,a.physics,d,e,p)}catch{try{this.addCollider(c,a.physics,d,e,!1)}catch(t){console.error(t)}}if(0===c.numColliders())return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(c);h?this.rigidBodyToMesh.set(c.handle,[t,gt.clone(),a.physics.fusedBody]):r?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(c.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,c,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=c}}addBoundsTree(e){let i=[];if(void 0!==e.geometry?.getAttribute("position")&&e.geometry?.getAttribute("position").count>0&&i.push(ct(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,i)),e.children.forEach(t=>t.updateMatrixWorld(!0)),i.length>0){let s=l(i,!1);e.bvhGeometry=s,s.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(t())(s),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(t,e,i,s,o=!0){if(0===i?.getAttribute("position").count||0===i?.getIndex()?.count)return;let a;i&&(a="trimesh"===e.colliderType?pt.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):pt.ColliderDesc.convexMesh(i.getAttribute("position").array,o?i.getIndex().array:void 0)),a.setFrictionCombineRule(pt.CoefficientCombineRule.Average).setRestitutionCombineRule(pt.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let n=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t);this.sharedGameControlGlobals.colliderToEntity.set(n.handle,s),this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]?.some(t=>"scene"===t.target)&&n.setActiveEvents(pt.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=Bt(t);return(s,o)=>{if(0===o)return;if(i&&s.parent===t)return!0;let a;if(v(s)){if(!s.objectForSample)return!0===s.object.dataPatched.physics.fusedBody&&"dynamic"===s.object.dataPatched.physics.rigidBody||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;a=s.object}else if(g(s))a=s.object;else if(a=s,a.dataPatched.cloner?.hideBase)return!0;let n=a.dataPatched;if("visibility"===n.physics.enabled?!n.visible:!n.physics.enabled)return!0;1===o?t.hasNonUniformScale?s.matrixWorld.multiplyMatrices(t.shearScale,s.hiddenMatrix):s.matrixWorld.copy(s.hiddenMatrix):s.matrixWorld.multiplyMatrices(s.parent.matrixWorld,s.hiddenMatrix),s.matrixWorld.multiply(s.matrix);let r=s.geometry;return void 0!==r?.getAttribute("position")&&e.push(ct(r,s.matrixWorld)),!!Bt(s)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(!1===e.data.disabled&&"Trigger"===e.data.type)return this.needsCollisionDetection=!0,!0});let s=I();if(null!==s?i=s.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:null!==this.page.data.publish.gameControlObject&&b("game-controls","the scene's game controls"),!1===i){let{enableRotate:t,enablePan:i,enableZoom:s,autoRotate:o,hoverRotatePanMode:a}=this.eventManager.publish.orbitControls;(t||i||s||o||0!==a)&&(this.orbitControls=new st(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let o=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();I()?.createJoysticks(this,o,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(t=>t.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new pt.World(new pt.Vector3(0,this.gravity,0)),this.events=new pt.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(i=>{let s;if(v(i)){if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;if(i.objectForSample.dataPatched.physics.fusedBody)return;s=i.object}else if(g(i))s=i.object;else{if(m(i)||u(i)||i instanceof r)return;if(s=i,!1===s.dataPatched.cloner?.disabled&&s.dataPatched.cloner?.hideBase&&!0!==s.dataPatched.physics?.fusedBody)return!0}let o,a=s.dataPatched;for(let t of a.events)!0!==t.data.disabled&&"GameControl"===t.data.type&&(o=t.data);if(!a.physics||("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled))return!0;i.updateMatrixWorldRigid();let n=Lt(a),h=!1,l=s.userData.hasDestroy,d=s.userData.hasDrag,c=!1;for(let t of a.events)if(!0!==t.data.disabled)if("Collision"===t.data.type){h=!0;let e=new mt(t.id,t.data,s,this.page,this.sharedAssets,this.eventManager);e.initialDisabled=!0,this.collisionEvents.push(e),this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid].every(e=>e.id!==t.id)?this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid].push(e):this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]=[e]}else if("Follow"===t.data.type){c=!0;let e=t.data.target;i.traverseVisible(t=>{t.userData.isFollowingObj=e})}"dynamic"===a.physics.rigidBody&&!1===a.physics.fusedBody&&(i.matrixWorldFusedFalse=i.matrixWorld.clone());let p=i.geometry;if(void 0!==o){let t=pt.RigidBodyDesc.kinematicPositionBased();(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(yt,vt,gt),i.position0=yt.clone().divideScalar(this.pixelsPerMeter),i.rotation0=vt.clone(),yt.divideScalar(this.pixelsPerMeter),t.setTranslation(yt.x,yt.y,yt.z).setRotation(vt);let e,n=this.sharedGameControlGlobals.rapierWorld.createRigidBody(t);i.rigidBody=n,e="sphere"===o.collider.type?pt.ColliderDesc.ball(o.collider.radius/this.pixelsPerMeter):"capsule"===o.collider.type?pt.ColliderDesc.capsule((o.collider.height/2-o.collider.radius)/this.pixelsPerMeter,o.collider.radius/this.pixelsPerMeter):pt.ColliderDesc.cuboid(o.collider.width/this.pixelsPerMeter/2,o.collider.height/this.pixelsPerMeter/2,o.collider.depth/this.pixelsPerMeter/2),e.setFrictionCombineRule(pt.CoefficientCombineRule.Average).setDensity(a.physics.density).setFriction(a.physics.friction).setRestitution(0).setRestitutionCombineRule(pt.CoefficientCombineRule.Min);let r=this.sharedGameControlGlobals.rapierWorld.createCollider(e,n);this.sharedGameControlGlobals.colliderToEntity.set(r.handle,s),yt.fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)).multiply(gt.setFromMatrixScale(s.matrixWorld)).divideScalar(this.pixelsPerMeter),r.setTranslationWrtParent(yt);let h=(new M).setFromEuler((new D).setFromVector3((new x).fromArray(o.collider.rotation.map(t=>"number"==typeof t?t:0))));r.setRotationWrtParent(h),r.setActiveEvents(pt.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(s,!0)}else"dynamic"===a.physics.rigidBody||n||c||l||d||h?(this.addRigidBody(i,s,{hasFollow:c,hasTransformAnim:n,hasDrag:d}),this.generateSensorColliderDescs(s,a.physics.fusedBody)):(p&&t.push(ct(p,i.matrixWorld)),a.physics.fusedBody&&!Bt(i)&&i.traverseObject((e,i)=>{if(0===i)return;let s;if(v(e)){if(!e.objectForSample)return!0===e.object.dataPatched.physics.fusedBody&&"dynamic"===e.object.dataPatched.physics.rigidBody||void 0;if(e.objectForSample.dataPatched.physics.fusedBody)return;s=e.object}else{if(m(e)||u(e)||e instanceof r)return;if(g(e))s=e.object;else if(s=e,s.dataPatched.cloner?.hideBase)return!0}let o=s.dataPatched;if("visibility"===o.physics.enabled?!o.visible:!o.physics.enabled)return!0;let a=e.geometry;return void 0!==a?.getAttribute("position")&&t.push(ct(a,e.matrixWorld)),!!Bt(e)||void 0}),this.generateSensorColliderDescs(s,a.physics.fusedBody,e));return!(!0!==a.physics?.fusedBody&&!o&&!Bt(i))||void 0}),0===t.length)return;let i=l(t),s=i.getIndex().count>0;if(!s&&0===e.length)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let o=pt.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o);if(s){let t=pt.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(pt.CoefficientCombineRule.Multiply).setRestitutionCombineRule(pt.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(t,a)}for(let[t,i]of e){let e=this.sharedGameControlGlobals.rapierWorld.createCollider(t,a);this.sensorToTriggerEvent[e.handle]=i}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let i=new ut(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),s=(new T).compose(bt.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),Ct.setFromEuler(ft.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Pt);if("box"===e.data.triggerZone){let o=new R;o.min.fromArray(e.data.size.map(t=>"number"==typeof t?t:0)).multiplyScalar(-.5),o.max.fromArray(e.data.size.map(t=>"number"==typeof t?t:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([o,s,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,s,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(void 0!==this.orbitControls&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):2===this.initializationCounter&&this.gameControl&&(e=!this.gameControl.update(t)&&e),!1===this.usePhysics&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(0===t)e=this.stepPhysics()&&e;else{let s=t/1e3;s<i&&s>.55*i&&(s=i),this.accumulator+=s;let o=performance.now(),a=0,n=6;for(;this.accumulator>=i&&a<n&&(e=this.stepPhysics()&&e,this.accumulator-=i,a++,!(performance.now()-o>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(yt,vt,gt);let e=t;void 0===e.prevQ?(e.prevQ=vt.clone(),e.prevT=yt.clone()):(e.prevQ.copy(vt),e.prevT.copy(yt))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,s]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(s)||(i.setBodyType(pt.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(void 0===t)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),s=t.translation(),o=Math.hypot(i.x,i.z);for(let a=0;a<t.numColliders();a++){let n=t.collider(a);e.contactPairsWith(n,t=>{let a=t.parent();if(null===a||!a.isDynamic())return;let r=a.translation(),h=-1/0,l=0,d=0;if(e.contactPair(n,t,t=>{let e=t.normal(),o=e.x*(r.x-s.x)+e.y*(r.y-s.y)+e.z*(r.z-s.z)<0?-1:1;if(Math.abs(e.y)>.7)return;let a=o*e.x,n=o*e.z,c=Math.hypot(a,n);if(c<1e-4)return;let p=(i.x*a+i.z*n)/c;p>h&&(h=p,l=a/c,d=n/c)}),h===-1/0)return;let c=i.x*l+i.z*d;if(c<-wt)return;let p=a.linvel();if(o>wt&&c>wt){let t=p.x*l+p.z*d;if(t<=0)return;let e=Math.min(t,c);return void a.setLinvel({x:l*e,y:p.y,z:d*e},!0)}let m=p.x*l+p.z*d-Math.max(0,c);if(m<=0)return;let u=.5*m;a.setLinvel({x:p.x-l*u,y:p.y,z:p.z-d*u},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let t of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(t),t.rigidBody.setNextKinematicTranslation(yt.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(vt);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)!0!==t.rigidBody?.isKinematic()&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let s,o=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner)for(let t of e.cloner.children)if(t.rigidBody===o){s=t;break}t.dispatch(s),e.dispatchEvent(Rt)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let s=xt.copy(t.matrixWorld).invert();t.traverseEntity((o,a)=>{if(!1===e&&1===a)return!0;for(let e of o.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let a,n=new ut(e.id,e.data,o,this.page,this.sharedAssets,this.eventManager);if(a="box"===e.data.triggerZone?pt.ColliderDesc.cuboid(...e.data.size.map(t=>("number"==typeof t?t:1)/(2*this.pixelsPerMeter))):pt.ColliderDesc.ball(e.data.radius/this.pixelsPerMeter),a.setDensity(0).setSensor(!0).setActiveEvents(pt.ActiveEvents.COLLISION_EVENTS),bt.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),Ct.setFromEuler(ft.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Mt.compose(bt,Ct,Pt).premultiply(o.matrixWorld),i?(Mt.decompose(bt,Ct,Et),a.setActiveCollisionTypes(pt.ActiveCollisionTypes.KINEMATIC_FIXED|pt.ActiveCollisionTypes.DYNAMIC_FIXED)):(Mt.premultiply(s).decompose(bt,Ct,Et),t.rigidBody.bodyType()===pt.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===pt.RigidBodyType.Fixed?a.setActiveCollisionTypes(pt.ActiveCollisionTypes.KINEMATIC_FIXED|pt.ActiveCollisionTypes.DYNAMIC_FIXED):a.setActiveCollisionTypes(pt.ActiveCollisionTypes.KINEMATIC_KINEMATIC|pt.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),bt.divideScalar(this.pixelsPerMeter),a.setTranslation(bt.x,bt.y,bt.z),a.setRotation(Ct),i)i.push([a,n]);else{let e=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t.rigidBody);this.sensorToTriggerEvent[e.handle]=n}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,s,o,a]=this.sharedGameControlGlobals.triggers[e];for(let e=0;e<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;e++){let n=this.sharedGameControlGlobals.entitiesWithTransformAnim[e];if(o===n||!1===a.isValidTriggeringObject(p.is(n)?n:n.object))continue;let r=xt.copy(o.matrixWorld).decompose(bt,St,Et).compose(bt,St,Pt).multiply(s),h=Mt.copy(n.matrixWorld).invert().multiply(r),l=n.bvhGeometry.boundsTree;i instanceof R?t=l.intersectsBox(i,h):(Dt.radius=i,Dt.center.setFromMatrixPosition(h),t=l.intersectsSphere(Dt)),t?-1===a.currentIntersectedObjects.indexOf(n)&&(a.currentIntersectedObjects.push(n),a.dispatch(),o.dispatchEvent(jt)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(t=>t!==n)}}}},Ft=new Promise(t=>{At=t});function kt(t){return Ot||(Ot=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.8/build";typeof window<"u"&&(Wt=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[s,o]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(t=>t.arrayBuffer())]),a=s.default,n=await a({wasmBinary:o});At(n)}())}export{st as a,lt as b,A as c,O as d,F as e,ct as f,Rt as g,Gt as h,Lt as i,It as j,Ft as k,Wt as l,kt as m};
1
+ import{b as t}from"./runtime-chunk-N2ZRGNPR.js";import{a as e,c as i}from"./runtime-chunk-VAVYZ35B.js";import{b as s,c as o,d as a,e as n}from"./runtime-chunk-FQNSP44B.js";import{a as r}from"./runtime-chunk-EPFYNTQQ.js";import{G as h,a as l}from"./runtime-chunk-3D6ELLRB.js";import{f as d,g as c}from"./runtime-chunk-EPHVY3XO.js";import{h as p}from"./runtime-chunk-R3V4RB3X.js";import{a as m,b as u,g as y,h as v,i as g}from"./runtime-chunk-2PT2WH66.js";import{a as f}from"./runtime-chunk-4KZXQGUQ.js";import{c as b}from"./runtime-chunk-TZCHGFVF.js";import{Fa as E}from"./runtime-chunk-VPEJ5BFD.js";import{Bc as P,Dc as C,Ec as M,Fc as x,Oc as T,Oe as S,Pc as D,Rc as w,Xc as R,b as j,bd as G,cd as L,dd as B}from"./runtime-chunk-VGN7YHB7.js";var A=200,W=null;function O(t){W=t}function I(){return W}function F(t){let e=!1;return t.scene.objects.forEach(i=>{"Page"===i.data.type&&!e&&i.data.publish.gameControlObject&&E.traverseModuleInstances(t,i.id,(t,i,s)=>{for(let t of s)"GameControl"===t.data.type&&t.data.navmesh.enabled&&(e=!0)})}),e}function k(t){return s?t.metaKey:t.ctrlKey}function V(t,e){return Math.abs(t+3*e)<=2||Math.abs(t+3*window.devicePixelRatio*e)<=2}var z={type:"change"},H={type:"start"},Z={type:"end",nonOrbit:!0},U={type:"end",nonOrbit:!1},Y={type:"end",isZoom:!0,nonOrbit:!0},X={type:"end",changed:!1},N={type:"cameraAnimatingInTimeline"},K=new M,_=new C,Q=2*Math.PI,q=new x,J=new C,$=new x,tt=new M,et=new T,it={type:"requestRender"},st=class extends P{constructor(t,i,s={isPlayMode:!1,isExport:!1},a){super(),this.object=t,this.domElement=i,this.options=s,this.timelineState=a,this.enabled=!0,this.useKeyEvents=!0,this.enableDamping=!1,this.enableZoom=!0,this.enableRotate=!0,this.enablePan=!0,this.autoRotate=!1,this.rotationLimitsMode=0,this.panLimitsMode=0,this.rotationSoftLimit=2,this.panSoftLimit=2,this.hoverRotatePanMode=0,this.zoomLimitsEnabled=!1,this.mouseButtons=[0,5],this.mouseButtonsPlay=[3,4,5],this.touches=[null,j.DOLLY_ROTATE,j.PAN],this.offset=new x,this.eye=new x,this.lastPosition=new x,this.lastQuaternion=new M,this.current=new C,this.overShoot=new C,this.overRatio=new C,this.spherical=new S,this.sphericalDelta=new S,this.panOffset=new x,this.panLeftV=new x,this.panUpV=new x,this.panV=new x,this.rotateStart=new C,this.rotateEnd=new C,this.rotateDelta=new C,this.panStart=new C,this.panEnd=new C,this.panDelta=new C,this.dollyStart=new C,this.dollyEnd=new C,this.dollyDelta=new C,this.rotationRangeFactor=new C,this.panRangeFactor=new C,this.state=-1,this.zoomChanged=!1,this.isPointerDown=!1,this.isThetaFlipped=!1,this.prevScale=0,this.scale=1,this.gesture=!1,this.lastTrackpadPanTime=-1/0,this.lastMouseWheelZoomTime=-1/0,this.timer=-1,this.timerHover=-1,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPhi=0,this.maxPhi=Math.PI,this.minTheta=-1/0,this.maxTheta=1/0,this.minH=0,this.maxH=Math.PI,this.minV=-1/0,this.maxV=1/0,this.autoRotateClockwise=!0,this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.resetHoverEffectOnPointerLeave=!1,this.hasChange=!1,this.useWindowEvents=!1,this.isTouchZoom=!0,this.autoRotateSpeed=2,this.dampingFactor=.125,this.zoomSpeed=2,this.rotateSpeed=1,this.rotateFactor=1,this.panSpeed=1,this.hoverRotatePanStrength=.1,this.hoverRotateDamping=this.dampingFactor,this.isCurrentlyDamping=!1,this.thetaIsFree=!1,this.phiIsFree=!1,this.needsUpdate=!0,this.onCameraChange=t=>{this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange),this.object=t.camera,this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)},this.update=()=>{this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose($,tt,q),this.offset.copy($).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.autoRotate&&-1===this.state&&this.rotateLeft((!0===this.autoRotateClockwise?1:-1)*this.getAutoRotationAngle()),0!==this.rotationLimitsMode&&this.applyLimits(this.sphericalDelta,this.rotationLimitsMode,this.rotationSoftLimit,this.maxTheta,this.minTheta,this.maxPhi,this.minPhi,this.rotationRangeFactor),2!==this.rotationLimitsMode&&(this.spherical.phi+=this.sphericalDelta.phi),(1!==this.rotationLimitsMode||!0===this.autoRotate)&&(this.spherical.theta+=this.sphericalDelta.theta),this.spherical.radius*=this.scale,this.zoomLimitsEnabled&&this.object.isPerspectiveCamera&&(this.spherical.radius=Math.max(this.minDistance,Math.min(this.maxDistance,this.spherical.radius))),0!==this.panLimitsMode&&(this.target.applyQuaternion(K.copy(tt).invert()),this.panOffset.applyQuaternion(K),this.applyLimits(this.panOffset,this.panLimitsMode,this.panSoftLimit,this.maxH,this.minH,this.maxV,this.minV,this.panRangeFactor),this.target.applyQuaternion(tt),this.panOffset.applyQuaternion(tt)),2===this.panLimitsMode&&(this.panOffset.y=0),1===this.panLimitsMode&&(this.panOffset.x=0),-1!==this.state||this.gesture?(this.target.add(this.panOffset),this.panOffset.set(0,0,0)):(this.panOffset.multiplyScalar(1-this.dampingFactor),this.target.add(this.panOffset)),this.offset.setFromSpherical(this.spherical),$.copy(this.target).add(this.offset),this.object.position.copy(this.target).add(this.offset),this.object.parent&&(et.copy(this.object.parent.matrixWorld).invert(),this.object.position.applyMatrix4(et));let t=this.spherical.phi%Q;if(this.eye.copy(this.offset).normalize(),this.object.up.copy(w.DEFAULT_UP).applyAxisAngle(this.eye,this.object.angleOffsetFromUp),t>0&&t>Math.PI||t<0&&t>-Math.PI?(this.object.up.negate(),this.object.lookAt(this.target),this.object.isUpVectorFlipped=!0):(this.object.lookAt(this.target),this.object.isUpVectorFlipped=!1),-1===this.state||!0===this.enableDamping){let t=1===this.hoverRotatePanMode?this.hoverRotateDamping:this.dampingFactor;this.sphericalDelta.theta*=1-t,this.sphericalDelta.phi*=1-t}else this.sphericalDelta.set(0,0,0);if(this.scale=1,this.lastPosition.distanceToSquared(this.object.position)>.01||8*(1-this.lastQuaternion.dot(this.object.quaternion))>1e-8)return this.dispatchEvent(z),this.object.dispatchEvent(it),this.lastPosition.copy(this.object.position),this.lastQuaternion.copy(this.object.quaternion),void(this.isCurrentlyDamping=!0);this.isPanOverShoot=!1,this.isRotateOverShoot=!1,this.object.wasMovedBySwitchCameraAction=!1,this.sphericalDelta.set(0,0,0),this.panOffset.set(0,0,0),this.isCurrentlyDamping=!1},this.onPointerDown=t=>{!1!==this.enabled&&("touch"===t.pointerType||"pen"===t.pointerType&&n?this.onPointerDownTouch(t):this.onPointerDownMouse(t),-1!==this.state&&(this.isPointerDown=!0,this.dispatchEvent(H),this.domElement.addEventListener("pointermove",this.onPointerMove),this.domElement.addEventListener("pointerup",this.onPointerUp),t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&n||this.domElement.setPointerCapture(t.pointerId)))},this.onPointerLeave=t=>{this.resetHoverEffectOnPointerLeave&&!this.useWindowEvents?(1===this.hoverRotatePanMode?(this.sphericalDelta.theta=-this.spherical.theta,this.sphericalDelta.phi=-this.spherical.phi,q.subVectors(this.position0,this.target0),this.spherical.setFromVector3(q),this.sphericalDelta.theta+=this.spherical.theta,this.sphericalDelta.phi+=this.spherical.phi,this.sphericalDelta.theta/=8,this.sphericalDelta.phi/=8):2===this.hoverRotatePanMode&&this.panOffset.subVectors(this.target0,this.target).divideScalar(8),this.update()):this.pointerLeaveEvent=t},this.onPointerEnter=t=>{this.resetHoverEffectOnPointerLeave||void 0===this.pointerLeaveEvent?J.set(t.clientX-this.domElement.clientWidth/2,t.clientY-this.domElement.clientHeight/2):J.set(t.clientX-this.pointerLeaveEvent.clientX,t.clientY-this.pointerLeaveEvent.clientY),1===this.hoverRotatePanMode?(this.rotateDelta.copy(J).multiplyScalar(this.rotateSpeed*this.hoverRotatePanStrength).rotateAround(_,-this.object.angleOffsetFromUp),this.rotateLeft(2*Math.PI*this.rotateDelta.x/this.domElement.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/this.domElement.clientHeight),this.rotateStart.set(t.clientX,t.clientY)):2===this.hoverRotatePanMode&&(this.panDelta.copy(J).multiplyScalar(this.panSpeed*this.hoverRotatePanStrength),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.set(t.clientX,t.clientY)),this.update()},this.onPointerMove=t=>{this.timelineState?.isPlayingCameraAnimation?this.dispatchEvent(N):!1!==this.enabled&&(this.checkRaycastLock()||("touch"===t.pointerType||"pen"===t.pointerType&&n?this.onPointerMoveTouch(t):this.onPointerMoveMouse(t),t.stopPropagation()))},this.onPointerUp=t=>{this.isPointerDown=!1,0===e.length&&(this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)),e.length>1&&t.preventDefault(),this.hasChange?this.dispatchEvent(0===this.state?U:Z):this.dispatchEvent(X),this.state=-1,t&&(t.stopPropagation(),"touch"===t.pointerType||"pen"===t.pointerType&&n||this.domElement.releasePointerCapture(t.pointerId))},this.onPointerDownMouse=t=>{let e;switch(e=this.useKeyEvents?this.mouseButtons[t.button]:this.mouseButtonsPlay[t.button],e){case 0:if(!0!==t.altKey||t.shiftKey||k(t)){if(" "===this.key){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 4:if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2;break;case 3:if(k(t)||t.shiftKey){if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}else{if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}break;case 5:if(k(t)||t.shiftKey){if(!1===this.enableRotate)return;this.handleMouseDownRotate(t),this.state=0}else{if(!1===this.enablePan)return;this.handleMouseDownPan(t),this.state=2}break;default:this.state=-1}},this.onPointerMoveMouse=t=>{switch(this.state){case 0:if(!1===this.enableRotate)return;this.handleMouseMoveRotate(t);break;case 1:if(!1===this.enableZoom)return;this.handleMouseMoveDolly(t);break;case 2:if(!1===this.enablePan)return;this.handleMouseMovePan(t)}this.object.wasMovedByUser=!0},this.onPointerDownTouch=t=>{switch(e.length>1&&t.preventDefault(),this.touches[e.length-1]){case j.ROTATE:if(!1===this.enableRotate)return void(this.state=-1);this.handleTouchStartRotate(),this.state=3;break;case j.PAN:if(!1===this.enablePan)return void(this.state=-1);this.handleTouchStartPan(),this.state=4;break;case j.DOLLY_PAN:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchStartDollyPan(),this.state=5;break;case j.DOLLY_ROTATE:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchStartDollyRotate(),this.state=6;break;default:this.state=-1}},this.onPointerMoveTouch=t=>{switch(e.length>1&&t.preventDefault(),this.state){case 3:if(!1===this.enableRotate)return;this.handleTouchMoveRotate(t),this.update();break;case 4:if(!1===this.enablePan)return;this.handleTouchMovePan(t),this.update();break;case 5:if(!1===this.enableZoom&&!1===this.enablePan)return;this.handleTouchMoveDollyPan(t),this.update();break;case 6:if(!1===this.enableZoom&&!1===this.enableRotate)return;this.handleTouchMoveDollyRotate(t),this.update();break;default:this.state=-1}this.object.wasMovedByUser=!0},this.dispatchEndDebounced=f(()=>{this.zoomChanged?this.dispatchEvent(Y):this.dispatchEvent(Z),this.zoomChanged=!1},33),this.onMouseWheel=t=>{if(!1!==this.enabled&&(!1!==this.enableZoom||!1!==this.enablePan)&&!this.checkRaycastLock()){if(!this.options.isExport&&this.domElement.clientHeight===document.body.clientHeight&&this.domElement.clientWidth===document.body.clientWidth&&t.preventDefault(),this.dispatchEvent(H),this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(N);this.handleMouseWheel(t),this.dispatchEndDebounced(),this.object.wasMovedByUser=!0}},this.onGesture=t=>{if(t.preventDefault(),!1!==this.enabled&&!this.checkRaycastLock()&&!o){if(this.timelineState?.isPlayingCameraAnimation)return void this.dispatchEvent(N);if("gesturechange"===t.type){if(!1===this.enableZoom||!1===this.isTouchZoom)return;this.dispatchEvent(H),t.scale>this.prevScale?this.dollyIn(this.getZoomScale()):t.scale<this.prevScale&&this.dollyOut(this.getZoomScale()),this.prevScale=t.scale,this.update(),this.object.wasMovedByUser=!0}else this.dispatchEvent(Z)}},this.onContextMenu=t=>{t.preventDefault()},this.onTouchEnd=t=>{t.preventDefault()},this.onKeyDown=t=>{!1!==this.enabled&&(this.key=t.key," "===t.key&&this.dispatchEvent(H))},this.onKeyUp=t=>{this.key=void 0,!1!==this.enabled&&(-1!==this.state&&"Alt"===t.key&&this.onPointerUp(e[0])," "===t.key&&this.dispatchEvent(Z))},this.onPointerHover=t=>{"mouse"!==t.pointerType||!1===this.enabled||-1!==this.state||2===this.hoverRotatePanMode&&this.isPanOverShoot||1===this.hoverRotatePanMode&&this.isRotateOverShoot||(this.isPointerDown=!0,2===this.hoverRotatePanMode?this.handleMouseMovePan(t,this.hoverRotatePanStrength):1===this.hoverRotatePanMode&&this.handleMouseMoveRotate(t,this.hoverRotatePanStrength))},this.onBeginState=()=>{this.enabled=!1,this.needsUpdate=!1},this.onCompleteState=t=>{t.isfromEntity&&this.options.isPlayMode||(this.enabled=!0,this.needsUpdate=!0,this.object.updateUp(),this.object.getTarget(this.target))},this.target=this.object.getTarget(),this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.quat0=this.object.quaternion.clone(),this.isUpVectorFlipped0=this.object.isUpVectorFlipped,this.object.updateWorldMatrix(!0,!1),this.object.matrixWorld.decompose($,tt,q),this.offset.copy($).sub(this.target),this.spherical.setFromVector3(this.offset),this.object.isUpVectorFlipped&&(this.spherical.phi*=-1,this.spherical.theta-=Math.PI),this.initialSphericalRadius=this.spherical.radius,this.addEventListenersToCamera()}dispatchEvent(t){"start"===t.type?this.hasChange=!1:this.hasChange=!0,super.dispatchEvent(t)}addEventListenersToCamera(){this.object.addEventListener("beginState",this.onBeginState),this.object.addEventListener("completeState",this.onCompleteState),this.object.addEventListener("cameraChange",this.onCameraChange)}removeEventListenersFromCamera(){this.object.removeEventListener("beginState",this.onBeginState),this.object.removeEventListener("completeState",this.onCompleteState),this.object.removeEventListener("cameraChange",this.onCameraChange)}updateUseWindowEvents(t){if(window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("pointermove",this.onPointerHover),this.useWindowEvents=t,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover)),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}}fromJSON(t,e){this.rotateFactor=t.rotationSpeed??1,this.setEnableDampingSpeed(t.enableDamping),this.enablePan=t.enablePan,this.enableZoom=t.enableZoom,this.enableRotate=t.enableRotate,this.rotationLimitsMode=t.rotationLimitsMode,this.thetaIsFree=t.rotationHorizontalOffset.min===t.rotationHorizontalOffset.max&&t.rotationHorizontalOffset.min===Math.PI,this.phiIsFree=t.rotationVerticalOffset.min===t.rotationVerticalOffset.max&&t.rotationVerticalOffset.min===Math.PI,this.panLimitsMode=t.panLimitsMode,this.panSoftLimit=t.panSoftLimit,this.rotationSoftLimit=t.rotationSoftLimit,this.hoverRotatePanMode=t.hoverRotatePanMode,this.hoverRotateDamping=t.hoverRotateDamping??this.dampingFactor,this.useWindowEvents="window"===e,0!==this.hoverRotatePanMode&&(this.useWindowEvents?window.addEventListener("pointermove",this.onPointerHover):this.domElement.addEventListener("pointermove",this.onPointerHover));let i=t.hoverRotatePanStrength/100;this.hoverRotatePanStrength=i**2,this.zoomLimitsEnabled=t.zoomLimitsEnabled,this.minZoom=t.zoomLimits.min,this.maxZoom=Math.max(t.zoomLimits.min,t.zoomLimits.max),this.minDistance=1e3/this.maxZoom,this.maxDistance=Math.max(this.minDistance,1e3/t.zoomLimits.min),this.autoRotate=t.autoRotate,this.autoRotateSpeed=t.autoRotateSpeed,this.autoRotateClockwise=t.autoRotateClockwise;let s=this.object.getTarget().applyQuaternion(K.copy(this.object.quaternion).invert());this.minV=-t.panVerticalOffset.min+s.y,this.maxV=t.panVerticalOffset.max+s.y,this.minH=-t.panHorizontalOffset.min+s.x,this.maxH=t.panHorizontalOffset.max+s.x,this.panRangeFactor.set(this.maxH-this.minH,this.maxV-this.minV).divideScalar(2),this.rotationRangeFactor.setScalar(Math.PI).divideScalar(4),this.minPhi=ot(this.spherical.phi-t.rotationVerticalOffset.min),this.maxPhi=ot(this.spherical.phi+t.rotationVerticalOffset.max),this.minTheta=ot(ot(this.spherical.theta)-t.rotationHorizontalOffset.min),this.maxTheta=ot(ot(this.spherical.theta)+t.rotationHorizontalOffset.max),this.isThetaFlipped=this.minTheta>this.maxTheta,1===t.orbitTouches&&(this.touches[0]=j.ROTATE),1===t.panTouches&&(this.touches[0]=j.PAN),2===t.orbitTouches&&(this.touches[1]=j.DOLLY_ROTATE),2===t.panTouches&&(this.touches[1]=j.DOLLY_PAN),3===t.orbitTouches&&(this.touches[2]=j.ROTATE),3===t.panTouches&&(this.touches[2]=j.PAN),this.isTouchZoom=t.isTouchZoom,this.resetHoverEffectOnPointerLeave=t.resetHoverEffectOnPointerLeave??!1}connect(){if(this.domElement.addEventListener("contextmenu",this.onContextMenu),this.domElement.addEventListener("pointerdown",this.onPointerDown),this.domElement.addEventListener("wheel",this.onMouseWheel),window.addEventListener("keydown",this.onKeyDown,!1),window.addEventListener("keyup",this.onKeyUp,!1),this.domElement.addEventListener("gesturestart",this.onGesture),this.domElement.addEventListener("gesturechange",this.onGesture),this.domElement.addEventListener("gestureend",this.onGesture),this.domElement.addEventListener("touchend",this.onTouchEnd),0!==this.hoverRotatePanMode&&!this.useWindowEvents){let t=this.useWindowEvents?window:this.domElement;t.addEventListener("pointerleave",this.onPointerLeave),t.addEventListener("pointerenter",this.onPointerEnter)}this.pointerLeaveEvent=void 0}dispose(){this.removeEventListenersFromCamera(),this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("wheel",this.onMouseWheel),window.removeEventListener("keydown",this.onKeyDown,!1),window.removeEventListener("keyup",this.onKeyUp,!1),this.domElement.removeEventListener("pointermove",this.onPointerHover),window.removeEventListener("pointermove",this.onPointerHover),this.domElement.removeEventListener("gesturestart",this.onGesture),this.domElement.removeEventListener("gesturechange",this.onGesture),this.domElement.removeEventListener("gestureend",this.onGesture),this.domElement.removeEventListener("touchend",this.onTouchEnd),this.domElement.removeEventListener("pointerleave",this.onPointerLeave),this.domElement.removeEventListener("pointerenter",this.onPointerEnter),window.removeEventListener("pointerleave",this.onPointerLeave),window.removeEventListener("pointerenter",this.onPointerEnter),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp)}applyLimits(t,e,i,s,o,a,n,r){let h,l,d;this.overShoot.set(0,0),t instanceof x?(h=t.x,l=t.y,this.current.set(this.target.x,this.target.y),d=!0):(h=t.theta,l=t.phi,this.current.set(ot(this.spherical.theta),ot(this.spherical.phi)),d=!1),0===i&&(this.current.x+=h,this.current.y+=l),(3===e||2===e)&&(!d&&this.isThetaFlipped?this.current.x>s&&this.current.x<0?this.overShoot.x=s-this.current.x:this.current.x<o&&this.current.x>0&&(this.overShoot.x=o-this.current.x):this.current.x>s?this.overShoot.x=s-this.current.x:this.current.x<o&&(this.overShoot.x=o-this.current.x)),(3===e||1===e)&&(this.current.y>a?this.overShoot.y=a-this.current.y:this.current.y<n&&(this.overShoot.y=n-this.current.y)),d||(this.overShoot.x=ot(this.overShoot.x),this.overShoot.y=ot(this.overShoot.y)),0!==i?(this.overRatio.copy(this.overShoot).divide(r),this.overRatio.x=Math.min(Math.abs(this.overRatio.x),1),this.overRatio.y=Math.min(Math.abs(this.overRatio.y),1),1===i&&(this.overRatio.x=at(Math.abs(this.overRatio.x)),this.overRatio.y=at(Math.abs(this.overRatio.y))),this.isPointerDown||1===i?2===i&&(this.overRatio.x>.9&&!this.thetaIsFree||this.overRatio.y>.9&&!this.phiIsFree)?this.isPointerDown=!1:(h*this.overShoot.x<0&&!this.thetaIsFree&&(h*=1-this.overRatio.x),l*this.overShoot.y<0&&!this.phiIsFree&&(l*=1-this.overRatio.y)):2===i&&(!d&&(this.overRatio.x>.002&&!this.thetaIsFree||this.overRatio.y>.002&&!this.phiIsFree)||d&&(Math.abs(this.overShoot.x)>2||Math.abs(this.overShoot.y)>2)?(this.thetaIsFree||(h=.05*this.overShoot.x),this.phiIsFree||(l=.05*this.overShoot.y),d?this.isPanOverShoot=!0:this.isRotateOverShoot=!0):d?this.isPanOverShoot=!1:this.isRotateOverShoot=!1)):(h+=this.overShoot.x,l+=this.overShoot.y),t instanceof x?(t.x=h,t.y=l):(this.thetaIsFree||(t.theta=h),this.phiIsFree||(t.phi=l))}setEnableDampingSpeed(t){this.enableDamping=t,this.rotateSpeed=(!0===t?.2:1)*this.rotateFactor}stopDamping(){this.sphericalDelta.theta=0,this.sphericalDelta.phi=0,this.panOffset.set(0,0,0)}setTarget(t,e,i){this.stopDamping(),this.target.set(t,e,i)}getAutoRotationAngle(){return 2*Math.PI/60/60*this.autoRotateSpeed}getZoomScale(){return Math.pow(.95,this.zoomSpeed)}rotateLeft(t){this.sphericalDelta.theta-=t}rotateUp(t){this.sphericalDelta.phi-=t}panLeft(t,e){this.panLeftV.setFromMatrixColumn(e,0),this.panLeftV.multiplyScalar(-t),this.panOffset.add(this.panLeftV)}panUp(t,e){this.panUpV.setFromMatrixColumn(e,1),this.panUpV.multiplyScalar(t),this.panOffset.add(this.panUpV)}pan(t,e){let i=this.domElement;if(i&&this.object.isPerspectiveCamera){let s=this.object.position;this.panV.copy(s).sub(this.target);let o=this.panV.length();o*=Math.tan(this.object.fov/2*Math.PI/180),this.panLeft(2*t*o/i.clientHeight,this.object.matrixWorld),this.panUp(2*e*o/i.clientHeight,this.object.matrixWorld)}else i&&this.object.isOrthographicCamera&&(this.panLeft(t*(this.object.right-this.object.left)/this.object.zoom/i.clientWidth,this.object.matrixWorld),this.panUp(e*(this.object.top-this.object.bottom)/this.object.zoom/i.clientHeight,this.object.matrixWorld));this.dispatchEvent(z)}dollyOut(t){this.object.isPerspectiveCamera?this.scale/=t:this.object.isOrthographicCamera&&(this.object.zoom*=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(z)}dollyIn(t){this.object.isPerspectiveCamera?this.scale*=t:this.object.isOrthographicCamera&&(this.object.zoom/=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0),this.dispatchEvent(z)}setZoom(t){if(this.dispatchEvent(H),this.object.isPerspectiveCamera){let e=this.initialSphericalRadius/t/this.spherical.radius;this.scale=e}else this.object.isOrthographicCamera&&(this.object.zoom=t,this.zoomLimitsEnabled&&(this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom))),this.object.updateProjectionMatrix(),this.zoomChanged=!0);this.dispatchEvent(Z)}handleMouseDownRotate(t){this.rotateStart.set(t.clientX,t.clientY)}handleMouseDownDolly(t){this.dollyStart.set(t.clientX,t.clientY)}handleMouseDownPan(t){this.panStart.set(t.clientX,t.clientY)}handleMouseMoveRotate(t,e=1){void 0!==t.movementX?this.rotateDelta.set(t.movementX,t.movementY):(this.rotateEnd.set(t.clientX,t.clientY),this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart),this.rotateStart.copy(this.rotateEnd)),this.rotateDelta.multiplyScalar(this.rotateSpeed*e).rotateAround(_,-this.object.angleOffsetFromUp);let i=this.domElement,s=this.useWindowEvents?window.innerHeight:i.clientHeight,o=2*Math.PI*this.rotateDelta.x/s,a=2*Math.PI*this.rotateDelta.y/s;this.rotateLeft(o),this.rotateUp(a),this.update()}handleMouseMoveDolly(t){this.dollyEnd.set(t.clientX,t.clientY),this.dollyDelta.subVectors(this.dollyEnd,this.dollyStart),this.dollyDelta.y>0?this.dollyOut(this.getZoomScale()):this.dollyDelta.y<0&&this.dollyIn(this.getZoomScale()),this.dollyStart.copy(this.dollyEnd),this.update()}handleMouseMovePan(t,e=1){void 0!==t.movementX?this.panDelta.set(t.movementX,t.movementY):(this.panEnd.set(t.clientX,t.clientY),this.panDelta.subVectors(this.panEnd,this.panStart),this.panStart.copy(this.panEnd)),this.panDelta.multiplyScalar(this.panSpeed*e),this.pan(this.panDelta.x,this.panDelta.y),this.update()}handleMouseWheel(t){if(0===t.deltaX&&0===t.deltaY)return;let e=!0===t.ctrlKey||!0===k(t),i=!1===k(t)&&!0===(0===(r=t).wheelDeltaY||0===r.deltaY?!(s&&r.shiftKey&&Math.abs(r.wheelDeltaX)>=120)&&(r.wheelDeltaX?V(r.wheelDeltaX,r.deltaX):0===r.deltaMode):r.wheelDeltaY?V(r.wheelDeltaY,r.deltaY):0===r.deltaMode),o=!1===e&&(!0===this.gesture||t.timeStamp-this.lastTrackpadPanTime<300),n=!1===e&&!1===o&&t.timeStamp-this.lastMouseWheelZoomTime<300;var r;if(!1!==a||!1!==n||!0!==i&&!0!==o){if(!1===this.enableZoom)return;this.gesture&&(window.clearTimeout(this.timer),this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Z)),!1===e&&!1===i&&(this.lastMouseWheelZoomTime=t.timeStamp),0===t.deltaY?t.deltaX<0?this.dollyIn(this.getZoomScale()):t.deltaX>0&&this.dollyOut(this.getZoomScale()):t.deltaY<0?this.dollyIn(this.getZoomScale()):t.deltaY>0&&this.dollyOut(this.getZoomScale()),this.update(),this.gesture=!1,this.isPointerDown=!1}else{if(!1===this.enablePan)return;let e=!1===this.gesture&&!1===o;this.lastTrackpadPanTime=t.timeStamp,this.gesture||(this.gesture=!0,this.isPointerDown=!0),!1===e&&(this.panDelta.set(-t.deltaX,-t.deltaY).multiplyScalar(this.panSpeed),this.panDelta.x=Math.min(Math.abs(this.panDelta.x),100)*(this.panDelta.x<0?-1:1),this.panDelta.y=Math.min(Math.abs(this.panDelta.y),100)*(this.panDelta.y<0?-1:1),t.altKey?this.pan(0,this.panDelta.y):t.shiftKey?this.pan(this.panDelta.x,0):this.pan(this.panDelta.x,this.panDelta.y),this.update()),window.clearTimeout(this.timer),this.timer=window.setTimeout(()=>{this.gesture=!1,this.isPointerDown=!1,this.dispatchEvent(Z)},100)}}handleTouchStartRotate(){if(2===e.length){let t=.5*(e[0].pageX+e[1].pageX),i=.5*(e[0].pageY+e[1].pageY);this.rotateStart.set(t,i)}else this.rotateStart.set(e[0].pageX,e[0].pageY)}handleTouchStartPan(){if(2===e.length){let t=.5*(e[0].pageX+e[1].pageX),i=.5*(e[0].pageY+e[1].pageY);this.panStart.set(t,i)}else this.panStart.set(e[0].pageX,e[0].pageY)}handleTouchStartDolly(){let t=e[0].pageX-e[1].pageX,i=e[0].pageY-e[1].pageY,s=Math.sqrt(t*t+i*i);this.dollyStart.set(0,s)}handleTouchStartDollyPan(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enablePan&&this.handleTouchStartPan()}handleTouchStartDollyRotate(){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchStartDolly(),this.enableRotate&&this.handleTouchStartRotate()}handleTouchMoveRotate(t){if(2===e.length){let e=i(t),s=.5*(t.pageX+e.x),o=.5*(t.pageY+e.y);this.rotateEnd.set(s,o)}else{if(t.pointerId!==e[0].pointerId)return;this.rotateEnd.set(t.pageX,t.pageY)}this.rotateDelta.subVectors(this.rotateEnd,this.rotateStart).multiplyScalar(this.rotateSpeed);let s=this.domElement;s&&(this.rotateLeft(2*Math.PI*this.rotateDelta.x/s.clientHeight),this.rotateUp(2*Math.PI*this.rotateDelta.y/s.clientHeight)),this.rotateStart.copy(this.rotateEnd)}handleTouchMovePan(t){if(2===e.length){let e=i(t),s=.5*(t.pageX+e.x),o=.5*(t.pageY+e.y);this.panEnd.set(s,o)}else{if(t.pointerId!==e[0].pointerId)return;this.panEnd.set(t.pageX,t.pageY)}this.panDelta.subVectors(this.panEnd,this.panStart).multiplyScalar(this.panSpeed),this.pan(this.panDelta.x,this.panDelta.y),this.panStart.copy(this.panEnd)}handleTouchMoveDolly(t){let e=i(t),s=t.pageX-e.x,o=t.pageY-e.y,a=Math.sqrt(s*s+o*o);this.dollyEnd.set(0,a),this.dollyDelta.set(0,Math.pow(this.dollyEnd.y/this.dollyStart.y,this.zoomSpeed)),this.dollyOut(this.dollyDelta.y),this.dollyStart.copy(this.dollyEnd)}handleTouchMoveDollyPan(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enablePan&&this.handleTouchMovePan(t)}handleTouchMoveDollyRotate(t){this.enableZoom&&!0===this.isTouchZoom&&this.handleTouchMoveDolly(t),this.enableRotate&&this.handleTouchMoveRotate(t)}checkRaycastLock(){if(this.object.data.raycastLock){if(this.options.isPlayMode)return!1;{let t=this.options?.showCameraLock;return t&&t(),!0}}return!1}};function ot(t){let e=2*Math.PI;for(;t<=-Math.PI;)t+=e;for(;t>Math.PI;)t-=e;return t}function at(t){return 1-Math.pow(1-t,4)}var nt,rt,ht=new Promise(t=>{nt=t});function lt(t){return rt||(rt=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.9/build",i=import("./physics.js"),[s,o]=await Promise.all([i,fetch(`${e}/physics.wasm`).then(t=>t.arrayBuffer())]);await s.init(o),nt(s)}())}function dt(t){let e=t.elements,i=e[0]**2+e[1]**2+e[2]**2,s=e[4]**2+e[5]**2+e[6]**2,o=e[8]**2+e[9]**2+e[10]**2,a=e[0]**2+e[4]**2+e[8]**2,n=e[1]**2+e[5]**2+e[9]**2,r=e[2]**2+e[6]**2+e[10]**2,h=1e-8;return i<h||s<h||o<h||a<h||n<h||r<h}function ct(t,e){let i=new B;if(e&&dt(e))return i.setAttribute("position",new G([],3)),i.setIndex([]),i;if(!t.getAttribute("position"))return i.setAttribute("position",new G([],3)),i.setIndex([]),i;let{positions:s,triIndices:o}=h(t.getAttribute("position"),t.getIndex());return i.setAttribute("position",new G(s,3)),i.setIndex(o),e&&i.applyMatrix4(e),i}var pt,mt=class{constructor(t,e,i,s,o,a){this.id=t,this.data=e,this.object=i,this.initialDisabled=!1,this.actions=d(e,e.actions,s,o,a,i),this.target=e.target}disconnect(){c(this.actions)}dispatch(t){this.initialDisabled||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Collision"}),this.actions.Transition.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Animation.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch(t??!1)}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}},ut=class{constructor(t,e,i,s,o,a){this.id=t,this.data=e,this.object=i,this.page=s,this.currentIntersectedObjects=[],this.actions=d(e,e.actions,s,o,a,i),this.target=e.target,this.triggeringObjects=[];for(let t of e.triggeringObjects){let e=s.scene.find(t);e&&this.triggeringObjects.push(e)}}isValidTriggeringObject(t){return"all"===this.target||this.triggeringObjects.some(e=>e===t||e.isAncestorOf(t.uuid)||t.isAncestorOf(e.uuid))}disconnect(){c(this.actions)}dispatch(){this.object.destroyedInAction||(this.actions.Transition.forEach(t=>{t.object.currentTransitionEvent!==this&&(t.object.currentTransitionEvent=this,t.init())}),this.object.dispatchEvent({type:"beginEvent",eventName:"Trigger"}),this.actions.Transition.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.SwitchCamera.forEach(t=>{"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.TimelineAnimation.forEach(t=>{"runMode"in t.data&&"Toggle"===t.data.runMode?t.toggle():t.play()}),this.actions.Link.forEach(t=>{t.dispatch()}),this.actions.Reset.forEach(t=>{t.dispatch()}),this.actions.Create.forEach(t=>{t.dispatch()}),this.actions.Destroy.forEach(t=>{t.dispatch(!1)}),this.actions.Audio.forEach(t=>{t.dispatchBasic()}),this.actions.Particles.forEach(t=>{t.dispatchBasic()}),this.actions.Video.forEach(t=>{t.dispatchBasic()}),this.actions.SceneTransition.forEach(t=>{t.dispatch()}),this.actions.SetVariable.forEach(t=>t.checkConditions()),this.actions.SetVariable.forEach(t=>t.dispatch()),this.actions.DynamicVariablePlay.forEach(t=>t.dispatch()),this.actions.ClearLocalStorage.forEach(t=>t.dispatch()),this.actions.UserAPI.forEach(t=>t.dispatch()))}};ht.then(t=>pt=t);var yt=new x,vt=new M,gt=new x,ft=(new D(0,0,0,"YXZ"),new D(0,0,0,"XYZ")),bt=new x,Et=new x,Pt=new x(1,1,1),Ct=new M,Mt=new T,xt=new T,Tt={type:"updateMatrix"},St=new M,Dt=new L,wt=.01,Rt={type:"beginEvent",eventName:"Collision"},jt={type:"beginEvent",eventName:"Trigger"};function Gt(t){if(E.physicsEnabled(t.scene.objects))return!0;let e=!1;return t.scene.objects.traverse((t,i)=>{if(i.events)if(Array.isArray(i.events)){for(let t of i.events)if(!0!==t.data.disabled&&"GameControl"===t.data.type&&t.data.collisionEnabled){e=!0;break}}else for(let t of Object.values(i.events))if(!0!==t.disabled&&"GameControl"===t.type&&t.collisionEnabled){e=!0;break}}),e}var Lt=t=>t.states.some(t=>void 0!==t.data.position||void 0!==t.data.rotation||void 0!==t.data.hiddenMatrix||void 0!==t.data.cloner||void 0!==t.data.pathSnapping);function Bt(t){return y(g(t)?t.object:t)}var At,Wt,Ot,It=class{constructor(t){this.eventContext=t,this.isEnabled=!1,this.gameControl=null,this.joysticks=[],this.joystickToGameControls=[],this.sharedGameControlGlobals={entitiesWithTransformAnim:[],entityToCollisionEvents:{},colliderToEntity:new Map,kinematicBodyToEntity:new Map,triggers:[],gamePads:[],createdObjects:[],nCreatedPerAction:{}},this.sensorToTriggerEvent={},this.eventManager=void 0,this.needsCollisionDetection=!1,this.initializationCounter=-1,this.fixedBodiesToWatch=[],this.rigidBodyToMesh=new Map,this.nActiveRigidBodies=0,this.collisionEvents=[],this.isExport=!1,this.skipRender=!0,this._staticBVHAttrIds=new WeakMap,this._staticBVHNextAttrId=1,this.processRigidBody=t=>{if(t.bodyType()!==pt.RigidBodyType.Dynamic)return;t.isSleeping()||this.nActiveRigidBodies++;let[e,i,s]=this.rigidBodyToMesh.get(t.handle);if(yt.copy(t.translation()).multiplyScalar(this.pixelsPerMeter),vt.copy(t.rotation()),e.matrixWorld.compose(yt,vt,i),e.hasNonUniformScale&&e.matrixWorld.multiply(e.shearScale),e.dispatchEvent(Tt),s){let t=e.cloner;if(t&&void 0===t.objectForSample){t.matrixWorld.copy(e.matrixWorld);for(let e of t.children)e.updateMatrixWorld(!0)}for(let t of e.children)t.updateMatrixWorld(!0)}},this.accumulator=0,this.handleCollisionEvents=(t,e,i)=>{if(!1===i)return;let s,o;if(this.sensorToTriggerEvent[t]?(s=this.sensorToTriggerEvent[t],o=this.sharedGameControlGlobals.colliderToEntity.get(e)):this.sensorToTriggerEvent[e]&&(s=this.sensorToTriggerEvent[e],o=this.sharedGameControlGlobals.colliderToEntity.get(t)),s&&o&&s.isValidTriggeringObject(o))s.dispatch();else{for(let i=this.sharedGameControlGlobals.createdObjects.length-1;i>=0;i--){let s=this.sharedGameControlGlobals.createdObjects[i];if(s.userData.hasCollisionDestroy&&(s.rigidBody?.collider(0).handle===t||s.rigidBody?.collider(0).handle===e)){this.sharedGameControlGlobals.createdObjects.splice(i,1),s.removeFromParent();let t=s.rigidBody;requestAnimationFrame(()=>{s.rigidBody===t&&(this.sharedGameControlGlobals.rapierWorld?.removeRigidBody(t),s.rigidBody=void 0)});break}}if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(t)){let t=this.sharedGameControlGlobals.colliderToEntity.get(e),i=this.sharedGameControlGlobals.entityToCollisionEvents[t.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,t,e)}else if(void 0!==this.gameControl?.object&&this.gameControl.object===this.sharedGameControlGlobals.colliderToEntity.get(e)){let e=this.sharedGameControlGlobals.colliderToEntity.get(t),i=this.sharedGameControlGlobals.entityToCollisionEvents[e.uuid];if(void 0===i)return;for(let s of i)"character"===s.data.target&&this.dispatchCollisionEvent(s,e,t)}else{let i=this.sharedGameControlGlobals.colliderToEntity.get(t),s=this.sharedGameControlGlobals.entityToCollisionEvents[i.uuid];if(void 0!==s)for(let e of s)"scene"===e.data.target&&this.dispatchCollisionEvent(e,i,t);let o=this.sharedGameControlGlobals.colliderToEntity.get(e),a=this.sharedGameControlGlobals.entityToCollisionEvents[o?.uuid];if(void 0!==a)for(let t of a)"scene"===t.data.target&&this.dispatchCollisionEvent(t,o,e)}}},this.isExport=t.isExport,this.sharedAssets=t.sharedAssets,this.renderer=t.renderer,this.requestRender=t.requestRender,this.domElement=this.renderer.domElement,this.pixelsPerMeter=200,this.gravity=this.page.data.globalPhysics.gravity}get page(){return this.eventContext.page}markIsDestroyTarget(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events){if(!0===t.data.disabled)continue;let e=t.data.actions?.find(t=>"Destroy"===t.data.type)?.data;if(e)for(let t of e.objects){let e=this.page.scene.find(t);e&&(e.userData.hasDestroy=!0)}}})}markIsDragObject(){this.page.traverseVisibleEntity(t=>{let e=t.dataPatched;for(let t of e.events)if(!0!==t.data.disabled&&"DragDrop"===t.data.type)for(let e of t.data.objects){let t=this.page.scene.find(e);t&&(t.userData.hasDrag=!0)}})}_staticBVHIdOf(t){let e=this._staticBVHAttrIds.get(t);return void 0===e&&(e=this._staticBVHNextAttrId++,this._staticBVHAttrIds.set(t,e)),e}initBVH(){if(null===t())return void b("collision-bvh","trigger/collision detection");let e=[],i=[];if(this.page.traverseChildren(t=>{let s,o=t instanceof r,a=m(t);if(v(t)||o||a)return;s=g(t)?t.object:t;let n=s.dataPatched;if("visibility"===n.physics?.enabled?!n.visible:!n.physics?.enabled)return!0;let h=t.geometry,l=!0===s.userData.hasDestroy,d=!0===s.userData.hasDrag;if(Lt(n)||l||d||s.dataPatched.events.some(t=>!0!==t.data.disabled&&("GameControl"===t.data.type||"Follow"===t.data.type)))return t.updateMatrixWorldRigid(),this.addBoundsTree(t),!0;if(h){let s=h.getAttribute("position");if(void 0!==s&&s.count>0){e.push({geometry:h,matrixWorld:t.matrixWorld}),i.push(h.id,this._staticBVHIdOf(s),s.version,null!==h.index?this._staticBVHIdOf(h.index):-1,null!==h.index?h.index.version:-1);for(let e of t.matrixWorld.elements)i.push(e)}}return!!Bt(t)||void 0}),e.length>0){let s=this._staticBVHCache;if(void 0!==s&&s.signature.length===i.length&&s.signature.every((t,e)=>t===i[e]))return void(this.sharedGameControlGlobals.staticMeshBVH=s.bvh);let o=e.map(t=>ct(t.geometry,t.matrixWorld)),a=l(o,!1),n=new(t())(a);this._staticBVHCache={signature:i,bvh:n},this.sharedGameControlGlobals.staticMeshBVH=n}}addRigidBody(t,e,i){if(dt(t.matrixWorld))return;let s=[],o="geometry"in t?t.geometry:void 0,a=e.dataPatched;if(void 0!==o?.getAttribute("position")&&s.push(ct(o,t.shearScale)),a.physics.fusedBody){let e=this.gatherChildrenGeom(t,s);t.traverseObject(e),t.children.forEach(t=>t.updateMatrixWorld(!0));let i=t.cloner;i&&void 0===i.objectForSample&&"dynamic"===a.physics.rigidBody&&(i.traverseObject(e),i.children.forEach(t=>t.updateMatrixWorld(!0)))}if(s.length>0){let n,r=!1,h=!i.fromCreate&&"dynamic"===a.physics.rigidBody||i.fromCreate&&i.dynamic;h?(n=pt.RigidBodyDesc.dynamic(),n.setLinearDamping(a.physics.damping).setAngularDamping(a.physics.damping).setAdditionalMass(1e-9).setGravityScale(a.physics.gravityScale).enabledRotations(...a.physics.enabledRotation).enabledTranslations(...a.physics.enabledTranslation)):(i.hasTransformAnim||i.hasFollow||i.hasDrag)&&!i.fromCreate?(n=pt.RigidBodyDesc.kinematicPositionBased(),r=!0):n=pt.RigidBodyDesc.fixed();let d=l(s);(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(yt,vt,gt),t.position0=yt.clone().divideScalar(this.pixelsPerMeter),t.rotation0=vt.clone(),yt.divideScalar(this.pixelsPerMeter),n.setTranslation(yt.x,yt.y,yt.z).setRotation(vt),o?d?.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter):d?.scale(gt.x/this.pixelsPerMeter,gt.y/this.pixelsPerMeter,gt.z/this.pixelsPerMeter);let c=this.sharedGameControlGlobals.rapierWorld.createRigidBody(n),p=!(void 0===a.geometry||"SubdivGeometry"===a.geometry.type||"NonParametricGeometry"===a.geometry.type||"BooleanGeometry"===a.geometry.type||"VectorGeometry"===a.geometry.type||"StarGeometry"===a.geometry.type||"RectangleGeometry"===a.geometry.type||"EllipseGeometry"===a.geometry.type||"TriangleGeometry"===a.geometry.type||"TorusGeometry"===a.geometry.type||"HelixGeometry"===a.geometry.type);try{this.addCollider(c,a.physics,d,e,p)}catch{try{this.addCollider(c,a.physics,d,e,!1)}catch(t){console.error(t)}}if(0===c.numColliders())return void this.sharedGameControlGlobals.rapierWorld.removeRigidBody(c);h?this.rigidBodyToMesh.set(c.handle,[t,gt.clone(),a.physics.fusedBody]):r?(this.sharedGameControlGlobals.kinematicBodyToEntity.set(c.handle,t),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(t)):this.fixedBodiesToWatch.push([t,c,(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).clone()]),t.rigidBody=c}}addBoundsTree(e){let i=[];if(void 0!==e.geometry?.getAttribute("position")&&e.geometry?.getAttribute("position").count>0&&i.push(ct(e.geometry,e.shearScale)),e.traverseObject(this.gatherChildrenGeom(e,i)),e.children.forEach(t=>t.updateMatrixWorld(!0)),i.length>0){let s=l(i,!1);e.bvhGeometry=s,s.getAttribute("position").count>0&&(e.bvhGeometry.boundsTree=new(t())(s),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e))}}addCollider(t,e,i,s,o=!0){if(0===i?.getAttribute("position").count||0===i?.getIndex()?.count)return;let a;i&&(a="trimesh"===e.colliderType?pt.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array):pt.ColliderDesc.convexMesh(i.getAttribute("position").array,o?i.getIndex().array:void 0)),a.setFrictionCombineRule(pt.CoefficientCombineRule.Average).setRestitutionCombineRule(pt.CoefficientCombineRule.Average).setDensity(e.density).setFriction(e.friction).setRestitution(e.restitution);let n=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t);this.sharedGameControlGlobals.colliderToEntity.set(n.handle,s),this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]?.some(t=>"scene"===t.target)&&n.setActiveEvents(pt.ActiveEvents.COLLISION_EVENTS)}gatherChildrenGeom(t,e){let i=Bt(t);return(s,o)=>{if(0===o)return;if(i&&s.parent===t)return!0;let a;if(v(s)){if(!s.objectForSample)return!0===s.object.dataPatched.physics.fusedBody&&"dynamic"===s.object.dataPatched.physics.rigidBody||void 0;if(s.objectForSample.dataPatched.physics.fusedBody)return;a=s.object}else if(g(s))a=s.object;else if(a=s,a.dataPatched.cloner?.hideBase)return!0;let n=a.dataPatched;if("visibility"===n.physics.enabled?!n.visible:!n.physics.enabled)return!0;1===o?t.hasNonUniformScale?s.matrixWorld.multiplyMatrices(t.shearScale,s.hiddenMatrix):s.matrixWorld.copy(s.hiddenMatrix):s.matrixWorld.multiplyMatrices(s.parent.matrixWorld,s.hiddenMatrix),s.matrixWorld.multiply(s.matrix);let r=s.geometry;return void 0!==r?.getAttribute("position")&&e.push(ct(r,s.matrixWorld)),!!Bt(s)||void 0}}activate(t){if(this.isEnabled)return;this.isEnabled=!0,this.eventManager=t,this.usePhysics=this.page.data.globalPhysics.usePhysics;let e=this.page.playCamera,i=!1;this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if(!1===e.data.disabled&&"Trigger"===e.data.type)return this.needsCollisionDetection=!0,!0});let s=I();if(null!==s?i=s.setup({manager:this,camera:e,renderer:this.renderer,sharedAssets:this.sharedAssets,eventContext:this.eventContext,isExport:this.isExport})||i:null!==this.page.data.publish.gameControlObject&&b("game-controls","the scene's game controls"),!1===i){let{enableRotate:t,enablePan:i,enableZoom:s,autoRotate:o,hoverRotatePanMode:a}=this.eventManager.publish.orbitControls;(t||i||s||o||0!==a)&&(this.orbitControls=new st(e,this.renderer.domElement,{isExport:this.isExport,isPlayMode:!0}),this.orbitControls.addEventListener("change",this.requestRender),this.orbitControls.addEventListener("end",this.requestRender),this.orbitControls.addEventListener("start",this.requestRender),this.orbitControls.fromJSON(this.eventManager.publish.orbitControls,this.eventManager.publish.mouseEventTarget),this.orbitControls.useKeyEvents=!1,this.orbitControls.addEventListenersToCamera(),this.orbitControls.connect(),this.orbitControls.update())}let o=this.renderer.domElement.width/this.renderer.getPixelRatio(),a=this.renderer.domElement.height/this.renderer.getPixelRatio();I()?.createJoysticks(this,o,a),this.markIsDestroyTarget(),this.markIsDragObject(),this.rebuildBVH(),this.initializationCounter++,window.setTimeout(()=>{this.collisionEvents.forEach(t=>t.initialDisabled=!1)},80)}initPhysics(){this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=new pt.World(new pt.Vector3(0,this.gravity,0)),this.events=new pt.EventQueue(!0);let t=[],e=[];if(this.page.traverseChildren(i=>{let s;if(v(i)){if(!i.objectForSample)return!0===i.object.dataPatched.physics.fusedBody&&"dynamic"===i.object.dataPatched.physics.rigidBody||void 0;if(i.objectForSample.dataPatched.physics.fusedBody)return;s=i.object}else if(g(i))s=i.object;else{if(m(i)||u(i)||i instanceof r)return;if(s=i,!1===s.dataPatched.cloner?.disabled&&s.dataPatched.cloner?.hideBase&&!0!==s.dataPatched.physics?.fusedBody)return!0}let o,a=s.dataPatched;for(let t of a.events)!0!==t.data.disabled&&"GameControl"===t.data.type&&(o=t.data);if(!a.physics||("visibility"===a.physics.enabled?!a.visible:!a.physics.enabled))return!0;i.updateMatrixWorldRigid();let n=Lt(a),h=!1,l=s.userData.hasDestroy,d=s.userData.hasDrag,c=!1;for(let t of a.events)if(!0!==t.data.disabled)if("Collision"===t.data.type){h=!0;let e=new mt(t.id,t.data,s,this.page,this.sharedAssets,this.eventManager);e.initialDisabled=!0,this.collisionEvents.push(e),this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]&&this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid].every(e=>e.id!==t.id)?this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid].push(e):this.sharedGameControlGlobals.entityToCollisionEvents[s.uuid]=[e]}else if("Follow"===t.data.type){c=!0;let e=t.data.target;i.traverseVisible(t=>{t.userData.isFollowingObj=e})}"dynamic"===a.physics.rigidBody&&!1===a.physics.fusedBody&&(i.matrixWorldFusedFalse=i.matrixWorld.clone());let p=i.geometry;if(void 0!==o){let t=pt.RigidBodyDesc.kinematicPositionBased();(i.hasNonUniformScale?i.matrixWorldRigid:i.matrixWorld).decompose(yt,vt,gt),i.position0=yt.clone().divideScalar(this.pixelsPerMeter),i.rotation0=vt.clone(),yt.divideScalar(this.pixelsPerMeter),t.setTranslation(yt.x,yt.y,yt.z).setRotation(vt);let e,n=this.sharedGameControlGlobals.rapierWorld.createRigidBody(t);i.rigidBody=n,e="sphere"===o.collider.type?pt.ColliderDesc.ball(o.collider.radius/this.pixelsPerMeter):"capsule"===o.collider.type?pt.ColliderDesc.capsule((o.collider.height/2-o.collider.radius)/this.pixelsPerMeter,o.collider.radius/this.pixelsPerMeter):pt.ColliderDesc.cuboid(o.collider.width/this.pixelsPerMeter/2,o.collider.height/this.pixelsPerMeter/2,o.collider.depth/this.pixelsPerMeter/2),e.setFrictionCombineRule(pt.CoefficientCombineRule.Average).setDensity(a.physics.density).setFriction(a.physics.friction).setRestitution(0).setRestitutionCombineRule(pt.CoefficientCombineRule.Min);let r=this.sharedGameControlGlobals.rapierWorld.createCollider(e,n);this.sharedGameControlGlobals.colliderToEntity.set(r.handle,s),yt.fromArray(o.collider.position.map(t=>"number"==typeof t?t:0)).multiply(gt.setFromMatrixScale(s.matrixWorld)).divideScalar(this.pixelsPerMeter),r.setTranslationWrtParent(yt);let h=(new M).setFromEuler((new D).setFromVector3((new x).fromArray(o.collider.rotation.map(t=>"number"==typeof t?t:0))));r.setRotationWrtParent(h),r.setActiveEvents(pt.ActiveEvents.COLLISION_EVENTS),this.generateSensorColliderDescs(s,!0)}else"dynamic"===a.physics.rigidBody||n||c||l||d||h?(this.addRigidBody(i,s,{hasFollow:c,hasTransformAnim:n,hasDrag:d}),this.generateSensorColliderDescs(s,a.physics.fusedBody)):(p&&t.push(ct(p,i.matrixWorld)),a.physics.fusedBody&&!Bt(i)&&i.traverseObject((e,i)=>{if(0===i)return;let s;if(v(e)){if(!e.objectForSample)return!0===e.object.dataPatched.physics.fusedBody&&"dynamic"===e.object.dataPatched.physics.rigidBody||void 0;if(e.objectForSample.dataPatched.physics.fusedBody)return;s=e.object}else{if(m(e)||u(e)||e instanceof r)return;if(g(e))s=e.object;else if(s=e,s.dataPatched.cloner?.hideBase)return!0}let o=s.dataPatched;if("visibility"===o.physics.enabled?!o.visible:!o.physics.enabled)return!0;let a=e.geometry;return void 0!==a?.getAttribute("position")&&t.push(ct(a,e.matrixWorld)),!!Bt(e)||void 0}),this.generateSensorColliderDescs(s,a.physics.fusedBody,e));return!(!0!==a.physics?.fusedBody&&!o&&!Bt(i))||void 0}),0===t.length)return;let i=l(t),s=i.getIndex().count>0;if(!s&&0===e.length)return;i.scale(1/this.pixelsPerMeter,1/this.pixelsPerMeter,1/this.pixelsPerMeter);let o=pt.RigidBodyDesc.fixed(),a=this.sharedGameControlGlobals.rapierWorld.createRigidBody(o);if(s){let t=pt.ColliderDesc.trimesh(i.getAttribute("position").array,i.getIndex().array).setFrictionCombineRule(pt.CoefficientCombineRule.Multiply).setRestitutionCombineRule(pt.CoefficientCombineRule.Multiply).setFriction(1).setRestitution(1);this.sharedGameControlGlobals.rapierWorld.createCollider(t,a)}for(let[t,i]of e){let e=this.sharedGameControlGlobals.rapierWorld.createCollider(t,a);this.sensorToTriggerEvent[e.handle]=i}}updatePositions(){return this.nActiveRigidBodies=0,this.sharedGameControlGlobals.rapierWorld.forEachRigidBody(this.processRigidBody),this.nActiveRigidBodies>0}rebuildBVH(){this.usePhysics?this.initPhysics():(this.page.traverseEntity(t=>{for(let e of t.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let i=new ut(e.id,e.data,t,this.page,this.sharedAssets,this.eventManager),s=(new T).compose(bt.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),Ct.setFromEuler(ft.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Pt);if("box"===e.data.triggerZone){let o=new R;o.min.fromArray(e.data.size.map(t=>"number"==typeof t?t:0)).multiplyScalar(-.5),o.max.fromArray(e.data.size.map(t=>"number"==typeof t?t:0)).multiplyScalar(.5),this.sharedGameControlGlobals.triggers.push([o,s,t,i])}else this.sharedGameControlGlobals.triggers.push([e.data.radius,s,t,i])}}),this.needsCollisionDetection&&this.initBVH())}disconnectEvents(){this.collisionEvents.forEach(t=>t.disconnect()),this.sharedGameControlGlobals.triggers.forEach(t=>t[3].disconnect()),this.sharedGameControlGlobals.triggers.length=0}deactivate(){if(this.isEnabled){this.isEnabled=!1,this.page.traverse(t=>{let e=t;e.matrixWorldFusedFalse&&(e.matrixWorldFusedFalse=void 0),e.rigidBody&&(e.rigidBody=void 0),e.position0&&(e.position0=void 0),e.rotation0&&(e.rotation0=void 0)}),this.sharedGameControlGlobals.rapierWorld?.free(),this.sharedGameControlGlobals.rapierWorld=void 0,this.sharedGameControlGlobals.staticMeshBVH=void 0,this.accumulator=0,this.sharedGameControlGlobals.entitiesWithTransformAnim=[],this.sharedGameControlGlobals.kinematicBodyToEntity.clear(),this.fixedBodiesToWatch=[],this.disconnectEvents(),this.gameControl?.reset(),this.gameControl?.dispose(),this.gameControl=null,this.initializationCounter=-1,this.joysticks.forEach(([t,e])=>{t?.destroy(),e.remove()}),this.joystickToGameControls=[],this.joysticks=[],this.orbitControls&&(this.orbitControls.dispose(),this.orbitControls=void 0),this.navigationMeshWrapper?.dispose(),this.navigationMeshWrapper=void 0;for(let t of Object.values(this.sharedGameControlGlobals.entityToCollisionEvents))t.forEach(t=>t.disconnect());this.sharedGameControlGlobals.entityToCollisionEvents={},this.page.updateMatrixWorld(!0)}}update(t){if(!this.isEnabled)return!0;let e=!0;if(void 0!==this.orbitControls&&this.orbitControls.needsUpdate&&(this.orbitControls.update(),e=!this.orbitControls.isCurrentlyDamping),this.initializationCounter>=0&&this.initializationCounter<2?(this.initializationCounter++,e=!1):2===this.initializationCounter&&this.gameControl&&(e=!this.gameControl.update(t)&&e),!1===this.usePhysics&&this.checkTrigger(),this.usePhysics){let i=.016666666666666666;if(0===t)e=this.stepPhysics()&&e;else{let s=t/1e3;s<i&&s>.55*i&&(s=i),this.accumulator+=s;let o=performance.now(),a=0,n=6;for(;this.accumulator>=i&&a<n&&(e=this.stepPhysics()&&e,this.accumulator-=i,a++,!(performance.now()-o>1e3*i)););this.accumulator=this.accumulator%i}}this.skipRender=e}recordPhysicsPose(t){(t.hasNonUniformScale?t.matrixWorldRigid:t.matrixWorld).decompose(yt,vt,gt);let e=t;void 0===e.prevQ?(e.prevQ=vt.clone(),e.prevT=yt.clone()):(e.prevQ.copy(vt),e.prevT.copy(yt))}promoteMovedFixedBodies(){for(let t=this.fixedBodiesToWatch.length-1;t>=0;t--){let[e,i,s]=this.fixedBodiesToWatch[t];(e.hasNonUniformScale?e.matrixWorldRigid:e.matrixWorld).equals(s)||(i.setBodyType(pt.RigidBodyType.KinematicPositionBased,!0),this.sharedGameControlGlobals.kinematicBodyToEntity.set(i.handle,e),this.sharedGameControlGlobals.entitiesWithTransformAnim.push(e),this.fixedBodiesToWatch.splice(t,1))}}clampPushedBodies(){let t=this.gameControl?.object.rigidBody;if(void 0===t)return;let e=this.sharedGameControlGlobals.rapierWorld,i=t.linvel(),s=t.translation(),o=Math.hypot(i.x,i.z);for(let a=0;a<t.numColliders();a++){let n=t.collider(a);e.contactPairsWith(n,t=>{let a=t.parent();if(null===a||!a.isDynamic())return;let r=a.translation(),h=-1/0,l=0,d=0;if(e.contactPair(n,t,t=>{let e=t.normal(),o=e.x*(r.x-s.x)+e.y*(r.y-s.y)+e.z*(r.z-s.z)<0?-1:1;if(Math.abs(e.y)>.7)return;let a=o*e.x,n=o*e.z,c=Math.hypot(a,n);if(c<1e-4)return;let p=(i.x*a+i.z*n)/c;p>h&&(h=p,l=a/c,d=n/c)}),h===-1/0)return;let c=i.x*l+i.z*d;if(c<-wt)return;let p=a.linvel();if(o>wt&&c>wt){let t=p.x*l+p.z*d;if(t<=0)return;let e=Math.min(t,c);return void a.setLinvel({x:l*e,y:p.y,z:d*e},!0)}let m=p.x*l+p.z*d-Math.max(0,c);if(m<=0)return;let u=.5*m;a.setLinvel({x:p.x-l*u,y:p.y,z:p.z-d*u},!0)})}}stepPhysics(){this.promoteMovedFixedBodies();for(let t of this.sharedGameControlGlobals.kinematicBodyToEntity.values())this.recordPhysicsPose(t),t.rigidBody.setNextKinematicTranslation(yt.divideScalar(this.pixelsPerMeter)),t.rigidBody.setNextKinematicRotation(vt);for(let t of this.sharedGameControlGlobals.entitiesWithTransformAnim)!0!==t.rigidBody?.isKinematic()&&this.recordPhysicsPose(t);return this.sharedGameControlGlobals.rapierWorld.step(this.events),this.clampPushedBodies(),this.events?.drainCollisionEvents(this.handleCollisionEvents),!this.updatePositions()}dispatchCollisionEvent(t,e,i){let s,o=(this.sharedGameControlGlobals.rapierWorld?.getCollider(i))._parent;if(e.cloner)for(let t of e.cloner.children)if(t.rigidBody===o){s=t;break}t.dispatch(s),e.dispatchEvent(Rt)}updateUseWindowEvents(t){this.orbitControls?.updateUseWindowEvents(t)}generateSensorColliderDescs(t,e,i){let s=xt.copy(t.matrixWorld).invert();t.traverseEntity((o,a)=>{if(!1===e&&1===a)return!0;for(let e of o.dataPatched.events)if("Trigger"===e.data.type&&!0!==e.data.disabled){let a,n=new ut(e.id,e.data,o,this.page,this.sharedAssets,this.eventManager);if(a="box"===e.data.triggerZone?pt.ColliderDesc.cuboid(...e.data.size.map(t=>("number"==typeof t?t:1)/(2*this.pixelsPerMeter))):pt.ColliderDesc.ball(e.data.radius/this.pixelsPerMeter),a.setDensity(0).setSensor(!0).setActiveEvents(pt.ActiveEvents.COLLISION_EVENTS),bt.fromArray(e.data.position.map(t=>"number"==typeof t?t:0)),Ct.setFromEuler(ft.fromArray(e.data.rotation.map(t=>"number"==typeof t?t:0))),Mt.compose(bt,Ct,Pt).premultiply(o.matrixWorld),i?(Mt.decompose(bt,Ct,Et),a.setActiveCollisionTypes(pt.ActiveCollisionTypes.KINEMATIC_FIXED|pt.ActiveCollisionTypes.DYNAMIC_FIXED)):(Mt.premultiply(s).decompose(bt,Ct,Et),t.rigidBody.bodyType()===pt.RigidBodyType.Dynamic||(t.rigidBody.bodyType()===pt.RigidBodyType.Fixed?a.setActiveCollisionTypes(pt.ActiveCollisionTypes.KINEMATIC_FIXED|pt.ActiveCollisionTypes.DYNAMIC_FIXED):a.setActiveCollisionTypes(pt.ActiveCollisionTypes.KINEMATIC_KINEMATIC|pt.ActiveCollisionTypes.DYNAMIC_KINEMATIC))),bt.divideScalar(this.pixelsPerMeter),a.setTranslation(bt.x,bt.y,bt.z),a.setRotation(Ct),i)i.push([a,n]);else{let e=this.sharedGameControlGlobals.rapierWorld.createCollider(a,t.rigidBody);this.sensorToTriggerEvent[e.handle]=n}}})}checkTrigger(){let t;for(let e=0;e<this.sharedGameControlGlobals.triggers.length;e++){let[i,s,o,a]=this.sharedGameControlGlobals.triggers[e];for(let e=0;e<this.sharedGameControlGlobals.entitiesWithTransformAnim.length;e++){let n=this.sharedGameControlGlobals.entitiesWithTransformAnim[e];if(o===n||!1===a.isValidTriggeringObject(p.is(n)?n:n.object))continue;let r=xt.copy(o.matrixWorld).decompose(bt,St,Et).compose(bt,St,Pt).multiply(s),h=Mt.copy(n.matrixWorld).invert().multiply(r),l=n.bvhGeometry.boundsTree;i instanceof R?t=l.intersectsBox(i,h):(Dt.radius=i,Dt.center.setFromMatrixPosition(h),t=l.intersectsSphere(Dt)),t?-1===a.currentIntersectedObjects.indexOf(n)&&(a.currentIntersectedObjects.push(n),a.dispatch(),o.dispatchEvent(jt)):a.currentIntersectedObjects=a.currentIntersectedObjects.filter(t=>t!==n)}}}},Ft=new Promise(t=>{At=t});function kt(t){return Ot||(Ot=async function(){let e=t??"https://cdn.spline.design/@splinetool/runtime@2.0.9/build";typeof window<"u"&&(Wt=new URL(e.endsWith("/")?e:`${e}/`,window.location.href).href);let i=import("./navmesh.js"),[s,o]=await Promise.all([i,fetch(`${e}/navmesh.wasm`).then(t=>t.arrayBuffer())]),a=s.default,n=await a({wasmBinary:o});At(n)}())}export{st as a,lt as b,A as c,O as d,F as e,ct as f,Rt as g,Gt as h,Lt as i,It as j,Ft as k,Wt as l,kt as m};
@@ -1 +1 @@
1
- import{a as e,b as t}from"./runtime-chunk-EJJZJ5MV.js";import{c as s,d as o}from"./runtime-chunk-AELTGHV2.js";import{da as r}from"./runtime-chunk-DK66VKWP.js";import{h as i,o as a,p as n,q as d,r as h,s as l,t as m,v as p}from"./runtime-chunk-CKT62HES.js";import{i as u}from"./runtime-chunk-2PT2WH66.js";import{Oc as c,bd as y,dd as g,ue as f}from"./runtime-chunk-VGN7YHB7.js";var b=new c,A=new c,M=new c,S=new c,v=new c;function w(e){let t=!1;return e.scene.objects.traverse((e,s)=>{"BooleanGeometry"===s.geometry?.type&&(t=!0)}),t}function x(e,t){let s=e.cloner;return void 0!==s&&s.parent===t?s:void 0}var D=new Float32Array(0);function B(e,t,s,o){let r=16*(t.children.length+1);D.length<r&&(D=new Float32Array(r));let i=0,a=e=>{e.toArray(D,16*i),i++},n=!0!==t.parameters.hideBase;n&&a(o),M.multiplyMatrices(e.hiddenMatrix,e.matrix);for(let e of t.children)!u(e)||!1===e.playModeVisible||(S.multiplyMatrices(e.hiddenMatrix,e.matrix).multiply(e.pivotMatrix),v.multiplyMatrices(M,S),(!n||!v.equals(o))&&a(v));try{return 0===i?0:m(s,D.subarray(0,16*i))}finally{l(s)}}var O,P=class extends r{constructor(e,t,s){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new g,this.onAfterRender=(e,t,s,o,r,i)=>{super.onAfterRender(e,t,s,o,r,i),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,t,s){super.updateByPatchedOp(e,t,s),1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&void 0!==e.props.operation&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(s,o=!0){if(-1!==this.booleanMeshSetAddress&&!s)return;for(let e=0;e<this.children.length;e++){let t=this.children[e];t instanceof P&&!0===t.dataPatched.visible&&t.recomputeBoolean(!0===s,o)}this.meshSetAddresses=[];for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t instanceof p&&!0===t.dataPatched.visible&&t.geometry.attributes.position?.count>0&&t.geometry.drawRange.count>0&&0!==t.booleanMeshSetAddress){b.multiplyMatrices(t.hiddenMatrix,t.matrix).multiply(t.pivotMatrix);try{let e=x(t,this);if(-1===t.booleanMeshSetAddress){if((t.geometry.index??t.geometry.getAttribute("position")).count/3<15e5){let r=a(t.geometry,!0===s,o);t.booleanMeshSetAddress=void 0===e||-1===r?r:B(t,e,r,b)}if(-1===t.booleanMeshSetAddress)return;void 0===e&&h(t.booleanMeshSetAddress,b),t.booleanMatrixInvOld.copy(b).invert(),t.booleanWasTransformed=!1}else t instanceof P&&!0===t.needsTransformForDownstream?(void 0===e?h(t.booleanMeshSetAddress,b):t.booleanMeshSetAddress=B(t,e,t.booleanMeshSetAddress,b),t.needsTransformForDownstream=!1):!0===t.booleanWasTransformed&&(h(t.booleanMeshSetAddress,A.multiplyMatrices(b,t.booleanMatrixInvOld)),t.booleanMatrixInvOld.copy(b).invert(),t.booleanWasTransformed=!1)}catch(e){console.error(e),t.booleanMeshSetAddress=0,t.geometry.userData.booleanOperationDidFail=!0;continue}if(0===t.booleanMeshSetAddress)continue;this.meshSetAddresses.push(t.booleanMeshSetAddress),t.geometry.userData.booleanOperationDidFail=!1}}if(0===this.meshSetAddresses.length){if(0!==this.geometry.getAttribute("position")?.array.length){let e=this.geometry;e.dispose(),this.geometry=new g,this.geometry.userData=e.userData,this.geometry.boundingSphere=e.boundingSphere,this.geometry.setAttribute("position",new y([],3))}return void this.geometry.setDrawRange(0,0)}if(!0===s)return d(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new g,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=n(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(e){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(e)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,e(this),t(this)}dispose(){super.dispose(),this.geometry.dispose()}};(O||(O={})).is=function(e){return i.is(e)&&e instanceof f};var T=(e,t)=>class extends(o(e,t)){updateState_Light(e,t){if(this.updateState_Entity(e,t),void 0!==e.color&&(this.color=t.shared.color(e.color)),void 0!==e.intensity&&(this.intensity=e.intensity*Math.PI),void 0!==e.depth){let t=this.shadow;t.camera.far=e.depth,t.needsUpdate=!0}void 0!==e.shadows&&(this.castShadow=e.shadows)}},F=e=>e instanceof p,j=e=>null!==e&&e instanceof P,k=e=>s.is(e);export{w as a,P as b,O as c,T as d,F as e,j as f,k as g};
1
+ import{a as e,b as t}from"./runtime-chunk-YANJNJO2.js";import{c as s,d as o}from"./runtime-chunk-FJZAL2GU.js";import{da as r}from"./runtime-chunk-3D6ELLRB.js";import{h as i,o as a,p as n,q as d,r as h,s as l,t as m,v as p}from"./runtime-chunk-R3V4RB3X.js";import{i as u}from"./runtime-chunk-2PT2WH66.js";import{Oc as c,bd as y,dd as g,ue as f}from"./runtime-chunk-VGN7YHB7.js";var b=new c,A=new c,M=new c,v=new c,S=new c;function w(e){let t=!1;return e.scene.objects.traverse((e,s)=>{"BooleanGeometry"===s.geometry?.type&&(t=!0)}),t}function x(e,t){let s=e.cloner;return void 0!==s&&s.parent===t?s:void 0}var D=new Float32Array(0);function B(e,t,s,o){let r=16*(t.children.length+1);D.length<r&&(D=new Float32Array(r));let i=0,a=e=>{e.toArray(D,16*i),i++},n=!0!==t.parameters.hideBase;n&&a(o),M.multiplyMatrices(e.hiddenMatrix,e.matrix);for(let e of t.children)!u(e)||!1===e.playModeVisible||(v.multiplyMatrices(e.hiddenMatrix,e.matrix).multiply(e.pivotMatrix),S.multiplyMatrices(M,v),(!n||!S.equals(o))&&a(S));try{return 0===i?0:m(s,D.subarray(0,16*i))}finally{l(s)}}var O,F=class extends r{constructor(e,t,s){super(e,t),this.data=t,this.meshSetAddresses=[],this.needsTransformForDownstream=!1,this.geometry=new g,this.onAfterRender=(e,t,s,o,r,i)=>{super.onAfterRender(e,t,s,o,r,i),this.recomputeBoolean()},this.geometry.userData.parameters={width:0,height:0,depth:0}}get booleanOp(){return this.data.geometry.operation}get phongAngle(){return this.data.geometry.phongAngle??45}get isLOD(){return this.recomputeBoolean(),!1}updateByPatchedOp(e,t,s){super.updateByPatchedOp(e,t,s),1===e.path.length&&"geometry"===e.path[0]&&0===e.type&&void 0!==e.props.operation&&(this.freeBooleanPointer(),this.resetBBoxNeedsUpdate())}freeBooleanPointer(){super.freeBooleanPointer(),this.geometry.dispose()}recomputeBoolean(s,o=!0){if(-1!==this.booleanMeshSetAddress&&!s)return;for(let e=0;e<this.children.length;e++){let t=this.children[e];t instanceof F&&!0===t.dataPatched.visible&&t.recomputeBoolean(!0===s,o)}this.meshSetAddresses=[];for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t instanceof p&&!0===t.dataPatched.visible&&t.geometry.attributes.position?.count>0&&t.geometry.drawRange.count>0&&0!==t.booleanMeshSetAddress){b.multiplyMatrices(t.hiddenMatrix,t.matrix).multiply(t.pivotMatrix);try{let e=x(t,this);if(-1===t.booleanMeshSetAddress){if((t.geometry.index??t.geometry.getAttribute("position")).count/3<15e5){let r=a(t.geometry,!0===s,o);t.booleanMeshSetAddress=void 0===e||-1===r?r:B(t,e,r,b)}if(-1===t.booleanMeshSetAddress)return;void 0===e&&h(t.booleanMeshSetAddress,b),t.booleanMatrixInvOld.copy(b).invert(),t.booleanWasTransformed=!1}else t instanceof F&&!0===t.needsTransformForDownstream?(void 0===e?h(t.booleanMeshSetAddress,b):t.booleanMeshSetAddress=B(t,e,t.booleanMeshSetAddress,b),t.needsTransformForDownstream=!1):!0===t.booleanWasTransformed&&(h(t.booleanMeshSetAddress,A.multiplyMatrices(b,t.booleanMatrixInvOld)),t.booleanMatrixInvOld.copy(b).invert(),t.booleanWasTransformed=!1)}catch(e){console.error(e),t.booleanMeshSetAddress=0,t.geometry.userData.booleanOperationDidFail=!0;continue}if(0===t.booleanMeshSetAddress)continue;this.meshSetAddresses.push(t.booleanMeshSetAddress),t.geometry.userData.booleanOperationDidFail=!1}}if(0===this.meshSetAddresses.length){if(0!==this.geometry.getAttribute("position")?.array.length){let e=this.geometry;e.dispose(),this.geometry=new g,this.geometry.userData=e.userData,this.geometry.boundingSphere=e.boundingSphere,this.geometry.setAttribute("position",new y([],3))}return void this.geometry.setDrawRange(0,0)}if(!0===s)return d(this.meshSetAddresses,this.booleanOp);let r=this.geometry;r.dispose(),this.geometry=new g,this.geometry.userData=r.userData,this.geometry.boundingSphere=r.boundingSphere;try{this.booleanMeshSetAddress=n(this.meshSetAddresses,this.booleanOp,this.geometry,this.phongAngle)}catch(e){this.booleanMeshSetAddress=0,this.geometry.userData.booleanOperationDidFail=!0,console.error(e)}this.booleanMatrixInvOld.copy(this.matrix).invert(),this.needsTransformForDownstream=!0,e(this),t(this)}dispose(){super.dispose(),this.geometry.dispose()}};(O||(O={})).is=function(e){return i.is(e)&&e instanceof f};var P=(e,t)=>class extends(o(e,t)){updateState_Light(e,t){if(this.updateState_Entity(e,t),void 0!==e.color&&(this.color=t.shared.color(e.color)),void 0!==e.intensity&&(this.intensity=e.intensity*Math.PI),void 0!==e.depth){let t=this.shadow;t.camera.far=e.depth,t.needsUpdate=!0}void 0!==e.shadows&&(this.castShadow=e.shadows)}},T=e=>e instanceof p,j=e=>null!==e&&e instanceof F,R=e=>s.is(e);export{w as a,F as b,O as c,P as d,T as e,j as f,R as g};