@splinetool/runtime 2.0.9 → 2.0.10

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 (280) hide show
  1. package/build/hana-ui.js +73 -43
  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-ZTHLLGVX.js → runtime-chunk-4LKRNVPP.js} +1 -1
  8. package/build/{runtime-chunk-ZTHLLGVX.js.br → runtime-chunk-4LKRNVPP.js.br} +0 -0
  9. package/build/runtime-chunk-4LKRNVPP.js.gz +0 -0
  10. package/build/{runtime-chunk-3D6ELLRB.js → runtime-chunk-7FDJ7IIR.js} +1 -1
  11. package/build/runtime-chunk-7FDJ7IIR.js.br +0 -0
  12. package/build/runtime-chunk-7FDJ7IIR.js.gz +0 -0
  13. package/build/{runtime-chunk-5RKK7JBF.js → runtime-chunk-BLFFIB2B.js} +1 -1
  14. package/build/runtime-chunk-BLFFIB2B.js.br +0 -0
  15. package/build/runtime-chunk-BLFFIB2B.js.gz +0 -0
  16. package/build/{runtime-chunk-U7JVP2TI.js → runtime-chunk-CDR3AZNB.js} +1 -1
  17. package/build/runtime-chunk-CDR3AZNB.js.br +0 -0
  18. package/build/runtime-chunk-CDR3AZNB.js.gz +0 -0
  19. package/build/{runtime-chunk-CUH4PXNR.js → runtime-chunk-CDYE22J6.js} +1 -1
  20. package/build/runtime-chunk-CDYE22J6.js.br +0 -0
  21. package/build/runtime-chunk-CDYE22J6.js.gz +0 -0
  22. package/build/runtime-chunk-DZIH7EMN.js +1 -0
  23. package/build/runtime-chunk-DZIH7EMN.js.br +0 -0
  24. package/build/runtime-chunk-DZIH7EMN.js.gz +0 -0
  25. package/build/{runtime-chunk-SOL2NZB4.js → runtime-chunk-FN2C54JM.js} +1 -1
  26. package/build/runtime-chunk-FN2C54JM.js.br +0 -0
  27. package/build/runtime-chunk-FN2C54JM.js.gz +0 -0
  28. package/build/runtime-chunk-I6B5A36U.js +1 -0
  29. package/build/runtime-chunk-I6B5A36U.js.br +0 -0
  30. package/build/runtime-chunk-I6B5A36U.js.gz +0 -0
  31. package/build/{runtime-chunk-KRQKRJPD.js → runtime-chunk-JSRKKIOS.js} +1 -1
  32. package/build/runtime-chunk-JSRKKIOS.js.br +0 -0
  33. package/build/runtime-chunk-JSRKKIOS.js.gz +0 -0
  34. package/build/{runtime-chunk-LVFNCYIC.js → runtime-chunk-KKDM5MC5.js} +1 -1
  35. package/build/runtime-chunk-KKDM5MC5.js.br +0 -0
  36. package/build/runtime-chunk-KKDM5MC5.js.gz +0 -0
  37. package/build/{runtime-chunk-YNTJMLA5.js → runtime-chunk-L2C7JGYG.js} +1 -1
  38. package/build/runtime-chunk-L2C7JGYG.js.br +0 -0
  39. package/build/runtime-chunk-L2C7JGYG.js.gz +0 -0
  40. package/build/{runtime-chunk-RYIFGI7L.js → runtime-chunk-LQL2PJVX.js} +1 -1
  41. package/build/runtime-chunk-LQL2PJVX.js.br +0 -0
  42. package/build/runtime-chunk-LQL2PJVX.js.gz +0 -0
  43. package/build/{runtime-chunk-YANJNJO2.js → runtime-chunk-M4BPCY7K.js} +1 -1
  44. package/build/runtime-chunk-M4BPCY7K.js.br +0 -0
  45. package/build/runtime-chunk-M4BPCY7K.js.gz +0 -0
  46. package/build/{runtime-chunk-R3V4RB3X.js → runtime-chunk-MOZWC42D.js} +1 -1
  47. package/build/runtime-chunk-MOZWC42D.js.br +0 -0
  48. package/build/runtime-chunk-MOZWC42D.js.gz +0 -0
  49. package/build/{runtime-chunk-EPFYNTQQ.js → runtime-chunk-MVJAFW5H.js} +1 -1
  50. package/build/runtime-chunk-MVJAFW5H.js.br +1 -0
  51. package/build/runtime-chunk-MVJAFW5H.js.gz +0 -0
  52. package/build/{runtime-chunk-CXBK7LPG.js → runtime-chunk-QSJVWNNM.js} +1 -1
  53. package/build/runtime-chunk-QSJVWNNM.js.br +0 -0
  54. package/build/runtime-chunk-QSJVWNNM.js.gz +0 -0
  55. package/build/{runtime-chunk-VJPN4EM6.js → runtime-chunk-RTRWO43P.js} +1 -1
  56. package/build/runtime-chunk-RTRWO43P.js.br +0 -0
  57. package/build/runtime-chunk-RTRWO43P.js.gz +0 -0
  58. package/build/{runtime-chunk-UFFTT5MI.js → runtime-chunk-RX3SW5K2.js} +1 -1
  59. package/build/runtime-chunk-RX3SW5K2.js.br +0 -0
  60. package/build/runtime-chunk-RX3SW5K2.js.gz +0 -0
  61. package/build/{runtime-chunk-4FRVTTCF.js → runtime-chunk-UHCXLQHA.js} +1 -1
  62. package/build/runtime-chunk-UHCXLQHA.js.br +0 -0
  63. package/build/runtime-chunk-UHCXLQHA.js.gz +0 -0
  64. package/build/{runtime-chunk-FJZAL2GU.js → runtime-chunk-VNO2DW74.js} +1 -1
  65. package/build/runtime-chunk-VNO2DW74.js.br +0 -0
  66. package/build/runtime-chunk-VNO2DW74.js.gz +0 -0
  67. package/build/{runtime-chunk-WFTAZCXD.js → runtime-chunk-WQ2NXI3U.js} +1 -1
  68. package/build/runtime-chunk-WQ2NXI3U.js.br +0 -0
  69. package/build/runtime-chunk-WQ2NXI3U.js.gz +0 -0
  70. package/build/{runtime-chunk-KJLTN6RE.js → runtime-chunk-YO3XFDZF.js} +1 -1
  71. package/build/runtime-chunk-YO3XFDZF.js.br +0 -0
  72. package/build/runtime-chunk-YO3XFDZF.js.gz +0 -0
  73. package/build/{runtime-chunk-44F5FA4N.js → runtime-chunk-YS7K3AW3.js} +1 -1
  74. package/build/runtime-chunk-YS7K3AW3.js.br +0 -0
  75. package/build/runtime-chunk-YS7K3AW3.js.gz +0 -0
  76. package/build/{runtime-chunk-33KX2TOT.js → runtime-chunk-ZASM3KKC.js} +1 -1
  77. package/build/runtime-chunk-ZASM3KKC.js.br +0 -0
  78. package/build/runtime-chunk-ZASM3KKC.js.gz +0 -0
  79. package/build/{runtime-chunk-ROGQC3YL.js → runtime-chunk-ZLOMOV3N.js} +1 -1
  80. package/build/runtime-chunk-ZLOMOV3N.js.br +0 -0
  81. package/build/runtime-chunk-ZLOMOV3N.js.gz +0 -0
  82. package/build/{runtime-chunk-5MDYMRYM.js → runtime-chunk-ZM7N5SZG.js} +1 -1
  83. package/build/runtime-chunk-ZM7N5SZG.js.br +0 -0
  84. package/build/runtime-chunk-ZM7N5SZG.js.gz +0 -0
  85. package/build/{runtime-classicRuntime-7YZ7NLMG.js → runtime-classicRuntime-A3DEJ3YH.js} +1 -1
  86. package/build/runtime-classicRuntime-A3DEJ3YH.js.br +0 -0
  87. package/build/runtime-classicRuntime-A3DEJ3YH.js.gz +0 -0
  88. package/build/{runtime-cloners-H554LSFU.js → runtime-cloners-UFF7A36S.js} +1 -1
  89. package/build/runtime-cloners-UFF7A36S.js.br +1 -0
  90. package/build/runtime-cloners-UFF7A36S.js.gz +0 -0
  91. package/build/{runtime-components-ZCELGDQ5.js → runtime-components-EESAIEPO.js} +1 -1
  92. package/build/runtime-components-EESAIEPO.js.br +0 -0
  93. package/build/runtime-components-EESAIEPO.js.gz +0 -0
  94. package/build/{runtime-createDestroy-FK2ZKK66.js → runtime-createDestroy-WBIIVRMC.js} +1 -1
  95. package/build/runtime-createDestroy-WBIIVRMC.js.br +0 -0
  96. package/build/runtime-createDestroy-WBIIVRMC.js.gz +0 -0
  97. package/build/{runtime-dragDrop-E4OSDFGY.js → runtime-dragDrop-D45J5GQ5.js} +1 -1
  98. package/build/runtime-dragDrop-D45J5GQ5.js.br +0 -0
  99. package/build/runtime-dragDrop-D45J5GQ5.js.gz +0 -0
  100. package/build/{runtime-gameControls-A3BST7FA.js → runtime-gameControls-GNLQ3FT6.js} +1 -1
  101. package/build/runtime-gameControls-GNLQ3FT6.js.br +0 -0
  102. package/build/runtime-gameControls-GNLQ3FT6.js.gz +0 -0
  103. package/build/{runtime-hair-W5WKY4OE.js → runtime-hair-55OFZZFY.js} +1 -1
  104. package/build/runtime-hair-55OFZZFY.js.br +1 -0
  105. package/build/runtime-hair-55OFZZFY.js.gz +0 -0
  106. package/build/{runtime-mergeStaticGeometries-5FS3LGQQ.js → runtime-mergeStaticGeometries-NLUOSGZB.js} +1 -1
  107. package/build/runtime-mergeStaticGeometries-NLUOSGZB.js.br +0 -0
  108. package/build/runtime-mergeStaticGeometries-NLUOSGZB.js.gz +0 -0
  109. package/build/{runtime-miscActions-F72HQZ5I.js → runtime-miscActions-5YY5ARQT.js} +1 -1
  110. package/build/runtime-miscActions-5YY5ARQT.js.br +0 -0
  111. package/build/runtime-miscActions-5YY5ARQT.js.gz +0 -0
  112. package/build/{runtime-mouseHover-44D2CVLI.js → runtime-mouseHover-MTTJI6DT.js} +1 -1
  113. package/build/runtime-mouseHover-MTTJI6DT.js.br +0 -0
  114. package/build/runtime-mouseHover-MTTJI6DT.js.gz +0 -0
  115. package/build/{runtime-particles-5BBDNO44.js → runtime-particles-VZVZJ35I.js} +1 -1
  116. package/build/runtime-particles-VZVZJ35I.js.br +0 -0
  117. package/build/runtime-particles-VZVZJ35I.js.gz +0 -0
  118. package/build/{runtime-paths-YF5SB3I3.js → runtime-paths-4UDUBYZN.js} +1 -1
  119. package/build/runtime-paths-4UDUBYZN.js.br +0 -0
  120. package/build/runtime-paths-4UDUBYZN.js.gz +0 -0
  121. package/build/{runtime-resize-ZORLCUGS.js → runtime-resize-QYCZUOPF.js} +1 -1
  122. package/build/runtime-resize-QYCZUOPF.js.br +0 -0
  123. package/build/runtime-resize-QYCZUOPF.js.gz +0 -0
  124. package/build/{runtime-sceneTransition-EEJJDLOW.js → runtime-sceneTransition-FC5TQNCH.js} +1 -1
  125. package/build/runtime-sceneTransition-FC5TQNCH.js.br +0 -0
  126. package/build/runtime-sceneTransition-FC5TQNCH.js.gz +0 -0
  127. package/build/{runtime-scroll-HSHQUB6P.js → runtime-scroll-VKMCDMAZ.js} +1 -1
  128. package/build/runtime-scroll-VKMCDMAZ.js.br +0 -0
  129. package/build/runtime-scroll-VKMCDMAZ.js.gz +0 -0
  130. package/build/runtime-shapeBlends-3QLNRN2O.js +1 -0
  131. package/build/runtime-shapeBlends-3QLNRN2O.js.br +4 -0
  132. package/build/runtime-shapeBlends-3QLNRN2O.js.gz +0 -0
  133. package/build/{runtime-text-UGIMBR6B.js → runtime-text-IYCY3PFB.js} +1 -1
  134. package/build/runtime-text-IYCY3PFB.js.br +0 -0
  135. package/build/runtime-text-IYCY3PFB.js.gz +0 -0
  136. package/build/{runtime-textInputs-HE2LSUKB.js → runtime-textInputs-LFDWIRLC.js} +1 -1
  137. package/build/runtime-textInputs-LFDWIRLC.js.br +0 -0
  138. package/build/runtime-textInputs-LFDWIRLC.js.gz +0 -0
  139. package/build/runtime-timeline-WNUPRRKW.js +1 -0
  140. package/build/runtime-timeline-WNUPRRKW.js.br +0 -0
  141. package/build/runtime-timeline-WNUPRRKW.js.gz +0 -0
  142. package/build/{runtime-tracking-WYI7223D.js → runtime-tracking-HMTCBZ7J.js} +1 -1
  143. package/build/runtime-tracking-HMTCBZ7J.js.br +0 -0
  144. package/build/runtime-tracking-HMTCBZ7J.js.gz +0 -0
  145. package/build/{runtime-transitions-ISGRYHHG.js → runtime-transitions-NPD3CNKU.js} +1 -1
  146. package/build/runtime-transitions-NPD3CNKU.js.br +0 -0
  147. package/build/runtime-transitions-NPD3CNKU.js.gz +0 -0
  148. package/build/{runtime-ui2d-K7CMSG7Q.js → runtime-ui2d-NZTQW5UJ.js} +1 -1
  149. package/build/runtime-ui2d-NZTQW5UJ.js.br +0 -0
  150. package/build/runtime-ui2d-NZTQW5UJ.js.gz +0 -0
  151. package/build/{runtime-vectorShapes-TE66F2C6.js → runtime-vectorShapes-26IDV3ZL.js} +1 -1
  152. package/build/runtime-vectorShapes-26IDV3ZL.js.br +0 -0
  153. package/build/runtime-vectorShapes-26IDV3ZL.js.gz +0 -0
  154. package/build/{runtime-webgpu-JHHLEDVG.js → runtime-webgpu-CDBERG7X.js} +1 -1
  155. package/build/runtime-webgpu-CDBERG7X.js.br +0 -0
  156. package/build/runtime-webgpu-CDBERG7X.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/build/snippets/hana-82e9eb82a79dead4/js-imports.js +204 -77
  177. package/package.json +1 -1
  178. package/build/runtime-chunk-2SOMTXZZ.js +0 -1
  179. package/build/runtime-chunk-2SOMTXZZ.js.br +0 -0
  180. package/build/runtime-chunk-2SOMTXZZ.js.gz +0 -0
  181. package/build/runtime-chunk-33KX2TOT.js.br +0 -0
  182. package/build/runtime-chunk-33KX2TOT.js.gz +0 -0
  183. package/build/runtime-chunk-3D6ELLRB.js.br +0 -0
  184. package/build/runtime-chunk-3D6ELLRB.js.gz +0 -0
  185. package/build/runtime-chunk-44F5FA4N.js.br +0 -0
  186. package/build/runtime-chunk-44F5FA4N.js.gz +0 -0
  187. package/build/runtime-chunk-4FRVTTCF.js.br +0 -0
  188. package/build/runtime-chunk-4FRVTTCF.js.gz +0 -0
  189. package/build/runtime-chunk-5MDYMRYM.js.br +0 -0
  190. package/build/runtime-chunk-5MDYMRYM.js.gz +0 -0
  191. package/build/runtime-chunk-5RKK7JBF.js.br +0 -0
  192. package/build/runtime-chunk-5RKK7JBF.js.gz +0 -0
  193. package/build/runtime-chunk-CUH4PXNR.js.br +0 -0
  194. package/build/runtime-chunk-CUH4PXNR.js.gz +0 -0
  195. package/build/runtime-chunk-CXBK7LPG.js.br +0 -0
  196. package/build/runtime-chunk-CXBK7LPG.js.gz +0 -0
  197. package/build/runtime-chunk-EPFYNTQQ.js.br +0 -0
  198. package/build/runtime-chunk-EPFYNTQQ.js.gz +0 -0
  199. package/build/runtime-chunk-FJZAL2GU.js.br +0 -0
  200. package/build/runtime-chunk-FJZAL2GU.js.gz +0 -0
  201. package/build/runtime-chunk-HRGNIGSC.js +0 -1
  202. package/build/runtime-chunk-HRGNIGSC.js.br +0 -0
  203. package/build/runtime-chunk-HRGNIGSC.js.gz +0 -0
  204. package/build/runtime-chunk-KJLTN6RE.js.br +0 -0
  205. package/build/runtime-chunk-KJLTN6RE.js.gz +0 -0
  206. package/build/runtime-chunk-KRQKRJPD.js.br +0 -0
  207. package/build/runtime-chunk-KRQKRJPD.js.gz +0 -0
  208. package/build/runtime-chunk-LVFNCYIC.js.br +0 -0
  209. package/build/runtime-chunk-LVFNCYIC.js.gz +0 -0
  210. package/build/runtime-chunk-R3V4RB3X.js.br +0 -0
  211. package/build/runtime-chunk-R3V4RB3X.js.gz +0 -0
  212. package/build/runtime-chunk-ROGQC3YL.js.br +0 -0
  213. package/build/runtime-chunk-ROGQC3YL.js.gz +0 -0
  214. package/build/runtime-chunk-RYIFGI7L.js.br +0 -0
  215. package/build/runtime-chunk-RYIFGI7L.js.gz +0 -0
  216. package/build/runtime-chunk-SOL2NZB4.js.br +0 -0
  217. package/build/runtime-chunk-SOL2NZB4.js.gz +0 -0
  218. package/build/runtime-chunk-U7JVP2TI.js.br +0 -0
  219. package/build/runtime-chunk-U7JVP2TI.js.gz +0 -0
  220. package/build/runtime-chunk-UFFTT5MI.js.br +0 -0
  221. package/build/runtime-chunk-UFFTT5MI.js.gz +0 -0
  222. package/build/runtime-chunk-VJPN4EM6.js.br +0 -0
  223. package/build/runtime-chunk-VJPN4EM6.js.gz +0 -0
  224. package/build/runtime-chunk-WFTAZCXD.js.br +0 -0
  225. package/build/runtime-chunk-WFTAZCXD.js.gz +0 -0
  226. package/build/runtime-chunk-YANJNJO2.js.br +0 -0
  227. package/build/runtime-chunk-YANJNJO2.js.gz +0 -0
  228. package/build/runtime-chunk-YNTJMLA5.js.br +0 -0
  229. package/build/runtime-chunk-YNTJMLA5.js.gz +0 -0
  230. package/build/runtime-chunk-ZTHLLGVX.js.gz +0 -0
  231. package/build/runtime-classicRuntime-7YZ7NLMG.js.br +0 -0
  232. package/build/runtime-classicRuntime-7YZ7NLMG.js.gz +0 -0
  233. package/build/runtime-cloners-H554LSFU.js.br +0 -0
  234. package/build/runtime-cloners-H554LSFU.js.gz +0 -0
  235. package/build/runtime-components-ZCELGDQ5.js.br +0 -0
  236. package/build/runtime-components-ZCELGDQ5.js.gz +0 -0
  237. package/build/runtime-createDestroy-FK2ZKK66.js.br +0 -0
  238. package/build/runtime-createDestroy-FK2ZKK66.js.gz +0 -0
  239. package/build/runtime-dragDrop-E4OSDFGY.js.br +0 -0
  240. package/build/runtime-dragDrop-E4OSDFGY.js.gz +0 -0
  241. package/build/runtime-gameControls-A3BST7FA.js.br +0 -0
  242. package/build/runtime-gameControls-A3BST7FA.js.gz +0 -0
  243. package/build/runtime-hair-W5WKY4OE.js.br +0 -2
  244. package/build/runtime-hair-W5WKY4OE.js.gz +0 -0
  245. package/build/runtime-mergeStaticGeometries-5FS3LGQQ.js.br +0 -0
  246. package/build/runtime-mergeStaticGeometries-5FS3LGQQ.js.gz +0 -0
  247. package/build/runtime-miscActions-F72HQZ5I.js.br +0 -0
  248. package/build/runtime-miscActions-F72HQZ5I.js.gz +0 -0
  249. package/build/runtime-mouseHover-44D2CVLI.js.br +0 -0
  250. package/build/runtime-mouseHover-44D2CVLI.js.gz +0 -0
  251. package/build/runtime-particles-5BBDNO44.js.br +0 -0
  252. package/build/runtime-particles-5BBDNO44.js.gz +0 -0
  253. package/build/runtime-paths-YF5SB3I3.js.br +0 -0
  254. package/build/runtime-paths-YF5SB3I3.js.gz +0 -0
  255. package/build/runtime-resize-ZORLCUGS.js.br +0 -0
  256. package/build/runtime-resize-ZORLCUGS.js.gz +0 -0
  257. package/build/runtime-sceneTransition-EEJJDLOW.js.br +0 -0
  258. package/build/runtime-sceneTransition-EEJJDLOW.js.gz +0 -0
  259. package/build/runtime-scroll-HSHQUB6P.js.br +0 -0
  260. package/build/runtime-scroll-HSHQUB6P.js.gz +0 -0
  261. package/build/runtime-shapeBlends-5ND6NZVA.js +0 -1
  262. package/build/runtime-shapeBlends-5ND6NZVA.js.br +0 -3
  263. package/build/runtime-shapeBlends-5ND6NZVA.js.gz +0 -0
  264. package/build/runtime-text-UGIMBR6B.js.br +0 -0
  265. package/build/runtime-text-UGIMBR6B.js.gz +0 -0
  266. package/build/runtime-textInputs-HE2LSUKB.js.br +0 -0
  267. package/build/runtime-textInputs-HE2LSUKB.js.gz +0 -0
  268. package/build/runtime-timeline-ZY2DQMB7.js +0 -1
  269. package/build/runtime-timeline-ZY2DQMB7.js.br +0 -0
  270. package/build/runtime-timeline-ZY2DQMB7.js.gz +0 -0
  271. package/build/runtime-tracking-WYI7223D.js.br +0 -0
  272. package/build/runtime-tracking-WYI7223D.js.gz +0 -0
  273. package/build/runtime-transitions-ISGRYHHG.js.br +0 -0
  274. package/build/runtime-transitions-ISGRYHHG.js.gz +0 -0
  275. package/build/runtime-ui2d-K7CMSG7Q.js.br +0 -0
  276. package/build/runtime-ui2d-K7CMSG7Q.js.gz +0 -0
  277. package/build/runtime-vectorShapes-TE66F2C6.js.br +0 -0
  278. package/build/runtime-vectorShapes-TE66F2C6.js.gz +0 -0
  279. package/build/runtime-webgpu-JHHLEDVG.js.br +0 -0
  280. package/build/runtime-webgpu-JHHLEDVG.js.gz +0 -0
@@ -1,93 +1,220 @@
1
-
2
1
  export async function loadImageFromBytes(bytes) {
3
- const blob = new Blob([bytes])
4
- const url = URL.createObjectURL(blob)
5
- return createImageBitmap(blob).finally(() => {
6
- URL.revokeObjectURL(url)
7
- })
2
+ return createImageBitmap(new Blob([bytes]))
8
3
  }
9
4
 
10
5
  export async function loadImageFromUrl(url) {
11
- return fetch(url)
12
- .then(response => {
13
- if (!response.ok) {
14
- throw new Error(`Failed to fetch image: ${response.statusText}`);
15
- }
16
- return response.blob();
17
- })
18
- .then(blob => createImageBitmap(blob));
6
+ return fetch(url)
7
+ .then((response) => {
8
+ if (!response.ok) {
9
+ throw new Error(`Failed to fetch image: ${response.statusText}`)
10
+ }
11
+ return response.blob()
12
+ })
13
+ .then((blob) => createImageBitmap(blob))
19
14
  }
20
15
 
21
16
  // Video Imports
22
- function setupVideo(video) {
23
- video.preload = "auto";
24
- video.autoplay = true; //iOs hack to show the first frame
25
- video.loop = true;
26
- video.muted = true;
27
- video.playsInline = true;
28
- video.currentTime = 0.01;
29
- video.load();
30
-
31
- video.onloadeddata = () => {
32
- video.muted = true;
33
- // DOMException: The play() request was interrupted by a new load request.
34
- // https://developers.google.com/web/updates/2017/06/play-request-was-interrupted
35
- const playPromise = video.play();
36
-
37
- if (playPromise !== undefined) {
38
- playPromise
39
- .then((_) => {
40
- // Automatic playback started! Do nothing all good!
41
- })
42
- .catch(() => {
43
- // for some reason the video could not be played (The play() request was interrupted by a new load request.)
44
- // so let's try to play it again
45
- video.play();
46
- }).finally(() => {
47
- video.pause();
48
- });
49
- }
50
- };
51
-
52
- let copyVideo = false;
53
- video.addEventListener("playing", function() {
54
- copyVideo = true;
55
- }, true);
56
-
57
- return new Promise((resolve) => {
58
- const checkVideo = () => {
59
- if (copyVideo) {
60
- resolve(video);
61
- } else {
62
- setTimeout(checkVideo, 10);
63
- }
64
- };
65
- checkVideo();
66
- });
67
- }
68
17
 
18
+ let videoFrameSeq = 0
69
19
 
70
- export async function loadVideoFromBytes(bytes) {
71
- const blob = new Blob([bytes])
72
- const video = document.createElement('video');
73
- video.src = URL.createObjectURL(blob);
74
- return setupVideo(video);
20
+ // Fallback tokens (see `videoFrameToken`) are the media clock offset per element
21
+ // by this stride, so two elements' ranges stay disjoint for any media under ~11.5 days.
22
+ const MEDIA_CLOCK_STRIDE = 1e6
23
+
24
+ // `HTMLMediaElement.HAVE_CURRENT_DATA` — a decoded frame the renderer can sample.
25
+ const HAVE_CURRENT_DATA = 2
26
+
27
+ // Generous, because a slow decode is not a failure — but bounded, because a source
28
+ // the browser silently declines must not wedge the load forever.
29
+ const VIDEO_READY_TIMEOUT_MS = 30000
30
+
31
+ // Maintains a token that changes exactly when the element presents a new frame,
32
+ // so the renderer can tell whether a GPU copy is needed at all.
33
+ //
34
+ // The callback chain re-arms itself and keeps `video` reachable until
35
+ // `disposeVideo` cancels it. It only fires on a presented frame, so a paused or
36
+ // stalled element costs nothing.
37
+ function trackPresentedFrames(video) {
38
+ if (typeof video.requestVideoFrameCallback !== 'function') {
39
+ // No presented-frame signal: `videoFrameToken` falls back to the media clock,
40
+ // offset per element to keep the guarantee below.
41
+ video.hanaClockBase = ++videoFrameSeq * MEDIA_CLOCK_STRIDE
42
+ return
43
+ }
44
+
45
+ // One global sequence, so no two elements ever report the same token: when an
46
+ // asset is replaced, the token the renderer still holds for the displaced
47
+ // element cannot collide with the replacement's.
48
+ video.hanaPresentedFrames = ++videoFrameSeq
49
+ const bump = () => {
50
+ // Disposal detaches the source, which fires `seeked` on the way out.
51
+ if (video.hanaDisposed) return
52
+ video.hanaPresentedFrames = ++videoFrameSeq
53
+ }
54
+
55
+ // A seek repaints a paused element without necessarily running the frame
56
+ // callback, and the video export seeks frame by frame with the element paused —
57
+ // it must never be handed the texture from the previous seek.
58
+ video.addEventListener('seeked', bump)
59
+
60
+ const onFrame = () => {
61
+ bump()
62
+ // Never re-arm a disposed element: that resurrects the cancelled chain.
63
+ if (video.hanaDisposed) return
64
+ video.hanaFrameCallback = video.requestVideoFrameCallback(onFrame)
65
+ }
66
+ video.hanaFrameCallback = video.requestVideoFrameCallback(onFrame)
75
67
  }
76
68
 
69
+ // Read by the renderer once per frame per video. Where
70
+ // `requestVideoFrameCallback` is missing, falls back to the media clock: browsers
71
+ // advance `currentTime` at frame granularity, so it answers the same question. The
72
+ // per-element base keeps the cross-element guarantee across a reload, where
73
+ // `Assets::insert_video` replaces the element under the same id.
74
+ export function videoFrameToken(video) {
75
+ const presented = video.hanaPresentedFrames
76
+ return presented === undefined ? video.hanaClockBase + video.currentTime : presented
77
+ }
77
78
 
78
- export async function loadVideoFromUrl(url) {
79
- return fetch(url)
80
- .then(response => {
81
- if (!response.ok) {
82
- throw new Error(`Failed to fetch video: ${response.statusText}`);
83
- }
84
- return response.blob();
79
+ // Only for `Local(bytes)`, which has no URL to stream from. A blob: URL pins its
80
+ // Blob — the whole file — until revoked, so keep it on the element for
81
+ // `disposeVideo` to release.
82
+ function setVideoSourceFromBlob(video, blob) {
83
+ video.hanaObjectUrl = URL.createObjectURL(blob)
84
+ video.src = video.hanaObjectUrl
85
+ }
86
+
87
+ // Releases everything the element holds: the frame-callback chain, the blob: URL
88
+ // mapping, and the buffered media and decoder behind it. Runs from `OwnedVideo`'s
89
+ // `Drop` in `assets.rs`. Idempotent, and each step is independently conditional —
90
+ // an element loaded without a blob: URL still gets the rest of the teardown.
91
+ export function disposeVideo(video) {
92
+ if (video.hanaDisposed) return
93
+ // Set first: the steps below fire events that must not read as a live element.
94
+ video.hanaDisposed = true
95
+
96
+ const callback = video.hanaFrameCallback
97
+ if (callback !== undefined) {
98
+ video.hanaFrameCallback = undefined
99
+ // A throw here must not skip the rest of the teardown.
100
+ if (typeof video.cancelVideoFrameCallback === 'function') {
101
+ video.cancelVideoFrameCallback(callback)
102
+ }
103
+ }
104
+
105
+ const url = video.hanaObjectUrl
106
+ if (url !== undefined) {
107
+ video.hanaObjectUrl = undefined
108
+ URL.revokeObjectURL(url)
109
+ }
110
+
111
+ video.pause()
112
+ // Revoking only drops the URL -> Blob mapping. Detaching the source is what
113
+ // actually releases the media the element has buffered and its decoder.
114
+ video.removeAttribute('src')
115
+ video.load()
116
+ }
117
+
118
+ // Resolves once the element holds a frame the renderer can sample, rejects if it
119
+ // never will. Every branch settles: an unsettled load holds its `PendingLoadGuard`,
120
+ // and headless hosts poll `Assets::pending_loads` to know a document is ready.
121
+ //
122
+ // Readiness is `loadeddata`, not `playing`: the video export drives the element
123
+ // paused, so `playing` never fires there, and a blocked autoplay is not a failure.
124
+ function whenSampleable(video) {
125
+ const mediaError = (prefix) => {
126
+ const err = video.error
127
+ return new Error(err === null ? prefix : `${prefix} (code ${err.code}: ${err.message})`)
128
+ }
129
+ // A rejected load never becomes an `OwnedVideo`, so nothing else releases the
130
+ // element: it would pin its blob: URL for the page lifetime and, if it buffers
131
+ // after a timeout, decode invisibly on loop (`autoplay` and `loop` stay set). The
132
+ // error is built first — `disposeVideo`'s `load()` clears `video.error`.
133
+ const failure = (prefix) => {
134
+ const err = mediaError(prefix)
135
+ disposeVideo(video)
136
+ return err
137
+ }
138
+
139
+ if (video.error !== null) return Promise.reject(failure('video failed to load'))
140
+ if (video.readyState >= HAVE_CURRENT_DATA) return Promise.resolve(video)
141
+
142
+ return new Promise((resolve, reject) => {
143
+ // Armed first so `settle` can clear it; nothing below runs this tick.
144
+ const timer = setTimeout(
145
+ () => settle(reject, failure('video timed out before presenting a frame')),
146
+ VIDEO_READY_TIMEOUT_MS,
147
+ )
148
+ const settle = (finish, value) => {
149
+ clearTimeout(timer)
150
+ video.removeEventListener('loadeddata', onReady)
151
+ video.removeEventListener('canplay', onReady)
152
+ video.removeEventListener('error', onError)
153
+ finish(value)
154
+ }
155
+ const onReady = () => settle(resolve, video)
156
+ const onError = () => settle(reject, failure('video failed to load'))
157
+
158
+ video.addEventListener('loadeddata', onReady)
159
+ // A partly-loaded source can become sampleable without a fresh `loadeddata`.
160
+ video.addEventListener('canplay', onReady)
161
+ video.addEventListener('error', onError)
162
+ })
163
+ }
164
+
165
+ function setupVideo(video) {
166
+ video.preload = 'auto'
167
+ video.autoplay = true //iOs hack to show the first frame
168
+ video.loop = true
169
+ video.muted = true
170
+ video.playsInline = true
171
+ video.currentTime = 0.01
172
+ video.load()
173
+
174
+ video.onloadeddata = () => {
175
+ video.muted = true
176
+ // DOMException: The play() request was interrupted by a new load request.
177
+ // https://developers.google.com/web/updates/2017/06/play-request-was-interrupted
178
+ const playPromise = video.play()
179
+
180
+ if (playPromise !== undefined) {
181
+ playPromise
182
+ .then((_) => {
183
+ // Automatic playback started! Do nothing all good!
184
+ })
185
+ .catch(() => {
186
+ // for some reason the video could not be played (The play() request was interrupted by a new load request.)
187
+ // so let's try to play it again
188
+ video.play()
189
+ })
190
+ .finally(() => {
191
+ video.pause()
85
192
  })
86
- .then(async blob => {
87
- const video = document.createElement('video');
88
- video.src = URL.createObjectURL(blob);
89
- return setupVideo(video);
90
- });
193
+ }
194
+ }
195
+
196
+ trackPresentedFrames(video)
197
+
198
+ return whenSampleable(video)
91
199
  }
92
200
 
201
+ export async function loadVideoFromBytes(bytes) {
202
+ const video = document.createElement('video')
203
+ setVideoSourceFromBlob(video, new Blob([bytes]))
204
+ return setupVideo(video)
205
+ }
93
206
 
207
+ // Streams from `url` instead of fetching it into a Blob first, so the browser can
208
+ // range-request it, playback starts before the last byte lands, and the file never
209
+ // sits in memory whole.
210
+ //
211
+ // `crossOrigin` must be set before `src`: without it a cross-origin element is
212
+ // tainted and every texture upload throws a SecurityError. It costs no reach — the
213
+ // `fetch` this replaces was already a CORS request, so any URL that used to load
214
+ // still does.
215
+ export async function loadVideoFromUrl(url) {
216
+ const video = document.createElement('video')
217
+ video.crossOrigin = 'anonymous'
218
+ video.src = url
219
+ return setupVideo(video)
220
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splinetool/runtime",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "Spline is a collaborative design platform for creating production-ready interactive experiences in multiple dimensions. © 2025 Spline, Inc.",
5
5
  "keywords": [
6
6
  "spline",
@@ -1 +0,0 @@
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};
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file