@splinetool/runtime 2.0.8 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/build/hana-ui.js +82 -32
  2. package/build/hana-ui.js.br +0 -0
  3. package/build/hana-ui.js.gz +0 -0
  4. package/build/hana-ui.wasm +0 -0
  5. package/build/hana-ui.wasm.br +0 -0
  6. package/build/hana-ui.wasm.gz +0 -0
  7. package/build/{runtime-chunk-KNL33WN7.js → runtime-chunk-2SOMTXZZ.js} +1 -1
  8. package/build/runtime-chunk-2SOMTXZZ.js.br +0 -0
  9. package/build/runtime-chunk-2SOMTXZZ.js.gz +0 -0
  10. package/build/{runtime-chunk-YULW5JRE.js → runtime-chunk-33KX2TOT.js} +1 -1
  11. package/build/runtime-chunk-33KX2TOT.js.br +0 -0
  12. package/build/runtime-chunk-33KX2TOT.js.gz +0 -0
  13. package/build/{runtime-chunk-DK66VKWP.js → runtime-chunk-3D6ELLRB.js} +1 -1
  14. package/build/runtime-chunk-3D6ELLRB.js.br +0 -0
  15. package/build/runtime-chunk-3D6ELLRB.js.gz +0 -0
  16. package/build/{runtime-chunk-32KZP4YN.js → runtime-chunk-44F5FA4N.js} +1 -1
  17. package/build/runtime-chunk-44F5FA4N.js.br +0 -0
  18. package/build/runtime-chunk-44F5FA4N.js.gz +0 -0
  19. package/build/{runtime-chunk-5RXW5MNJ.js → runtime-chunk-4FRVTTCF.js} +1 -1
  20. package/build/runtime-chunk-4FRVTTCF.js.br +0 -0
  21. package/build/runtime-chunk-4FRVTTCF.js.gz +0 -0
  22. package/build/{runtime-chunk-5JEZ42OM.js → runtime-chunk-5MDYMRYM.js} +1 -1
  23. package/build/runtime-chunk-5MDYMRYM.js.br +0 -0
  24. package/build/runtime-chunk-5MDYMRYM.js.gz +0 -0
  25. package/build/{runtime-chunk-23QXG35G.js → runtime-chunk-5RKK7JBF.js} +1 -1
  26. package/build/runtime-chunk-5RKK7JBF.js.br +0 -0
  27. package/build/runtime-chunk-5RKK7JBF.js.gz +0 -0
  28. package/build/{runtime-chunk-HZ6FL5GH.js → runtime-chunk-CUH4PXNR.js} +1 -1
  29. package/build/runtime-chunk-CUH4PXNR.js.br +0 -0
  30. package/build/runtime-chunk-CUH4PXNR.js.gz +0 -0
  31. package/build/{runtime-chunk-USGQ26QU.js → runtime-chunk-CXBK7LPG.js} +1 -1
  32. package/build/runtime-chunk-CXBK7LPG.js.br +0 -0
  33. package/build/runtime-chunk-CXBK7LPG.js.gz +0 -0
  34. package/build/{runtime-chunk-RLYG5YBB.js → runtime-chunk-EPFYNTQQ.js} +1 -1
  35. package/build/runtime-chunk-EPFYNTQQ.js.br +0 -0
  36. package/build/runtime-chunk-EPFYNTQQ.js.gz +0 -0
  37. package/build/{runtime-chunk-AELTGHV2.js → runtime-chunk-FJZAL2GU.js} +1 -1
  38. package/build/runtime-chunk-FJZAL2GU.js.br +0 -0
  39. package/build/runtime-chunk-FJZAL2GU.js.gz +0 -0
  40. package/build/{runtime-chunk-KE6HNYUL.js → runtime-chunk-HRGNIGSC.js} +1 -1
  41. package/build/runtime-chunk-HRGNIGSC.js.br +0 -0
  42. package/build/{runtime-chunk-KE6HNYUL.js.gz → runtime-chunk-HRGNIGSC.js.gz} +0 -0
  43. package/build/{runtime-chunk-557KVSJL.js → runtime-chunk-KJLTN6RE.js} +1 -1
  44. package/build/runtime-chunk-KJLTN6RE.js.br +0 -0
  45. package/build/runtime-chunk-KJLTN6RE.js.gz +0 -0
  46. package/build/{runtime-chunk-E3IEBR27.js → runtime-chunk-KRQKRJPD.js} +1 -1
  47. package/build/runtime-chunk-KRQKRJPD.js.br +0 -0
  48. package/build/runtime-chunk-KRQKRJPD.js.gz +0 -0
  49. package/build/{runtime-chunk-BMA5KYBS.js → runtime-chunk-LVFNCYIC.js} +1 -1
  50. package/build/runtime-chunk-LVFNCYIC.js.br +0 -0
  51. package/build/runtime-chunk-LVFNCYIC.js.gz +0 -0
  52. package/build/{runtime-chunk-CKT62HES.js → runtime-chunk-R3V4RB3X.js} +1 -1
  53. package/build/runtime-chunk-R3V4RB3X.js.br +0 -0
  54. package/build/runtime-chunk-R3V4RB3X.js.gz +0 -0
  55. package/build/{runtime-chunk-OUXEWX5Z.js → runtime-chunk-ROGQC3YL.js} +1 -1
  56. package/build/runtime-chunk-ROGQC3YL.js.br +0 -0
  57. package/build/runtime-chunk-ROGQC3YL.js.gz +0 -0
  58. package/build/{runtime-chunk-GZ7C2GJM.js → runtime-chunk-RYIFGI7L.js} +1 -1
  59. package/build/runtime-chunk-RYIFGI7L.js.br +0 -0
  60. package/build/runtime-chunk-RYIFGI7L.js.gz +0 -0
  61. package/build/{runtime-chunk-TAY7IXEZ.js → runtime-chunk-SOL2NZB4.js} +1 -1
  62. package/build/runtime-chunk-SOL2NZB4.js.br +0 -0
  63. package/build/runtime-chunk-SOL2NZB4.js.gz +0 -0
  64. package/build/{runtime-chunk-DHWGP6NU.js → runtime-chunk-U7JVP2TI.js} +1 -1
  65. package/build/runtime-chunk-U7JVP2TI.js.br +0 -0
  66. package/build/runtime-chunk-U7JVP2TI.js.gz +0 -0
  67. package/build/{runtime-chunk-HK23JJVH.js → runtime-chunk-UFFTT5MI.js} +1 -1
  68. package/build/runtime-chunk-UFFTT5MI.js.br +0 -0
  69. package/build/runtime-chunk-UFFTT5MI.js.gz +0 -0
  70. package/build/{runtime-chunk-F3ZACLZW.js → runtime-chunk-VJPN4EM6.js} +1 -1
  71. package/build/runtime-chunk-VJPN4EM6.js.br +0 -0
  72. package/build/runtime-chunk-VJPN4EM6.js.gz +0 -0
  73. package/build/{runtime-chunk-UIM3XKIT.js → runtime-chunk-WFTAZCXD.js} +1 -1
  74. package/build/runtime-chunk-WFTAZCXD.js.br +0 -0
  75. package/build/runtime-chunk-WFTAZCXD.js.gz +0 -0
  76. package/build/{runtime-chunk-EJJZJ5MV.js → runtime-chunk-YANJNJO2.js} +1 -1
  77. package/build/runtime-chunk-YANJNJO2.js.br +0 -0
  78. package/build/runtime-chunk-YANJNJO2.js.gz +0 -0
  79. package/build/{runtime-chunk-3GRN37GY.js → runtime-chunk-YNTJMLA5.js} +1 -1
  80. package/build/runtime-chunk-YNTJMLA5.js.br +0 -0
  81. package/build/runtime-chunk-YNTJMLA5.js.gz +0 -0
  82. package/build/{runtime-chunk-PDASWDVC.js → runtime-chunk-ZTHLLGVX.js} +1 -1
  83. package/build/{runtime-chunk-PDASWDVC.js.br → runtime-chunk-ZTHLLGVX.js.br} +0 -0
  84. package/build/runtime-chunk-ZTHLLGVX.js.gz +0 -0
  85. package/build/{runtime-classicRuntime-U672GAGM.js → runtime-classicRuntime-7YZ7NLMG.js} +1 -1
  86. package/build/runtime-classicRuntime-7YZ7NLMG.js.br +0 -0
  87. package/build/runtime-classicRuntime-7YZ7NLMG.js.gz +0 -0
  88. package/build/{runtime-cloners-2AC7OZRC.js → runtime-cloners-H554LSFU.js} +1 -1
  89. package/build/runtime-cloners-H554LSFU.js.br +0 -0
  90. package/build/runtime-cloners-H554LSFU.js.gz +0 -0
  91. package/build/{runtime-components-L63NUGAO.js → runtime-components-ZCELGDQ5.js} +1 -1
  92. package/build/runtime-components-ZCELGDQ5.js.br +0 -0
  93. package/build/runtime-components-ZCELGDQ5.js.gz +0 -0
  94. package/build/{runtime-createDestroy-QHHQ6LYS.js → runtime-createDestroy-FK2ZKK66.js} +1 -1
  95. package/build/runtime-createDestroy-FK2ZKK66.js.br +0 -0
  96. package/build/runtime-createDestroy-FK2ZKK66.js.gz +0 -0
  97. package/build/{runtime-dragDrop-YBSWK3ET.js → runtime-dragDrop-E4OSDFGY.js} +1 -1
  98. package/build/runtime-dragDrop-E4OSDFGY.js.br +0 -0
  99. package/build/runtime-dragDrop-E4OSDFGY.js.gz +0 -0
  100. package/build/{runtime-gameControls-DSJRSTW5.js → runtime-gameControls-A3BST7FA.js} +1 -1
  101. package/build/runtime-gameControls-A3BST7FA.js.br +0 -0
  102. package/build/runtime-gameControls-A3BST7FA.js.gz +0 -0
  103. package/build/{runtime-hair-V4RTCES2.js → runtime-hair-W5WKY4OE.js} +1 -1
  104. package/build/runtime-hair-W5WKY4OE.js.br +2 -0
  105. package/build/runtime-hair-W5WKY4OE.js.gz +0 -0
  106. package/build/{runtime-mergeStaticGeometries-VXENKMD4.js → runtime-mergeStaticGeometries-5FS3LGQQ.js} +1 -1
  107. package/build/runtime-mergeStaticGeometries-5FS3LGQQ.js.br +0 -0
  108. package/build/runtime-mergeStaticGeometries-5FS3LGQQ.js.gz +0 -0
  109. package/build/{runtime-miscActions-RPUPHHGJ.js → runtime-miscActions-F72HQZ5I.js} +1 -1
  110. package/build/runtime-miscActions-F72HQZ5I.js.br +0 -0
  111. package/build/runtime-miscActions-F72HQZ5I.js.gz +0 -0
  112. package/build/{runtime-mouseHover-HG6AHA2L.js → runtime-mouseHover-44D2CVLI.js} +1 -1
  113. package/build/runtime-mouseHover-44D2CVLI.js.br +0 -0
  114. package/build/runtime-mouseHover-44D2CVLI.js.gz +0 -0
  115. package/build/{runtime-particles-ZHE2MC33.js → runtime-particles-5BBDNO44.js} +1 -1
  116. package/build/runtime-particles-5BBDNO44.js.br +0 -0
  117. package/build/runtime-particles-5BBDNO44.js.gz +0 -0
  118. package/build/{runtime-paths-GN6E6ZYL.js → runtime-paths-YF5SB3I3.js} +1 -1
  119. package/build/runtime-paths-YF5SB3I3.js.br +0 -0
  120. package/build/runtime-paths-YF5SB3I3.js.gz +0 -0
  121. package/build/{runtime-resize-LACR4RFK.js → runtime-resize-ZORLCUGS.js} +1 -1
  122. package/build/runtime-resize-ZORLCUGS.js.br +0 -0
  123. package/build/runtime-resize-ZORLCUGS.js.gz +0 -0
  124. package/build/{runtime-sceneTransition-QLPFYHHY.js → runtime-sceneTransition-EEJJDLOW.js} +1 -1
  125. package/build/runtime-sceneTransition-EEJJDLOW.js.br +0 -0
  126. package/build/runtime-sceneTransition-EEJJDLOW.js.gz +0 -0
  127. package/build/{runtime-scroll-WZZBT2XR.js → runtime-scroll-HSHQUB6P.js} +1 -1
  128. package/build/runtime-scroll-HSHQUB6P.js.br +0 -0
  129. package/build/runtime-scroll-HSHQUB6P.js.gz +0 -0
  130. package/build/runtime-shapeBlends-5ND6NZVA.js +1 -0
  131. package/build/runtime-shapeBlends-5ND6NZVA.js.br +3 -0
  132. package/build/runtime-shapeBlends-5ND6NZVA.js.gz +0 -0
  133. package/build/{runtime-text-UADJSRL4.js → runtime-text-UGIMBR6B.js} +1 -1
  134. package/build/runtime-text-UGIMBR6B.js.br +0 -0
  135. package/build/runtime-text-UGIMBR6B.js.gz +0 -0
  136. package/build/{runtime-textInputs-7U3TTJ4X.js → runtime-textInputs-HE2LSUKB.js} +1 -1
  137. package/build/runtime-textInputs-HE2LSUKB.js.br +0 -0
  138. package/build/runtime-textInputs-HE2LSUKB.js.gz +0 -0
  139. package/build/{runtime-timeline-JXKHKUAC.js → runtime-timeline-ZY2DQMB7.js} +1 -1
  140. package/build/runtime-timeline-ZY2DQMB7.js.br +0 -0
  141. package/build/runtime-timeline-ZY2DQMB7.js.gz +0 -0
  142. package/build/{runtime-tracking-MC74576T.js → runtime-tracking-WYI7223D.js} +1 -1
  143. package/build/runtime-tracking-WYI7223D.js.br +0 -0
  144. package/build/runtime-tracking-WYI7223D.js.gz +0 -0
  145. package/build/{runtime-transitions-S22YS7E6.js → runtime-transitions-ISGRYHHG.js} +1 -1
  146. package/build/runtime-transitions-ISGRYHHG.js.br +0 -0
  147. package/build/runtime-transitions-ISGRYHHG.js.gz +0 -0
  148. package/build/{runtime-ui2d-EX3RBXPP.js → runtime-ui2d-K7CMSG7Q.js} +1 -1
  149. package/build/runtime-ui2d-K7CMSG7Q.js.br +0 -0
  150. package/build/runtime-ui2d-K7CMSG7Q.js.gz +0 -0
  151. package/build/{runtime-vectorShapes-J5Y3LMND.js → runtime-vectorShapes-TE66F2C6.js} +1 -1
  152. package/build/runtime-vectorShapes-TE66F2C6.js.br +0 -0
  153. package/build/runtime-vectorShapes-TE66F2C6.js.gz +0 -0
  154. package/build/{runtime-webgpu-LDZ3N2D5.js → runtime-webgpu-JHHLEDVG.js} +1 -1
  155. package/build/runtime-webgpu-JHHLEDVG.js.br +0 -0
  156. package/build/runtime-webgpu-JHHLEDVG.js.gz +0 -0
  157. package/build/runtime.cjs +5 -5
  158. package/build/runtime.js +1 -1
  159. package/build/runtime.js.br +0 -0
  160. package/build/runtime.js.gz +0 -0
  161. package/build/runtime.standalone.js +1 -1
  162. package/build/runtime.standalone.js.br +0 -0
  163. package/build/runtime.standalone.js.gz +0 -0
  164. package/build/runtime.standalone.webgl.js +1 -1
  165. package/build/runtime.standalone.webgl.js.br +0 -0
  166. package/build/runtime.standalone.webgl.js.gz +0 -0
  167. package/build/runtime.standalone.webgpu.js +1 -1
  168. package/build/runtime.standalone.webgpu.js.br +0 -0
  169. package/build/runtime.standalone.webgpu.js.gz +0 -0
  170. package/build/runtime.standalone.webgpu.micro.js +1 -1
  171. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  172. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  173. package/build/runtime.standalone.webgpu.min.js +1 -1
  174. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  175. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  176. package/package.json +1 -1
  177. package/build/runtime-chunk-23QXG35G.js.br +0 -0
  178. package/build/runtime-chunk-23QXG35G.js.gz +0 -0
  179. package/build/runtime-chunk-32KZP4YN.js.br +0 -0
  180. package/build/runtime-chunk-32KZP4YN.js.gz +0 -0
  181. package/build/runtime-chunk-3GRN37GY.js.br +0 -0
  182. package/build/runtime-chunk-3GRN37GY.js.gz +0 -0
  183. package/build/runtime-chunk-557KVSJL.js.br +0 -0
  184. package/build/runtime-chunk-557KVSJL.js.gz +0 -0
  185. package/build/runtime-chunk-5JEZ42OM.js.br +0 -0
  186. package/build/runtime-chunk-5JEZ42OM.js.gz +0 -0
  187. package/build/runtime-chunk-5RXW5MNJ.js.br +0 -0
  188. package/build/runtime-chunk-5RXW5MNJ.js.gz +0 -0
  189. package/build/runtime-chunk-AELTGHV2.js.br +0 -0
  190. package/build/runtime-chunk-AELTGHV2.js.gz +0 -0
  191. package/build/runtime-chunk-BMA5KYBS.js.br +0 -0
  192. package/build/runtime-chunk-BMA5KYBS.js.gz +0 -0
  193. package/build/runtime-chunk-CKT62HES.js.br +0 -0
  194. package/build/runtime-chunk-CKT62HES.js.gz +0 -0
  195. package/build/runtime-chunk-DHWGP6NU.js.br +0 -0
  196. package/build/runtime-chunk-DHWGP6NU.js.gz +0 -0
  197. package/build/runtime-chunk-DK66VKWP.js.br +0 -0
  198. package/build/runtime-chunk-DK66VKWP.js.gz +0 -0
  199. package/build/runtime-chunk-E3IEBR27.js.br +0 -0
  200. package/build/runtime-chunk-E3IEBR27.js.gz +0 -0
  201. package/build/runtime-chunk-EJJZJ5MV.js.br +0 -0
  202. package/build/runtime-chunk-EJJZJ5MV.js.gz +0 -0
  203. package/build/runtime-chunk-F3ZACLZW.js.br +0 -0
  204. package/build/runtime-chunk-F3ZACLZW.js.gz +0 -0
  205. package/build/runtime-chunk-GZ7C2GJM.js.br +0 -0
  206. package/build/runtime-chunk-GZ7C2GJM.js.gz +0 -0
  207. package/build/runtime-chunk-HK23JJVH.js.br +0 -0
  208. package/build/runtime-chunk-HK23JJVH.js.gz +0 -0
  209. package/build/runtime-chunk-HZ6FL5GH.js.br +0 -0
  210. package/build/runtime-chunk-HZ6FL5GH.js.gz +0 -0
  211. package/build/runtime-chunk-KE6HNYUL.js.br +0 -0
  212. package/build/runtime-chunk-KNL33WN7.js.br +0 -0
  213. package/build/runtime-chunk-KNL33WN7.js.gz +0 -0
  214. package/build/runtime-chunk-OUXEWX5Z.js.br +0 -0
  215. package/build/runtime-chunk-OUXEWX5Z.js.gz +0 -0
  216. package/build/runtime-chunk-PDASWDVC.js.gz +0 -0
  217. package/build/runtime-chunk-RLYG5YBB.js.br +0 -1
  218. package/build/runtime-chunk-RLYG5YBB.js.gz +0 -0
  219. package/build/runtime-chunk-TAY7IXEZ.js.br +0 -0
  220. package/build/runtime-chunk-TAY7IXEZ.js.gz +0 -0
  221. package/build/runtime-chunk-UIM3XKIT.js.br +0 -0
  222. package/build/runtime-chunk-UIM3XKIT.js.gz +0 -0
  223. package/build/runtime-chunk-USGQ26QU.js.br +0 -0
  224. package/build/runtime-chunk-USGQ26QU.js.gz +0 -0
  225. package/build/runtime-chunk-YULW5JRE.js.br +0 -0
  226. package/build/runtime-chunk-YULW5JRE.js.gz +0 -0
  227. package/build/runtime-classicRuntime-U672GAGM.js.br +0 -0
  228. package/build/runtime-classicRuntime-U672GAGM.js.gz +0 -0
  229. package/build/runtime-cloners-2AC7OZRC.js.br +0 -0
  230. package/build/runtime-cloners-2AC7OZRC.js.gz +0 -0
  231. package/build/runtime-components-L63NUGAO.js.br +0 -0
  232. package/build/runtime-components-L63NUGAO.js.gz +0 -0
  233. package/build/runtime-createDestroy-QHHQ6LYS.js.br +0 -0
  234. package/build/runtime-createDestroy-QHHQ6LYS.js.gz +0 -0
  235. package/build/runtime-dragDrop-YBSWK3ET.js.br +0 -0
  236. package/build/runtime-dragDrop-YBSWK3ET.js.gz +0 -0
  237. package/build/runtime-gameControls-DSJRSTW5.js.br +0 -0
  238. package/build/runtime-gameControls-DSJRSTW5.js.gz +0 -0
  239. package/build/runtime-hair-V4RTCES2.js.br +0 -2
  240. package/build/runtime-hair-V4RTCES2.js.gz +0 -0
  241. package/build/runtime-mergeStaticGeometries-VXENKMD4.js.br +0 -0
  242. package/build/runtime-mergeStaticGeometries-VXENKMD4.js.gz +0 -0
  243. package/build/runtime-miscActions-RPUPHHGJ.js.br +0 -0
  244. package/build/runtime-miscActions-RPUPHHGJ.js.gz +0 -0
  245. package/build/runtime-mouseHover-HG6AHA2L.js.br +0 -0
  246. package/build/runtime-mouseHover-HG6AHA2L.js.gz +0 -0
  247. package/build/runtime-particles-ZHE2MC33.js.br +0 -0
  248. package/build/runtime-particles-ZHE2MC33.js.gz +0 -0
  249. package/build/runtime-paths-GN6E6ZYL.js.br +0 -0
  250. package/build/runtime-paths-GN6E6ZYL.js.gz +0 -0
  251. package/build/runtime-resize-LACR4RFK.js.br +0 -0
  252. package/build/runtime-resize-LACR4RFK.js.gz +0 -0
  253. package/build/runtime-sceneTransition-QLPFYHHY.js.br +0 -0
  254. package/build/runtime-sceneTransition-QLPFYHHY.js.gz +0 -0
  255. package/build/runtime-scroll-WZZBT2XR.js.br +0 -0
  256. package/build/runtime-scroll-WZZBT2XR.js.gz +0 -0
  257. package/build/runtime-shapeBlends-O6ATLCCA.js +0 -1
  258. package/build/runtime-shapeBlends-O6ATLCCA.js.br +0 -0
  259. package/build/runtime-shapeBlends-O6ATLCCA.js.gz +0 -0
  260. package/build/runtime-text-UADJSRL4.js.br +0 -0
  261. package/build/runtime-text-UADJSRL4.js.gz +0 -0
  262. package/build/runtime-textInputs-7U3TTJ4X.js.br +0 -0
  263. package/build/runtime-textInputs-7U3TTJ4X.js.gz +0 -0
  264. package/build/runtime-timeline-JXKHKUAC.js.br +0 -0
  265. package/build/runtime-timeline-JXKHKUAC.js.gz +0 -0
  266. package/build/runtime-tracking-MC74576T.js.br +0 -0
  267. package/build/runtime-tracking-MC74576T.js.gz +0 -0
  268. package/build/runtime-transitions-S22YS7E6.js.br +0 -0
  269. package/build/runtime-transitions-S22YS7E6.js.gz +0 -0
  270. package/build/runtime-ui2d-EX3RBXPP.js.br +0 -0
  271. package/build/runtime-ui2d-EX3RBXPP.js.gz +0 -0
  272. package/build/runtime-vectorShapes-J5Y3LMND.js.br +0 -0
  273. package/build/runtime-vectorShapes-J5Y3LMND.js.gz +0 -0
  274. package/build/runtime-webgpu-LDZ3N2D5.js.br +0 -0
  275. package/build/runtime-webgpu-LDZ3N2D5.js.gz +0 -0
@@ -1 +1 @@
1
- import{a as t}from"./runtime-chunk-PDASWDVC.js";import{a as e,b as i}from"./runtime-chunk-DZNU62CT.js";import{a as s}from"./runtime-chunk-VAVYZ35B.js";import{c as n}from"./runtime-chunk-FQNSP44B.js";import"./runtime-chunk-DK66VKWP.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import"./runtime-chunk-CKT62HES.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-U4QOT2PX.js";import{a as r,f as a}from"./runtime-chunk-TZCHGFVF.js";import{D as o,Ha as h}from"./runtime-chunk-VPEJ5BFD.js";import{Dc as l,Fc as p,Gc as u,Sc as d,Vc as c,Vd as g,bd as m,dd as x,kd as v,l as y,ld as I,rd as M}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var f=class extends t{constructor(t,e,i){super(t,e,i),this.data=e}},C=class extends d{constructor(){super(),this.caretIndex=0,this._caretVisibleAlpha=1,this._selectionVisibleAlpha=.3,this.current={start:0,end:void 0},this.matrixAutoUpdate=!1,this.caretMesh=new I(new g(1,1),new v({transparent:!0,opacity:0,side:y})),this.add(this.caretMesh),this.selectionMesh=new I(new g(1,1),new v({color:2857471,transparent:!0,depthTest:!1,depthWrite:!1,opacity:0,side:y})),this.add(this.selectionMesh),this.hide()}get caretHeight(){return this.object?.AD??0}show(t){this.visible=!0,this.object=t,this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.y=.5*-this.caretHeight,this.setCaretPosition(this.caretIndex),this.update()}hide(){this.visible=!1}update(){if(void 0===this.object)return;this.updateHelperMatrix();let{depth:t}=this.object.geometry.userData.parameters;this.caretMesh.position.z=t,this.selectionMesh.position.z=t}updateHelperMatrix(){if(void 0===this.object)return;let t=this.object,e=t.parent;null!==e&&e.updateWorldMatrix(!0,!1),t.matrixAutoUpdate&&t.updateMatrix(),null!==e?(this.matrixWorld.multiplyMatrices(e.matrixWorld,t.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,t.matrix)):this.matrixWorld.multiplyMatrices(t.hiddenMatrix,t.matrix),this.matrix.copy(this.matrixWorld);for(let t of this.children)t.matrixWorld.copy(this.matrixWorld);t.updateWorldMatrix(!0,!0)}setCaretColor(t){let e=this.caretMesh.material;e.color.setRGB(t.r,t.g,t.b);let i=this._caretVisibleAlpha===e.opacity;this._caretVisibleAlpha=t.a,i&&(e.opacity=this._caretVisibleAlpha)}setSelectionColor(t){this.selectionMesh.material.color.setRGB(t.r,t.g,t.b)}setCaretPosition(t,e={}){if(void 0===this.object)return;this.caretIndex=t;let i=this.object.wrappedText,[s,n]=_(i,t),[r,a]=t>0?_(i,t-1):[null,null];"\n"===(t>0&&i.length?i[r].charAt(a):null)&&(s++,n=0),this.current.start=t,this.current.end=void 0;let[o,h]=b(this.object,s,n),{AD:l,descender:p}=this.object,u=p+.5*l,{width:d,height:c,depth:g}=this.object.geometry.userData.parameters,m="string"==typeof d?0:d,x="string"==typeof c?0:c;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(o-.5*m,h+u+.5*x,g),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(t,e){if(void 0===this.object)return;let i=this.object.wrappedText;this.current.start=t,this.current.end=e;let s=[],n=[],r=function(t,e,i){let[s,n]=_(t,e),[r,a]=_(t,i),o=[];n>=t[s].length&&(s++,n=0);for(let e=s;e<=r;e++){let i=t[e],h=e===s?n:0,l=e===r?a:i.length;o.push([e,h,l])}return o}(i,t,e),{lineHeight:a,AD:o,descender:h}=this.object,l=h+.5*o-.5*a;for(let[t,e,i]of r)if(e!==i){let[r,o]=b(this.object,t,e),[h,p]=b(this.object,t,i),u=o,d=p;u+=l,d+=l,d+=a;let c=s.length/3;s.push(r,u,0),s.push(h,u,0),s.push(h,d,0),s.push(r,d,0),n.push(c+0,c+1,c+2),n.push(c+2,c+3,c+0)}let p=new x;p.setIndex(n),p.setAttribute("position",new m(s,3));let{width:u,height:d,depth:c}=this.object.geometry.userData.parameters,g="string"==typeof u?0:u,v="string"==typeof d?0:d;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=p,this.selectionMesh.position.x=.5*-g,this.selectionMesh.position.y=.5*v,this.selectionMesh.position.z=c,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(t,e,i="previous"){if(void 0===this.object||void 0===this.object.font)return;let s=this.object.wrappedText,n=s.length,r=this.object.lineHeight,a=n*r,{height:o,verticalAlign:h}=this.object.geometry.userData.parameters,l="string"==typeof o?0:o,p=0;3===h?p=l-a:2===h&&(p=.5*l-.5*a);let u=Math.min(Math.floor(Math.max(Math.min(-e-p,a),0)/r),n-1),d=this.object.charCoords[u],c=this.object.charWidths[u],g=0,m=!1;if("previous"===i){for(let e=0;e<d.length;e++)if(d[e][0]+.5*c[e]-t>0){g=e,m=!0;break}}else if("closest"===i){let e=1/0;for(let i=0;i<d.length;i++){let s=d[i][0]+.5*c[i],n=Math.abs(s-t);n<e&&(e=n,g=i,m=!0)}}else for(let e=0;e<d.length;e++){let i=d[e][0],s=d[e][0]+c[e];if(t>=i&&t<s){g=e,m=!0;break}}return m||(g=d.length),{index:this.getGlobalIndexFromLineAndCharIndexes(s,u,g),lineIndex:u,characterIndex:g}}getGlobalIndexFromLineAndCharIndexes(t,e,i){return t.slice(0,e).reduce((t,e)=>t+e.length,0)+i}showSelectionMesh(){this.selectionMesh.material.opacity=this._selectionVisibleAlpha}hideSelectionMesh(){this.selectionMesh.material.opacity=0}showCaretMesh(){this.caretMesh.material.opacity=this._caretVisibleAlpha}hideCaretMesh(){this.caretMesh.material.opacity=0}};function b(t,e,i){let{charCoords:s,charWidths:n,initialOffsetY:r,lineHeight:a}=t;if(s[e]&&0===s[e].length||0===s.length){let i=0,{horizontalAlign:s}=t.data.geometry,n=t.wrappedText,{width:o}=t.geometry.userData.parameters;return 1===n.length&&0===n[0].length&&(3===s?i=.5*o:2===s&&(i=o)),[i,r-a*e]}let o=s[e];if(void 0===o||0===o.length)return[0,0];let[h,l]=o[Math.min(i,o.length-1)],p=h;return i>=o.length&&(p+=n[e][i-1]),[p,l]}function _(t,e){let i=0;for(let s=0;s<t.length;s++){let n=t[s],r=e-i;if(r<=n.length)return[s,r];i+=n.length}return[Math.max(0,t.length-1),t[t.length-1]?.length??0]}function w(t,e){return"string"==typeof t?e.data.colors[t]:t}function k(t){return t.colors[0]}var E=class{constructor(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0],this._delay=500,this._distance=2,this._onMouseDown=t=>{let e=[t.clientX,t.clientY],i=(new Date).getTime();if(this._clickCount>0){let t=e[0]-this._lastPosition[0],i=e[1]-this._lastPosition[1];Math.sqrt(t*t+i*i)>this._distance&&(this._clickCount=0)}this._lastPosition=e,this._clickCount=i-this._lastTime>this._delay?1:this._clickCount+1,this._lastTime=i},this._onMouseUp=t=>{}}start(t,e=500,i=2){this._target&&this.stop(),this.reset(),this._delay=e,this._distance=i,this._target=t,this._target.addEventListener("pointerdown",this._onMouseDown,!1),this._target.addEventListener("pointerup",this._onMouseUp,!1)}stop(){this._target&&(this._target.removeEventListener("pointerdown",this._onMouseDown,!1),this._target.removeEventListener("pointerup",this._onMouseUp,!1),this._target=void 0)}get clickCount(){return this._clickCount}reset(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0]}},j=new p(0,0,1),D=new p,T=new p,S=new u,A=class{constructor(t,e,i,s,n){this.containerScene=t,this.raycaster=e,this.sharedAssets=i,this.requestRender=s,this.onExit=n,this.htmlInput=null,this.virtualInput=null,this.helper=new C,this.doubleClickHandler=new E,this.isDragging=!1,this.plane=new M,this.caretInterval=0,this.planeIntersection=new p,this.projected=new l,this._lastIndex=0,this._isFirstDragMove=!1,this.selectionOnDragStart=0,this.onTextMaterialChanged=()=>{let t=this.virtualInput?.data;if(void 0!==this.virtualInput&&t){let e=t.material,i=function(t,e){let i=o.fromHex(3223857),s=.8;for(let n of t.layers){if("light"===n.data.type||"displace"===n.data.type||"fresnel"===n.data.type||"dust"===n.data.type||"matcap"===n.data.type||"texture"===n.data.type||"toon"===n.data.type||"outline"===n.data.type||"transmission"===n.data.type||"noise"===n.data.type||"vertexColor"===n.data.type)continue;let t="string"==typeof n.data.alpha?Number(e.getVariable(n.data.alpha)):n.data.alpha;if("color"===n.data.type&&t>.3){i=w(n.data.color,e),s=t;break}if(("depth"===n.data.type||"gradient"===n.data.type)&&t>.3){let t=k(n.data);i={r:t[0],g:t[1],b:t[2]},s="string"==typeof n.data.alpha?1:n.data.alpha;break}}return{...i,a:s}}("string"==typeof e?this.sharedAssets.data.materials[e]:e,this.sharedAssets);this.helper.setCaretColor(i)}},this.stopAnimateTextCursor=()=>{clearInterval(this.caretInterval),this.helper&&(this.helper.caretMesh.visible=!1)},this.startAnimateTextCursor=()=>{this.stopAnimateTextCursor(),this.helper&&(this.helper.caretMesh.visible=!0,this.caretInterval=setInterval(()=>{this.helper&&(this.helper.caretMesh.visible=!this.helper.caretMesh.visible),this.requestRender()},600))},this.handleCaretUpdate=t=>{if(!this.htmlInput||!this.virtualInput)return;let e=this.helper,i="ArrowLeft"===t?.key||"ArrowRight"===t?.key,s="ArrowUp"===t?.key||"ArrowDown"===t?.key;this.htmlInput.selectionStart===this.htmlInput.selectionEnd?(e.setCaretPosition(this.htmlInput.selectionStart,{horizontalKeyMove:i,verticalKeyMove:s}),this.startAnimateTextCursor()):e.setSelection(this.htmlInput.selectionStart,this.htmlInput.selectionEnd),this.requestRender()},this.containerScene.add(this.helper)}createInput(){return this.htmlInput=function(){let t=document.createElement("textarea");return t.style.position="fixed",t.style.top="200px",t.style.left="400px",t.style.zIndex="-1",t.style.border="1px solid rgba(255,0,0,0.5)",t.style.width="10px",t.style.height="500px",t.style.color="white",t.style.opacity="0.5",t.style.background="transparent",t.style.display="none",t.style.margin="0px",t.style.padding="0px",t.style.boxSizing="content-box",t.style.pointerEvents="none",t}(),this.htmlInput}connect(){}disconnect(){this.stopAnimateTextCursor(),this.helper.hide(),this.htmlInput?.remove(),this.doubleClickHandler.stop()}handleMouseDown(){if(!this.htmlInput||!this.virtualInput)return!0;this.getPointOnPlane();let t=this.doubleClickHandler.clickCount,e=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,t>1?"inside":"previous")??{index:0,lineIndex:0,characterIndex:0},{lineIndex:i}=e,{index:s,characterIndex:n}=e;this.virtualInput?.wrappedText?.length&&"\n"===this.virtualInput.wrappedText[i][Math.max(0,n-1)]&&(s--,n--),this._lastIndex=s,this._isFirstDragMove=!0;let r=this.checkClickedObject();if(1===t){if(null===r)return this.onExit(this.virtualInput),!0;this.selectionOnDragStart=s,this.isDragging=!0,this.setInputSelection(s)}else r===this.virtualInput&&(2===t?this.selectClosestWord(i,n):t>2&&(this.setInputSelection(0,this.htmlInput.value.length),this.doubleClickHandler.reset()))}handleMouseUp(){this.applyRangeToTextInput(),this.isDragging=!1,this._isFirstDragMove=!1}handleMouseMove(){!this.virtualInput||(this._isFirstDragMove&&this.doubleClickHandler.clickCount>1&&(this.selectionOnDragStart=this._lastIndex,this.isDragging=!0,this.setInputSelection(this._lastIndex)),this._isFirstDragMove=!1,this.getPointOnPlane(),this.applyRangeToTextInput())}focus(t){if(this.virtualInput=t,this.updateTextInputStyles(),this.htmlInput)if(t){let t=this.data?.geometry.text;this.htmlInput.value="string"==typeof t?"":t?.textValue.toString()??""}else this.htmlInput.value=""}blur(){}get data(){let{virtualInput:t}=this;if(t)return t.dataPatched}applyRangeToTextInput(){if(!this.isDragging||!this.virtualInput||!this.htmlInput)return;let t=this.selectionOnDragStart,{index:e,lineIndex:i,characterIndex:s}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,this.doubleClickHandler.clickCount>2?"inside":"previous")??{index:0},n=e;void 0!==i&&void 0!==s&&"\n"===this.virtualInput?.wrappedText[i][s-1]&&n--,this.htmlInput.setSelectionRange(Math.min(t,n),Math.max(t,n))}checkClickedObject(){if(this.virtualInput){let t=this.raycaster.intersectObject(this.virtualInput,!1);if(t.length>0){let e=t[0];if(e.object instanceof f)return e.object}}return null}selectClosestWord(t,e){if(!this.virtualInput)return;let i=this.virtualInput.wrappedText,s=i[t],n=e+1,r=e;" "!==s[e]&&(n=this.findNextCharOccurence(s,e,"forward"," "),r=this.findNextCharOccurence(s,e,"backward"," "),r>0&&r++,n>=s.length-1&&t===i.length-1&&n++);let a=this.helper,o=a.getGlobalIndexFromLineAndCharIndexes(i,t,r),h=a.getGlobalIndexFromLineAndCharIndexes(i,t,n);this.setInputSelection(o,h)}findNextCharOccurence(t,e,i,s=" "){let n=Math.max(0,t.length-1),r="forward"===i?n:0,a="forward"===i?1:-1,o=Math.max(Math.min(e,n),0);for(;o!==r;)if(o+=a,t.charAt(o)===s)return o;return r}getPointOnPlane(){let t=this.virtualInput?.data;if(this.virtualInput&&t&&this.raycaster.ray.intersectsPlane(this.plane)){null===this.planeIntersection&&(this.planeIntersection=new p);let e=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(e){this.planeIntersection.copy(this.virtualInput.worldToLocal(e));let i="number"==typeof t.geometry.width?t.geometry.width:1,s="number"==typeof t.geometry.height?t.geometry.height:1;this.projected.set(e.x+.5*i,e.y-.5*s)}}}updatePlane(){let t=this.virtualInput?.data;this.virtualInput&&t&&(S.getNormalMatrix(this.virtualInput.matrixWorld),D.copy(j).applyMatrix3(S).normalize(),this.virtualInput.localToWorld(T.set(0,0,t.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(D,T))}setInputSelection(t,e=t){this.htmlInput?.setSelectionRange(t,e),n&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){let t=this.virtualInput?.data;var e;this.virtualInput&&t&&this.htmlInput&&(this.htmlInput.style.fontSize=t.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=t.geometry.letterSpacing*t.geometry.fontSize+"px",this.htmlInput.style.lineHeight=t.geometry.fontSize*t.geometry.lineHeight+"px",this.htmlInput.style.width=t.geometry.width+"px",this.htmlInput.style.height=t.geometry.height+"px",this.htmlInput.style.textAlign=4===(e=t.geometry.horizontalAlign)?"justify":2===e?"right":3===e?"center":"left")}},L=(t,e)=>{if("string"==typeof t){let i=e.data(t);if(i)return L(i.value,e)}return h.getDisplayedValue(t)};function U(t,e){let i=t.text,s="";if("string"==typeof i){let t=e.variables.data(s);t&&(s=L(t.value,e.variables))}else s=i.textValue.toString();return s}var H=class extends e{constructor(t,e){super(t),this.eventManager=e,this._textInputs=[],this.sceneHelpers=new c,this.helper=new C,this._onMouseDownFocusIn=t=>{if(s.length>1)return;this.eventContext.updateRaycaster(t);let e=null;if(this.eventContext.raycaster)for(let t of this._textInputs)if(this.eventContext.raycaster.intersectObject(t,!0).length>0){e=t;break}this.focusOnTextInput(e),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(t),this._onMouseDown(t)},this.onExit=()=>{let{virtualInput:t}=this.textInputManager;if(null===t)return;let e=this.textInputManager.htmlInput;this.helper.hide(),e?.setSelectionRange(e.value.length,e.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:i}=this.eventContext;i.removeEventListener("pointerdown",this._onMouseDown,!1),i.removeEventListener("pointerup",this._onMouseUp,!1),i.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),i.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()},this._onMouseDown=t=>{this.eventContext.updateRaycaster(t),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)},this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)},this._onMouseMove=t=>{this.eventContext.updateRaycaster(t),this.textInputManager.handleMouseMove()},this._onTextEdit=t=>{let{htmlInput:e,virtualInput:i,helper:s}=this.textInputManager;if(!e||!i)return;let n=e.value;i.textGeometry.setText(n,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let r=i.data;s.update();let a=r.geometry.text;if("string"==typeof a){let t=a;this.eventContext.sharedAssets.updateVariable(t,{textValue:n})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=t=>{this.textInputManager.handleCaretUpdate(t)},this._onKeyPress=t=>{"Escape"===t.key&&this.onExit()},this.textInputManager=new A(this.sceneHelpers,t.raycaster,t.sharedAssets,t.requestRender,this.onExit)}connect(){let t=[];if(this.eventContext.scene.traverseEntity(e=>{e instanceof f&&t.push(e)}),this._textInputs=t,0===t.length)return;let{domElement:e}=this.eventContext;e.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let i=this.textInputManager.createInput();document.body.appendChild(i),i.style.display="none",i.addEventListener("keyup",this._onCaretUpdate),i.addEventListener("keydown",this._onCaretUpdate),i.addEventListener("beforeinput",this._onCaretUpdate),i.addEventListener("paste",this._onCaretUpdate),i.addEventListener("cut",this._onCaretUpdate),i.addEventListener("select",this._onCaretUpdate),i.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let t=this.textInputManager.htmlInput,{domElement:e,sharedAssets:i}=this.eventContext;e.removeEventListener("pointerdown",this._onMouseDownFocusIn),t?.removeEventListener("keyup",this._onCaretUpdate),t?.removeEventListener("keydown",this._onCaretUpdate),t?.removeEventListener("beforeinput",this._onCaretUpdate),t?.removeEventListener("paste",this._onCaretUpdate),t?.removeEventListener("cut",this._onCaretUpdate),t?.removeEventListener("select",this._onCaretUpdate),t?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(t=>{let e=U(t.data.geometry,this.eventContext.sharedAssets.data);t.textGeometry.setText(e,i)}),e.removeEventListener("pointerdown",this._onMouseDown,!1),e.removeEventListener("pointerup",this._onMouseUp,!1),e.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(t){this.textInputManager.focus(t),this.textInputManager.onTextMaterialChanged();let e=this.textInputManager.htmlInput;if(!e||null===t)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let i=U(t.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);e.value=i,e.setSelectionRange(0,0),this.textInputManager.helper.show(t),e.style.display="block",e.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:s}=this.eventContext;s.removeEventListener("pointerdown",this._onMouseDownFocusIn),s.addEventListener("pointerdown",this._onMouseDown,!1),s.addEventListener("pointerup",this._onMouseUp,!1),s.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}};i("Textfields",({eventContext:t,eventManager:e})=>new H(t,e)),a("InputGeometry",(t,e,i)=>new f(t,e,i)),r("textinputs");
1
+ import{a as t}from"./runtime-chunk-ZTHLLGVX.js";import{a as e,b as i}from"./runtime-chunk-DZNU62CT.js";import{a as s}from"./runtime-chunk-VAVYZ35B.js";import{c as n}from"./runtime-chunk-FQNSP44B.js";import"./runtime-chunk-3D6ELLRB.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import"./runtime-chunk-R3V4RB3X.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-U4QOT2PX.js";import{a as r,f as a}from"./runtime-chunk-TZCHGFVF.js";import{D as o,Ha as h}from"./runtime-chunk-VPEJ5BFD.js";import{Dc as l,Fc as p,Gc as u,Sc as d,Vc as c,Vd as g,bd as m,dd as x,kd as v,l as y,ld as I,rd as M}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var f=class extends t{constructor(t,e,i){super(t,e,i),this.data=e}},C=class extends d{constructor(){super(),this.caretIndex=0,this._caretVisibleAlpha=1,this._selectionVisibleAlpha=.3,this.current={start:0,end:void 0},this.matrixAutoUpdate=!1,this.caretMesh=new I(new g(1,1),new v({transparent:!0,opacity:0,side:y})),this.add(this.caretMesh),this.selectionMesh=new I(new g(1,1),new v({color:2857471,transparent:!0,depthTest:!1,depthWrite:!1,opacity:0,side:y})),this.add(this.selectionMesh),this.hide()}get caretHeight(){return this.object?.AD??0}show(t){this.visible=!0,this.object=t,this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.y=.5*-this.caretHeight,this.setCaretPosition(this.caretIndex),this.update()}hide(){this.visible=!1}update(){if(void 0===this.object)return;this.updateHelperMatrix();let{depth:t}=this.object.geometry.userData.parameters;this.caretMesh.position.z=t,this.selectionMesh.position.z=t}updateHelperMatrix(){if(void 0===this.object)return;let t=this.object,e=t.parent;null!==e&&e.updateWorldMatrix(!0,!1),t.matrixAutoUpdate&&t.updateMatrix(),null!==e?(this.matrixWorld.multiplyMatrices(e.matrixWorld,t.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,t.matrix)):this.matrixWorld.multiplyMatrices(t.hiddenMatrix,t.matrix),this.matrix.copy(this.matrixWorld);for(let t of this.children)t.matrixWorld.copy(this.matrixWorld);t.updateWorldMatrix(!0,!0)}setCaretColor(t){let e=this.caretMesh.material;e.color.setRGB(t.r,t.g,t.b);let i=this._caretVisibleAlpha===e.opacity;this._caretVisibleAlpha=t.a,i&&(e.opacity=this._caretVisibleAlpha)}setSelectionColor(t){this.selectionMesh.material.color.setRGB(t.r,t.g,t.b)}setCaretPosition(t,e={}){if(void 0===this.object)return;this.caretIndex=t;let i=this.object.wrappedText,[s,n]=_(i,t),[r,a]=t>0?_(i,t-1):[null,null];"\n"===(t>0&&i.length?i[r].charAt(a):null)&&(s++,n=0),this.current.start=t,this.current.end=void 0;let[o,h]=b(this.object,s,n),{AD:l,descender:p}=this.object,u=p+.5*l,{width:d,height:c,depth:g}=this.object.geometry.userData.parameters,m="string"==typeof d?0:d,x="string"==typeof c?0:c;this.caretMesh.scale.set(1,this.caretHeight,1),this.caretMesh.position.set(o-.5*m,h+u+.5*x,g),this.hideSelectionMesh(),this.showCaretMesh()}setSelection(t,e){if(void 0===this.object)return;let i=this.object.wrappedText;this.current.start=t,this.current.end=e;let s=[],n=[],r=function(t,e,i){let[s,n]=_(t,e),[r,a]=_(t,i),o=[];n>=t[s].length&&(s++,n=0);for(let e=s;e<=r;e++){let i=t[e],h=e===s?n:0,l=e===r?a:i.length;o.push([e,h,l])}return o}(i,t,e),{lineHeight:a,AD:o,descender:h}=this.object,l=h+.5*o-.5*a;for(let[t,e,i]of r)if(e!==i){let[r,o]=b(this.object,t,e),[h,p]=b(this.object,t,i),u=o,d=p;u+=l,d+=l,d+=a;let c=s.length/3;s.push(r,u,0),s.push(h,u,0),s.push(h,d,0),s.push(r,d,0),n.push(c+0,c+1,c+2),n.push(c+2,c+3,c+0)}let p=new x;p.setIndex(n),p.setAttribute("position",new m(s,3));let{width:u,height:d,depth:c}=this.object.geometry.userData.parameters,g="string"==typeof u?0:u,v="string"==typeof d?0:d;this.selectionMesh.geometry.dispose(),this.selectionMesh.geometry=p,this.selectionMesh.position.x=.5*-g,this.selectionMesh.position.y=.5*v,this.selectionMesh.position.z=c,this.showSelectionMesh(),this.hideCaretMesh()}getSelectionFromPosition(t,e,i="previous"){if(void 0===this.object||void 0===this.object.font)return;let s=this.object.wrappedText,n=s.length,r=this.object.lineHeight,a=n*r,{height:o,verticalAlign:h}=this.object.geometry.userData.parameters,l="string"==typeof o?0:o,p=0;3===h?p=l-a:2===h&&(p=.5*l-.5*a);let u=Math.min(Math.floor(Math.max(Math.min(-e-p,a),0)/r),n-1),d=this.object.charCoords[u],c=this.object.charWidths[u],g=0,m=!1;if("previous"===i){for(let e=0;e<d.length;e++)if(d[e][0]+.5*c[e]-t>0){g=e,m=!0;break}}else if("closest"===i){let e=1/0;for(let i=0;i<d.length;i++){let s=d[i][0]+.5*c[i],n=Math.abs(s-t);n<e&&(e=n,g=i,m=!0)}}else for(let e=0;e<d.length;e++){let i=d[e][0],s=d[e][0]+c[e];if(t>=i&&t<s){g=e,m=!0;break}}return m||(g=d.length),{index:this.getGlobalIndexFromLineAndCharIndexes(s,u,g),lineIndex:u,characterIndex:g}}getGlobalIndexFromLineAndCharIndexes(t,e,i){return t.slice(0,e).reduce((t,e)=>t+e.length,0)+i}showSelectionMesh(){this.selectionMesh.material.opacity=this._selectionVisibleAlpha}hideSelectionMesh(){this.selectionMesh.material.opacity=0}showCaretMesh(){this.caretMesh.material.opacity=this._caretVisibleAlpha}hideCaretMesh(){this.caretMesh.material.opacity=0}};function b(t,e,i){let{charCoords:s,charWidths:n,initialOffsetY:r,lineHeight:a}=t;if(s[e]&&0===s[e].length||0===s.length){let i=0,{horizontalAlign:s}=t.data.geometry,n=t.wrappedText,{width:o}=t.geometry.userData.parameters;return 1===n.length&&0===n[0].length&&(3===s?i=.5*o:2===s&&(i=o)),[i,r-a*e]}let o=s[e];if(void 0===o||0===o.length)return[0,0];let[h,l]=o[Math.min(i,o.length-1)],p=h;return i>=o.length&&(p+=n[e][i-1]),[p,l]}function _(t,e){let i=0;for(let s=0;s<t.length;s++){let n=t[s],r=e-i;if(r<=n.length)return[s,r];i+=n.length}return[Math.max(0,t.length-1),t[t.length-1]?.length??0]}function w(t,e){return"string"==typeof t?e.data.colors[t]:t}function k(t){return t.colors[0]}var E=class{constructor(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0],this._delay=500,this._distance=2,this._onMouseDown=t=>{let e=[t.clientX,t.clientY],i=(new Date).getTime();if(this._clickCount>0){let t=e[0]-this._lastPosition[0],i=e[1]-this._lastPosition[1];Math.sqrt(t*t+i*i)>this._distance&&(this._clickCount=0)}this._lastPosition=e,this._clickCount=i-this._lastTime>this._delay?1:this._clickCount+1,this._lastTime=i},this._onMouseUp=t=>{}}start(t,e=500,i=2){this._target&&this.stop(),this.reset(),this._delay=e,this._distance=i,this._target=t,this._target.addEventListener("pointerdown",this._onMouseDown,!1),this._target.addEventListener("pointerup",this._onMouseUp,!1)}stop(){this._target&&(this._target.removeEventListener("pointerdown",this._onMouseDown,!1),this._target.removeEventListener("pointerup",this._onMouseUp,!1),this._target=void 0)}get clickCount(){return this._clickCount}reset(){this._clickCount=0,this._lastTime=0,this._lastPosition=[0,0]}},j=new p(0,0,1),D=new p,T=new p,L=new u,S=class{constructor(t,e,i,s,n){this.containerScene=t,this.raycaster=e,this.sharedAssets=i,this.requestRender=s,this.onExit=n,this.htmlInput=null,this.virtualInput=null,this.helper=new C,this.doubleClickHandler=new E,this.isDragging=!1,this.plane=new M,this.caretInterval=0,this.planeIntersection=new p,this.projected=new l,this._lastIndex=0,this._isFirstDragMove=!1,this.selectionOnDragStart=0,this.onTextMaterialChanged=()=>{let t=this.virtualInput?.data;if(void 0!==this.virtualInput&&t){let e=t.material,i=function(t,e){let i=o.fromHex(3223857),s=.8;for(let n of t.layers){if("light"===n.data.type||"displace"===n.data.type||"fresnel"===n.data.type||"dust"===n.data.type||"matcap"===n.data.type||"texture"===n.data.type||"toon"===n.data.type||"outline"===n.data.type||"transmission"===n.data.type||"noise"===n.data.type||"vertexColor"===n.data.type)continue;let t="string"==typeof n.data.alpha?Number(e.getVariable(n.data.alpha)):n.data.alpha;if("color"===n.data.type&&t>.3){i=w(n.data.color,e),s=t;break}if(("depth"===n.data.type||"gradient"===n.data.type)&&t>.3){let t=k(n.data);i={r:t[0],g:t[1],b:t[2]},s="string"==typeof n.data.alpha?1:n.data.alpha;break}}return{...i,a:s}}("string"==typeof e?this.sharedAssets.data.materials[e]:e,this.sharedAssets);this.helper.setCaretColor(i)}},this.stopAnimateTextCursor=()=>{clearInterval(this.caretInterval),this.helper&&(this.helper.caretMesh.visible=!1)},this.startAnimateTextCursor=()=>{this.stopAnimateTextCursor(),this.helper&&(this.helper.caretMesh.visible=!0,this.caretInterval=setInterval(()=>{this.helper&&(this.helper.caretMesh.visible=!this.helper.caretMesh.visible),this.requestRender()},600))},this.handleCaretUpdate=t=>{if(!this.htmlInput||!this.virtualInput)return;let e=this.helper,i="ArrowLeft"===t?.key||"ArrowRight"===t?.key,s="ArrowUp"===t?.key||"ArrowDown"===t?.key;this.htmlInput.selectionStart===this.htmlInput.selectionEnd?(e.setCaretPosition(this.htmlInput.selectionStart,{horizontalKeyMove:i,verticalKeyMove:s}),this.startAnimateTextCursor()):e.setSelection(this.htmlInput.selectionStart,this.htmlInput.selectionEnd),this.requestRender()},this.containerScene.add(this.helper)}createInput(){return this.htmlInput=function(){let t=document.createElement("textarea");return t.style.position="fixed",t.style.top="200px",t.style.left="400px",t.style.zIndex="-1",t.style.border="1px solid rgba(255,0,0,0.5)",t.style.width="10px",t.style.height="500px",t.style.color="white",t.style.opacity="0.5",t.style.background="transparent",t.style.display="none",t.style.margin="0px",t.style.padding="0px",t.style.boxSizing="content-box",t.style.pointerEvents="none",t}(),this.htmlInput}connect(){}disconnect(){this.stopAnimateTextCursor(),this.helper.hide(),this.htmlInput?.remove(),this.doubleClickHandler.stop()}handleMouseDown(){if(!this.htmlInput||!this.virtualInput)return!0;this.getPointOnPlane();let t=this.doubleClickHandler.clickCount,e=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,t>1?"inside":"previous")??{index:0,lineIndex:0,characterIndex:0},{lineIndex:i}=e,{index:s,characterIndex:n}=e;this.virtualInput?.wrappedText?.length&&"\n"===this.virtualInput.wrappedText[i][Math.max(0,n-1)]&&(s--,n--),this._lastIndex=s,this._isFirstDragMove=!0;let r=this.checkClickedObject();if(1===t){if(null===r)return this.onExit(this.virtualInput),!0;this.selectionOnDragStart=s,this.isDragging=!0,this.setInputSelection(s)}else r===this.virtualInput&&(2===t?this.selectClosestWord(i,n):t>2&&(this.setInputSelection(0,this.htmlInput.value.length),this.doubleClickHandler.reset()))}handleMouseUp(){this.applyRangeToTextInput(),this.isDragging=!1,this._isFirstDragMove=!1}handleMouseMove(){!this.virtualInput||(this._isFirstDragMove&&this.doubleClickHandler.clickCount>1&&(this.selectionOnDragStart=this._lastIndex,this.isDragging=!0,this.setInputSelection(this._lastIndex)),this._isFirstDragMove=!1,this.getPointOnPlane(),this.applyRangeToTextInput())}focus(t){if(this.virtualInput=t,this.updateTextInputStyles(),this.htmlInput)if(t){let t=this.data?.geometry.text;this.htmlInput.value="string"==typeof t?"":t?.textValue.toString()??""}else this.htmlInput.value=""}blur(){}get data(){let{virtualInput:t}=this;if(t)return t.dataPatched}applyRangeToTextInput(){if(!this.isDragging||!this.virtualInput||!this.htmlInput)return;let t=this.selectionOnDragStart,{index:e,lineIndex:i,characterIndex:s}=this.helper.getSelectionFromPosition(this.projected.x,this.projected.y,this.doubleClickHandler.clickCount>2?"inside":"previous")??{index:0},n=e;void 0!==i&&void 0!==s&&"\n"===this.virtualInput?.wrappedText[i][s-1]&&n--,this.htmlInput.setSelectionRange(Math.min(t,n),Math.max(t,n))}checkClickedObject(){if(this.virtualInput){let t=this.raycaster.intersectObject(this.virtualInput,!1);if(t.length>0){let e=t[0];if(e.object instanceof f)return e.object}}return null}selectClosestWord(t,e){if(!this.virtualInput)return;let i=this.virtualInput.wrappedText,s=i[t],n=e+1,r=e;" "!==s[e]&&(n=this.findNextCharOccurence(s,e,"forward"," "),r=this.findNextCharOccurence(s,e,"backward"," "),r>0&&r++,n>=s.length-1&&t===i.length-1&&n++);let a=this.helper,o=a.getGlobalIndexFromLineAndCharIndexes(i,t,r),h=a.getGlobalIndexFromLineAndCharIndexes(i,t,n);this.setInputSelection(o,h)}findNextCharOccurence(t,e,i,s=" "){let n=Math.max(0,t.length-1),r="forward"===i?n:0,a="forward"===i?1:-1,o=Math.max(Math.min(e,n),0);for(;o!==r;)if(o+=a,t.charAt(o)===s)return o;return r}getPointOnPlane(){let t=this.virtualInput?.data;if(this.virtualInput&&t&&this.raycaster.ray.intersectsPlane(this.plane)){null===this.planeIntersection&&(this.planeIntersection=new p);let e=this.raycaster.ray.intersectPlane(this.plane,this.planeIntersection);if(e){this.planeIntersection.copy(this.virtualInput.worldToLocal(e));let i="number"==typeof t.geometry.width?t.geometry.width:1,s="number"==typeof t.geometry.height?t.geometry.height:1;this.projected.set(e.x+.5*i,e.y-.5*s)}}}updatePlane(){let t=this.virtualInput?.data;this.virtualInput&&t&&(L.getNormalMatrix(this.virtualInput.matrixWorld),D.copy(j).applyMatrix3(L).normalize(),this.virtualInput.localToWorld(T.set(0,0,t.geometry.depth)),this.plane.setFromNormalAndCoplanarPoint(D,T))}setInputSelection(t,e=t){this.htmlInput?.setSelectionRange(t,e),n&&this.htmlInput?.focus(),setTimeout(()=>{this.htmlInput?.focus()})}updateTextInputStyles(){let t=this.virtualInput?.data;var e;this.virtualInput&&t&&this.htmlInput&&(this.htmlInput.style.fontSize=t.geometry.fontSize+"px",this.htmlInput.style.letterSpacing=t.geometry.letterSpacing*t.geometry.fontSize+"px",this.htmlInput.style.lineHeight=t.geometry.fontSize*t.geometry.lineHeight+"px",this.htmlInput.style.width=t.geometry.width+"px",this.htmlInput.style.height=t.geometry.height+"px",this.htmlInput.style.textAlign=4===(e=t.geometry.horizontalAlign)?"justify":2===e?"right":3===e?"center":"left")}},A=(t,e)=>{if("string"==typeof t){let i=e.data(t);if(i)return A(i.value,e)}return h.getDisplayedValue(t)};function U(t,e){let i=t.text,s="";if("string"==typeof i){let t=e.variables.data(s);t&&(s=A(t.value,e.variables))}else s=i.textValue.toString();return s}var H=class extends e{constructor(t,e){super(t),this.eventManager=e,this._textInputs=[],this.sceneHelpers=new c,this.helper=new C,this._onMouseDownFocusIn=t=>{if(s.length>1)return;this.eventContext.updateRaycaster(t);let e=null;if(this.eventContext.raycaster)for(let t of this._textInputs)if(this.eventContext.raycaster.intersectObject(t,!0).length>0){e=t;break}this.focusOnTextInput(e),this._onCaretUpdate(),this._onMouseUp(),this.textInputManager.doubleClickHandler.start(this.eventContext.domElement),this.textInputManager.doubleClickHandler._onMouseDown(t),this._onMouseDown(t)},this.onExit=()=>{let{virtualInput:t}=this.textInputManager;if(null===t)return;let e=this.textInputManager.htmlInput;this.helper.hide(),e?.setSelectionRange(e.value.length,e.value.length),this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!0);let{domElement:i}=this.eventContext;i.removeEventListener("pointerdown",this._onMouseDown,!1),i.removeEventListener("pointerup",this._onMouseUp,!1),i.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.textInputManager.doubleClickHandler.reset(),i.addEventListener("pointerdown",this._onMouseDownFocusIn),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers()},this._onMouseDown=t=>{this.eventContext.updateRaycaster(t),this.textInputManager.handleMouseDown(),this.textInputManager.virtualInput&&this.eventContext.raycaster.intersectObject(this.textInputManager.virtualInput,!0).length>0&&this.eventManager.controlsManager.orbitControls&&(this.eventManager.controlsManager.orbitControls.enabled=!1)},this._onMouseUp=()=>{this.textInputManager.handleMouseUp(),this.eventManager.controlsManager.orbitControls&&!this.eventManager.controlsManager.orbitControls.enabled&&(this.eventManager.controlsManager.orbitControls.enabled=!0)},this._onMouseMove=t=>{this.eventContext.updateRaycaster(t),this.textInputManager.handleMouseMove()},this._onTextEdit=t=>{let{htmlInput:e,virtualInput:i,helper:s}=this.textInputManager;if(!e||!i)return;let n=e.value;i.textGeometry.setText(n,this.eventContext.sharedAssets).then(()=>{this.eventContext.requestRender()});let r=i.data;s.update();let a=r.geometry.text;if("string"==typeof a){let t=a;this.eventContext.sharedAssets.updateVariable(t,{textValue:n})}this.textInputManager.updateTextInputStyles(),this._onCaretUpdate()},this._onCaretUpdate=t=>{this.textInputManager.handleCaretUpdate(t)},this._onKeyPress=t=>{"Escape"===t.key&&this.onExit()},this.textInputManager=new S(this.sceneHelpers,t.raycaster,t.sharedAssets,t.requestRender,this.onExit)}connect(){let t=[];if(this.eventContext.scene.traverseEntity(e=>{e instanceof f&&t.push(e)}),this._textInputs=t,0===t.length)return;let{domElement:e}=this.eventContext;e.addEventListener("pointerdown",this._onMouseDownFocusIn),this.textInputManager.connect();let i=this.textInputManager.createInput();document.body.appendChild(i),i.style.display="none",i.addEventListener("keyup",this._onCaretUpdate),i.addEventListener("keydown",this._onCaretUpdate),i.addEventListener("beforeinput",this._onCaretUpdate),i.addEventListener("paste",this._onCaretUpdate),i.addEventListener("cut",this._onCaretUpdate),i.addEventListener("select",this._onCaretUpdate),i.addEventListener("selectstart",this._onCaretUpdate)}disconnect(){let t=this.textInputManager.htmlInput,{domElement:e,sharedAssets:i}=this.eventContext;e.removeEventListener("pointerdown",this._onMouseDownFocusIn),t?.removeEventListener("keyup",this._onCaretUpdate),t?.removeEventListener("keydown",this._onCaretUpdate),t?.removeEventListener("beforeinput",this._onCaretUpdate),t?.removeEventListener("paste",this._onCaretUpdate),t?.removeEventListener("cut",this._onCaretUpdate),t?.removeEventListener("select",this._onCaretUpdate),t?.removeEventListener("selectstart",this._onCaretUpdate),this._textInputs.forEach(t=>{let e=U(t.data.geometry,this.eventContext.sharedAssets.data);t.textGeometry.setText(e,i)}),e.removeEventListener("pointerdown",this._onMouseDown,!1),e.removeEventListener("pointerup",this._onMouseUp,!1),e.removeEventListener("pointermove",this._onMouseMove,!1),window.removeEventListener("keydown",this._onKeyPress),this.eventContext.renderer.sceneHelpersOnTop=void 0,this.eventContext.renderer.pipeline.disableHelpers(),this.textInputManager.disconnect()}focusOnTextInput(t){this.textInputManager.focus(t),this.textInputManager.onTextMaterialChanged();let e=this.textInputManager.htmlInput;if(!e||null===t)return;this.textInputManager.updateTextInputStyles(),this.eventContext.renderer.sceneHelpersOnTop=this.sceneHelpers,this.eventContext.renderer.pipeline.enableHelpers(),this.textInputManager.isDragging=!1;let i=U(t.textGeometry.userData.parameters,this.eventContext.sharedAssets.data);e.value=i,e.setSelectionRange(0,0),this.textInputManager.helper.show(t),e.style.display="block",e.addEventListener("input",this._onTextEdit),this.textInputManager.updatePlane();let{domElement:s}=this.eventContext;s.removeEventListener("pointerdown",this._onMouseDownFocusIn),s.addEventListener("pointerdown",this._onMouseDown,!1),s.addEventListener("pointerup",this._onMouseUp,!1),s.addEventListener("pointermove",this._onMouseMove,!1),window.addEventListener("keydown",this._onKeyPress)}};i("Textfields",({eventContext:t,eventManager:e})=>new H(t,e)),a("InputGeometry",(t,e,i)=>new f(t,e,i)),r("textinputs");
@@ -1 +1 @@
1
- import{a as t,b as e,c as i,d as a,e as n,f as s,h as r,i as o}from"./runtime-chunk-OUXEWX5Z.js";import"./runtime-chunk-KE6HNYUL.js";import"./runtime-chunk-NTUTXO7Q.js";import{a as l}from"./runtime-chunk-R43XZP65.js";import{a as d}from"./runtime-chunk-5JEZ42OM.js";import{a as h,b as u}from"./runtime-chunk-F3ZACLZW.js";import"./runtime-chunk-YULW5JRE.js";import"./runtime-chunk-FTVQTRM7.js";import{a as c}from"./runtime-chunk-32KZP4YN.js";import"./runtime-chunk-E3IEBR27.js";import"./runtime-chunk-EJJZJ5MV.js";import"./runtime-chunk-AELTGHV2.js";import{Y as m,ca as p}from"./runtime-chunk-DK66VKWP.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{b as g,e as f}from"./runtime-chunk-EPHVY3XO.js";import"./runtime-chunk-CKT62HES.js";import{d as y}from"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import{g as v,h as x,i as M}from"./runtime-chunk-U4QOT2PX.js";import{a as b}from"./runtime-chunk-TZCHGFVF.js";import{A as N,B as k,C,D as T,E as j,q as O,z as E}from"./runtime-chunk-VPEJ5BFD.js";import{Bc as w,Cc as F}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var P=0;function A(){P++}function L(t,e){return(e.epoch!==P||e.t!==t.t||e.index!==t.index)&&(e.epoch=P,e.t=t.t,e.index=t.index,!0)}function D(t,e,i,a){if(e){let n={},s=[...e.keyframes??[]].sort((t,e)=>t.data.time-e.data.time);if("data"in t){let e=s[0];e&&i?.(e.data.value,t),n={index:[],t:[]};for(let t=0;t<s.length-1;t++){let e=s[t],i=s[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0};n.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),n.index.push({...a,value:t,easing:"linear"})}if(s.length>1){let e={t:0,index:0},r={t:NaN,index:NaN};return{targets:e,...n,update:()=>{if(!L(e,r))return;let n=Math.ceil(e.index),o=n%2==0?e.t:1-e.t,l=s?.[Math.min(n,s.length-1)].data.value,d=s?.[Math.min(n,s.length-1)+1]?.data.value,h={},u={};if(Object.keys(l).length>0&&Object.keys(d).length>0)for(let e in t.data)if(e in l&&e in d){let t=I(l[e],d[e],o,a);void 0!==t&&(h[e]=t,u[e]={start:l,end:d,t:o})}i?.({...h},t,u)}}}}}}function I(t,e,i,a){if("string"==typeof t&&a&&(t=a.color(t)),"string"==typeof e&&a&&(e=a.color(e)),"number"==typeof t)return F.lerp(t,e,i);if(j.is(t))return j.lerp(t,e,i);if(T.is(t))return T.lerp(t,e,i);if(Array.isArray(t))return(t.length>e.length?e:t).map((a,n)=>{if(Array.isArray(a)){let a=t[n].length>e[n].length?e[n].length:t[n].length;return(4===a?k:3===a?N:E).lerp(t[n],e[n],i)}return F.lerp(t[n],e[n],i)});if("object"==typeof t&&null!==t){let n={};for(let s in t){let r=I(t[s],e[s],i,a);void 0!==r&&(n[s]=r)}return n}}var _=new Map,H=new Map,S=class extends w{constructor(s,g,f,b,N,k,T){super(),this.id=s,this.data=g,this.scene=f,this.sharedAssets=b,this.object=N,this.eventType=k,this.actionCondition=T,this.toggleIsForward=!1,this._finished=!1,this.hasPlayedOnce=!1,this._shouldForwardLoop=!1,this._shouldPauseOnNextLoopComplete=!1,this.hiddenMatrixOverrides=[],this._onLoopComplete=()=>{this._shouldPauseOnNextLoopComplete&&(this.timeline.pause(),this._shouldPauseOnNextLoopComplete=!1)};try{let s=r(this.data);"number"==typeof s.loop&&s.loop--,this.timeline=l.timeline({...s,autoplay:!1}),this._shouldForwardLoop=!0===s.loop||"number"==typeof s.loop&&s.loop>1;let g=this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping;Object.entries(g).forEach(([s,r])=>{let o=this.scene.find(s);if(!o)return;let l=o.data.timelineAnimations[r];if(!l)return;let g=o.data.states.data(r);g?.hiddenMatrix&&16===g.hiddenMatrix.length&&!C.isEqual(g.hiddenMatrix,o.data.hiddenMatrix)&&this.hiddenMatrixOverrides.push({objId:s,original:o.hiddenMatrix.clone(),state:g.hiddenMatrix});let N=function(n,s,r,o){let l=[];return s.properties.forEach(s=>{let g=s.data.path?.[0];if(g&&["position","rotation","scale"].includes(g)){let t=function(t,e=()=>{}){let i=[];for(let a of M){let n=[...t.keyframes??[]].filter(t=>void 0!==t.data.value[a]).sort((t,e)=>t.data.time-e.data.time),s=n[0];s&&e?.(s.data.value);let r={index:[],t:[]};for(let t=0;t<n.length-1;t++){let e=n[t],i=n[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*n[0].data.time:0};r.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),r.index.push({...a,value:t,easing:"linear"})}if(n.length>1){let t={t:0,index:0},s={t:NaN,index:NaN};i.push({targets:t,...r,update:()=>{if(!L(t,s))return;let i=Math.ceil(t.index),r=i%2==0?t.t:1-t.t,o=n?.[i].data.value,l=n?.[i+1]?.data.value;void 0!==o&&void 0!==l&&e?.({[a]:o[a]+(l[a]-o[a])*r})}})}}return i}(s.data,r?.[g]);t&&l.push(...t)}if(g&&"shape size"===g&&"geometry"in n){let t=function(t,e,i){let a=[];for(let t of M){let n={},s=[...e.keyframes??[]].filter(e=>void 0!==e.data.value[t]).sort((t,e)=>t.data.time-e.data.time),r=s[0];r&&i?.(r.data.value),n={index:[],t:[]};for(let t=0;t<s.length-1;t++){let e=s[t],i=s[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0};n.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),n.index.push({...a,value:t,easing:"linear"})}if(s.length>1){let e={t:0,index:0},r={t:NaN,index:NaN};a.push({targets:e,...n,update:()=>{if(!L(e,r))return;let a=Math.ceil(e.index),n=a%2==0?e.t:1-e.t,o=s?.[a].data.value,l=s?.[a+1]?.data.value;void 0!==o&&void 0!==l&&i?.({[t]:o[t]+(l[t]-o[t])*n})}})}}return a}(0,s.data,r?.shapeSize);t&&l.push(...t)}if(g&&"path extrusion"===g&&y(n)){let e=function(e,i,a){let n={},s=[...i.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),r=s[0];r&&a?.(e,r.data.value),n={index:[],t:[]};for(let t=0;t<s.length-1;t++){let e=s[t],i=s[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0};n.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),n.index.push({...a,value:t,easing:"linear"})}if(s.length>1){let i={t:0,index:0},r={t:NaN,index:NaN};return{targets:i,...n,update:()=>{if(!L(i,r))return;let n=Math.ceil(i.index),o=n%2==0?i.t:1-i.t,l=s?.[Math.min(n,s.length-1)].data.value,d=s?.[Math.min(n,s.length-1)+1]?.data.value;a?.(e,t(e,l,d,o))}}}}(n,s.data,r?.pathExtrusion);e&&l.push(e)}if(g&&"path snapping"===g&&n.data.pathSnapping){let t=function(t,i,a){let n={},s=[...i.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),r=s[0];r&&a?.(r.data.value),n={index:[],t:[]};for(let t=0;t<s.length-1;t++){let e=s[t],i=s[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0};n.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),n.index.push({...a,value:t,easing:"linear"})}if(s.length>1){let i={t:0,index:0},r={t:NaN,index:NaN};return{targets:i,...n,update:()=>{if(!L(i,r))return;let n=Math.ceil(i.index),o=n%2==0?i.t:1-i.t,l=s?.[Math.min(n,s.length-1)].data.value,d=s?.[Math.min(n,s.length-1)+1]?.data.value;a?.(e(t,l,d,o))}}}}(n,s.data,r?.pathSnapping);t&&l.push(t)}if(g&&"material"===g&&"Mesh"===n.type&&"material"in n){let t=p(n.material)?n.material:void 0;if(t){let e=s.data.id;if(e){let i=(s.data.keyframes??[]).some(t=>m(t.data.value?.noiseStrength)),a=t.ensureRainbowNoiseCompiled,n=e=>{i&&"function"==typeof a&&a.call(t,e)};n(e);let d=t.getLayerByUuid(e);if(d){let t=D(d,s.data,r?.material,o);t&&l.push(t)}else{let e=s.data.type;for(let i of t.getLayersOfType(e))n(i.uuid);let i=t.getLayersOfType(e);if(i)for(let t of i){let e=D(t,s.data,r?.material,o);e&&l.push(e)}}}}}if(g&&"opacity"===g&&"Mesh"===n.type&&"material"in n){let t=function(t,e){if(t){let i={},a=[...t.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),n=a[0];n&&e?.(n.data.value),i={index:[],t:[]};for(let t=0;t<a.length-1;t++){let e=a[t],n=a[t+1]??e,s={duration:1e3*(n?.data?.time-e.data.time),delay:0===t?1e3*a[0].data.time:0};i.t.push({...s,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(n.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),i.index.push({...s,value:t,easing:"linear"})}if(a.length>1){let t={t:0,index:0},n={t:NaN,index:NaN};return{targets:t,...i,update:()=>{if(!L(t,n))return;let i=Math.ceil(t.index),s=i%2==0?t.t:1-t.t,r=a?.[Math.min(i,a.length-1)].data.value,o=a?.[Math.min(i,a.length-1)+1]?.data.value;e?.(F.lerp(r,o,s))}}}}}(s.data,r?.opacity);t&&l.push(t)}if(g&&"cloner"===g){let t=function(t,e,n){let s={},r=[...e.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),o=r[0];o&&n?.(t,o.data.value,o.data.value),s={index:[],t:[]};for(let t=0;t<r.length-1;t++){let e=r[t],i=r[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*r[0].data.time:0};s.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),s.index.push({...a,value:t,easing:"linear"})}if(r.length>1){let e={t:0,index:0},o={t:NaN,index:NaN};return{targets:e,...s,update:()=>{if(!L(e,o))return;let s=Math.ceil(e.index),l=s%2==0?e.t:1-e.t,d=r?.[Math.min(s,r.length-1)].data.value,h=r?.[Math.min(s,r.length-1)+1]?.data.value;n?.(t,d.randomnessObject?void 0:i(d,h,l,t),d.randomnessObject?a(d,h,l,t):void 0)}}}}(n,s.data,r?.cloner);t&&l.push(t)}if(g&&"camera"===g&&n instanceof c){let t=function(t,e,i,a){if(e){let n={[a]:[]},s=[...e.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),r=s[0];r&&(t[a]=r.data.value,i?.(a,r.data.value));for(let t=0;t<s.length-1;t++){let e=s[t];if(!Number.isFinite(e.data.value))continue;let i=s[t+1]??e;n[a].push({value:i.data.value,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters),duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0})}if(s.length>1)return{targets:t,...n,update:()=>{i?.(a,t[a])}}}}(n,s.data,r?.camera,"zoom");t&&l.push(t)}if(g&&"light"===g&&(n instanceof h||n instanceof d||n instanceof u)){let t=function(t,e,i,a,n){if(e){let s={},r=[...e.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),o=r[0];if(o){let e=o.data.value;t[a]=e,i?.(a,e)}s={index:[],t:[]};for(let t=0;t<r.length-1;t++){let e=r[t],i=r[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*r[0].data.time:0};s.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),s.index.push({...a,value:t,easing:"linear"})}if(r.length>1){let t={t:0,index:0},e={t:NaN,index:NaN};return{targets:t,...s,update:()=>{if(!L(t,e))return;let s=Math.ceil(t.index),o=s%2==0?t.t:1-t.t,l=r?.[Math.min(s,r.length-1)].data.value,d=r?.[Math.min(s,r.length-1)+1]?.data.value;i?.(a,I(l,d,o,n))}}}}}(n,s.data,r?.light,s.data.path[1],o);t&&l.push(t)}}),l}(o,{...l},n(o,{scene:f,shared:b}),this.sharedAssets),k=("start"===this.data.delayDirection?this.data.delay:0)+("start-end"===this.data.delayDirection?this.data.delay:0)+("start-once"===this.data.delayDirection?this.data.delay:0);N.forEach(t=>{this.timeline.add(t,k)}),this.timeline.duration=1e3*l.to+k}),this.timeline.delay=0,this.timeline.duration+=("start"===this.data.delayDirection?this.data.delay:0)+("end"===this.data.delayDirection?this.data.delay:0)+("start-end"===this.data.delayDirection?2*this.data.delay:0)+("start-once"===this.data.delayDirection?2*this.data.delay:0),this.timeline.finished.then(()=>{Object.keys(g).forEach(t=>{let e=this.scene.find(t);e instanceof c&&e.dispatchEvent(o)}),this._finished=!0}),this.timeline.loopComplete=this._onLoopComplete}catch(t){throw new Error("Missing property")}N&&(H.has(N.uuid)?H.get(N.uuid).push(this):H.set(N.uuid,[this])),_.set(s,this)}get playing(){return!1===this.timeline.paused}get finished(){return this._finished}get paused(){return this.timeline.paused}applyStateHiddenMatrices(){for(let{objId:t,state:e}of this.hiddenMatrixOverrides){let i=this.scene.find(t);i&&i.hiddenMatrix.fromArray(e)}}restoreOriginalHiddenMatrices(){for(let{objId:t,original:e}of this.hiddenMatrixOverrides){let i=this.scene.find(t);i&&i.hiddenMatrix.copy(e)}}play(){let t=void 0!==this.eventType&&O(this.eventType)&&"Once"===this.data.runMode&&this.hasPlayedOnce&&this.paused&&this.timeline.currentTime>0&&!this._finished;if(void 0!==this.eventType&&O(this.eventType)&&"Once"===this.data.runMode&&this.hasPlayedOnce&&!t||void 0===this.eventType&&this._finished)return!1;this.hasPlayedOnce=!0,this.applyStateHiddenMatrices();let e=this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping;Object.keys(e).forEach(t=>{let e=this.scene.find(t);e instanceof c&&e.dispatchEvent(s)}),A(),this.paused&&this.timeline.currentTime>0?this.timeline.play():this.timeline.restart()}pauseTimeline(){this.paused||this.timeline.pause()}pause(){this.pauseTimeline()}stop(){this.pauseTimeline(),this.seek(0),this.timeline.reset(),this.restoreOriginalHiddenMatrices(),this._finished=!1}seek(t){this.timeline.seek(t*this.timeline.duration,!0)}toggle(t){let e=this.paused&&this.timeline.currentTime>0&&this.timeline.currentTime<this.timeline.duration;if(void 0!==t?this.toggleIsForward=t:e||(this.toggleIsForward=!this.toggleIsForward),this.playing){if(!this.toggleIsForward&&this.timeline.reversed&&this._shouldForwardLoop&&this.timeline.remaining%2==1)return void(this._shouldPauseOnNextLoopComplete=!0);this.timeline.reverse(this.timeline.duration-this.timeline.currentTime),this._shouldForwardLoop&&this.timeline.loop&&this.timeline.reversed&&(this._shouldPauseOnNextLoopComplete=!0)}else this.applyStateHiddenMatrices(),A(),(!this.toggleIsForward!==this.timeline.reversed||!this.toggleIsForward&&this.timeline.reversed&&"alternate"===this.timeline.direction)&&this.timeline.reverse(),"number"==typeof this.timeline.loop&&"number"==typeof this.timeline.remaining&&this.timeline.remaining<this.timeline.loop&&this.toggleIsForward&&(this.timeline.remaining=this.timeline.loop),this.timeline.play()}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pauseTimeline(),this.restoreOriginalHiddenMatrices()}},Z=class{constructor(t){this.data=t}dispatch(){this.data.playTimeline?this.pauseTimeline(this.data.playTimeline):this.data.object?this.pauseAllTimelinesFromObject(this.data.object):this.pauseAllTimelines()}pauseTimeline(t){let e=this.getTimelineActions(t);!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t[this.data.interaction]()}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t[this.data.interaction]()}))}getTimelineActions(t){let e=_.get(t);return e?[e]:[..._.values()].filter(e=>e.data.timeline===t)}pauseAllTimelinesFromObject(t){let e=H.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>t[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(t=>t[this.data.interaction]()))}pauseAllTimelines(){let t=[...H.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(t=>{t.forEach(t=>{t[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(t=>{t.forEach(t=>{t[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},U=class{constructor(t,e,i,a,n,s,r){this.data=e;let o="interaction"in e?e.interaction:"play";if("play"===o||void 0===o)this.interaction=new S(t,e,i,a,n,s,r);else{if("pause"!==o&&"stop"!==o)throw new Error("Missing property");this.interaction=new Z(e)}}get playing(){return this.interaction instanceof S&&this.interaction.playing}get finished(){return!(this.interaction instanceof S)||this.interaction.finished}get paused(){return!(this.interaction instanceof S)||this.interaction.paused}play(){if(this.interaction instanceof S)return this.interaction.play();this.interaction.dispatch()}stop(){this.interaction instanceof S&&this.interaction.stop()}seek(t){this.interaction instanceof S&&this.interaction.seek(t)}toggle(t){this.interaction instanceof S?this.interaction.toggle(t):this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof S?this.interaction.playFromCurrent():this.interaction.dispatch()}dispatchConditional(){this.interaction instanceof S?f(this.interaction.sharedAssets,this.interaction.actionCondition)&&this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof S&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};g("TimelineAnimation",({id:t,data:e,page:i,shared:a,object:n,eventType:s,actionCondition:r})=>new U(t,e,i.scene,a,n,s,r)),b("timeline");
1
+ import{a as t,b as e,c as i,d as a,e as n,f as s,h as r,i as o}from"./runtime-chunk-ROGQC3YL.js";import"./runtime-chunk-HRGNIGSC.js";import"./runtime-chunk-NTUTXO7Q.js";import{a as l}from"./runtime-chunk-R43XZP65.js";import{a as d}from"./runtime-chunk-5MDYMRYM.js";import{a as h,b as u}from"./runtime-chunk-VJPN4EM6.js";import"./runtime-chunk-33KX2TOT.js";import"./runtime-chunk-FTVQTRM7.js";import{a as c}from"./runtime-chunk-44F5FA4N.js";import"./runtime-chunk-KRQKRJPD.js";import"./runtime-chunk-YANJNJO2.js";import"./runtime-chunk-FJZAL2GU.js";import{Y as m,ca as p}from"./runtime-chunk-3D6ELLRB.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{b as g,e as f}from"./runtime-chunk-EPHVY3XO.js";import"./runtime-chunk-R3V4RB3X.js";import{d as y}from"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import{g as v,h as x,i as M}from"./runtime-chunk-U4QOT2PX.js";import{a as N}from"./runtime-chunk-TZCHGFVF.js";import{A as b,B as k,C,D as T,E as j,q as O,z as F}from"./runtime-chunk-VPEJ5BFD.js";import{Bc as w,Cc as P}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var E=0;function A(){E++}function D(t,e){return(e.epoch!==E||e.t!==t.t||e.index!==t.index)&&(e.epoch=E,e.t=t.t,e.index=t.index,!0)}function L(t,e,i,a){if(e){let n={},s=[...e.keyframes??[]].sort((t,e)=>t.data.time-e.data.time);if("data"in t){let e=s[0];e&&i?.(e.data.value,t),n={index:[],t:[]};for(let t=0;t<s.length-1;t++){let e=s[t],i=s[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0};n.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),n.index.push({...a,value:t,easing:"linear"})}if(s.length>1){let e={t:0,index:0},r={t:NaN,index:NaN};return{targets:e,...n,update:()=>{if(!D(e,r))return;let n=Math.ceil(e.index),o=n%2==0?e.t:1-e.t,l=s?.[Math.min(n,s.length-1)].data.value,d=s?.[Math.min(n,s.length-1)+1]?.data.value,h={},u={};if(Object.keys(l).length>0&&Object.keys(d).length>0)for(let e in t.data)if(e in l&&e in d){let t=I(l[e],d[e],o,a);void 0!==t&&(h[e]=t,u[e]={start:l,end:d,t:o})}i?.({...h},t,u)}}}}}}function I(t,e,i,a){if("string"==typeof t&&a&&(t=a.color(t)),"string"==typeof e&&a&&(e=a.color(e)),"number"==typeof t)return P.lerp(t,e,i);if(j.is(t))return j.lerp(t,e,i);if(T.is(t))return T.lerp(t,e,i);if(Array.isArray(t))return(t.length>e.length?e:t).map((a,n)=>{if(Array.isArray(a)){let a=t[n].length>e[n].length?e[n].length:t[n].length;return(4===a?k:3===a?b:F).lerp(t[n],e[n],i)}return P.lerp(t[n],e[n],i)});if("object"==typeof t&&null!==t){let n={};for(let s in t){let r=I(t[s],e[s],i,a);void 0!==r&&(n[s]=r)}return n}}var _=new Map,H=new Map,R=class extends w{constructor(s,g,f,N,b,k,T){super(),this.id=s,this.data=g,this.scene=f,this.sharedAssets=N,this.object=b,this.eventType=k,this.actionCondition=T,this.toggleIsForward=!1,this._finished=!1,this.hasPlayedOnce=!1,this._shouldForwardLoop=!1,this._shouldPauseOnNextLoopComplete=!1,this.hiddenMatrixOverrides=[],this._onLoopComplete=()=>{this._shouldPauseOnNextLoopComplete&&(this.timeline.pause(),this._shouldPauseOnNextLoopComplete=!1)};try{let s=r(this.data);"number"==typeof s.loop&&s.loop--,this.timeline=l.timeline({...s,autoplay:!1}),this._shouldForwardLoop=!0===s.loop||"number"==typeof s.loop&&s.loop>1;let g=this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping;Object.entries(g).forEach(([s,r])=>{let o=this.scene.find(s);if(!o)return;let l=o.data.timelineAnimations[r];if(!l)return;let g=o.data.states.data(r);g?.hiddenMatrix&&16===g.hiddenMatrix.length&&!C.isEqual(g.hiddenMatrix,o.data.hiddenMatrix)&&this.hiddenMatrixOverrides.push({objId:s,original:o.hiddenMatrix.clone(),state:g.hiddenMatrix});let b=function(n,s,r,o){let l=[];return s.properties.forEach(s=>{let g=s.data.path?.[0];if(g&&["position","rotation","scale"].includes(g)){let t=function(t,e=()=>{}){let i=[];for(let a of M){let n=[...t.keyframes??[]].filter(t=>void 0!==t.data.value[a]).sort((t,e)=>t.data.time-e.data.time),s=n[0];s&&e?.(s.data.value);let r={index:[],t:[]};for(let t=0;t<n.length-1;t++){let e=n[t],i=n[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*n[0].data.time:0};r.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),r.index.push({...a,value:t,easing:"linear"})}if(n.length>1){let t={t:0,index:0},s={t:NaN,index:NaN};i.push({targets:t,...r,update:()=>{if(!D(t,s))return;let i=Math.ceil(t.index),r=i%2==0?t.t:1-t.t,o=n?.[i].data.value,l=n?.[i+1]?.data.value;void 0!==o&&void 0!==l&&e?.({[a]:o[a]+(l[a]-o[a])*r})}})}}return i}(s.data,r?.[g]);t&&l.push(...t)}if(g&&"shape size"===g&&"geometry"in n){let t=function(t,e,i){let a=[];for(let t of M){let n={},s=[...e.keyframes??[]].filter(e=>void 0!==e.data.value[t]).sort((t,e)=>t.data.time-e.data.time),r=s[0];r&&i?.(r.data.value),n={index:[],t:[]};for(let t=0;t<s.length-1;t++){let e=s[t],i=s[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0};n.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),n.index.push({...a,value:t,easing:"linear"})}if(s.length>1){let e={t:0,index:0},r={t:NaN,index:NaN};a.push({targets:e,...n,update:()=>{if(!D(e,r))return;let a=Math.ceil(e.index),n=a%2==0?e.t:1-e.t,o=s?.[a].data.value,l=s?.[a+1]?.data.value;void 0!==o&&void 0!==l&&i?.({[t]:o[t]+(l[t]-o[t])*n})}})}}return a}(0,s.data,r?.shapeSize);t&&l.push(...t)}if(g&&"path extrusion"===g&&y(n)){let e=function(e,i,a){let n={},s=[...i.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),r=s[0];r&&a?.(e,r.data.value),n={index:[],t:[]};for(let t=0;t<s.length-1;t++){let e=s[t],i=s[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0};n.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),n.index.push({...a,value:t,easing:"linear"})}if(s.length>1){let i={t:0,index:0},r={t:NaN,index:NaN};return{targets:i,...n,update:()=>{if(!D(i,r))return;let n=Math.ceil(i.index),o=n%2==0?i.t:1-i.t,l=s?.[Math.min(n,s.length-1)].data.value,d=s?.[Math.min(n,s.length-1)+1]?.data.value;a?.(e,t(e,l,d,o))}}}}(n,s.data,r?.pathExtrusion);e&&l.push(e)}if(g&&"path snapping"===g&&n.data.pathSnapping){let t=function(t,i,a){let n={},s=[...i.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),r=s[0];r&&a?.(r.data.value),n={index:[],t:[]};for(let t=0;t<s.length-1;t++){let e=s[t],i=s[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0};n.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),n.index.push({...a,value:t,easing:"linear"})}if(s.length>1){let i={t:0,index:0},r={t:NaN,index:NaN};return{targets:i,...n,update:()=>{if(!D(i,r))return;let n=Math.ceil(i.index),o=n%2==0?i.t:1-i.t,l=s?.[Math.min(n,s.length-1)].data.value,d=s?.[Math.min(n,s.length-1)+1]?.data.value;a?.(e(t,l,d,o))}}}}(n,s.data,r?.pathSnapping);t&&l.push(t)}if(g&&"material"===g&&"Mesh"===n.type&&"material"in n){let t=p(n.material)?n.material:void 0;if(t){let e=s.data.id;if(e){let i=(s.data.keyframes??[]).some(t=>m(t.data.value?.noiseStrength)),a=t.ensureRainbowNoiseCompiled,n=e=>{i&&"function"==typeof a&&a.call(t,e)};n(e);let d=t.getLayerByUuid(e);if(d){let t=L(d,s.data,r?.material,o);t&&l.push(t)}else{let e=s.data.type;for(let i of t.getLayersOfType(e))n(i.uuid);let i=t.getLayersOfType(e);if(i)for(let t of i){let e=L(t,s.data,r?.material,o);e&&l.push(e)}}}}}if(g&&"opacity"===g&&"Mesh"===n.type&&"material"in n){let t=function(t,e){if(t){let i={},a=[...t.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),n=a[0];n&&e?.(n.data.value),i={index:[],t:[]};for(let t=0;t<a.length-1;t++){let e=a[t],n=a[t+1]??e,s={duration:1e3*(n?.data?.time-e.data.time),delay:0===t?1e3*a[0].data.time:0};i.t.push({...s,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(n.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),i.index.push({...s,value:t,easing:"linear"})}if(a.length>1){let t={t:0,index:0},n={t:NaN,index:NaN};return{targets:t,...i,update:()=>{if(!D(t,n))return;let i=Math.ceil(t.index),s=i%2==0?t.t:1-t.t,r=a?.[Math.min(i,a.length-1)].data.value,o=a?.[Math.min(i,a.length-1)+1]?.data.value;e?.(P.lerp(r,o,s))}}}}}(s.data,r?.opacity);t&&l.push(t)}if(g&&"cloner"===g){let t=function(t,e,n){let s={},r=[...e.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),o=r[0];o&&n?.(t,o.data.value,o.data.value),s={index:[],t:[]};for(let t=0;t<r.length-1;t++){let e=r[t],i=r[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*r[0].data.time:0};s.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),s.index.push({...a,value:t,easing:"linear"})}if(r.length>1){let e={t:0,index:0},o={t:NaN,index:NaN};return{targets:e,...s,update:()=>{if(!D(e,o))return;let s=Math.ceil(e.index),l=s%2==0?e.t:1-e.t,d=r?.[Math.min(s,r.length-1)].data.value,h=r?.[Math.min(s,r.length-1)+1]?.data.value;n?.(t,d.randomnessObject?void 0:i(d,h,l,t),d.randomnessObject?a(d,h,l,t):void 0)}}}}(n,s.data,r?.cloner);t&&l.push(t)}if(g&&"camera"===g&&n instanceof c){let t=function(t,e,i,a){if(e){let n={[a]:[]},s=[...e.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),r=s[0];r&&(t[a]=r.data.value,i?.(a,r.data.value));for(let t=0;t<s.length-1;t++){let e=s[t];if(!Number.isFinite(e.data.value))continue;let i=s[t+1]??e;n[a].push({value:i.data.value,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters),duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*s[0].data.time:0})}if(s.length>1)return{targets:t,...n,update:()=>{i?.(a,t[a])}}}}(n,s.data,r?.camera,"zoom");t&&l.push(t)}if(g&&"light"===g&&(n instanceof h||n instanceof d||n instanceof u)){let t=function(t,e,i,a,n){if(e){let s={},r=[...e.keyframes??[]].sort((t,e)=>t.data.time-e.data.time),o=r[0];if(o){let e=o.data.value;t[a]=e,i?.(a,e)}s={index:[],t:[]};for(let t=0;t<r.length-1;t++){let e=r[t],i=r[t+1]??e,a={duration:1e3*(i?.data?.time-e.data.time),delay:0===t?1e3*r[0].data.time:0};s.t.push({...a,value:t%2==0?1:0,easing:x(e.data.easing.type,{control1:v(e.data.easing.cubicControls?.control1,[0,0]),control2:v(i.data.easing.cubicControls?.control2,[1,1])},e.data.easing.springParameters)}),s.index.push({...a,value:t,easing:"linear"})}if(r.length>1){let t={t:0,index:0},e={t:NaN,index:NaN};return{targets:t,...s,update:()=>{if(!D(t,e))return;let s=Math.ceil(t.index),o=s%2==0?t.t:1-t.t,l=r?.[Math.min(s,r.length-1)].data.value,d=r?.[Math.min(s,r.length-1)+1]?.data.value;i?.(a,I(l,d,o,n))}}}}}(n,s.data,r?.light,s.data.path[1],o);t&&l.push(t)}}),l}(o,{...l},n(o,{scene:f,shared:N}),this.sharedAssets),k=("start"===this.data.delayDirection?this.data.delay:0)+("start-end"===this.data.delayDirection?this.data.delay:0)+("start-once"===this.data.delayDirection?this.data.delay:0);b.forEach(t=>{this.timeline.add(t,k)}),this.timeline.duration=1e3*l.to+k}),this.timeline.delay=0,this.timeline.duration+=("start"===this.data.delayDirection?this.data.delay:0)+("end"===this.data.delayDirection?this.data.delay:0)+("start-end"===this.data.delayDirection?2*this.data.delay:0)+("start-once"===this.data.delayDirection?2*this.data.delay:0),this.timeline.finished.then(()=>{Object.keys(g).forEach(t=>{let e=this.scene.find(t);e instanceof c&&e.dispatchEvent(o)}),this._finished=!0}),this.timeline.loopComplete=this._onLoopComplete}catch(t){throw new Error("Missing property")}b&&(H.has(b.uuid)?H.get(b.uuid).push(this):H.set(b.uuid,[this])),_.set(s,this)}get playing(){return!1===this.timeline.paused}get finished(){return this._finished}get paused(){return this.timeline.paused}applyStateHiddenMatrices(){for(let{objId:t,state:e}of this.hiddenMatrixOverrides){let i=this.scene.find(t);i&&i.hiddenMatrix.fromArray(e)}}restoreOriginalHiddenMatrices(){for(let{objId:t,original:e}of this.hiddenMatrixOverrides){let i=this.scene.find(t);i&&i.hiddenMatrix.copy(e)}}play(){let t=void 0!==this.eventType&&O(this.eventType)&&"Once"===this.data.runMode&&this.hasPlayedOnce&&this.paused&&this.timeline.currentTime>0&&!this._finished;if(void 0!==this.eventType&&O(this.eventType)&&"Once"===this.data.runMode&&this.hasPlayedOnce&&!t||void 0===this.eventType&&this._finished)return!1;this.hasPlayedOnce=!0,this.applyStateHiddenMatrices();let e=this.sharedAssets.data.timelineAnimations[this.data.timeline].mapping;Object.keys(e).forEach(t=>{let e=this.scene.find(t);e instanceof c&&e.dispatchEvent(s)}),A(),this.paused&&this.timeline.currentTime>0?this.timeline.play():this.timeline.restart()}pauseTimeline(){this.paused||this.timeline.pause()}pause(){this.pauseTimeline()}stop(){this.pauseTimeline(),this.seek(0),this.timeline.reset(),this.restoreOriginalHiddenMatrices(),this._finished=!1}seek(t){this.timeline.seek(t*this.timeline.duration,!0)}toggle(t){let e=this.paused&&this.timeline.currentTime>0&&this.timeline.currentTime<this.timeline.duration;if(void 0!==t?this.toggleIsForward=t:e||(this.toggleIsForward=!this.toggleIsForward),this.playing){if(!this.toggleIsForward&&this.timeline.reversed&&this._shouldForwardLoop&&this.timeline.remaining%2==1)return void(this._shouldPauseOnNextLoopComplete=!0);this.timeline.reverse(this.timeline.duration-this.timeline.currentTime),this._shouldForwardLoop&&this.timeline.loop&&this.timeline.reversed&&(this._shouldPauseOnNextLoopComplete=!0)}else this.applyStateHiddenMatrices(),A(),(!this.toggleIsForward!==this.timeline.reversed||!this.toggleIsForward&&this.timeline.reversed&&"alternate"===this.timeline.direction)&&this.timeline.reverse(),"number"==typeof this.timeline.loop&&"number"==typeof this.timeline.remaining&&this.timeline.remaining<this.timeline.loop&&this.toggleIsForward&&(this.timeline.remaining=this.timeline.loop),this.timeline.play()}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){this.pauseTimeline(),this.restoreOriginalHiddenMatrices()}},S=class{constructor(t){this.data=t}dispatch(){this.data.playTimeline?this.pauseTimeline(this.data.playTimeline):this.data.object?this.pauseAllTimelinesFromObject(this.data.object):this.pauseAllTimelines()}pauseTimeline(t){let e=this.getTimelineActions(t);!e.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>{t[this.data.interaction]()}),this.disposeDelay()},this.data.delay)):e.forEach(t=>{t[this.data.interaction]()}))}getTimelineActions(t){let e=_.get(t);return e?[e]:[..._.values()].filter(e=>e.data.timeline===t)}pauseAllTimelinesFromObject(t){let e=H.get(t);!e?.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{e.forEach(t=>t[this.data.interaction]()),this.disposeDelay()},this.data.delay)):e.forEach(t=>t[this.data.interaction]()))}pauseAllTimelines(){let t=[...H.values()];!t.length||(this.data.delay>0?(this.disposeDelay(),this.timeoutId=window.setTimeout(()=>{t.forEach(t=>{t.forEach(t=>{t[this.data.interaction]()})}),this.disposeDelay()},this.data.delay)):t.forEach(t=>{t.forEach(t=>{t[this.data.interaction]()})}))}disposeDelay(){clearTimeout(this.timeoutId),delete this.timeoutId}dispose(){clearTimeout(this.timeoutId),delete this.timeoutId}},B=class{constructor(t,e,i,a,n,s,r){this.data=e;let o="interaction"in e?e.interaction:"play";if("play"===o||void 0===o)this.interaction=new R(t,e,i,a,n,s,r);else{if("pause"!==o&&"stop"!==o)throw new Error("Missing property");this.interaction=new S(e)}}get playing(){return this.interaction instanceof R&&this.interaction.playing}get finished(){return!(this.interaction instanceof R)||this.interaction.finished}get paused(){return!(this.interaction instanceof R)||this.interaction.paused}play(){if(this.interaction instanceof R)return this.interaction.play();this.interaction.dispatch()}stop(){this.interaction instanceof R&&this.interaction.stop()}seek(t){this.interaction instanceof R&&this.interaction.seek(t)}toggle(t){this.interaction instanceof R?this.interaction.toggle(t):this.interaction.dispatch()}playFromCurrent(){this.interaction instanceof R?this.interaction.playFromCurrent():this.interaction.dispatch()}dispatchConditional(){this.interaction instanceof R?f(this.interaction.sharedAssets,this.interaction.actionCondition)&&this.interaction.playFromCurrent():this.interaction.dispatch()}reverseFromCurrent(){this.interaction instanceof R&&this.interaction.reverseFromCurrent()}dispose(){this.interaction.dispose()}};g("TimelineAnimation",({id:t,data:e,page:i,shared:a,object:n,eventType:s,actionCondition:r})=>new B(t,e,i.scene,a,n,s,r)),N("timeline");
@@ -1 +1 @@
1
- import{a as e}from"./runtime-chunk-NBYTQLIB.js";import{f as t}from"./runtime-chunk-YULW5JRE.js";import{a as n,b as i}from"./runtime-chunk-DZNU62CT.js";import{a as s}from"./runtime-chunk-VAVYZ35B.js";import{e as a}from"./runtime-chunk-FQNSP44B.js";import"./runtime-chunk-32KZP4YN.js";import"./runtime-chunk-EJJZJ5MV.js";import"./runtime-chunk-AELTGHV2.js";import"./runtime-chunk-DK66VKWP.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f as o,g as r}from"./runtime-chunk-EPHVY3XO.js";import{d,v as l}from"./runtime-chunk-CKT62HES.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-U4QOT2PX.js";import{a as u}from"./runtime-chunk-TZCHGFVF.js";import{s as h,t as c}from"./runtime-chunk-VPEJ5BFD.js";import{Ec as p,Fc as m,Oc as v,rd as g}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var E=new m,f=new m,w=new m,y=new m,L=new g,F={type:"requestRender"},M=function(){let e=new m,t=new m;return(n,i,s)=>s>0?(e.subVectors(n,i),e.length()<=s?n:t.copy(i).add(e.normalize().multiplyScalar(s))):i}(),x=function(){let e=new v;return(n,i)=>{n.position.copy(i),null!==n.parent&&(e.copy(n.parent.matrixWorld).invert(),n.position.applyMatrix4(e)),e.copy(n.hiddenMatrix).invert(),n.position.applyMatrix4(e),n.updateMatrix(),n.hasNonUniformScale&&(n.updateMatrixWorld(),n.updateMatrixWorldRigid()),n instanceof l&&t(n.parent)&&n.invalidateDownstreamBooleanData(!0)}}(),D=class{constructor(e,t,n,i,s,a){this.data=e,this.id=t,this.object=n,this.paused=!1,this.currentDampingFactor=1,this.snapComplete=!1,this.isReset=!1,this.worldPosition0=new m,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...h.defaultData,...e,...void 0===e.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===e.target||"cursor"===e.target||(this.target=i.find(e.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.resetDampingFactor=80/this.data.resetSpeed+1,this.object.getWorldPosition(this.worldPosition0),this.actions=o(e,e.actions,i,s,a,n)}},P=class extends n{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.pairOfEventListeners=[],this.onMouseMove=e=>{if(!(s.length>1)){this.eventContext.updateRaycaster(e);for(let e of this.events)void 0===e.target&&this.updateSingleEvent(e)}},this.onMouseEnter=e=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=e=>{for(let e of this.events)void 0===e.target&&(e.data.resetOnPointerLeave&&(e.isReset=!0,e.currentDampingFactor=e.resetDampingFactor),this.updateSingleEvent(e))},this.onTargetChange=e=>()=>{this.updateSingleEvent(e)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(t=>{let n=t.data?.events.find(e=>"Follow"===e.data.type&&!e.data.disabled);n&&(!e.data.globalPhysics.usePhysics||"dynamic"!==t.dataPatched.physics?.rigidBody)&&this.events.push(new D(n.data,n.id,t,e,this.eventContext.sharedAssets,this.eventManager))}),!this.events.length)return;let{domElement:t,eventElement:n}=this.eventContext;this.domEventsNeeded.clear(),a&&(this.domEventsNeeded.add("pointerdown"),t.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),n.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents||(t.addEventListener("pointerenter",this.onMouseEnter),t.addEventListener("pointerleave",this.onMouseLeave));for(let e of this.events)if(void 0!==e.target){let t=e.target,n=this.onTargetChange(e);this.pairOfEventListeners.push([t,n]),t.addEventListener("requestRender",n)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;this.domEventsNeeded.clear(),a&&e.removeEventListener("pointerdown",this.onMouseMove),t.removeEventListener("pointermove",this.onMouseMove),e.removeEventListener("pointerenter",this.onMouseEnter),e.removeEventListener("pointerleave",this.onMouseLeave);for(let[e,t]of this.pairOfEventListeners)e.removeEventListener("requestRender",t);for(let e of this.events)e.paused=!0,e.isReset=!1,r(e.actions)}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e,!0)}updateSingleEvent(e,t=!1){this.events.forEach(e=>{e.actions.Create.forEach(e=>{e.dispatchThrottled()})});let{plane:n,limitDistance:i,limitDistanceEnabled:s}=e.data;if(e.object.getWorldPosition(w),e.isReset)y.copy(e.worldPosition0);else if(e.target)e.target.getWorldPosition(y);else{let{getCamera:e,raycaster:t}=this.eventContext;if("custom"===n?(e().getWorldDirection(f),f.negate(),E.copy(f)):"xy"===n?E.set(0,0,1):"xz"===n?E.set(0,1,0):"yz"===n&&E.set(1,0,0),L.setFromNormalAndCoplanarPoint(E,w),!t.ray.intersectPlane(L,y))return}if(!e.isReset)if(y.distanceTo(e.worldPosition0)>i&&s&&e.target){if(e.snapComplete=!1,e.data.snapDelay&&(e.delayFinished=!1,typeof window<"u"&&null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,!e.data.resetAfterDistanceLimit)return;y.copy(e.worldPosition0),e.currentDampingFactor=e.resetDampingFactor}else if(e.wasOutside&&(e.data.snapDelay&&typeof window<"u"&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},1e3*e.data.snapDelay)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),!1===e.delayFinished)return;!1===e.data.enabledTranslation[0]&&(y.x=w.x),!1===e.data.enabledTranslation[1]&&(y.y=w.y),!1===e.data.enabledTranslation[2]&&(y.z=w.z);let a=M(w,y,e.wasOutside?0:e.data.maxDelta);if(e.currentDampingFactor>1){let n=E.subVectors(a,w).divideScalar(e.currentDampingFactor);w.add(n),t&&x(e.object,w),e.paused=n.length()<.01}else x(e.object,a),e.paused=!0;e.object?.dispatchEvent({type:"beginEvent",eventName:"Follow"}),e.object.dispatchEvent(F)}},b=new m,j=new m,C=new v,R=new p,N=new p,S=new m,k=new m,O=new m,Q=new m,z=new g,T={type:"requestRender"},W={type:"changeRotation"},V=function(){let e=new v;return function(n,i){null!==n.parent?e.multiplyMatrices(n.parent.matrixWorld,n.hiddenMatrix):e.copy(n.hiddenMatrix),i.premultiply(d(e).invert()),n.rotation.setFromRotationMatrix(i),n.updateMatrix(),n instanceof l&&t(n.parent)&&n.invalidateDownstreamBooleanData(!0)}}(),A=class{constructor(e,t,n,i){this.id=t,this.object=n,this.paused=!1,this.currentDampingFactor=1,this.isReset=!1,this.worldQuaternion0=new p,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...c.defaultData,...e,...void 0===e.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===e.target||"cursor"===e.target||(this.target=i.find(e.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.object.getWorldQuaternion(this.worldQuaternion0),isNaN(this.worldQuaternion0.x)&&(this.worldQuaternion0.x=0),isNaN(this.worldQuaternion0.y)&&(this.worldQuaternion0.y=0),isNaN(this.worldQuaternion0.z)&&(this.worldQuaternion0.z=0),isNaN(this.worldQuaternion0.w)&&(this.worldQuaternion0.w=1),this.resetDampingFactor=80/this.data.resetSpeed+1}},U=class extends n{constructor(){super(...arguments),this.events=[],this.pairOfEventListeners=[],this.pairOfUserEventListeners=[],this.onMouseMove=e=>{if(!(s.length>1)){this._lastMouseEvent=e,this.eventContext.updateRaycaster(e);for(let e of this.events)void 0===e.target&&this.updateSingleEvent(e)}},this.onMouseEnter=e=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=e=>{for(let e of this.events)void 0===e.target&&(e.data.resetOnPointerLeave&&(e.isReset=!0,e.currentDampingFactor=e.resetDampingFactor),this.updateSingleEvent(e))},this.onScroll=e=>{if(this._lastMouseEvent){let e=new PointerEvent("pointermove",{clientX:this._lastMouseEvent.clientX,clientY:this._lastMouseEvent.clientY,bubbles:!0,cancelable:!0,view:window});this.eventContext.eventElement.dispatchEvent(e)}},this.onTargetChange=e=>()=>{this.updateSingleEvent(e)},this.createUserEventListener=t=>({eventName:n,target:i})=>{if(!n||!i)return;let s=e(n);s&&"LookAt"===s&&this.updateSingleEvent(t)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(t=>{let n=t.data?.events.find(e=>"LookAt"===e.data.type&&!e.data.disabled);n&&(!e.data.globalPhysics.usePhysics||"dynamic"!==t.dataPatched.physics?.rigidBody)&&this.events.push(new A(n.data,n.id,t,e))}),!this.events.length)return;let{domElement:t,eventElement:n}=this.eventContext;this.domEventsNeeded.clear(),a&&(this.domEventsNeeded.add("pointerdown"),t.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),n.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents?n.addEventListener("scroll",this.onScroll):(t.addEventListener("pointerenter",this.onMouseEnter),t.addEventListener("pointerleave",this.onMouseLeave));for(let e of this.events){if(void 0!==e.target){let t=this.onTargetChange(e),n=e.target;this.pairOfEventListeners.push([n,t]),n.addEventListener("requestRender",t)}let t=this.createUserEventListener(e),n=e.object;this.pairOfUserEventListeners.push([n,t]),n.addEventListener("userEvent",t)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;this.domEventsNeeded.clear(),a&&e.removeEventListener("pointerdown",this.onMouseMove),t.removeEventListener("pointermove",this.onMouseMove),e.removeEventListener("pointerenter",this.onMouseEnter),e.removeEventListener("pointerleave",this.onMouseLeave),t.removeEventListener("scroll",this.onScroll);for(let[e,t]of this.pairOfEventListeners)e.removeEventListener("requestRender",t);for(let[e,t]of this.pairOfUserEventListeners)e.removeEventListener("userEvent",t);for(let e of this.events)e.paused=!0,e.isReset=!1}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e)}updateSingleEvent(e){let{tilt:t,axis:n,distance:i,plane:s,limitDistance:a,enabledRotation:o,limitDistanceEnabled:r}=e.data,{getCamera:l,raycaster:u}=this.eventContext,{object:h,target:c}=e;if(h.getWorldPosition(S),!e.isReset)if(e.target)e.target.getWorldPosition(k);else{if("custom"===s?(l().getWorldDirection(j),j.negate(),z.setFromNormalAndCoplanarPoint(j,S)):("xy"===s?b.set(0,0,1):"xz"===s?b.set(0,1,0):"yz"===s&&b.set(1,0,0),z.setFromNormalAndCoplanarPoint(b,S)),!u.ray.intersectPlane(z,k))return;i>0&&("custom"===s||void 0===s)&&k.addScaledVector(j,i)}if(e.isReset||(c?"target"===t?O.copy(c.up).applyMatrix4(C.extractRotation(c.matrixWorld)).normalize():o.some(e=>!1===e)?("x"===n?(Q.set(0,0,1),!1===o[2]&&Q.set(0,1,0)):"y"===n?(Q.set(1,0,0),!1===o[0]&&Q.set(0,0,1)):(Q.set(0,1,0),!1===o[1]&&Q.set(1,0,0)),O.copy(Q).applyQuaternion(e.worldQuaternion0).normalize()):O.set(0,1,0):"custom"===s?O.set(0,1,0):O.copy(b)),e.isReset)N.copy(e.worldQuaternion0);else if(S.distanceTo(k)>a&&r&&c){if(e.data.snapDelay&&(e.delayFinished=!1,typeof window<"u"&&null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,!e.data.resetAfterDistanceLimit)return;N.copy(e.worldQuaternion0),e.currentDampingFactor=e.resetDampingFactor}else{if(e.wasOutside&&(e.data.snapDelay&&typeof window<"u"&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},1e3*e.data.snapDelay)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),!1===e.delayFinished)return;(function(e,t,n,i,s,a){let o=C.elements;Y.subVectors(t,n),0===Y.lengthSq()&&(Y.z=1),Y.normalize(),I.crossVectors(i,Y),0===I.lengthSq()&&(1===Math.abs(i.z)?Y.x+=1e-4:Y.z+=1e-4,Y.normalize(),I.crossVectors(i,Y)),I.normalize(),B.crossVectors(Y,I),"x"===s?1===a.z?[I,B,Y]=[Y,I,B]:(I.negate(),[I,Y]=[Y,I]):"y"===s?1===a.x?[I,B,Y]=[B,Y,I]:(I.negate(),[B,Y]=[Y,B]):1===a.x&&(I.negate(),[I,B]=[B,I]),o[0]=I.x,o[4]=B.x,o[8]=Y.x,o[1]=I.y,o[5]=B.y,o[9]=Y.y,o[2]=I.z,o[6]=B.z,o[10]=Y.z})(0,k,S,O,n,Q),N.setFromRotationMatrix(C),R.setFromUnitVectors(Q.applyQuaternion(N),O),o.some(e=>!1===e)&&"target"!==t&&N.premultiply(R).normalize()}e.currentDampingFactor>1?(h.updateWorldMatrix(!0,!1),R.setFromRotationMatrix(d(h.matrixWorld)),R.slerp(N,1/e.currentDampingFactor),V(h,C.makeRotationFromQuaternion(R)),e.paused=8*(1-R.dot(N))<1e-6):(V(h,C.makeRotationFromQuaternion(N)),e.paused=!0),e.object?.dispatchEvent({type:"beginEvent",eventName:"LookAt"}),h.dispatchEvent(T),h.dispatchEvent(W)}},B=new m,I=new m,Y=new m;i("Follow",({eventContext:e,eventManager:t})=>new P(e,t)),i("LookAt",({eventContext:e})=>new U(e)),u("tracking");
1
+ import{a as e}from"./runtime-chunk-NBYTQLIB.js";import{f as t}from"./runtime-chunk-33KX2TOT.js";import{a as n,b as i}from"./runtime-chunk-DZNU62CT.js";import{a as s}from"./runtime-chunk-VAVYZ35B.js";import{e as a}from"./runtime-chunk-FQNSP44B.js";import"./runtime-chunk-44F5FA4N.js";import"./runtime-chunk-YANJNJO2.js";import"./runtime-chunk-FJZAL2GU.js";import"./runtime-chunk-3D6ELLRB.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{f as o,g as r}from"./runtime-chunk-EPHVY3XO.js";import{d,v as l}from"./runtime-chunk-R3V4RB3X.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-U4QOT2PX.js";import{a as u}from"./runtime-chunk-TZCHGFVF.js";import{s as h,t as c}from"./runtime-chunk-VPEJ5BFD.js";import{Ec as p,Fc as m,Oc as v,rd as g}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var E=new m,f=new m,w=new m,y=new m,F=new g,L={type:"requestRender"},M=function(){let e=new m,t=new m;return(n,i,s)=>s>0?(e.subVectors(n,i),e.length()<=s?n:t.copy(i).add(e.normalize().multiplyScalar(s))):i}(),x=function(){let e=new v;return(n,i)=>{n.position.copy(i),null!==n.parent&&(e.copy(n.parent.matrixWorld).invert(),n.position.applyMatrix4(e)),e.copy(n.hiddenMatrix).invert(),n.position.applyMatrix4(e),n.updateMatrix(),n.hasNonUniformScale&&(n.updateMatrixWorld(),n.updateMatrixWorldRigid()),n instanceof l&&t(n.parent)&&n.invalidateDownstreamBooleanData(!0)}}(),D=class{constructor(e,t,n,i,s,a){this.data=e,this.id=t,this.object=n,this.paused=!1,this.currentDampingFactor=1,this.snapComplete=!1,this.isReset=!1,this.worldPosition0=new m,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...h.defaultData,...e,...void 0===e.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===e.target||"cursor"===e.target||(this.target=i.find(e.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.resetDampingFactor=80/this.data.resetSpeed+1,this.object.getWorldPosition(this.worldPosition0),this.actions=o(e,e.actions,i,s,a,n)}},P=class extends n{constructor(e,t){super(e),this.eventManager=t,this.events=[],this.pairOfEventListeners=[],this.onMouseMove=e=>{if(!(s.length>1)){this.eventContext.updateRaycaster(e);for(let e of this.events)void 0===e.target&&this.updateSingleEvent(e)}},this.onMouseEnter=e=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=e=>{for(let e of this.events)void 0===e.target&&(e.data.resetOnPointerLeave&&(e.isReset=!0,e.currentDampingFactor=e.resetDampingFactor),this.updateSingleEvent(e))},this.onTargetChange=e=>()=>{this.updateSingleEvent(e)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(t=>{let n=t.data?.events.find(e=>"Follow"===e.data.type&&!e.data.disabled);n&&(!e.data.globalPhysics.usePhysics||"dynamic"!==t.dataPatched.physics?.rigidBody)&&this.events.push(new D(n.data,n.id,t,e,this.eventContext.sharedAssets,this.eventManager))}),!this.events.length)return;let{domElement:t,eventElement:n}=this.eventContext;this.domEventsNeeded.clear(),a&&(this.domEventsNeeded.add("pointerdown"),t.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),n.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents||(t.addEventListener("pointerenter",this.onMouseEnter),t.addEventListener("pointerleave",this.onMouseLeave));for(let e of this.events)if(void 0!==e.target){let t=e.target,n=this.onTargetChange(e);this.pairOfEventListeners.push([t,n]),t.addEventListener("requestRender",n)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;this.domEventsNeeded.clear(),a&&e.removeEventListener("pointerdown",this.onMouseMove),t.removeEventListener("pointermove",this.onMouseMove),e.removeEventListener("pointerenter",this.onMouseEnter),e.removeEventListener("pointerleave",this.onMouseLeave);for(let[e,t]of this.pairOfEventListeners)e.removeEventListener("requestRender",t);for(let e of this.events)e.paused=!0,e.isReset=!1,r(e.actions)}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e,!0)}updateSingleEvent(e,t=!1){this.events.forEach(e=>{e.actions.Create.forEach(e=>{e.dispatchThrottled()})});let{plane:n,limitDistance:i,limitDistanceEnabled:s}=e.data;if(e.object.getWorldPosition(w),e.isReset)y.copy(e.worldPosition0);else if(e.target)e.target.getWorldPosition(y);else{let{getCamera:e,raycaster:t}=this.eventContext;if("custom"===n?(e().getWorldDirection(f),f.negate(),E.copy(f)):"xy"===n?E.set(0,0,1):"xz"===n?E.set(0,1,0):"yz"===n&&E.set(1,0,0),F.setFromNormalAndCoplanarPoint(E,w),!t.ray.intersectPlane(F,y))return}if(!e.isReset)if(y.distanceTo(e.worldPosition0)>i&&s&&e.target){if(e.snapComplete=!1,e.data.snapDelay&&(e.delayFinished=!1,typeof window<"u"&&null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,!e.data.resetAfterDistanceLimit)return;y.copy(e.worldPosition0),e.currentDampingFactor=e.resetDampingFactor}else if(e.wasOutside&&(e.data.snapDelay&&typeof window<"u"&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},1e3*e.data.snapDelay)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),!1===e.delayFinished)return;!1===e.data.enabledTranslation[0]&&(y.x=w.x),!1===e.data.enabledTranslation[1]&&(y.y=w.y),!1===e.data.enabledTranslation[2]&&(y.z=w.z);let a=M(w,y,e.wasOutside?0:e.data.maxDelta);if(e.currentDampingFactor>1){let n=E.subVectors(a,w).divideScalar(e.currentDampingFactor);w.add(n),t&&x(e.object,w),e.paused=n.length()<.01}else x(e.object,a),e.paused=!0;e.object?.dispatchEvent({type:"beginEvent",eventName:"Follow"}),e.object.dispatchEvent(L)}},b=new m,R=new m,j=new v,N=new p,C=new p,O=new m,k=new m,S=new m,Q=new m,z=new g,T={type:"requestRender"},W={type:"changeRotation"},A=function(){let e=new v;return function(n,i){null!==n.parent?e.multiplyMatrices(n.parent.matrixWorld,n.hiddenMatrix):e.copy(n.hiddenMatrix),i.premultiply(d(e).invert()),n.rotation.setFromRotationMatrix(i),n.updateMatrix(),n instanceof l&&t(n.parent)&&n.invalidateDownstreamBooleanData(!0)}}(),V=class{constructor(e,t,n,i){this.id=t,this.object=n,this.paused=!1,this.currentDampingFactor=1,this.isReset=!1,this.worldQuaternion0=new p,this.timeoutId=null,this.delayFinished=!0,this.wasOutside=!1,this.data={...c.defaultData,...e,...void 0===e.resetOnPointerLeave&&{resetOnPointerLeave:!1}},void 0===e.target||"cursor"===e.target||(this.target=i.find(e.target)),this.data.dampingFactor&&(this.currentDampingFactor=this.data.dampingFactor),this.object.getWorldQuaternion(this.worldQuaternion0),isNaN(this.worldQuaternion0.x)&&(this.worldQuaternion0.x=0),isNaN(this.worldQuaternion0.y)&&(this.worldQuaternion0.y=0),isNaN(this.worldQuaternion0.z)&&(this.worldQuaternion0.z=0),isNaN(this.worldQuaternion0.w)&&(this.worldQuaternion0.w=1),this.resetDampingFactor=80/this.data.resetSpeed+1}},B=class extends n{constructor(){super(...arguments),this.events=[],this.pairOfEventListeners=[],this.pairOfUserEventListeners=[],this.onMouseMove=e=>{if(!(s.length>1)){this._lastMouseEvent=e,this.eventContext.updateRaycaster(e);for(let e of this.events)void 0===e.target&&this.updateSingleEvent(e)}},this.onMouseEnter=e=>{for(let e of this.events)void 0===e.target&&(e.isReset=!1,e.currentDampingFactor=e.data.dampingFactor)},this.onMouseLeave=e=>{for(let e of this.events)void 0===e.target&&(e.data.resetOnPointerLeave&&(e.isReset=!0,e.currentDampingFactor=e.resetDampingFactor),this.updateSingleEvent(e))},this.onScroll=e=>{if(this._lastMouseEvent){let e=new PointerEvent("pointermove",{clientX:this._lastMouseEvent.clientX,clientY:this._lastMouseEvent.clientY,bubbles:!0,cancelable:!0,view:window});this.eventContext.eventElement.dispatchEvent(e)}},this.onTargetChange=e=>()=>{this.updateSingleEvent(e)},this.createUserEventListener=t=>({eventName:n,target:i})=>{if(!n||!i)return;let s=e(n);s&&"LookAt"===s&&this.updateSingleEvent(t)}}connect(){let{page:e}=this.eventContext;if(e.traverseEntity(t=>{let n=t.data?.events.find(e=>"LookAt"===e.data.type&&!e.data.disabled);n&&(!e.data.globalPhysics.usePhysics||"dynamic"!==t.dataPatched.physics?.rigidBody)&&this.events.push(new V(n.data,n.id,t,e))}),!this.events.length)return;let{domElement:t,eventElement:n}=this.eventContext;this.domEventsNeeded.clear(),a&&(this.domEventsNeeded.add("pointerdown"),t.addEventListener("pointerdown",this.onMouseMove)),this.domEventsNeeded.add("pointermove"),n.addEventListener("pointermove",this.onMouseMove),this.eventContext.useWindowEvents?n.addEventListener("scroll",this.onScroll):(t.addEventListener("pointerenter",this.onMouseEnter),t.addEventListener("pointerleave",this.onMouseLeave));for(let e of this.events){if(void 0!==e.target){let t=this.onTargetChange(e),n=e.target;this.pairOfEventListeners.push([n,t]),n.addEventListener("requestRender",t)}let t=this.createUserEventListener(e),n=e.object;this.pairOfUserEventListeners.push([n,t]),n.addEventListener("userEvent",t)}}disconnect(){if(!this.events.length)return;let{domElement:e,eventElement:t}=this.eventContext;this.domEventsNeeded.clear(),a&&e.removeEventListener("pointerdown",this.onMouseMove),t.removeEventListener("pointermove",this.onMouseMove),e.removeEventListener("pointerenter",this.onMouseEnter),e.removeEventListener("pointerleave",this.onMouseLeave),t.removeEventListener("scroll",this.onScroll);for(let[e,t]of this.pairOfEventListeners)e.removeEventListener("requestRender",t);for(let[e,t]of this.pairOfUserEventListeners)e.removeEventListener("userEvent",t);for(let e of this.events)e.paused=!0,e.isReset=!1}onAnimationFrameDamping(){for(let e of this.events)e.paused||this.updateSingleEvent(e)}updateSingleEvent(e){let{tilt:t,axis:n,distance:i,plane:s,limitDistance:a,enabledRotation:o,limitDistanceEnabled:r}=e.data,{getCamera:l,raycaster:u}=this.eventContext,{object:h,target:c}=e;if(h.getWorldPosition(O),!e.isReset)if(e.target)e.target.getWorldPosition(k);else{if("custom"===s?(l().getWorldDirection(R),R.negate(),z.setFromNormalAndCoplanarPoint(R,O)):("xy"===s?b.set(0,0,1):"xz"===s?b.set(0,1,0):"yz"===s&&b.set(1,0,0),z.setFromNormalAndCoplanarPoint(b,O)),!u.ray.intersectPlane(z,k))return;i>0&&("custom"===s||void 0===s)&&k.addScaledVector(R,i)}if(e.isReset||(c?"target"===t?S.copy(c.up).applyMatrix4(j.extractRotation(c.matrixWorld)).normalize():o.some(e=>!1===e)?("x"===n?(Q.set(0,0,1),!1===o[2]&&Q.set(0,1,0)):"y"===n?(Q.set(1,0,0),!1===o[0]&&Q.set(0,0,1)):(Q.set(0,1,0),!1===o[1]&&Q.set(1,0,0)),S.copy(Q).applyQuaternion(e.worldQuaternion0).normalize()):S.set(0,1,0):"custom"===s?S.set(0,1,0):S.copy(b)),e.isReset)C.copy(e.worldQuaternion0);else if(O.distanceTo(k)>a&&r&&c){if(e.data.snapDelay&&(e.delayFinished=!1,typeof window<"u"&&null!==e.timeoutId&&(window.clearTimeout(e.timeoutId),e.timeoutId=null)),e.wasOutside=!0,!e.data.resetAfterDistanceLimit)return;C.copy(e.worldQuaternion0),e.currentDampingFactor=e.resetDampingFactor}else{if(e.wasOutside&&(e.data.snapDelay&&typeof window<"u"&&(e.timeoutId=window.setTimeout(()=>{e.delayFinished=!0,e.paused=!1,this.updateSingleEvent(e)},1e3*e.data.snapDelay)),e.currentDampingFactor=e.data.dampingFactor,e.wasOutside=!1),!1===e.delayFinished)return;(function(e,t,n,i,s,a){let o=j.elements;q.subVectors(t,n),0===q.lengthSq()&&(q.z=1),q.normalize(),I.crossVectors(i,q),0===I.lengthSq()&&(1===Math.abs(i.z)?q.x+=1e-4:q.z+=1e-4,q.normalize(),I.crossVectors(i,q)),I.normalize(),U.crossVectors(q,I),"x"===s?1===a.z?[I,U,q]=[q,I,U]:(I.negate(),[I,q]=[q,I]):"y"===s?1===a.x?[I,U,q]=[U,q,I]:(I.negate(),[U,q]=[q,U]):1===a.x&&(I.negate(),[I,U]=[U,I]),o[0]=I.x,o[4]=U.x,o[8]=q.x,o[1]=I.y,o[5]=U.y,o[9]=q.y,o[2]=I.z,o[6]=U.z,o[10]=q.z})(0,k,O,S,n,Q),C.setFromRotationMatrix(j),N.setFromUnitVectors(Q.applyQuaternion(C),S),o.some(e=>!1===e)&&"target"!==t&&C.premultiply(N).normalize()}e.currentDampingFactor>1?(h.updateWorldMatrix(!0,!1),N.setFromRotationMatrix(d(h.matrixWorld)),N.slerp(C,1/e.currentDampingFactor),A(h,j.makeRotationFromQuaternion(N)),e.paused=8*(1-N.dot(C))<1e-6):(A(h,j.makeRotationFromQuaternion(C)),e.paused=!0),e.object?.dispatchEvent({type:"beginEvent",eventName:"LookAt"}),h.dispatchEvent(T),h.dispatchEvent(W)}},U=new m,I=new m,q=new m;i("Follow",({eventContext:e,eventManager:t})=>new P(e,t)),i("LookAt",({eventContext:e})=>new B(e)),u("tracking");
@@ -1 +1 @@
1
- import{a as t}from"./runtime-chunk-3GRN37GY.js";import{k as i}from"./runtime-chunk-OUXEWX5Z.js";import"./runtime-chunk-KE6HNYUL.js";import"./runtime-chunk-NTUTXO7Q.js";import{a as e,b as n}from"./runtime-chunk-KGZNRID6.js";import"./runtime-chunk-R43XZP65.js";import"./runtime-chunk-5JEZ42OM.js";import"./runtime-chunk-F3ZACLZW.js";import"./runtime-chunk-YULW5JRE.js";import"./runtime-chunk-FTVQTRM7.js";import"./runtime-chunk-32KZP4YN.js";import"./runtime-chunk-E3IEBR27.js";import"./runtime-chunk-EJJZJ5MV.js";import"./runtime-chunk-AELTGHV2.js";import"./runtime-chunk-DK66VKWP.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{b as r,e as s}from"./runtime-chunk-EPHVY3XO.js";import"./runtime-chunk-CKT62HES.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-U4QOT2PX.js";import{a as h}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-VPEJ5BFD.js";import{Bc as o,Cc as m}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var a=class extends o{constructor(t,i,n,r,s){super(),this.data=t,this.page=i,this.animationControls=n,this.shared=r,this.condition=s,this.startOnceDelay=0,this.toggleIsForward=!1;let h=t.object,o=i.scene.find(t.object);o&&Array.isArray(o.identity)&&(h=o.identity[0]),this.data={...t,object:h};let m=this.animationControls.clipIdToAction[t.clipId+"/"+h];if(this.duration=m?.getClip()?.duration??1,this.data.crop2){let t=e(m?.getClip());this.leftFrameTime=this.data.crop2[0]/(t-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(t-1)*this.duration}else{let t=m?.getClip()?.tracks[0]?.times.length;t&&t>1?(this.leftFrameTime=this.data.crop[0]/t*this.duration,this.rightFrameTime=this.data.crop[1]/t*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=t.delay}get playing(){return this.threeAnimAction?.isRunning()??!1}play(t=!1){if(!1===s(this.shared,this.condition))return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction)return;this.threeAnimAction.reset(),this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime;let i=this.data.object;Object.entries(this.animationControls.clipIdToAction).forEach(([e,n])=>{let r=e.split("/")[1];this.threeAnimAction!==n&&r===i&&(t?n.fadeOut(.2):n.stop())}),t&&this.threeAnimAction?.fadeIn(.2)},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),window.clearTimeout(this.timeoutId),delete this.timeoutId}stop(){this.threeAnimAction?.fadeOut(.2)}seek(t){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=m.clamp(this.threeAnimAction.time+1/60*t,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(t,i=!1){if(!1===s(this.shared,this.condition))return!1;this.toggleIsForward=t??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction){this.toggleIsForward?(this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction.time=this.rightFrameTime,this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime),this.threeAnimAction.paused=!1,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1;let t=this.data.clipId.split("/")[1];Object.entries(this.animationControls.clipIdToAction).forEach(([e,n])=>{let r=e.split("/")[1];this.threeAnimAction!==n&&r===t&&n.isRunning()&&(i?n.fadeOut(.2):n.stop())}),i&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let t=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();t&&(t.duration=this.duration),this.pause()}};n(i),r("Transition",({eventType:i,data:e,page:n,shared:r,actionCondition:s})=>new t(i,e,n,r,s)),r("Animation",({data:t,page:i,eventManager:e,shared:n,actionCondition:r})=>new a(t,i,e.animationControls,n,r)),h("transitions");
1
+ import{a as t}from"./runtime-chunk-YNTJMLA5.js";import{k as i}from"./runtime-chunk-ROGQC3YL.js";import"./runtime-chunk-HRGNIGSC.js";import"./runtime-chunk-NTUTXO7Q.js";import{a as e,b as n}from"./runtime-chunk-KGZNRID6.js";import"./runtime-chunk-R43XZP65.js";import"./runtime-chunk-5MDYMRYM.js";import"./runtime-chunk-VJPN4EM6.js";import"./runtime-chunk-33KX2TOT.js";import"./runtime-chunk-FTVQTRM7.js";import"./runtime-chunk-44F5FA4N.js";import"./runtime-chunk-KRQKRJPD.js";import"./runtime-chunk-YANJNJO2.js";import"./runtime-chunk-FJZAL2GU.js";import"./runtime-chunk-3D6ELLRB.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{b as r,e as s}from"./runtime-chunk-EPHVY3XO.js";import"./runtime-chunk-R3V4RB3X.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-U4QOT2PX.js";import{a as h}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-VPEJ5BFD.js";import{Bc as o,Cc as m}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var a=class extends o{constructor(t,i,n,r,s){super(),this.data=t,this.page=i,this.animationControls=n,this.shared=r,this.condition=s,this.startOnceDelay=0,this.toggleIsForward=!1;let h=t.object,o=i.scene.find(t.object);o&&Array.isArray(o.identity)&&(h=o.identity[0]),this.data={...t,object:h};let m=this.animationControls.clipIdToAction[t.clipId+"/"+h];if(this.duration=m?.getClip()?.duration??1,this.data.crop2){let t=e(m?.getClip());this.leftFrameTime=this.data.crop2[0]/(t-1)*this.duration,this.rightFrameTime=this.data.crop2[1]/(t-1)*this.duration}else{let t=m?.getClip()?.tracks[0]?.times.length;t&&t>1?(this.leftFrameTime=this.data.crop[0]/t*this.duration,this.rightFrameTime=this.data.crop[1]/t*this.duration):(this.leftFrameTime=0,this.rightFrameTime=this.duration)}this.startOnceDelay=t.delay}get playing(){return this.threeAnimAction?.isRunning()??!1}play(t=!1){if(!1===s(this.shared,this.condition))return!1;window.clearTimeout(this.timeoutId),this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),!this.threeAnimAction)return;this.threeAnimAction.reset(),this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime;let i=this.data.object;Object.entries(this.animationControls.clipIdToAction).forEach(([e,n])=>{let r=e.split("/")[1];this.threeAnimAction!==n&&r===i&&(t?n.fadeOut(.2):n.stop())}),t&&this.threeAnimAction?.fadeIn(.2)},this.startOnceDelay)}pause(){this.threeAnimAction&&(this.threeAnimAction.paused=!0),window.clearTimeout(this.timeoutId),delete this.timeoutId}stop(){this.threeAnimAction?.fadeOut(.2)}seek(t){this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction&&(this.threeAnimAction.paused=!0,this.threeAnimAction.time=m.clamp(this.threeAnimAction.time+1/60*t,this.leftFrameTime,this.rightFrameTime-16e-5),this.animationControls.needsUpdate=!0,this.animationControls.requestRender())}toggle(t,i=!1){if(!1===s(this.shared,this.condition))return!1;this.toggleIsForward=t??!this.toggleIsForward,this.threeAnimAction&&(this.threeAnimAction._loopCount=0),this.playing?this.threeAnimAction&&(this.threeAnimAction.timeScale=this.toggleIsForward?1:-1,this.toggleIsForward?(this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime)):this.timeoutId=window.setTimeout(()=>{if(this.threeAnimAction=this.animationControls.play(this.data),this.threeAnimAction){this.toggleIsForward?(this.threeAnimAction.time=this.leftFrameTime,this.threeAnimAction._clip.start=this.leftFrameTime,this.threeAnimAction._clip.duration=this.rightFrameTime):(this.threeAnimAction.time=this.rightFrameTime,this.threeAnimAction._clip.start=this.rightFrameTime,this.threeAnimAction._clip.duration=this.leftFrameTime),this.threeAnimAction.paused=!1,this.threeAnimAction.timeScale=this.toggleIsForward?1:-1;let t=this.data.clipId.split("/")[1];Object.entries(this.animationControls.clipIdToAction).forEach(([e,n])=>{let r=e.split("/")[1];this.threeAnimAction!==n&&r===t&&n.isRunning()&&(i?n.fadeOut(.2):n.stop())}),i&&this.threeAnimAction?.fadeIn(.2)}},this.startOnceDelay)}playFromCurrent(){this.toggle(!0)}reverseFromCurrent(){this.toggle(!1)}dispose(){let t=this.animationControls.clipIdToAction[this.data.clipId+"/"+this.data.object]?.getClip();t&&(t.duration=this.duration),this.pause()}};n(i),r("Transition",({eventType:i,data:e,page:n,shared:r,actionCondition:s})=>new t(i,e,n,r,s)),r("Animation",({data:t,page:i,eventManager:e,shared:n,actionCondition:r})=>new a(t,i,e.animationControls,n,r)),h("transitions");
@@ -1 +1 @@
1
- import{a as e}from"./runtime-chunk-CVUJ3GMH.js";import{a as t,b as i,c as r,d as a,f as s,g as n,h,i as d,j as o,k as m,l as c,m as u,n as l}from"./runtime-chunk-KE6HNYUL.js";import"./runtime-chunk-NTUTXO7Q.js";import"./runtime-chunk-FTVQTRM7.js";import{I as p,ea as f}from"./runtime-chunk-DK66VKWP.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{b as v}from"./runtime-chunk-CKT62HES.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import{e as g,f as y}from"./runtime-chunk-U4QOT2PX.js";import{a as w,f as O,j as P}from"./runtime-chunk-TZCHGFVF.js";import{E as j}from"./runtime-chunk-VPEJ5BFD.js";import{Ae as b,Ba as x,Bd as R,Cc as S,Lc as T,Le as F,bd as H,ce as D,dd as I,ld as W}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";function E(e,t,i,r){return r?i:2048/Math.max(1,e,t)}var U=new b(-1,1,1,-1,0,1),B=new class extends I{constructor(){super(),this.setAttribute("position",new H([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new H([0,2,0,0,2,0],2))}},M=new D({defines:{},uniforms:{tDiffuse:new F(null)},vertexShader:"\n\tvarying vec2 vUv;\n\tvoid main() {\n\t\tvUv = uv;\n\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t}",fragmentShader:"\n\tuniform sampler2D tDiffuse;\n\tvarying vec2 vUv;\n\tvoid main() {\n\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\tgl_FragColor = texel;\n\t}"}),z=new class{constructor(e){this._mesh=new W(B,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,U)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}(M),G=null,k=null,_=t.identity(),C=class{constructor(t,i,r,s){var n;this.uuid=t,this.width=i,this.height=r,this.context=s,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||e(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let e=this.width,t=this.height;this.renderer.dpr=E(e,t,this.dpr,this.isScreenSpace),this.renderer.setSize(e,t)},this.onFrameOverrideObjectEvent=e=>{if(void 0!==e.target?.uuid){let t=this.frameRoot?.find(e.target.uuid);t&&t.dispatchEvent({...e,target:t})}},this.scene2d=new u(S.generateUUID(),y.defaultData,{dpr:window.devicePixelRatio,shared:s.shared}),this.canvas=(null===G&&(G=document.createElement("canvas")),G),this.renderer=(n=this.canvas,null===k&&(k=new a(n)),k),this.promise=this.init(),this.renderTarget=new T(1,1,{type:x,stencilBuffer:!1,depthBuffer:!1}),s.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=s.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new R(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(e){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,e.blitTextureToTarget)e.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{M.uniforms.tDiffuse.value=this.canvasTexture;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),z.render(e),e.setRenderTarget(t)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(e,t,i,r){this.scene2d.updateEntityByOp(e,t,i,r),this.applySize()}updateTreeByOp(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}applyOverrides(e){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let t=e?.width??this.width,i=e?.height??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=_,this.isScreenSpace&&(this.frameOverride.fill.color=j.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},L({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(e,t=window.devicePixelRatio){let i=Math.max(1,e?.width??this.width),r=Math.max(1,e?.height??this.height);this.dpr=t,this.width=i,this.height=r,this._innerApplySize();let a=function(e,t,i,r){let a=E(e,t,i,r),s=Math.max(i,512/Math.min(e,t)),n=Math.min(s,a);return{width:Math.max(1,Math.ceil(e*n)),height:Math.max(1,Math.ceil(t*n))}}(i,r,t,this.isScreenSpace);this.renderTarget.setSize(a.width,a.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),this.frameOverride?.requestRender()}applyFrame(e){let t=this.context.scene.find2D(e);if(t&&t instanceof o)return this.disposeFrameOverride(),this.frameRoot=t,this.frameOverride=t.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(e=>{e.addEventListener("beginState",this.onFrameOverrideObjectEvent),e.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),t}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(e){return this.scene2d.find(e)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(e=>{e.removeEventListener("beginState",this.onFrameOverrideObjectEvent),e.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function L({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s}){if(e instanceof o&&t instanceof o||e instanceof d&&t instanceof d)for(let n=0,h=e.children.length;n<h;n++){let h=e.children[n],d=t.children[n];h&&d&&h.uuid===d.uuid&&V({objectOverride:h,objectRoot:d,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s})}}function V({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s}){let[n,h]=function(e){if(A(e))return[e.width,e.height];if(e instanceof m){let[t,i]=e.getHalfSize();return[2*t,2*i]}if(e instanceof d){let[t,i]=e.recursiveBBox.getHalfSize();return[2*t,2*i]}return[0,0]}(t),{width:o,height:u,position:p}=l({constraints:e.data,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s,objectInitialWidth:n,objectInitialHeight:h,objectInitialPosition:t.position});if(e.position=p,e.data={...e.data,position:p},e.states)for(let n in e.states)q({stateId:n,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s});if(A(e)||e instanceof d)A(e)&&(e.width=o,e.height=u,e.data={...e.data,width:o,height:u}),L({objectOverride:e,objectRoot:t,newParentWidth:o,newParentHeight:u,initialParentWidth:n,initialParentHeight:h});else if(e instanceof m){let i=t,r=0!==n?o/n:1,a=0!==h?u/h:1;e.path=c(i.path,r,a),e.data={...e.data,path:e.path}}}function q({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:a,initialParentWidth:s,initialParentHeight:n}){let h=t.states?.[e],d=i.states?.[e];if(h&&d){let{width:i,height:o,position:m}=l({constraints:t.data,newParentWidth:r,newParentHeight:a,initialParentWidth:s,initialParentHeight:n,objectInitialWidth:g.isResizeable(d)?d.width:0,objectInitialHeight:g.isResizeable(d)?d.height:0,objectInitialPosition:d.position});Object.assign(t.states[e],{position:m}),g.isResizeable(h)&&Object.assign(t.states[e],{width:i,height:o})}}function A(e){return e instanceof n||e instanceof o||e instanceof s||e instanceof h}var N=class extends f{constructor(e,t,i){super(e,t,i),this.isUIObject=!0,this.uiCanvas=new C(e+"-canvas",t.geometry.width,t.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),0===e.type&&(void 0!==e.props.frame&&this.applyFrame(e.props.frame,i.shared),(void 0!==e.props.width||void 0!==e.props.height)&&this.applySize(e.props,i.shared))}applySize(e,t){let i=e?.width??this.dataPatched.geometry.width,r=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(t)}applyFrame(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}applyGeometryParametersFromFrame(e){let t=this.frame;t&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=p(this.dataPatched.geometry,e,this.data.flatShading,this))}applyMaterialParametersFromFrame(e){let t=this.frame;if(t){let i=t.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,e,!0)}}updateEntity2DByOp(e,t,i,r){this.uiCanvas.updateEntity2DByOp(e,t,i,r),e===this.frameId&&0===t.type&&(void 0!==t.props.cornerRadius?this.applyGeometryParametersFromFrame(r):v(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.applySize({width:e.width,height:e.height},t);let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=p(i,t,this.data.flatShading,this)}};O("UIGeometry",(e,t,i)=>new N(e,t,i)),P({Scene2D:u,UICanvas:C,loadHanaUIRUNTIME:r,setHanaUIWasmUrl:i}),w("ui-2d");
1
+ import{a as e}from"./runtime-chunk-CVUJ3GMH.js";import{a as t,b as i,c as r,d as a,f as s,g as n,h,i as d,j as o,k as m,l as c,m as u,n as l}from"./runtime-chunk-HRGNIGSC.js";import"./runtime-chunk-NTUTXO7Q.js";import"./runtime-chunk-FTVQTRM7.js";import{I as p,ea as f}from"./runtime-chunk-3D6ELLRB.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{b as v}from"./runtime-chunk-R3V4RB3X.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import{e as g,f as y}from"./runtime-chunk-U4QOT2PX.js";import{a as w,f as O,j as P}from"./runtime-chunk-TZCHGFVF.js";import{E as j}from"./runtime-chunk-VPEJ5BFD.js";import{Ae as b,Ba as R,Bd as x,Cc as S,Lc as F,Le as T,bd as H,ce as D,dd as I,ld as B}from"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";function W(e,t,i,r){return r?i:2048/Math.max(1,e,t)}var E=new b(-1,1,1,-1,0,1),U=new class extends I{constructor(){super(),this.setAttribute("position",new H([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new H([0,2,0,0,2,0],2))}},G=new D({defines:{},uniforms:{tDiffuse:new T(null)},vertexShader:"\n\tvarying vec2 vUv;\n\tvoid main() {\n\t\tvUv = uv;\n\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t}",fragmentShader:"\n\tuniform sampler2D tDiffuse;\n\tvarying vec2 vUv;\n\tvoid main() {\n\t\tvec4 texel = texture2D( tDiffuse, vUv );\n\t\tgl_FragColor = texel;\n\t}"}),M=new class{constructor(e){this._mesh=new B(U,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,E)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}(G),z=null,k=null,_=t.identity(),C=class{constructor(t,i,r,s){var n;this.uuid=t,this.width=i,this.height=r,this.context=s,this.enabled=!0,this.isScreenSpace=!1,this.dpr=window.devicePixelRatio,this.isFrameDirty=!1,this.onRenderRequestedDownstream=()=>{this.isFrameDirty=!0,this.isScreenSpace||e(this),this.context.shared.requestRender()},this._innerApplySize=()=>{let e=this.width,t=this.height;this.renderer.dpr=W(e,t,this.dpr,this.isScreenSpace),this.renderer.setSize(e,t)},this.onFrameOverrideObjectEvent=e=>{if(void 0!==e.target?.uuid){let t=this.frameRoot?.find(e.target.uuid);t&&t.dispatchEvent({...e,target:t})}},this.scene2d=new u(S.generateUUID(),y.defaultData,{dpr:window.devicePixelRatio,shared:s.shared}),this.canvas=(null===z&&(z=document.createElement("canvas")),z),this.renderer=(n=this.canvas,null===k&&(k=new a(n)),k),this.promise=this.init(),this.renderTarget=new F(1,1,{type:R,stencilBuffer:!1,depthBuffer:!1}),s.shared.addUIBuffer(this.uuid,this.renderTarget),this.textureHolder=s.shared.uiBuffer(this.uuid)}get canvasTexture(){return this._canvasTexture||(this._canvasTexture=new x(this.canvas)),this._canvasTexture}async init(){await this.renderer.init(),this.renderer.uiFontReady?.then(()=>{this.frameOverride&&this.onRenderRequestedDownstream()})}render(e){if(this.isFrameDirty){if(this.isFrameDirty=!1,this._innerApplySize(),this.renderer.clear(),this.frameOverride?.draw(this.renderer),this.renderer.render(),this.canvasTexture.needsUpdate=!0,e.blitTextureToTarget)e.blitTextureToTarget(this.canvasTexture,this.renderTarget);else{G.uniforms.tDiffuse.value=this.canvasTexture;let t=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.clear(),M.render(e),e.setRenderTarget(t)}this.textureHolder?.setNeedsUpdate(!0)}}updateEntity2DByOp(e,t,i,r){this.scene2d.updateEntityByOp(e,t,i,r),this.applySize()}updateTreeByOp(e,t){this.scene2d.updateTreeByOp(e,t),this.applySize()}applyOverrides(e){if(this.frameOverride&&this.frameRoot){this.frameOverride.position=[0,0],this.frameOverride.rotation=0;let t=e?.width??this.width,i=e?.height??this.height;this.frameOverride.width=t,this.frameOverride.height=i,this.frameOverride.localMatrix=_,this.isScreenSpace&&(this.frameOverride.fill.color=j.from0to1([0,0,0,0])),this.frameOverride.data={...this.frameOverride.data,width:t,height:i},L({objectOverride:this.frameOverride,objectRoot:this.frameRoot,newParentWidth:this.frameOverride.width,newParentHeight:this.frameOverride.height,initialParentWidth:this.frameRoot.width,initialParentHeight:this.frameRoot.height}),this.frameOverride.updateWorldMatrix(!0,!1,!0)}}applySize(e,t=window.devicePixelRatio){let i=Math.max(1,e?.width??this.width),r=Math.max(1,e?.height??this.height);this.dpr=t,this.width=i,this.height=r,this._innerApplySize();let a=function(e,t,i,r){let a=W(e,t,i,r),s=Math.max(i,512/Math.min(e,t)),n=Math.min(s,a);return{width:Math.max(1,Math.ceil(e*n)),height:Math.max(1,Math.ceil(t*n))}}(i,r,t,this.isScreenSpace);this.renderTarget.setSize(a.width,a.height),this._canvasTexture?.dispose(),this._canvasTexture=void 0,this.applyOverrides(e),this.frameOverride?.requestRender()}applyFrame(e){let t=this.context.scene.find2D(e);if(t&&t instanceof o)return this.disposeFrameOverride(),this.frameRoot=t,this.frameOverride=t.clone({dpr:this.renderer.dpr,shared:this.context.shared}),this.scene2d.add(this.frameOverride),this.applySize(),this.frame?.addEventListener("render",this.onRenderRequestedDownstream),this.frameOverride.traverse(e=>{e.addEventListener("beginState",this.onFrameOverrideObjectEvent),e.addEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frame?.requestRender(),t}get frame(){return this.frameOverride}get frameId(){return this.frame?.uuid}find(e){return this.scene2d.find(e)}get texture(){return this.textureHolder?.getTexture(1001)}disposeFrameOverride(){this.frameOverride?.removeEventListener("render",this.onRenderRequestedDownstream),this.frameOverride?.traverse(e=>{e.removeEventListener("beginState",this.onFrameOverrideObjectEvent),e.removeEventListener("completeState",this.onFrameOverrideObjectEvent)}),this.frameOverride&&this.scene2d.remove(this.frameOverride)}};function L({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s}){if(e instanceof o&&t instanceof o||e instanceof d&&t instanceof d)for(let n=0,h=e.children.length;n<h;n++){let h=e.children[n],d=t.children[n];h&&d&&h.uuid===d.uuid&&V({objectOverride:h,objectRoot:d,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s})}}function V({objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s}){let[n,h]=function(e){if(A(e))return[e.width,e.height];if(e instanceof m){let[t,i]=e.getHalfSize();return[2*t,2*i]}if(e instanceof d){let[t,i]=e.recursiveBBox.getHalfSize();return[2*t,2*i]}return[0,0]}(t),{width:o,height:u,position:p}=l({constraints:e.data,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s,objectInitialWidth:n,objectInitialHeight:h,objectInitialPosition:t.position});if(e.position=p,e.data={...e.data,position:p},e.states)for(let n in e.states)q({stateId:n,objectOverride:e,objectRoot:t,newParentWidth:i,newParentHeight:r,initialParentWidth:a,initialParentHeight:s});if(A(e)||e instanceof d)A(e)&&(e.width=o,e.height=u,e.data={...e.data,width:o,height:u}),L({objectOverride:e,objectRoot:t,newParentWidth:o,newParentHeight:u,initialParentWidth:n,initialParentHeight:h});else if(e instanceof m){let i=t,r=0!==n?o/n:1,a=0!==h?u/h:1;e.path=c(i.path,r,a),e.data={...e.data,path:e.path}}}function q({stateId:e,objectOverride:t,objectRoot:i,newParentWidth:r,newParentHeight:a,initialParentWidth:s,initialParentHeight:n}){let h=t.states?.[e],d=i.states?.[e];if(h&&d){let{width:i,height:o,position:m}=l({constraints:t.data,newParentWidth:r,newParentHeight:a,initialParentWidth:s,initialParentHeight:n,objectInitialWidth:g.isResizeable(d)?d.width:0,objectInitialHeight:g.isResizeable(d)?d.height:0,objectInitialPosition:d.position});Object.assign(t.states[e],{position:m}),g.isResizeable(h)&&Object.assign(t.states[e],{width:i,height:o})}}function A(e){return e instanceof n||e instanceof o||e instanceof s||e instanceof h}var N=class extends f{constructor(e,t,i){super(e,t,i),this.isUIObject=!0,this.uiCanvas=new C(e+"-canvas",t.geometry.width,t.geometry.height,i),this.uiCanvas.promise.then(()=>{this.applyFrame(this.dataPatched.geometry.frame,i.shared)})}updateByPatchedOpGeometry(e,t,i){super.updateByPatchedOpGeometry(e,t,i),0===e.type&&(void 0!==e.props.frame&&this.applyFrame(e.props.frame,i.shared),(void 0!==e.props.width||void 0!==e.props.height)&&this.applySize(e.props,i.shared))}applySize(e,t){let i=e?.width??this.dataPatched.geometry.width,r=e?.height??this.dataPatched.geometry.height;this.uiCanvas.applySize({width:i,height:r}),this.applyGeometryParametersFromFrame(t)}applyFrame(e,t){this.uiCanvas.applyFrame(e),this.applyGeometryParametersFromFrame(t),this.applyMaterialParametersFromFrame({shared:t})}applyGeometryParametersFromFrame(e){let t=this.frame;t&&(Object.assign(this.data,{geometry:Object.assign(this.data.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),Object.assign(this.dataPatched,{geometry:Object.assign(this.dataPatched.geometry,{cornerRadius:t.cornerRadius,cornerType:0})}),this.localGeometry?.dispose(),this.localGeometry=p(this.dataPatched.geometry,e,this.data.flatShading,this))}applyMaterialParametersFromFrame(e){let t=this.frame;if(t){let i=t.data.backgroundBlur;Object.assign(this.data.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.data.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),Object.assign(this.dataPatched.material.layers[0].data.texture,{image:this.uiCanvas.uuid}),Object.assign(this.dataPatched.material.layers[1].data,{roughness:i.radius,alpha:i.enabled?1:0}),this.material.reset?.(this.dataPatched.material,e,!0)}}updateEntity2DByOp(e,t,i,r){this.uiCanvas.updateEntity2DByOp(e,t,i,r),e===this.frameId&&0===t.type&&(void 0!==t.props.cornerRadius?this.applyGeometryParametersFromFrame(r):v(t.path,["backgroundBlur"])&&this.applyMaterialParametersFromFrame({shared:r}))}get frame(){return this.uiCanvas.frame}get frameId(){return this.frame?.uuid}removeInteractionGeometry(e){super.removeInteractionGeometry(e),this.applySize({},e)}updateGeometryInteractions(e,t){super.updateGeometryInteractions(e,t),this.applySize({width:e.width,height:e.height},t);let i={...this.data.geometry,...e};this.localGeometry?.dispose(),this.localGeometry=p(i,t,this.data.flatShading,this)}};O("UIGeometry",(e,t,i)=>new N(e,t,i)),P({Scene2D:u,UICanvas:C,loadHanaUIRUNTIME:r,setHanaUIWasmUrl:i}),w("ui-2d");
@@ -1 +1 @@
1
- import{ea as t}from"./runtime-chunk-DK66VKWP.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{u as e}from"./runtime-chunk-CKT62HES.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-U4QOT2PX.js";import{a as r,f as i}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-VPEJ5BFD.js";import"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var n=class extends t{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,r){let i=this.geometry.getAttribute("position");void 0!==i?e(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,r):super.updateEntityBoxSize(t,r)}};i("VectorGeometry",(t,e,r)=>new n(t,e,r)),r("vector-shapes");
1
+ import{ea as t}from"./runtime-chunk-3D6ELLRB.js";import"./runtime-chunk-4YV3EXSU.js";import"./runtime-chunk-NSD7DU3P.js";import{u as e}from"./runtime-chunk-R3V4RB3X.js";import"./runtime-chunk-2PT2WH66.js";import"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-U4QOT2PX.js";import{a as r,f as i}from"./runtime-chunk-TZCHGFVF.js";import"./runtime-chunk-VPEJ5BFD.js";import"./runtime-chunk-VGN7YHB7.js";import"./runtime-chunk-ML3Z74BL.js";var n=class extends t{get forceComputeSize(){return!0}get shape(){return this.geometry.userData.shape}updateEntityBoxSize(t,r){let i=this.geometry.getAttribute("position");void 0!==i?e(i,this.geometry.drawRange.start,this.geometry.drawRange.count<1/0?this.geometry.drawRange.count:i.count,t,r):super.updateEntityBoxSize(t,r)}};i("VectorGeometry",(t,e,r)=>new n(t,e,r)),r("vector-shapes");