@splinetool/runtime 2.0.11 → 2.0.12

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 (269) hide show
  1. package/build/{runtime-chunk-NHLFGFU5.js → runtime-chunk-2LTYI3AN.js} +1 -1
  2. package/build/runtime-chunk-2LTYI3AN.js.br +0 -0
  3. package/build/runtime-chunk-2LTYI3AN.js.gz +0 -0
  4. package/build/{runtime-chunk-T7HEAOAP.js → runtime-chunk-3A4X5B7V.js} +1 -1
  5. package/build/runtime-chunk-3A4X5B7V.js.br +0 -0
  6. package/build/runtime-chunk-3A4X5B7V.js.gz +0 -0
  7. package/build/{runtime-chunk-FYQSEYL5.js → runtime-chunk-3CMVQQOR.js} +1 -1
  8. package/build/runtime-chunk-3CMVQQOR.js.br +0 -0
  9. package/build/runtime-chunk-3CMVQQOR.js.gz +0 -0
  10. package/build/{runtime-chunk-Q23Z6MJP.js → runtime-chunk-3O7PY43O.js} +1 -1
  11. package/build/runtime-chunk-3O7PY43O.js.br +0 -0
  12. package/build/runtime-chunk-3O7PY43O.js.gz +0 -0
  13. package/build/{runtime-chunk-HLXTXF7I.js → runtime-chunk-5IABHLHS.js} +1 -1
  14. package/build/runtime-chunk-5IABHLHS.js.br +0 -0
  15. package/build/runtime-chunk-5IABHLHS.js.gz +0 -0
  16. package/build/{runtime-chunk-MQKKQEK3.js → runtime-chunk-6ARRPM23.js} +1 -1
  17. package/build/{runtime-chunk-MQKKQEK3.js.br → runtime-chunk-6ARRPM23.js.br} +0 -0
  18. package/build/{runtime-chunk-MQKKQEK3.js.gz → runtime-chunk-6ARRPM23.js.gz} +0 -0
  19. package/build/{runtime-chunk-DQMOB5OU.js → runtime-chunk-AAGXG7XK.js} +1 -1
  20. package/build/runtime-chunk-AAGXG7XK.js.br +0 -0
  21. package/build/runtime-chunk-AAGXG7XK.js.gz +0 -0
  22. package/build/{runtime-chunk-FJ3HZ257.js → runtime-chunk-AYLDDUAZ.js} +1 -1
  23. package/build/runtime-chunk-AYLDDUAZ.js.br +0 -0
  24. package/build/runtime-chunk-AYLDDUAZ.js.gz +0 -0
  25. package/build/{runtime-chunk-K3MY5TZT.js → runtime-chunk-BZJCMBUI.js} +1 -1
  26. package/build/runtime-chunk-BZJCMBUI.js.br +0 -0
  27. package/build/runtime-chunk-BZJCMBUI.js.gz +0 -0
  28. package/build/{runtime-chunk-DA36J6OU.js → runtime-chunk-DMDTTYNN.js} +1 -1
  29. package/build/runtime-chunk-DMDTTYNN.js.br +0 -0
  30. package/build/runtime-chunk-DMDTTYNN.js.gz +0 -0
  31. package/build/{runtime-chunk-FBNDPGTS.js → runtime-chunk-E3QYEXEP.js} +1 -1
  32. package/build/runtime-chunk-E3QYEXEP.js.br +0 -0
  33. package/build/runtime-chunk-E3QYEXEP.js.gz +0 -0
  34. package/build/{runtime-chunk-4ENGAWL7.js → runtime-chunk-E753C25I.js} +1 -1
  35. package/build/runtime-chunk-E753C25I.js.br +0 -0
  36. package/build/runtime-chunk-E753C25I.js.gz +0 -0
  37. package/build/{runtime-chunk-O6F5QJHF.js → runtime-chunk-FGRW5LUR.js} +1 -1
  38. package/build/runtime-chunk-FGRW5LUR.js.br +0 -0
  39. package/build/runtime-chunk-FGRW5LUR.js.gz +0 -0
  40. package/build/{runtime-chunk-XT53PDQV.js → runtime-chunk-HN7CSPUY.js} +1 -1
  41. package/build/runtime-chunk-HN7CSPUY.js.br +0 -0
  42. package/build/runtime-chunk-HN7CSPUY.js.gz +0 -0
  43. package/build/{runtime-chunk-I5YVCEFL.js → runtime-chunk-K67GTQLJ.js} +1 -1
  44. package/build/runtime-chunk-K67GTQLJ.js.br +0 -0
  45. package/build/runtime-chunk-K67GTQLJ.js.gz +0 -0
  46. package/build/{runtime-chunk-AVO7AFZY.js → runtime-chunk-M424ONWP.js} +1 -1
  47. package/build/runtime-chunk-M424ONWP.js.br +0 -0
  48. package/build/runtime-chunk-M424ONWP.js.gz +0 -0
  49. package/build/{runtime-chunk-CUGQPKPQ.js → runtime-chunk-POTYLEGO.js} +1 -1
  50. package/build/runtime-chunk-POTYLEGO.js.br +0 -0
  51. package/build/runtime-chunk-POTYLEGO.js.gz +0 -0
  52. package/build/{runtime-chunk-OWPKF7IL.js → runtime-chunk-SFPD5AFA.js} +1 -1
  53. package/build/runtime-chunk-SFPD5AFA.js.br +0 -0
  54. package/build/runtime-chunk-SFPD5AFA.js.gz +0 -0
  55. package/build/{runtime-chunk-DX665HUE.js → runtime-chunk-SIC5B7QX.js} +1 -1
  56. package/build/runtime-chunk-SIC5B7QX.js.br +0 -0
  57. package/build/runtime-chunk-SIC5B7QX.js.gz +0 -0
  58. package/build/{runtime-chunk-5GCT2MXQ.js → runtime-chunk-SNCE2TY4.js} +1 -1
  59. package/build/runtime-chunk-SNCE2TY4.js.br +0 -0
  60. package/build/runtime-chunk-SNCE2TY4.js.gz +0 -0
  61. package/build/{runtime-chunk-7UK5TXXX.js → runtime-chunk-SRQQYOPW.js} +1 -1
  62. package/build/runtime-chunk-SRQQYOPW.js.br +0 -0
  63. package/build/runtime-chunk-SRQQYOPW.js.gz +0 -0
  64. package/build/{runtime-chunk-CSQ34B7E.js → runtime-chunk-TD5YRDN7.js} +1 -1
  65. package/build/runtime-chunk-TD5YRDN7.js.br +0 -0
  66. package/build/runtime-chunk-TD5YRDN7.js.gz +0 -0
  67. package/build/{runtime-chunk-BY4Y72LZ.js → runtime-chunk-UBSXIKOG.js} +1 -1
  68. package/build/runtime-chunk-UBSXIKOG.js.br +0 -0
  69. package/build/runtime-chunk-UBSXIKOG.js.gz +0 -0
  70. package/build/{runtime-chunk-LEHYVJOU.js → runtime-chunk-UX2PD5MY.js} +1 -1
  71. package/build/runtime-chunk-UX2PD5MY.js.br +0 -0
  72. package/build/runtime-chunk-UX2PD5MY.js.gz +0 -0
  73. package/build/{runtime-chunk-H3NZ2DPE.js → runtime-chunk-W44H46BZ.js} +1 -1
  74. package/build/runtime-chunk-W44H46BZ.js.br +4 -0
  75. package/build/runtime-chunk-W44H46BZ.js.gz +0 -0
  76. package/build/{runtime-chunk-ALDD75EK.js → runtime-chunk-WGMSWSKD.js} +1 -1
  77. package/build/runtime-chunk-WGMSWSKD.js.br +0 -0
  78. package/build/runtime-chunk-WGMSWSKD.js.gz +0 -0
  79. package/build/{runtime-classicRuntime-K34VIFGP.js → runtime-classicRuntime-XD52Z3ID.js} +1 -1
  80. package/build/runtime-classicRuntime-XD52Z3ID.js.br +0 -0
  81. package/build/runtime-classicRuntime-XD52Z3ID.js.gz +0 -0
  82. package/build/{runtime-cloners-3Y3EIRQD.js → runtime-cloners-7P25TLWX.js} +1 -1
  83. package/build/runtime-cloners-7P25TLWX.js.br +0 -0
  84. package/build/runtime-cloners-7P25TLWX.js.gz +0 -0
  85. package/build/{runtime-components-OIRGNZ53.js → runtime-components-KE6NSJIH.js} +1 -1
  86. package/build/runtime-components-KE6NSJIH.js.br +0 -0
  87. package/build/runtime-components-KE6NSJIH.js.gz +0 -0
  88. package/build/{runtime-createDestroy-IXF6AHPT.js → runtime-createDestroy-HT4FKH5P.js} +1 -1
  89. package/build/runtime-createDestroy-HT4FKH5P.js.br +0 -0
  90. package/build/runtime-createDestroy-HT4FKH5P.js.gz +0 -0
  91. package/build/{runtime-dragDrop-XMMLZ4DN.js → runtime-dragDrop-FB4BVR5B.js} +1 -1
  92. package/build/runtime-dragDrop-FB4BVR5B.js.br +0 -0
  93. package/build/runtime-dragDrop-FB4BVR5B.js.gz +0 -0
  94. package/build/{runtime-gameControls-AJVDYQ34.js → runtime-gameControls-KXHLXQUL.js} +1 -1
  95. package/build/runtime-gameControls-KXHLXQUL.js.br +0 -0
  96. package/build/runtime-gameControls-KXHLXQUL.js.gz +0 -0
  97. package/build/{runtime-hair-LL7HBW3N.js → runtime-hair-RGFARTLM.js} +1 -1
  98. package/build/runtime-hair-RGFARTLM.js.br +1 -0
  99. package/build/runtime-hair-RGFARTLM.js.gz +0 -0
  100. package/build/{runtime-mergeStaticGeometries-SLURKUQL.js → runtime-mergeStaticGeometries-GWJX3PTU.js} +1 -1
  101. package/build/runtime-mergeStaticGeometries-GWJX3PTU.js.br +0 -0
  102. package/build/runtime-mergeStaticGeometries-GWJX3PTU.js.gz +0 -0
  103. package/build/{runtime-miscActions-MYXVSOXT.js → runtime-miscActions-QTP3QTK2.js} +1 -1
  104. package/build/runtime-miscActions-QTP3QTK2.js.br +0 -0
  105. package/build/runtime-miscActions-QTP3QTK2.js.gz +0 -0
  106. package/build/{runtime-mouseHover-VNG5G3EV.js → runtime-mouseHover-ATG5LR7E.js} +1 -1
  107. package/build/runtime-mouseHover-ATG5LR7E.js.br +0 -0
  108. package/build/runtime-mouseHover-ATG5LR7E.js.gz +0 -0
  109. package/build/{runtime-particles-WY5ERTQY.js → runtime-particles-E7XPFZHE.js} +1 -1
  110. package/build/runtime-particles-E7XPFZHE.js.br +0 -0
  111. package/build/runtime-particles-E7XPFZHE.js.gz +0 -0
  112. package/build/{runtime-paths-EBK4AK5D.js → runtime-paths-EZZ2EKYD.js} +1 -1
  113. package/build/runtime-paths-EZZ2EKYD.js.br +0 -0
  114. package/build/runtime-paths-EZZ2EKYD.js.gz +0 -0
  115. package/build/{runtime-resize-ARFL653M.js → runtime-resize-MUZH7MEA.js} +1 -1
  116. package/build/runtime-resize-MUZH7MEA.js.br +0 -0
  117. package/build/runtime-resize-MUZH7MEA.js.gz +0 -0
  118. package/build/{runtime-sceneTransition-U767Q26P.js → runtime-sceneTransition-RUIJWZQL.js} +1 -1
  119. package/build/runtime-sceneTransition-RUIJWZQL.js.br +0 -0
  120. package/build/runtime-sceneTransition-RUIJWZQL.js.gz +0 -0
  121. package/build/{runtime-scroll-PJN2KY5P.js → runtime-scroll-2YNJT2VF.js} +1 -1
  122. package/build/runtime-scroll-2YNJT2VF.js.br +0 -0
  123. package/build/runtime-scroll-2YNJT2VF.js.gz +0 -0
  124. package/build/runtime-shapeBlends-KRYJJPAK.js +1 -0
  125. package/build/runtime-shapeBlends-KRYJJPAK.js.br +3 -0
  126. package/build/runtime-shapeBlends-KRYJJPAK.js.gz +0 -0
  127. package/build/{runtime-text-BIQDLMVM.js → runtime-text-FMV3CA36.js} +1 -1
  128. package/build/runtime-text-FMV3CA36.js.br +0 -0
  129. package/build/runtime-text-FMV3CA36.js.gz +0 -0
  130. package/build/{runtime-textInputs-PBVRLIAG.js → runtime-textInputs-CYBDVKZW.js} +1 -1
  131. package/build/runtime-textInputs-CYBDVKZW.js.br +0 -0
  132. package/build/runtime-textInputs-CYBDVKZW.js.gz +0 -0
  133. package/build/{runtime-timeline-FZBQAKBM.js → runtime-timeline-3FHFLHWF.js} +1 -1
  134. package/build/runtime-timeline-3FHFLHWF.js.br +0 -0
  135. package/build/runtime-timeline-3FHFLHWF.js.gz +0 -0
  136. package/build/{runtime-tracking-OGGWBM2F.js → runtime-tracking-EMTZIN3W.js} +1 -1
  137. package/build/runtime-tracking-EMTZIN3W.js.br +0 -0
  138. package/build/runtime-tracking-EMTZIN3W.js.gz +0 -0
  139. package/build/{runtime-transitions-UZMSVIQQ.js → runtime-transitions-VL46OOZE.js} +1 -1
  140. package/build/runtime-transitions-VL46OOZE.js.br +0 -0
  141. package/build/runtime-transitions-VL46OOZE.js.gz +0 -0
  142. package/build/{runtime-ui2d-3SFWWIHX.js → runtime-ui2d-KV2KXS4A.js} +1 -1
  143. package/build/runtime-ui2d-KV2KXS4A.js.br +0 -0
  144. package/build/runtime-ui2d-KV2KXS4A.js.gz +0 -0
  145. package/build/{runtime-vectorShapes-LG23IGW6.js → runtime-vectorShapes-5G7BQGJ6.js} +1 -1
  146. package/build/runtime-vectorShapes-5G7BQGJ6.js.br +0 -0
  147. package/build/runtime-vectorShapes-5G7BQGJ6.js.gz +0 -0
  148. package/build/{runtime-webgpu-HA7LX6HX.js → runtime-webgpu-2J3TE4FB.js} +1 -1
  149. package/build/runtime-webgpu-2J3TE4FB.js.br +0 -0
  150. package/build/runtime-webgpu-2J3TE4FB.js.gz +0 -0
  151. package/build/runtime.cjs +5 -5
  152. package/build/runtime.js +1 -1
  153. package/build/runtime.js.br +0 -0
  154. package/build/runtime.js.gz +0 -0
  155. package/build/runtime.standalone.js +1 -1
  156. package/build/runtime.standalone.js.br +0 -0
  157. package/build/runtime.standalone.js.gz +0 -0
  158. package/build/runtime.standalone.webgl.js +1 -1
  159. package/build/runtime.standalone.webgl.js.br +0 -0
  160. package/build/runtime.standalone.webgl.js.gz +0 -0
  161. package/build/runtime.standalone.webgpu.js +1 -1
  162. package/build/runtime.standalone.webgpu.js.br +0 -0
  163. package/build/runtime.standalone.webgpu.js.gz +0 -0
  164. package/build/runtime.standalone.webgpu.micro.js +1 -1
  165. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  166. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  167. package/build/runtime.standalone.webgpu.min.js +1 -1
  168. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  169. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  170. package/package.json +1 -1
  171. package/build/runtime-chunk-4ENGAWL7.js.br +0 -0
  172. package/build/runtime-chunk-4ENGAWL7.js.gz +0 -0
  173. package/build/runtime-chunk-5GCT2MXQ.js.br +0 -0
  174. package/build/runtime-chunk-5GCT2MXQ.js.gz +0 -0
  175. package/build/runtime-chunk-7UK5TXXX.js.br +0 -0
  176. package/build/runtime-chunk-7UK5TXXX.js.gz +0 -0
  177. package/build/runtime-chunk-ALDD75EK.js.br +0 -0
  178. package/build/runtime-chunk-ALDD75EK.js.gz +0 -0
  179. package/build/runtime-chunk-AVO7AFZY.js.br +0 -0
  180. package/build/runtime-chunk-AVO7AFZY.js.gz +0 -0
  181. package/build/runtime-chunk-BY4Y72LZ.js.br +0 -0
  182. package/build/runtime-chunk-BY4Y72LZ.js.gz +0 -0
  183. package/build/runtime-chunk-CSQ34B7E.js.br +0 -0
  184. package/build/runtime-chunk-CSQ34B7E.js.gz +0 -0
  185. package/build/runtime-chunk-CUGQPKPQ.js.br +0 -0
  186. package/build/runtime-chunk-CUGQPKPQ.js.gz +0 -0
  187. package/build/runtime-chunk-DA36J6OU.js.br +0 -0
  188. package/build/runtime-chunk-DA36J6OU.js.gz +0 -0
  189. package/build/runtime-chunk-DQMOB5OU.js.br +0 -0
  190. package/build/runtime-chunk-DQMOB5OU.js.gz +0 -0
  191. package/build/runtime-chunk-DX665HUE.js.br +0 -0
  192. package/build/runtime-chunk-DX665HUE.js.gz +0 -0
  193. package/build/runtime-chunk-FBNDPGTS.js.br +0 -0
  194. package/build/runtime-chunk-FBNDPGTS.js.gz +0 -0
  195. package/build/runtime-chunk-FJ3HZ257.js.br +0 -0
  196. package/build/runtime-chunk-FJ3HZ257.js.gz +0 -0
  197. package/build/runtime-chunk-FYQSEYL5.js.br +0 -0
  198. package/build/runtime-chunk-FYQSEYL5.js.gz +0 -0
  199. package/build/runtime-chunk-H3NZ2DPE.js.br +0 -0
  200. package/build/runtime-chunk-H3NZ2DPE.js.gz +0 -0
  201. package/build/runtime-chunk-HLXTXF7I.js.br +0 -0
  202. package/build/runtime-chunk-HLXTXF7I.js.gz +0 -0
  203. package/build/runtime-chunk-I5YVCEFL.js.br +0 -0
  204. package/build/runtime-chunk-I5YVCEFL.js.gz +0 -0
  205. package/build/runtime-chunk-K3MY5TZT.js.br +0 -0
  206. package/build/runtime-chunk-K3MY5TZT.js.gz +0 -0
  207. package/build/runtime-chunk-LEHYVJOU.js.br +0 -0
  208. package/build/runtime-chunk-LEHYVJOU.js.gz +0 -0
  209. package/build/runtime-chunk-NHLFGFU5.js.br +0 -0
  210. package/build/runtime-chunk-NHLFGFU5.js.gz +0 -0
  211. package/build/runtime-chunk-O6F5QJHF.js.br +0 -0
  212. package/build/runtime-chunk-O6F5QJHF.js.gz +0 -0
  213. package/build/runtime-chunk-OWPKF7IL.js.br +0 -0
  214. package/build/runtime-chunk-OWPKF7IL.js.gz +0 -0
  215. package/build/runtime-chunk-Q23Z6MJP.js.br +0 -0
  216. package/build/runtime-chunk-Q23Z6MJP.js.gz +0 -0
  217. package/build/runtime-chunk-T7HEAOAP.js.br +0 -0
  218. package/build/runtime-chunk-T7HEAOAP.js.gz +0 -0
  219. package/build/runtime-chunk-XT53PDQV.js.br +0 -0
  220. package/build/runtime-chunk-XT53PDQV.js.gz +0 -0
  221. package/build/runtime-classicRuntime-K34VIFGP.js.br +0 -0
  222. package/build/runtime-classicRuntime-K34VIFGP.js.gz +0 -0
  223. package/build/runtime-cloners-3Y3EIRQD.js.br +0 -1
  224. package/build/runtime-cloners-3Y3EIRQD.js.gz +0 -0
  225. package/build/runtime-components-OIRGNZ53.js.br +0 -0
  226. package/build/runtime-components-OIRGNZ53.js.gz +0 -0
  227. package/build/runtime-createDestroy-IXF6AHPT.js.br +0 -0
  228. package/build/runtime-createDestroy-IXF6AHPT.js.gz +0 -0
  229. package/build/runtime-dragDrop-XMMLZ4DN.js.br +0 -0
  230. package/build/runtime-dragDrop-XMMLZ4DN.js.gz +0 -0
  231. package/build/runtime-gameControls-AJVDYQ34.js.br +0 -0
  232. package/build/runtime-gameControls-AJVDYQ34.js.gz +0 -0
  233. package/build/runtime-hair-LL7HBW3N.js.br +0 -2
  234. package/build/runtime-hair-LL7HBW3N.js.gz +0 -0
  235. package/build/runtime-mergeStaticGeometries-SLURKUQL.js.br +0 -0
  236. package/build/runtime-mergeStaticGeometries-SLURKUQL.js.gz +0 -0
  237. package/build/runtime-miscActions-MYXVSOXT.js.br +0 -0
  238. package/build/runtime-miscActions-MYXVSOXT.js.gz +0 -0
  239. package/build/runtime-mouseHover-VNG5G3EV.js.br +0 -0
  240. package/build/runtime-mouseHover-VNG5G3EV.js.gz +0 -0
  241. package/build/runtime-particles-WY5ERTQY.js.br +0 -0
  242. package/build/runtime-particles-WY5ERTQY.js.gz +0 -0
  243. package/build/runtime-paths-EBK4AK5D.js.br +0 -0
  244. package/build/runtime-paths-EBK4AK5D.js.gz +0 -0
  245. package/build/runtime-resize-ARFL653M.js.br +0 -0
  246. package/build/runtime-resize-ARFL653M.js.gz +0 -0
  247. package/build/runtime-sceneTransition-U767Q26P.js.br +0 -0
  248. package/build/runtime-sceneTransition-U767Q26P.js.gz +0 -0
  249. package/build/runtime-scroll-PJN2KY5P.js.br +0 -0
  250. package/build/runtime-scroll-PJN2KY5P.js.gz +0 -0
  251. package/build/runtime-shapeBlends-QL2RV3WU.js +0 -1
  252. package/build/runtime-shapeBlends-QL2RV3WU.js.br +0 -4
  253. package/build/runtime-shapeBlends-QL2RV3WU.js.gz +0 -0
  254. package/build/runtime-text-BIQDLMVM.js.br +0 -0
  255. package/build/runtime-text-BIQDLMVM.js.gz +0 -0
  256. package/build/runtime-textInputs-PBVRLIAG.js.br +0 -0
  257. package/build/runtime-textInputs-PBVRLIAG.js.gz +0 -0
  258. package/build/runtime-timeline-FZBQAKBM.js.br +0 -0
  259. package/build/runtime-timeline-FZBQAKBM.js.gz +0 -0
  260. package/build/runtime-tracking-OGGWBM2F.js.br +0 -0
  261. package/build/runtime-tracking-OGGWBM2F.js.gz +0 -0
  262. package/build/runtime-transitions-UZMSVIQQ.js.br +0 -0
  263. package/build/runtime-transitions-UZMSVIQQ.js.gz +0 -0
  264. package/build/runtime-ui2d-3SFWWIHX.js.br +0 -0
  265. package/build/runtime-ui2d-3SFWWIHX.js.gz +0 -0
  266. package/build/runtime-vectorShapes-LG23IGW6.js.br +0 -0
  267. package/build/runtime-vectorShapes-LG23IGW6.js.gz +0 -0
  268. package/build/runtime-webgpu-HA7LX6HX.js.br +0 -0
  269. package/build/runtime-webgpu-HA7LX6HX.js.gz +0 -0
package/build/runtime.js CHANGED
@@ -1 +1 @@
1
- import{a as e,c as t}from"./runtime-chunk-KGZNRID6.js";import{c as n,d as i,f as s}from"./runtime-chunk-FBNDPGTS.js";import{a as r}from"./runtime-chunk-4ENGAWL7.js";import{a}from"./runtime-chunk-R43XZP65.js";import"./runtime-chunk-CSQ34B7E.js";import{a as o,b as l,c,d as h,e as d}from"./runtime-chunk-XT53PDQV.js";import"./runtime-chunk-7UK5TXXX.js";import{a as u,b as p}from"./runtime-chunk-NBYTQLIB.js";import{h as m}from"./runtime-chunk-ALDD75EK.js";import"./runtime-chunk-FYQSEYL5.js";import{a as f,c as v,f as y}from"./runtime-chunk-Q23Z6MJP.js";import"./runtime-chunk-TU4KDRKR.js";import{a as b,c as g}from"./runtime-chunk-DZNU62CT.js";import"./runtime-chunk-5GCT2MXQ.js";import{c as w}from"./runtime-chunk-T53JMQSH.js";import{a as E}from"./runtime-chunk-FTVQTRM7.js";import{a as _,b as j,e as P,h as M,j as C,m as A}from"./runtime-chunk-OWPKF7IL.js";import"./runtime-chunk-N2ZRGNPR.js";import{a as O,d as x,e as S}from"./runtime-chunk-VAVYZ35B.js";import"./runtime-chunk-FQNSP44B.js";import"./runtime-chunk-AVO7AFZY.js";import"./runtime-chunk-H3NZ2DPE.js";import{a as k}from"./runtime-chunk-LEHYVJOU.js";import"./runtime-chunk-I5YVCEFL.js";import"./runtime-chunk-T7HEAOAP.js";import"./runtime-chunk-DA36J6OU.js";import{D as R,H as T,J as D,K as V,R as L,b as I,ba as G,da as U,ea as B,f as K,h as N,j as F,o as z}from"./runtime-chunk-BY4Y72LZ.js";import"./runtime-chunk-4YV3EXSU.js";import{a as W,b as H}from"./runtime-chunk-NSD7DU3P.js";import{c as q,d as $,f as Y,g as X}from"./runtime-chunk-WGBR2HLR.js";import{n as Q}from"./runtime-chunk-MQKKQEK3.js";import{b as Z,c as J,e as ee,f as te,h as ne}from"./runtime-chunk-2PT2WH66.js";import{a as ie,i as se}from"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-VGEECQH4.js";import{b as re,c as ae,k as oe,l as le}from"./runtime-chunk-TZCHGFVF.js";import{$ as ce,Aa as he,Ca as de,Ea as ue,F as pe,Fa as me,G as fe,H as ve,Ha as ye,U as be,X as ge,Y as we,Z as Ee,_ as _e,aa as je,ba as Pe,ca as Me,e as Ce,ea as Ae,fa as Oe,g as xe,ga as Se,h as ke,ha as Re,m as Te,oa as De,p as Ve,w as Le,x as Ie,xa as Ge,y as Ue,ya as Be}from"./runtime-chunk-D3BWEUN6.js";import{a as Ke}from"./runtime-chunk-Y3BMDVJ7.js";import{$c as Ne,Ab as Fe,Bb as ze,Cb as We,Cc as He,Dc as qe,Ec as $e,Fc as Ye,Ke as Xe,Oc as Qe,Pc as Ze,Tc as Je,Xc as et,bd as tt,dd as nt,oe as it}from"./runtime-chunk-BVVSZMXD.js";import{a as st,b as rt}from"./runtime-chunk-ML3Z74BL.js";var at=st((e,t)=>{t.exports=function(e,t){for(var n=e.split("."),i=t.split("."),s=0;s<3;s++){var r=Number(n[s]),a=Number(i[s]);if(r>a)return 1;if(a>r)return-1;if(!isNaN(r)&&isNaN(a))return 1;if(isNaN(r)&&!isNaN(a))return-1}return 0}}),ot=".",lt=Symbol("target"),ct=Symbol("unsubscribe");function ht(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}var dt=Array.isArray;function ut(e){return"symbol"==typeof e}var pt={after:(e,t)=>dt(e)?e.slice(t.length):""===t?e:e.slice(t.length+1),concat:(e,t)=>dt(e)?(e=[...e],t&&e.push(t),e):t&&void 0!==t.toString?(""!==e&&(e+=ot),ut(t)?e+t.toString():e+t):e,initial:e=>{if(dt(e))return e.slice(0,-1);if(""===e)return e;let t=e.lastIndexOf(ot);return-1===t?"":e.slice(0,t)},last:e=>{if(dt(e))return e[e.length-1]||"";if(""===e)return e;let t=e.lastIndexOf(ot);return-1===t?e:e.slice(t+1)},walk:(e,t)=>{if(dt(e))for(let n of e)t(n);else if(""!==e){let n=0,i=e.indexOf(ot);if(-1===i)t(e);else for(;n<e.length;)-1===i&&(i=e.length),t(e.slice(n,i)),n=i+1,i=e.indexOf(ot,n)}},get(e,t){return this.walk(t,t=>{e&&(e=e[t])}),e}};function mt(e,t,n){return e.isUnsubscribed||t.ignoreSymbols&&ut(n)||t.ignoreUnderscores&&"_"===n.charAt(0)||"ignoreKeys"in t&&t.ignoreKeys.includes(n)}var ft=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return void 0===this._descriptorCache&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let n=this._getProperties(e),i=n[t];return void 0===i&&(i=Reflect.getOwnPropertyDescriptor(e,t),n[t]=i),i}getProxy(e,t,n,i){if(this.isUnsubscribed)return e;let s=e[i],r=s||e;this._pathCache.set(r,t);let a=this._proxyCache.get(r);return void 0===a&&(a=void 0===s?new Proxy(e,n):e,this._proxyCache.set(r,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,pt.get(t,this.getPath(e)))}defineProperty(e,t,n){return!!Reflect.defineProperty(e,t,n)&&(this.isUnsubscribed||(this._getProperties(e)[t]=n),!0)}setProperty(e,t,n,i,s){if(!this._equals(s,n)||!(t in e)){let s=this._getOwnPropertyDescriptor(e,t);return void 0!==s&&"set"in s?Reflect.set(e,t,n,i):Reflect.set(e,t,n)}return!0}deleteProperty(e,t,n){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let i=this._getDescriptorCache().get(e);i&&(delete i[t],this._pathCache.delete(n))}return!0}return!1}isSameDescriptor(e,t,n){let i=this._getOwnPropertyDescriptor(t,n);return void 0!==e&&void 0!==i&&Object.is(e.value,i.value)&&(e.writable||!1)===(i.writable||!1)&&(e.enumerable||!1)===(i.enumerable||!1)&&(e.configurable||!1)===(i.configurable||!1)&&e.get===i.get&&e.set===i.set}isGetInvariant(e,t){let n=this._getOwnPropertyDescriptor(e,t);return void 0!==n&&!0!==n.configurable&&!0!==n.writable}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function vt(e){return"[object Object]"===toString.call(e)}function yt(){return!0}function bt(e,t){return e.length!==t.length||e.some((e,n)=>t[n]!==e)}var gt=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),wt=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),Et={push:yt,pop:yt,shift:yt,unshift:yt,copyWithin:bt,reverse:bt,sort:bt,splice:bt,flat:bt,fill:bt},_t=new Set([...gt,...wt,...Object.keys(Et)]);function jt(e,t){if(e.size!==t.size)return!0;for(let n of e)if(!t.has(n))return!0;return!1}var Pt=["keys","values","entries"],Mt=new Set(["has","toString"]),Ct={add:jt,clear:jt,delete:jt,forEach:jt},At=new Set([...Mt,...Object.keys(Ct),...Pt]);function Ot(e,t){if(e.size!==t.size)return!0;let n;for(let[i,s]of e)if(n=t.get(i),n!==s||void 0===n&&!t.has(i))return!0;return!1}var xt=new Set([...Mt,"get"]),St={set:Ot,clear:Ot,delete:Ot,forEach:Ot},kt=new Set([...xt,...Object.keys(St),...Pt]),Rt=class{constructor(e,t,n,i){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=i,this._changes=i?[]:null,this.clone=void 0===t?e:this._shallowClone(e)}static isHandledMethod(e){return gt.has(e)}_shallowClone(e){let t=e;if(vt(e))t={...e};else if(dt(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(e=>this._shallowClone(e)));else if(e instanceof Map){t=new Map;for(let[n,i]of e.entries())t.set(n,this._shallowClone(i))}return this._clonedCache.add(t),t}preferredThisArg(e,t,n,i){return e?(dt(i)?this._onIsChanged=Et[t]:i instanceof Set?this._onIsChanged=Ct[t]:i instanceof Map&&(this._onIsChanged=St[t]),i):n}update(e,t,n){let i=pt.after(e,this._path);if("length"!==t){let e=this.clone;pt.walk(i,t=>{e&&e[t]&&(this._clonedCache.has(e[t])||(e[t]=this._shallowClone(e[t])),e=e[t])}),this._hasOnValidate&&this._changes.push({path:i,property:t,previous:n}),e&&e[t]&&(e[t]=n)}this._isChanged=!0}undo(e){let t;for(let n=this._changes.length-1;-1!==n;n--)t=this._changes[n],pt.get(e,t.path)[t.property]=t.previous}isChanged(e){return void 0===this._onIsChanged?this._isChanged:this._onIsChanged(this.clone,e)}},Tt=class extends Rt{static isHandledMethod(e){return _t.has(e)}},Dt=class extends Rt{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},Vt=class extends Rt{static isHandledMethod(e){return At.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}},Lt=class extends Rt{static isHandledMethod(e){return kt.has(e)}undo(e){for(let[t,n]of this.clone.entries())e.set(t,n);for(let t of e.keys())this.clone.has(t)||e.delete(t)}},It=class extends Rt{constructor(e,t,n,i){super(void 0,t,n,i),this._arg1=n[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}},Gt=class extends Rt{constructor(e,t,n,i){super(void 0,t,n,i),this._weakKey=n[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}},Ut=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return vt(e)||dt(e)||ht(e)}static isHandledMethod(e,t){return vt(e)?Rt.isHandledMethod(t):dt(e)?Tt.isHandledMethod(t):e instanceof Set?Vt.isHandledMethod(t):e instanceof Map?Lt.isHandledMethod(t):ht(e)}get isCloning(){return this._stack.length>0}start(e,t,n){let i=Rt;dt(e)?i=Tt:e instanceof Date?i=Dt:e instanceof Set?i=Vt:e instanceof Map?i=Lt:e instanceof WeakSet?i=It:e instanceof WeakMap&&(i=Gt),this._stack.push(new i(e,t,n,this._hasOnValidate))}update(e,t,n){this._stack[this._stack.length-1].update(e,t,n)}preferredThisArg(e,t,n){let{name:i}=e,s=Ut.isHandledMethod(n,i);return this._stack[this._stack.length-1].preferredThisArg(s,i,t,n)}isChanged(e,t,n){return this._stack[this._stack.length-1].isChanged(e,t,n)}undo(e){void 0!==this._previousClone&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},Bt={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},Kt=(e,t,n={})=>{n={...Bt,...n};let i=Symbol("ProxyTarget"),{equals:s,isShallow:r,ignoreDetached:a,details:o}=n,l=new ft(s),c="function"==typeof n.onValidate,h=new Ut(c),d=(e,t,i,s,r)=>!c||h.isCloning||!0===n.onValidate(pt.concat(l.getPath(e),t),i,s,r),u=(t,i,s,r)=>{!mt(l,n,i)&&(!a||!l.isDetached(t,e))&&p(l.getPath(t),i,s,r)},p=(e,n,i,s,r)=>{h.isCloning?h.update(e,n,s):t(pt.concat(e,n),i,s,r)},m=e=>e&&(e[i]||e),f=(t,s,o,c)=>function(e){return("object"==typeof e?null===e:"function"!=typeof e)||e instanceof RegExp}(t)||"constructor"===o||r&&!Ut.isHandledMethod(s,o)||mt(l,n,o)||l.isGetInvariant(s,o)||a&&l.isDetached(s,e)?t:(void 0===c&&(c=l.getPath(s)),l.getProxy(t,pt.concat(c,o),v,i)),v={get(e,t,n){if(ut(t)){if(t===i||t===lt)return e;if(t===ct&&!l.isUnsubscribed&&0===l.getPath(e).length)return l.unsubscribe(),e}let s=ht(e)?Reflect.get(e,t):Reflect.get(e,t,n);return f(s,e,t)},set(e,t,n,r){n=m(n);let a=e[i]||e,o=a[t];if(s(o,n)&&t in e)return!0;let c=d(e,t,n,o);return c&&l.setProperty(a,t,n,r,o)?(u(e,t,e[t],o),!0):!c},defineProperty(e,t,n){if(!l.isSameDescriptor(n,e,t)){let i=e[t];d(e,t,n.value,i)&&l.defineProperty(e,t,n,i)&&u(e,t,n.value,i)}return!0},deleteProperty(e,t){if(!Reflect.has(e,t))return!0;let n=Reflect.get(e,t),i=d(e,t,void 0,n);return i&&l.deleteProperty(e,t,n)?(u(e,t,void 0,n),!0):!i},apply(t,n,r){let a=n[i]||n;if(l.isUnsubscribed)return Reflect.apply(t,a,r);if((!1===o||!0!==o&&!o.includes(t.name))&&Ut.isHandledType(a)){let i=pt.initial(l.getPath(t)),o=Ut.isHandledMethod(a,t.name);h.start(a,i,r);let c=Reflect.apply(t,h.preferredThisArg(t,n,a),o?r.map(e=>m(e)):r),u=h.isChanged(a,s),y=h.stop();if(Ut.isHandledType(c)&&o&&(n instanceof Map&&"get"===t.name&&(i=pt.concat(i,r[0])),c=l.getProxy(c,i,v)),u){let n={name:t.name,args:r,result:c},s=h.isCloning?pt.initial(i):i,o=h.isCloning?pt.last(i):"";d(pt.get(e,s),o,a,y,n)?p(s,o,a,y,n):h.undo(a)}return(n instanceof Map||n instanceof Set)&&function(e){return"object"==typeof e&&"function"==typeof e.next}(c)?function(e,t,n,i,s){let r=e.next;if("entries"===t.name)e.next=function(){let e=r.call(this);return!1===e.done&&(e.value[0]=s(e.value[0],t,e.value[0],i),e.value[1]=s(e.value[1],t,e.value[0],i)),e};else if("values"===t.name){let a=n[lt].keys();e.next=function(){let e=r.call(this);return!1===e.done&&(e.value=s(e.value,t,a.next().value,i)),e}}else e.next=function(){let e=r.call(this);return!1===e.done&&(e.value=s(e.value,t,e.value,i)),e};return e}(c,t,n,i,f):c}return Reflect.apply(t,n,r)}},y=l.getProxy(e,n.pathAsArray?[]:"",v);return t=t.bind(y),c&&(n.onValidate=n.onValidate.bind(y)),y};Kt.target=e=>e&&e[lt]||e,Kt.unsubscribe=e=>e[ct]||e;var Nt=Kt,Ft="__splineHtmlContent",zt=`(function () {\n\t'use strict';\n\tvar MARKER = ${JSON.stringify(Ft)};\n\tvar callSeq = 1;\n\tvar pending = {};\n\tvar listeners = {};\n\tvar acked = false;\n\tvar readyResolve;\n\tvar readyPromise = new Promise(function (resolve) { readyResolve = resolve; });\n\n\tfunction post(msg) {\n\t\tmsg[MARKER] = true;\n\t\ttry {\n\t\t\twindow.parent.postMessage(msg, '*');\n\t\t} catch (e) { /* parent gone — nothing to do */ }\n\t}\n\n\tfunction call(method, args) {\n\t\treturn new Promise(function (resolve, reject) {\n\t\t\tvar id = callSeq++;\n\t\t\tpending[id] = { resolve: resolve, reject: reject };\n\t\t\tpost({ kind: 'call', id: id, method: method, args: args });\n\t\t});\n\t}\n\n\t// ---- the public API ----------------------------------------------------\n\tvar spline = {\n\t\t/** Resolves once the editor has acknowledged the frame. */\n\t\tready: readyPromise,\n\t\tsetVariable: function (name, value) { return call('setVariable', [name, value]); },\n\t\tsetVariables: function (variables) { return call('setVariables', [variables]); },\n\t\tgetVariable: function (name) { return call('getVariable', [name]); },\n\t\tgetVariables: function () { return call('getVariables', []); },\n\t\tgetAllObjects: function () { return call('getAllObjects', []); },\n\t\tfindObjectByName: function (name) { return call('findObjectByName', [name]); },\n\t\tfindObjectById: function (id) { return call('findObjectById', [id]); },\n\t\t/** Read a mesh's live geometry ({vertexCount, triangleCount, indexed, bounds, vertices: Float32Array, indices?, normals?, uvs?}); options {space: 'local'|'world'}. Resolves undefined (with a console warning) when unreadable. */\n\t\tgetGeometry: function (nameOrId, options) { return call('getGeometry', [nameOrId, options || {}]); },\n\t\t/** Runtime-only transform/visibility update ({position,rotation,scale,visible}; rotation in degrees). */\n\t\tupdateObject: function (nameOrId, props) { return call('updateObject', [nameOrId, props]); },\n\t\t/** Runtime-only object creation ('Cube', 'Sphere', …, 'Text', 'Group', lights); resolves to the new object's snapshot. */\n\t\tcreateObject: function (type, options) {\n\t\t\t// A three.js material instance or createCustomMaterial factory can't cross\n\t\t\t// the postMessage boundary (textures/callbacks/functions fail\n\t\t\t// structured clone) — fail loud, not with a cryptic DataCloneError.\n\t\t\tif (options && options.material && (\n\t\t\t\toptions.material.isMaterial === true ||\n\t\t\t\ttypeof options.material === 'function'\n\t\t\t)) {\n\t\t\t\treturn Promise.reject(new Error(\n\t\t\t\t\t'createObject: custom three.js materials need the inline ' +\n\t\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t\t'cannot carry them. Use a color/PBR bag or shared material ' +\n\t\t\t\t\t'name here instead.'\n\t\t\t\t));\n\t\t\t}\n\t\t\treturn call('createObject', [type, options || {}]);\n\t\t},\n\t\t/** Custom three.js/TSL materials — inline HTML-content mode only; the\n\t\t * factory function cannot cross this sandboxed transport. */\n\t\tcreateCustomMaterial: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'createCustomMaterial: custom three.js materials need the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry the factory function or the material it returns.'\n\t\t\t));\n\t\t},\n\t\t/** Replace a mesh's material with a custom three.js material — inline\n\t\t * HTML-content mode only; neither factories nor instances can cross\n\t\t * this sandboxed transport. */\n\t\tsetMaterial: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'setMaterial: custom three.js materials need the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry the factory function or the material it returns.'\n\t\t\t));\n\t\t},\n\t\t/** Runtime-only deep clone of an existing object; resolves to the clone's snapshot. */\n\t\tcloneObject: function (nameOrId, options) { return call('cloneObject', [nameOrId, options || {}]); },\n\t\t/** Removes an object (and its subtree); resolves to false when none matched. */\n\t\tremoveObject: function (nameOrId) { return call('removeObject', [nameOrId]); },\n\t\t/** Spawn a runtime-only copy of a template object; resolves to its snapshot ({id,...}) or undefined. */\n\t\tspawnObject: function (templateNameOrId, options) { return call('spawnObject', [templateNameOrId, options || {}]); },\n\t\t/** Remove a spawned copy by id (or assigned name). Spawned objects only. */\n\t\tdestroyObject: function (idOrName) { return call('destroyObject', [idOrName]); },\n\t\t/** Per-copy transform writes on a cloner ([{position,rotation,scale}|null, ...]; degrees); null clears all. Resolves to the copy count. */\n\t\tsetInstanceTransforms: function (nameOrId, transforms) { return call('setInstanceTransforms', [nameOrId, transforms === undefined ? null : transforms]); },\n\t\t/** Trigger a Spline event on an object (requires Play mode). */\n\t\temitEvent: function (eventName, nameOrUuid) { return call('emitEvent', [eventName, nameOrUuid]); },\n\t\temitEventReverse: function (eventName, nameOrUuid) { return call('emitEventReverse', [eventName, nameOrUuid]); },\n\t\trequestRender: function () { return call('requestRender', []); },\n\t\taddEventListener: function (eventName, cb) {\n\t\t\tif (typeof cb !== 'function') return;\n\t\t\tif (!listeners[eventName]) {\n\t\t\t\tlisteners[eventName] = [];\n\t\t\t\tcall('listenEvent', [eventName]);\n\t\t\t}\n\t\t\tlisteners[eventName].push(cb);\n\t\t},\n\t\tremoveEventListener: function (eventName, cb) {\n\t\t\tvar list = listeners[eventName];\n\t\t\tif (!list) return;\n\t\t\tvar i = list.indexOf(cb);\n\t\t\tif (i !== -1) list.splice(i, 1);\n\t\t\tif (list.length === 0) {\n\t\t\t\tdelete listeners[eventName];\n\t\t\t\tcall('unlistenEvent', [eventName]);\n\t\t\t}\n\t\t},\n\t};\n\twindow.spline = spline;\n\n\t// ---- editor -> frame ---------------------------------------------------\n\twindow.addEventListener('message', function (event) {\n\t\tif (event.source !== window.parent) return;\n\t\tvar data = event.data;\n\t\tif (!data || data[MARKER] !== true) return;\n\t\tif (data.kind === 'ready-ack') {\n\t\t\tacked = true;\n\t\t\treadyResolve();\n\t\t} else if (data.kind === 'result') {\n\t\t\tvar entry = pending[data.id];\n\t\t\tif (!entry) return;\n\t\t\tdelete pending[data.id];\n\t\t\tif (data.ok) entry.resolve(data.value);\n\t\t\telse entry.reject(new Error(data.error || 'spline bridge call failed'));\n\t\t} else if (data.kind === 'event') {\n\t\t\tvar list = listeners[data.eventName];\n\t\t\tif (!list) return;\n\t\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tlist[i](data.payload);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treportError(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t// ---- console + error capture --------------------------------------------\n\tfunction stringify(value, depth) {\n\t\ttry {\n\t\t\tif (typeof value === 'string') return value;\n\t\t\tif (value instanceof Error) return value.stack || String(value);\n\t\t\tif (typeof value === 'function') return '[function ' + (value.name || 'anonymous') + ']';\n\t\t\tif (value === undefined) return 'undefined';\n\t\t\tvar seen = [];\n\t\t\tvar json = JSON.stringify(value, function (k, v) {\n\t\t\t\tif (typeof v === 'object' && v !== null) {\n\t\t\t\t\tif (seen.indexOf(v) !== -1) return '[circular]';\n\t\t\t\t\tseen.push(v);\n\t\t\t\t}\n\t\t\t\tif (typeof v === 'function') return '[function]';\n\t\t\t\treturn v;\n\t\t\t});\n\t\t\treturn json === undefined ? String(value) : json;\n\t\t} catch (e) {\n\t\t\ttry { return String(value); } catch (e2) { return '[unserializable]'; }\n\t\t}\n\t}\n\n\tfunction sendConsole(level, args) {\n\t\tvar parts = [];\n\t\tfor (var i = 0; i < args.length; i++) parts.push(stringify(args[i]));\n\t\tvar text = parts.join(' ');\n\t\tif (text.length > 4000) text = text.slice(0, 4000) + '…';\n\t\tpost({ kind: 'console', level: level, text: text });\n\t}\n\n\t['log', 'info', 'warn', 'error'].forEach(function (level) {\n\t\tvar original = console[level];\n\t\tconsole[level] = function () {\n\t\t\tsendConsole(level, arguments);\n\t\t\tif (original) original.apply(console, arguments);\n\t\t};\n\t});\n\n\tfunction reportError(error) {\n\t\tsendConsole('error', [error instanceof Error ? error : String(error)]);\n\t}\n\twindow.addEventListener('error', function (event) {\n\t\tsendConsole('error', [event.message + (event.filename ? ' (' + event.filename + ':' + event.lineno + ')' : '')]);\n\t});\n\twindow.addEventListener('unhandledrejection', function (event) {\n\t\tsendConsole('error', ['Unhandled promise rejection: ' + stringify(event.reason)]);\n\t});\n\n\t// ---- input passthrough ---------------------------------------------------\n\t// A pointer that goes DOWN on the page background belongs to the 3D scene\n\t// until it is released; one that goes down on generated UI never forwards.\n\tvar forwardedPointers = {};\n\n\tfunction isBackground(target) {\n\t\tif (!target || target === document || target === document.documentElement || target === document.body) {\n\t\t\treturn true;\n\t\t}\n\t\tif (target.closest && target.closest('[data-spline-passthrough]')) return true;\n\t\treturn false;\n\t}\n\n\tfunction baseInput(e, type) {\n\t\treturn {\n\t\t\ttype: type,\n\t\t\tx: e.clientX,\n\t\t\ty: e.clientY,\n\t\t\tbutton: e.button,\n\t\t\tbuttons: e.buttons,\n\t\t\tpointerId: e.pointerId,\n\t\t\tpointerType: e.pointerType,\n\t\t\tisPrimary: e.isPrimary,\n\t\t\tmovementX: e.movementX,\n\t\t\tmovementY: e.movementY,\n\t\t\tshiftKey: e.shiftKey,\n\t\t\tctrlKey: e.ctrlKey,\n\t\t\taltKey: e.altKey,\n\t\t\tmetaKey: e.metaKey,\n\t\t};\n\t}\n\n\tdocument.addEventListener('pointerdown', function (e) {\n\t\tif (!isBackground(e.target)) return;\n\t\tforwardedPointers[e.pointerId] = true;\n\t\tpost({ kind: 'input', event: baseInput(e, 'pointerdown') });\n\t}, true);\n\n\tdocument.addEventListener('pointermove', function (e) {\n\t\tif (!forwardedPointers[e.pointerId] && !isBackground(e.target)) return;\n\t\tpost({ kind: 'input', event: baseInput(e, 'pointermove') });\n\t}, true);\n\n\t['pointerup', 'pointercancel'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\tvar wasForwarded = forwardedPointers[e.pointerId];\n\t\t\tdelete forwardedPointers[e.pointerId];\n\t\t\tif (!wasForwarded && !isBackground(e.target)) return;\n\t\t\tpost({ kind: 'input', event: baseInput(e, type) });\n\t\t}, true);\n\t});\n\n\t['click', 'dblclick'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\tif (!isBackground(e.target)) return;\n\t\t\tpost({ kind: 'input', event: baseInput(e, type) });\n\t\t}, true);\n\t});\n\n\tdocument.addEventListener('wheel', function (e) {\n\t\tif (!isBackground(e.target)) return;\n\t\te.preventDefault();\n\t\tvar msg = baseInput(e, 'wheel');\n\t\tmsg.deltaX = e.deltaX;\n\t\tmsg.deltaY = e.deltaY;\n\t\tmsg.deltaMode = e.deltaMode;\n\t\t// The legacy wheelDelta fields carry the trackpad-vs-mouse signature\n\t\t// the editor's pan/zoom discrimination reads (wheelDeltaY === -3*dY\n\t\t// on trackpads) — a reconstructed WheelEvent loses them, turning\n\t\t// two-finger pans into zooms. Forward them verbatim.\n\t\tif (typeof e.wheelDeltaX === 'number') msg.wheelDeltaX = e.wheelDeltaX;\n\t\tif (typeof e.wheelDeltaY === 'number') msg.wheelDeltaY = e.wheelDeltaY;\n\t\tpost({ kind: 'input', event: msg });\n\t}, { capture: true, passive: false });\n\n\t['keydown', 'keyup'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\t// Never steal keys from the page's own form fields.\n\t\t\tvar t = e.target;\n\t\t\tif (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;\n\t\t\tpost({ kind: 'input', event: {\n\t\t\t\ttype: type,\n\t\t\t\tkey: e.key,\n\t\t\t\tcode: e.code,\n\t\t\t\trepeat: e.repeat,\n\t\t\t\tshiftKey: e.shiftKey,\n\t\t\t\tctrlKey: e.ctrlKey,\n\t\t\t\taltKey: e.altKey,\n\t\t\t\tmetaKey: e.metaKey,\n\t\t\t} });\n\t\t}, true);\n\t});\n\n\t// ---- handshake -----------------------------------------------------------\n\t// Announce readiness and KEEP announcing until the editor acks. A single\n\t// 'ready' can race the editor attaching its listener (or land while the\n\t// editor is busy); code that awaits spline.ready would then hang forever.\n\t// The editor acks every 'ready' (and posts a proactive ack on attach), so\n\t// this settles within one round-trip in the normal case.\n\tpost({ kind: 'ready' });\n\tvar readyRetry = setInterval(function () {\n\t\tif (acked) {\n\t\t\tclearInterval(readyRetry);\n\t\t\treturn;\n\t\t}\n\t\tpost({ kind: 'ready' });\n\t}, 250);\n})();`,Wt=class{constructor(e,t,n){this.deps=e,this.onConsole=t,this.onEvent=n,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let e of this.eventUnsubs.values())e();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(e,t){let n=this.deps;switch(e){case"setVariable":{let e=n.setVariable(String(t[0]),t[1]);return e.warning&&this.onConsole("warn",e.warning),e.ok}case"setVariables":{let e=t[0]??{},i=!0;for(let[t,s]of Object.entries(e)){let e=n.setVariable(t,s);e.warning&&this.onConsole("warn",e.warning),i=i&&e.ok}return i}case"getVariable":return n.getVariable(String(t[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(t[0]));case"getGeometry":{let e=n.getGeometry(String(t[0]),t[1]??{});return e.warning&&this.onConsole("warn",e.warning),e.data}case"updateObject":return n.updateObject(String(t[0]),t[1]??{});case"createObject":return n.createObject(String(t[0]),t[1]??{});case"createCustomMaterial":if(void 0===n.createCustomMaterial)throw new Error("createCustomMaterial: not available on this surface — custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(t[0]);case"setMaterial":if(void 0===n.setMaterial)throw new Error("setMaterial: not available on this surface — custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.setMaterial(String(t[0]),t[1]);case"cloneObject":return n.cloneObject(String(t[0]),t[1]??{});case"removeObject":return n.removeObject(String(t[0]));case"spawnObject":{let e=n.spawnObject(String(t[0]),t[1]??{});return e.warning&&this.onConsole("warn",e.warning),e.object}case"destroyObject":return n.destroyObject(String(t[0]));case"setInstanceTransforms":{let e=null===t[1]||void 0===t[1]?null:t[1],i=n.setInstanceTransforms(String(t[0]),e);return i<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(t[0])}" has no cloner — make the object a cloner first (its copies are what this drives).`),i}case"emitEvent":case"emitEventReverse":{let i=n.emitEvent(String(t[0]),String(t[1]),"emitEventReverse"===e);return i.warning&&this.onConsole("warn",i.warning),i.ok}case"requestRender":return n.requestRender(),!0;case"listenEvent":{let e=String(t[0]);return"variableChange"===e?this.startVariablePolling():this.eventUnsubs.has(e)||this.eventUnsubs.set(e,n.addSplineEventListener(e,t=>{this.onEvent(e,t)})),!0}case"unlistenEvent":{let e=String(t[0]);return"variableChange"===e?this.stopVariablePolling():(this.eventUnsubs.get(e)?.(),this.eventUnsubs.delete(e)),!0}default:throw new Error(`Unknown spline bridge method: ${e}`)}}startVariablePolling(){null===this.variablePollHandle&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let e=this.deps.getVariables(),t=function(e,t){let n=[];for(let i of Object.keys(t))e[i]!==t[i]&&n.push({name:i,value:t[i]});return n}(this.lastVariables??{},e);this.lastVariables=e;for(let e of t)this.onEvent("variableChange",e)},100))}stopVariablePolling(){null!==this.variablePollHandle&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}};function Ht(e,t,n,i){return[e[0]*t+e[4]*n+e[8]*i+e[12],e[1]*t+e[5]*n+e[9]*i+e[13],e[2]*t+e[6]*n+e[10]*i+e[14]]}var qt=class{constructor(e,t,n){this.iframe=e,this.deps=t,this.onConsole=n,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=e=>{if(this.disposed||e.source!==this.iframe.contentWindow)return;let t=e.data;var n;"object"!=typeof(n=t)||null===n||!0!==n[Ft]||"string"!=typeof n.kind||this.handleMessage(t)},this.host=new Wt(t,n,(e,t)=>{this.sendEvent(e,t)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Ft]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) — if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),null!==this.handshakeTimer&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(e){switch(e.kind){case"ready":this.handshakeSeen=!0,this.send({[Ft]:!0,kind:"ready-ack"});break;case"console":this.onConsole(e.level,e.text);break;case"call":{let t;try{t=Promise.resolve(this.host.execute(e.method,e.args))}catch(e){t=Promise.reject(e)}t.then(t=>{this.send({[Ft]:!0,kind:"result",id:e.id,ok:!0,value:t,error:void 0})},t=>{let n=t instanceof Error?t.message:String(t);this.send({[Ft]:!0,kind:"result",id:e.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(e.event)}}send(e){this.iframe.contentWindow?.postMessage(e,"*")}sendEvent(e,t){this.send({[Ft]:!0,kind:"event",eventName:e,payload:t})}dispatchInput(e){let t=this.deps.getCanvas();if(!t)return;let n=this.iframe.getBoundingClientRect(),i={bubbles:!0,cancelable:!0,view:window,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey};switch(e.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":t.dispatchEvent(new PointerEvent(e.type,{...i,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,button:e.button,buttons:e.buttons,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,movementX:e.movementX,movementY:e.movementY}));break;case"click":case"dblclick":t.dispatchEvent(new MouseEvent(e.type,{...i,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,button:e.button,buttons:e.buttons}));break;case"wheel":{let s=new WheelEvent("wheel",{...i,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode});"number"==typeof e.wheelDeltaX&&Object.defineProperty(s,"wheelDeltaX",{value:e.wheelDeltaX}),"number"==typeof e.wheelDeltaY&&Object.defineProperty(s,"wheelDeltaY",{value:e.wheelDeltaY}),t.dispatchEvent(s);break}case"keydown":case"keyup":t.dispatchEvent(new KeyboardEvent(e.type,{...i,key:e.key,code:e.code,repeat:e.repeat}))}}};function $t(e){let t=e.points.length/7,n=new xe;for(let i=0;i<t;i++){let t=7*i,s=e.points[t+0],r=e.points[t+1],a=e.points[t+2],o=e.points[t+3],l=e.points[t+4],c=e.points[t+5],h=e.points[t+6];n.push({fi:i,id:He.generateUUID(),data:{roundness:h,position:[s,r],areControlsDirectionsMirrored:!0,controlPrevious:{position:[a,o]},controlNext:{position:[l,c]}}})}return{points:n,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(e=>$t(e))??[]}}function Yt(e){let{userData:t,uuid:n,...i}=e;if(void 0===t||"NonParametricGeometry"===t.type)return function(e){let t,{userData:n,data:i}=e,s=i?.groups,r=i?.attributes??{},a=i?.morphAttributes??{},o=i?.interleavedBuffers,l=i?.arrayBuffers,c=i?.index;void 0!==r.position&&Array.isArray(r.position.array)&&(t=function(e){let t=1/0,n=1/0,i=1/0,s=-1/0,r=-1/0,a=-1/0;for(let o=0;o<e.length;o+=3){let l=e[o],c=e[o+1],h=e[o+2];t=Math.min(t,l),n=Math.min(n,c),i=Math.min(i,h),s=Math.max(s,l),r=Math.max(r,c),a=Math.max(a,h)}return{width:s-t,height:r-n,depth:a-i}}(r.position.array));let h={...void 0===n?{}:n.parameters,data:{attributes:r,morphAttributes:a,interleavedBuffers:o,arrayBuffers:l},...void 0===t?{}:t,type:"NonParametricGeometry"};return void 0!==c&&Object.assign(h.data,{index:c}),void 0!==s&&Object.assign(h.data,{groups:s.map(e=>({...e,materialIndex:e.materialIndex??0}))}),h}(e);if("SubdivGeometry"===t.type){let e="SubdivGeometry",n=i.data?.attributes;if(void 0===n?.positionWASM){let e=new nt;if(void 0===n?.position||void 0===n?.faceMap)return null;let t=n.position.array,s=n.faceMap.array,r=i.data.index.array;e.setAttribute("position",new tt(t,3)),e.setIndex(new Ne(r,1));let a=I(e),o=[],l=new Array(s[s.length-1]+1).fill(3),c=a.getIndex().array;for(let e=0,t=s.length;e<t;)s[e]===s[e+1]?(l[s[e]]++,o.push(...new Set(c.slice(3*e,3*e+6))),e+=2):(o.push(...c.slice(3*e,3*e+3)),e++);n.indexWASM={array:o},n.positionWASM=a.attributes.position,n.verticesPerFaceWASM={array:l}}if(void 0===n?.positionWASM||0===n?.positionWASM.length||void 0===n?.indexWASM||0===n?.indexWASM.length||void 0===n?.verticesPerFaceWASM||0===n?.verticesPerFaceWASM.length)return null;let s={type:e,...Zt(n.positionWASM.array)};s.subdivisions=t.parameters.subdivisions;for(let e in n)"positionWASM"===e?s[e]=new Float32Array(n[e].array):"indexWASM"===e?s[e]=new Int32Array(n[e].array):"verticesPerFaceWASM"===e&&(s[e]=new Int8Array(n[e].array));return s.scaleBaked=[1,1,1],s}let s=t.type,r=t.parameters;return"VectorGeometry"===s?(r.extrudeDepth&&(r.depth=r.extrudeDepth),{...r,width:100,height:100,shape:$t(t.shape),type:s}):"LatheGeometry"===s?{...t.parameters,type:s,points:(t?.parameters.points??[]).map(e=>[e.x,e.y])}:(r.extrudeDepth&&(r.depth=r.extrudeDepth),{...r,type:s})}new Qe,new $e,new Ze,new Ye,new Ye;var Xt=new et,Qt=new Ye;function Zt(e){return Xt.setFromArray(e),Xt.getSize(Qt),{width:Qt.x,height:Qt.y,depth:Qt.z}}var Jt=class{constructor(e,t,n,i,s,r){if(this.id=e,this.data=t,this.object=n,this.entered=!1,("KeyDown"===t.type||"KeyUp"===t.type||"KeyPress"===t.type)&&!t.key)throw new Error("Missing property");this.actions=Y(t,t.actions,i,s,r,n)}disconnect(){X(this.actions)}dispatchHeld(e){this.actions.Create.forEach(t=>{e&&t.dispatchThrottled.cancel(),t.dispatchThrottled()})}dispatch(e=!1){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),"MousePress"===this.data.type||"KeyPress"===this.data.type?this.entered||(this.entered=!0,this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStart())):(this.actions.Transition.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.Transition.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.SwitchCamera.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.SwitchCamera.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&"Toggle"===e.data.runMode?e.toggle():e.play()})),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),!1===e&&this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}dispatchRelease(){this.entered&&(this.entered=!1,this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()))}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}},en=class extends b{constructor(e,t,n){super(e),this.eventManager=t,this.useForRaycastProperty=n,this.objectsPerTypes={MouseDown:[],MouseUp:[],MousePress:[],KeyDown:[],KeyUp:[],KeyPress:[]},this.canvasMouseEvents=[],this.eventsPerObjects={MouseDown:{},MouseUp:{},MousePress:{},KeyDown:{},KeyUp:{},KeyPress:{}},this.heldKeys={},this.heldKeysPress={},this._prevObjects=[],this.sceneInterects=null,this.onCanvasRaycast=e=>{if(!0===this.useForRaycastProperty&&null===this.sceneInterects){this.eventContext.updateRaycaster(e);let{raycaster:t,page:n}=this.eventContext,i=o(t,n,[],!0);this.sceneInterects=i,i.length&&(this.eventContext.sharedAssets.raycastProperty={x:i[0].point.x,y:i[0].point.y,z:i[0].point.z,objX:i[0].object.matrixWorld.elements[12],objY:i[0].object.matrixWorld.elements[13],objZ:i[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{("MouseDown"===t.data.type||"MousePress"===t.data.type)&&(this.onCanvasRaycast(e),t.dispatch())})},this.onCanvasMouseUp=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{"MouseUp"===t.data.type?(this.onCanvasRaycast(e),t.dispatch()):"MousePress"===t.data.type&&t.dispatchRelease()})},this.onMouseDown=e=>{O.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseDown"))},this.onMouseUp=e=>{O.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=e=>{O.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent())},this.onMousePressRelease=e=>{O.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent(!0))},this.onKeyDown=e=>{this.heldKeys[e.key]||(this.handleKeyEvent(e,"KeyDown"),this.handleKeyEventHeld(e,"KeyDown",!0)),this.heldKeys[e.key]=!0},this.onKeyUp=e=>{this.handleKeyEvent(e,"KeyUp"),this.handleKeyEventHeld(e,"KeyUp",!0)},this.onKeyPressDown=e=>{this.heldKeysPress[e.key]?this.handleKeyEventHeld(e,"KeyPress"):(this.handleKeyEvent(e,"KeyPress"),this.handleKeyEventHeld(e,"KeyPress",!0)),this.heldKeysPress[e.key]=!0},this.onKeyPressUp=e=>{this.handleKeyEvent(e,"KeyPress",!0)},this.releaseHeldKey=e=>{delete this.heldKeys[e.key]},this.releaseHeldKeyPress=e=>{delete this.heldKeysPress[e.key]},this._onUserEvent=({eventName:e,target:t,reverse:n})=>{if(!e||!t)return;let i=u(e);i&&("MouseDown"===i||"MouseUp"===i||"MousePress"===i?(t.dispatchEvent({type:"beginEvent",eventName:i}),this.eventsPerObjects[i]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent(n)}),this.canvasMouseEvents.forEach(e=>{e.dispatchUserEvent(n)})):("KeyDown"===i||"KeyUp"===i||"KeyPress"===i)&&(t.dispatchEvent({type:"beginEvent",eventName:i}),this.eventsPerObjects[i]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent()})))}}connect(){let{page:e,sharedAssets:t,domElement:n}=this.eventContext,i=(n,i)=>{if(!n.data?.events.length)return;let s=["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"];for(let r of s){let s=this.eventsPerObjects[r];if(n.data.events.filter(({data:e})=>e.type===r&&!0!==e.disabled).forEach(({id:i,data:r})=>{try{let a=new Jt(i,r,n,e,t,this.eventManager);a.actions.Video.length&&(this.hasVideoAction=!0),"MouseDown"!==r.type&&"MouseUp"!==r.type&&"MousePress"!==r.type||"Canvas"!==r.mode&&"Window"!==r.mode?(s[n.uuid]?s[n.uuid].some(e=>e.id===a.id)||s[n.uuid].push(a):s[n.uuid]=[a],J(n)&&n.traverseChildren(e=>{if(!e.visible)return!0;e instanceof B&&"shapeBlendNode"in e.data.geometry&&2!==e.data.geometry.shapeBlendNode?.operation&&(s[e.uuid]?s[e.uuid].push(a):s[e.uuid]=[a])})):this.canvasMouseEvents.push(a)}catch(e){}}),s[n.uuid]?.length&&(this.objectsPerTypes[r].push(!ee(n)||"MouseDown"!==r&&"MouseUp"!==r&&"MousePress"!==r?n:i),J(n))){let e=this.objectsPerTypes[r];n.traverseChildren(t=>{if(!t.visible)return!0;t instanceof B&&-1===e.indexOf(t)&&e.push(t)})}}};e.traverseEntity(e=>{(te(e)||e instanceof m)&&e.frame?.traverse(t=>{i(t,e)}),i(e)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),n.addEventListener("pointerdown",this.onCanvasMouseDown),n.addEventListener("pointerup",this.onCanvasMouseUp),(this.objectsPerTypes.MouseDown?.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),n.addEventListener("pointerdown",this.onMouseDown)),this.objectsPerTypes.MouseUp?.length&&(this.domEventsNeeded.add("pointerup"),n.addEventListener("pointerup",this.onMouseUp)),this.objectsPerTypes.MousePress?.length&&(this.domEventsNeeded.add("pointerdown"),n.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),n.addEventListener("pointerup",this.onMousePressRelease)),this.objectsPerTypes.KeyDown?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.objectsPerTypes.KeyUp?.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),this.objectsPerTypes.KeyPress?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyPressDown),document.addEventListener("keyup",this.releaseHeldKeyPress),this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyPressUp)),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.addEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.addEventListener("userEvent",this._onUserEvent)})}disconnect(){let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),this.heldKeys={},this.heldKeysPress={},e.removeEventListener("pointerdown",this.onCanvasMouseDown),e.removeEventListener("pointerup",this.onCanvasMouseUp),e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerdown",this.onMousePressDown),e.removeEventListener("pointerup",this.onMouseUp),e.removeEventListener("pointerup",this.onMousePressRelease),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyPressDown),document.removeEventListener("keyup",this.onKeyPressUp),document.removeEventListener("keyup",this.releaseHeldKey),Object.values(this.eventsPerObjects).forEach(e=>{Object.values(e).forEach(e=>{e.forEach(e=>{e.disconnect()})})}),this.canvasMouseEvents.forEach(e=>{e.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.removeEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.removeEventListener("userEvent",this._onUserEvent)})}handleMouseEvent(e){let{stopRaycast:t,raycaster:n,page:i,pointerScreen:s}=this.eventContext,r=this.objectsPerTypes[e],a=r.filter(e=>!ee(e));if((r.length||this.useForRaycastProperty)&&(!i.uiCanvas||!c(i,[s.x,s.y],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))){if(t||this.useForRaycastProperty){let s;if(null===this.sceneInterects?s=o(n,i,a,this.useForRaycastProperty):(s=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&s.length&&(this.eventContext.sharedAssets.raycastProperty={x:s[0].point.x,y:s[0].point.y,z:s[0].point.z,objX:s[0].object.matrixWorld.elements[12],objY:s[0].object.matrixWorld.elements[13],objZ:s[0].object.matrixWorld.elements[14]}),t){let t=[s[0]?.uv?.x??0,s[0]?.uv?.y??0];l(s).forEach(n=>{te(n)&&c(n,t,Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}),this.eventsPerObjects[e][n.uuid]&&this.handleObjectMouseEventDispatch(n,e)})}}t||a.forEach(t=>{let i=h(n,t);i&&(this.handleObjectMouseEventDispatch(t,e),te(t)&&c(t,[i?.uv?.x??0,i?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",n=this.objectsPerTypes[t],i=n.filter(e=>!ee(e)),s=[];if(n.length){if(!e){let{stopRaycast:e,raycaster:n,page:r,pointerScreen:a}=this.eventContext,d=!1;if(r.uiCanvas&&(d=c(r,[a.x,a.y],Object.keys(this.eventsPerObjects[t]),e=>{s.push(e)})),e&&!d){let e=o(n,r,i);s=l(e),e.forEach(e=>{te(e.object)&&c(e.object,[e?.uv?.x??0,e?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{s.push(e)})})}else i.forEach(e=>{let i=h(n,e);i&&(s.push(e),te(e)&&c(e,[i?.uv?.x??0,i?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{s.push(e)}))})}this._prevObjects.length&&this._prevObjects.forEach(e=>{s.includes(e)||this.handleObjectMouseEventDispatchRelease(e,t)}),s.length&&s.forEach(e=>{this.handleObjectMouseEventDispatch(e,t)}),this._prevObjects=s}}handleObjectMouseEventDispatch(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatchRelease()})}handleKeyEvent(e,t,n=!1){this.objectsPerTypes[t].forEach(i=>{let s=this.eventsPerObjects[t][i.uuid];s.some(({data:t})=>"key"in t&&t.key===e.key)&&i.dispatchEvent({type:"beginEvent",eventName:t}),s.forEach(t=>{"key"in t.data&&t.data.key===e.key&&(n?t.dispatchRelease():t.dispatch(!0))})})}handleKeyEventHeld(e,t,n=!1){this.objectsPerTypes[t].forEach(i=>{this.eventsPerObjects[t][i.uuid].forEach(t=>{"key"in t.data&&t.data.key===e.key&&t.dispatchHeld(n)})})}},tn=e=>!0===e?.isPlayAudioAction,nn=e=>!0===e?.isPauseAudioAction,sn=e=>!0===e?.isPlayVideoAction,rn=e=>!0===e?.isPauseVideoAction,an=class{constructor(e,t,n,i,s,r){this.id=e,this.data=t,this.object=n,this.actions=Y(t,t.actions,i,s,r,n)}disconnect(){X(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatchFromStart()}),this.actions.Destroy.forEach(e=>{e.dispatchFromStart()})}dispatchAfter(e){this.actions.Audio.forEach(t=>{(t.interaction.data.triggerAfter??"any")===e&&(tn(t.interaction)?t.interaction.audioPlayer?.play():nn(t.interaction)&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let n=t.interaction.data.triggerAfter??"autoplay";n===e&&(sn(t.interaction)?t.interaction.play("autoplay"===n):rn(t.interaction)&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}async seekVideos(e){let t=[];this.actions.Video.forEach(n=>{"autoplay"===(n.interaction.data.triggerAfter??"autoplay")&&sn(n.interaction)&&t.push(n.interaction.seek(e))}),await Promise.all(t)}pauseVideos(){this.actions.Video.forEach(e=>{sn(e.interaction)&&e.interaction.pause()})}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{tn(e.interaction)?e.interaction.audioPlayer?.play():nn(e.interaction)&&e.interaction.dispatch()}),this.actions.Video.forEach(e=>{sn(e.interaction)?e.interaction.play():rn(e.interaction)&&e.interaction.dispatch()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()})}},on=class extends b{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.actions.Audio.forEach(e=>{tn(e.interaction)&&e.interaction.audioPlayer?.play()}),e.actions.Video.forEach(e=>{let t=e.interaction.data.triggerAfter??"autoplay";sn(e.interaction)&&e.interaction.play("autoplay"===t)}),e.actions.Particles.forEach(e=>{e.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("autoplay")})})},this.seekVideos=async e=>{let t=[];[...this.eventsAfterPerObject.entries()].forEach(([n,i])=>{!n.data.visible||i.forEach(n=>{t.push(n.seekVideos(e))})}),await Promise.all(t)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>{e.pauseVideos()})})},this.onUserEvent=({eventName:e,target:t,reverse:n})=>{if(!e||!t)return;let i=u(e);i&&"Start"===i&&(ee(t)||t.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(n)}),this.eventsAfterPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(n)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,n=n=>{if(n.data?.events.length)for(let{id:i,data:s}of n.data.events){if(s.disabled||"Start"!==s.type)continue;let r=new an(i,s,n,t,e,this.eventManager);(r.actions.Transition.length||r.actions.TimelineAnimation.length||r.actions.Animation.length||r.actions.SwitchCamera.length||r.actions.Create.length||r.actions.Destroy.length||r.actions.SceneTransition.length||r.actions.Reset.length||r.actions.SetVariable.length||r.actions.DynamicVariablePlay.length||r.actions.ClearLocalStorage.length||r.actions.UserAPI.length)&&(this.eventsPerObject.has(n)?this.eventsPerObject.get(n)?.push(r):this.eventsPerObject.set(n,[r])),r.actions.Audio.length&&(this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(r):this.eventsAfterPerObject.set(n,[r])),r.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(r):this.eventsAfterPerObject.set(n,[r])),r.actions.Particles.length&&(this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(r):this.eventsAfterPerObject.set(n,[r]))}};if(t.traverseEntity(e=>{(te(e)||e instanceof m)&&e.frame?.traverse(e=>{n(e)}),n(e)}),[...this.eventsAfterPerObject.values()].some(e=>e.length)){if(0===this.eventManager.activateCount){let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.addEventListener("pointerdown",this.onMouseDown,{once:!0}),n.addEventListener("mousedown",this.onMouseDown,{once:!0}),document.addEventListener("keydown",this.onKeyDown,{once:!0}),n.addEventListener("pointerdown",this.onAny),n.addEventListener("mousedown",this.onAny),document.addEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>e.dispatch()),e.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if([...this.eventsAfterPerObject.values()].some(e=>e.length)){let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.removeEventListener("pointerdown",this.onMouseDown),n.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("keydown",this.onKeyDown),n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())})}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},ln=class{constructor(e,t,n,i,s){this.publish=e,this.controlsManager=t,this.animationControls=n,this.eventContext=i,this.sharedVariables=s,this.isEnabled=!1,this.activateCount=0,this.needsMouse=!1,this.needsRaycast=!1,this.onTouchMovePreventScroll=e=>{let t=window.parent!==window,n=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(e.touches.length>1||this.preventTouchScroll||!1===t&&!1===n)&&e.preventDefault()},this.onMouseWheelPreventScroll=e=>{this.preventScroll&&e.preventDefault()},this.onMouseMove=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:e.buttons>0}},this.onMouseDown=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!0}},this.onMouseUp=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!1}},this.getMousePosition=e=>{let{domRect:t}=this.eventContext,{pageX:n,pageY:i}=e.touches?.length>0?e.touches[0]:e;return{x:n-(t.left+window.scrollX),y:i-(t.top+window.scrollY)}},this.stopRaycast=e.stopRaycast,this.preventScroll=e.preventScroll,this.preventTouchScroll=e.preventTouchScroll,this.hideCursor=e.hideCursor,this.requestRender=i.requestRender}warnMissingEventFeatures(){this.eventContext.page.traverseEntity(e=>{for(let t of e.dataPatched.events){if(!0===t.data.disabled)continue;let e=t.data.type;if(void 0!==this.handlers[e])continue;let n=q[e];void 0!==n&&ae(n,`a "${e}" event`)}})}activate(e=!1){if(this.isEnabled)return;this.isEnabled=!0,this.initializeActionsDependentStates(),this.needsMouse&&(this.eventContext.domElement.addEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.addEventListener("pointerdown",this.onMouseDown));let t={eventContext:this.eventContext,eventManager:this,sharedVariables:this.sharedVariables,needsMouse:this.needsMouse,needsRaycast:this.needsRaycast};this.handlers={};let n=(e,n)=>{let i=g(e);void 0!==i?this.handlers[e]=i(t):void 0!==n&&(this.handlers[e]=n())};n("Spline",()=>new p(this.eventContext)),n("VariableChange"),n("API"),n("WEBHOOK"),n("AIAssistantListener"),n("AIAssistantTrigger"),n("Conditional"),n("Start",()=>new on(this.eventContext,this)),n("Basic",()=>new en(this.eventContext,this,this.needsRaycast)),n("MouseHover"),n("Scroll"),n("Follow"),n("DragDrop"),n("LookAt"),n("Resize"),n("Textfields"),this.warnMissingEventFeatures();let{page:i,domElement:s}=this.eventContext;this.hideCursor&&(s.style.cursor="none"),i.traverseEntity(e=>{e.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(e=>e.connect()),s.addEventListener("wheel",this.onMouseWheelPreventScroll),s.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(e=!1){if(!this.isEnabled)return;this.isEnabled=!1,this.eventContext.domElement.removeEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.removeEventListener("pointerdown",this.onMouseDown),this.eventContext.domElement.removeEventListener("pointerup",this.onMouseUp),this.eventContext.sharedAssets.mouseProperty=null,this.eventContext.sharedAssets.raycastProperty=null;let{page:t,domElement:n}=this.eventContext;n.style.cursor="",Object.values(this.handlers).forEach(e=>e.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(e=>{e.removeEventListener("requestRender",this.requestRender),e.destroyedInAction=!1}),n.removeEventListener("touchmove",this.onTouchMovePreventScroll),n.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),e||this.eventContext.sharedAssets.openAIRealtime?.disconnect()}dispose(){this.deactivate(),Object.values(this.handlers).forEach(e=>e.dispose())}get isPaused(){return this.isEnabled}pause(){this.deactivate()}resume(){this.activate()}reset(){this.deactivate(!0),this.activate(!0),this.controlsManager.deactivate(),this.controlsManager.activate(this),this.controlsManager.page.updateMatrixWorld(!0),this.controlsManager.rebuildBVH()}updateUseWindowEvents(e){let t=this.isEnabled;t&&this.deactivate(),this.eventContext.useWindowEvents=e,t&&this.activate()}initializeActionsDependentStates(){let e=this.eventContext.sharedAssets;e.resetDynamicVariablePlayState();let t=n=>{if("Conditional"===n.data.type&&(n.data.ifActions.forEach(t),n.data.elseActions.forEach(t)),"Conditional"===n.data.type||"SetVariable"===n.data.type)for(let e of"Conditional"===n.data.type?n.data.condition:n.data.expression)"id"in e&&Array.isArray(e.id)&&("mouse"===e.id[0]&&(this.needsMouse=!0),"raycast"===e.id[0]&&(this.needsRaycast=!0));"DynamicVariablePlay"===n.data.type&&""!==n.data.variableId&&("Play"===n.data.mode||"PlayPause"===n.data.mode||"Toggle"===n.data.mode)&&e.setDynamicVariablePlayState(n.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(e=>{if(e.data?.events.length)for(let n of e.data.events)if("VariableChange"===n.data.type&&("mouseProperty"===n.data.variableId&&(this.needsMouse=!0),"raycastProperty"===n.data.variableId&&(this.needsRaycast=!0)),"Conditional"===n.data.type)for(let e of["inActions","outActions"])n.data[e].forEach(t);else if("DragDrop"===n.data.type)for(let e of["drag","drop"])n.data.dragDropActions[e].forEach(t);else if("GameControl"===n.data.type)for(let e of["idle","move","jump","run"])n.data.gameActions[e].forEach(t);else if("Resize"===n.data.type)for(let e of n.data.breakpoints)e.data.actions.forEach(t);else"LookAt"===n.data.type||"API"===n.data.type||n.data.actions.forEach(t)})}},cn=class{constructor(e,t,n,i,s){this._aspect=1,this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=(new qe).copy(n),this._editorSize=(new qe).copy(i),this._aspect=t.aspect,this._fov=s??t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewport(){if(!this._renderer||!this._camera||"PerspectiveCamera"!==this._camera.cameraType)return;let e=this._frameSize.x,t=this._frameSize.y,n=this._editorSize.y;this._aspect=e/t,t<=n&&(this._camera.zoom*=n/t),this._renderer.setViewport(0,0,e,t)}updateCamera(e=!0){if(this._camera)if("PerspectiveCamera"===this._camera.cameraType){let t=this._frameSize.y,n=this._editorSize.y,i=this._fov;if(e&&t>n){i*=t/n,i*=1-((t-1080)/1080*14+1)/100}this._camera.aspect=this._aspect,this._camera.fov=i,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y,this.enableResponsive)}setCamera(e){this._camera=e,this._aspect=e.aspect,this._fov=e.fov}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t,this.enableResponsive),this._camera.updateProjectionMatrix())}},hn=["particles","hair","shape-blends","vector-shapes","3d-paths","cloners","components","text","ui-2d","game-controls","collision-bvh","transitions"];function dn(e,t){switch(e.type){case"Particle":case"ParticleCollider":t.add("particles");break;case"Hair":t.add("hair");break;case"Page":{null!=e.publish?.gameControlObject&&t.add("game-controls"),(null!=e.uiScene||void 0!==e.uiFrame)&&t.add("ui-2d");let n=e.uiScene?.objects;if(void 0!==n){if("function"!=typeof n.traverse)throw new Error("unrecognized uiScene shape");n.traverse((e,n)=>{dn(n,t)})}break}}switch(e.geometry?.type){case"ShapeBlendGeometry":t.add("shape-blends");break;case"VectorGeometry":t.add("vector-shapes");break;case"PathGeometry":t.add("3d-paths");break;case"UIGeometry":t.add("ui-2d");break;case"TextGeometry":case"InputGeometry":t.add("text")}("Component"===e.type||"Instance"===e.type)&&t.add("components"),null!=e.cloner&&t.add("cloners");let n=e.timelineAnimations;void 0!==n&&Object.keys(n).length>0&&t.add("timeline");let i=e.states;if(null!=i)if(Array.isArray(i))i.length>0&&t.add("transitions");else{if("object"!=typeof i)throw new Error("unrecognized states shape");Object.keys(i).length>0&&t.add("transitions")}}function un(e,t){if(e&&(e.data&&dn(e.data,t),e.children))for(let n of e.children)un(n,t)}var pn,mn,fn=class{get sharedAssets(){return this.shared}constructor(e,t={},n=!0){this.shared=new G(e.shared,t,!0,n),this.scene=new s(e.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(e,t){this.scene.clearScene(),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let e of this.scene.children)e instanceof m&&!e.uiScene&&e.personalCamera.updateState(e.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(e=>{e instanceof B&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}};function vn(e){return mn||(mn=import("./runtime-DRACOLoader-5OLRBTT3.js").then(({DRACOLoader:t})=>((pn=new t).setDecoderPath(void 0!==e?`${e}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),pn.decoderPending))),mn}async function yn(e){if(pn){let t,n={attributeIDs:pn.defaultAttributeIDs,attributeTypes:pn.defaultAttributeTypes,useUniqueIDs:!1};try{t=await pn.decodeGeometry(new Int8Array(e).buffer,n)}catch(e){console.error(e)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([e,t])=>({name:e,itemSize:t.itemSize,array:t.array}))}}return null}async function bn(e){for(let t of e){let e=await yn(t.geometry.data.draco);if(e){let n=t.geometry.data;e.index&&(n.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let i={};e.attributes.forEach(({name:e,array:t,itemSize:n})=>{i[e]={array:t,itemSize:n,type:"Float32Array",normalized:!1}}),n.attributes=i,n.draco=void 0}}}function gn(e){let t=this._clip.duration,n=this._clip.start??0,i=this.loop,s=this.time+e,r=this._loopCount,a=i===We;if(0===e)return-1===r||!a||1&~r?s:t-(s-n);if(i===Fe){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else{if(!(s<0)){this.time=s;break e}s=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),s>=t||s<n){let i=Math.floor((s-n)/(t-n));s-=(t-n)*i,r+=Math.abs(i);let o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,a||(s=e>0?t:n,1===this.repetitions&&(s=t)),this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=s;if(a&&!(1&~r))return t-(s-n)}return s}var wn=!1,En=class{constructor(e,t,n,i){this.scene=e,this.requestRender=t,this.updateDisplayProgress=n,this.animationInspectorState=i,this.clipIdToAction={},this.activeClip=null,this.needsUpdate=!1,this.addClip=e=>{"Empty"===e.data.type&&Array.isArray(e.data.animations)&&e.data.animations.forEach((t,n)=>{let i=t[0]+"/";if(Array.isArray(e.identity)?i+=e.identity[0]:i+=e.uuid,this.clipIdToAction[i])return;let s=it.parse(JSON.parse(t[2]));e.animations[n]=s;let r=this.mixer.clipAction(s,e);!1===wn&&(Object.getPrototypeOf(r)._updateTime=gn,wn=!0),r.clampWhenFinished=!0,this.clipIdToAction[i]=r})},this.mixer=new Xe(e),this.scene.traverseEntity(this.addClip)}deleteClip(e,t){let n=this.scene.find(t);if(!n)return;let i=n.animations.find(t=>t.uuid===e);if(!i)return;let s=this.clipIdToAction[e];!s||(s.stop(),this.mixer.uncacheClip(i),delete this.clipIdToAction[e],n.animations=n.animations.filter(t=>t.uuid!==e))}get isPlaying(){return Object.values(this.clipIdToAction).some(e=>e.isRunning())}playFromInspector(e){this.mixer.stopAllAction();let t=this.clipIdToAction[e];!t||(t.play(),this.activeClip=t.getClip(),this.scene.markShadowsDirty(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(e=>{e.repetitions=1/0,e.loop=ze}),this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}play(e){let t=e.clipId+"/"+e.object,n=this.clipIdToAction[t];if(n)return e&&(e.repeat>=0&&(n.repetitions=e.repeat+1),"pingpong"===e.direction&&0!==e.repeat&&(n.loop=We)),n.play(),n.paused=!1,this.requestRender(),n}resumeFromInspector(e){let t=this.clipIdToAction[e];!t||(t.play(),t.paused=!1,this.scene.markShadowsDirty(),this.requestRender())}pauseFromInspector(e){let t=this.clipIdToAction[e];!t||(t.paused=!0)}stop(){this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}update(e){if(this.needsUpdate)this.needsUpdate=!1;else if(!1===this.isPlaying||this.animationInspectorState?.isScrubbing)return;this.mixer.update(e/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return e(this.activeClip??void 0)}setProgressFromInspector(e,t){if(!this.clipIdToAction[t])return;this.activeClip!==this.clipIdToAction[t].getClip()&&this.playFromInspector(t);let n=this.clipIdToAction[t].paused;this.clipIdToAction[t].paused=!1,this.mixer.setTime(Math.min(e/(this.maxFrames-1),.9999)*this.activeClip.duration),this.scene.markShadowsDirty(),this.requestRender(),n&&(this.clipIdToAction[t].paused=!0)}},_n={bloom:()=>import("./runtime-bloom-2RFMVZQ7.js"),chromaticAberration:()=>import("./runtime-chromaticAberration-RWVAY3QZ.js"),vignette:()=>import("./runtime-vignette-B5W47RG2.js"),noise:()=>import("./runtime-noise-RIVY2SBP.js"),hueSaturation:()=>import("./runtime-hueSaturation-6PRKHQSJ.js"),brightnessContrast:()=>import("./runtime-brightnessContrast-XQS55SYB.js"),depthOfField:()=>import("./runtime-depthOfField-RNAILIMC.js"),pixelation:()=>import("./runtime-pixelation-VIGYNJ6A.js")},jn={bloom:()=>import("./runtime-fxBloom-B4TFLFRV.js"),depthOfField:()=>import("./runtime-fxDepthOfField-OB66CUJW.js")};function Pn(e,t,n){return Promise.all(e.map(e=>t[e]?.().catch(t=>{console.warn(`[spline] Failed to load the ${e} postprocessing effect (${n}); the effect will be skipped.`,t)}))).then(()=>{})}function Mn(e){return Pn(e,_n,"webgl")}var Cn=rt(at(),1);function An(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function On(e){return{id:e.uuid,name:e.name,type:e.object.data?.type??e.object.type,visible:!1!==e.playModeVisible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*He.RAD2DEG,y:e.rotation.y*He.RAD2DEG,z:e.rotation.z*He.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z},spawned:!0}}function xn(e){return{id:e.uuid,name:e.name,type:e.type??"Object",visible:e.visible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*He.RAD2DEG,y:e.rotation.y*He.RAD2DEG,z:e.rotation.z*He.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z}}}function Sn(e,t,n){let i=t=>e.findObjectById(t)??e.findObjectByName(t),s=new Map,r=e=>{let t=s.get(e);if(t)return t;for(let t of s.values())if(t.name===e)return t};return{setVariable:(t,n)=>t in e.getVariables()?(e.setVariable(t,n),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${t}" in this scene.`},getVariable:t=>e.getVariable(t),getVariables:()=>e.getVariables(),getAllObjects:()=>e.getAllObjects().map(xn),findObject:e=>{let t=i(e);return t?xn(t):void 0},getGeometry:(e,t)=>{if(!n)return{warning:"spline.getGeometry: not available in this runtime integration."};let s=r(e),a=s?s.object:(()=>{let t=i(e);return t?n.findEntity(t.uuid):void 0})();if(!a)return{warning:`spline.getGeometry: no object named "${e}" (names/ids come from getAllObjects).`};let o,l=s??a;"world"===t.space&&(l.updateWorldMatrix?.(!0,!1),o=l.matrixWorld?.elements);let c=function(e,t){let n=e?.getAttribute("position");if(!n||!n.count)return null;let i=n.count,s=t??null,r=e.getIndex?.()??null,a=Math.floor((r?r.count:i)/3),o=1/0,l=1/0,c=1/0,h=-1/0,d=-1/0,u=-1/0,p=new Float32Array(3*i);for(let e=0;e<i;e++){let t=n.getX(e),i=n.getY(e),r=n.getZ(e);s&&([t,i,r]=Ht(s,t,i,r)),t<o&&(o=t),i<l&&(l=i),r<c&&(c=r),t>h&&(h=t),i>d&&(d=i),r>u&&(u=r),p[3*e]=t,p[3*e+1]=i,p[3*e+2]=r}let m={space:s?"world":"local",vertexCount:i,triangleCount:a,indexed:null!==r,bounds:{min:[o,l,c],max:[h,d,u],size:[h-o,d-l,u-c]},vertices:p};if(r){let e=new Uint32Array(r.count);for(let t=0;t<r.count;t++)e[t]=r.getX(t);m.indices=e}let f=e.getAttribute("normal");if(f&&f.count===i){let e=s?function(e){let t=e[0],n=e[4],i=e[8],s=e[1],r=e[5],a=e[9],o=e[2],l=e[6],c=e[10],h=t*(r*c-a*l)-n*(s*c-a*o)+i*(s*l-r*o);if(!isFinite(h)||Math.abs(h)<1e-12)return null;let d=1/h,u=[(r*c-a*l)*d,(i*l-n*c)*d,(n*a-i*r)*d,(a*o-s*c)*d,(t*c-i*o)*d,(i*s-t*a)*d,(s*l-r*o)*d,(n*o-t*l)*d,(t*r-n*s)*d];return[u[0],u[3],u[6],u[1],u[4],u[7],u[2],u[5],u[8]]}(s):void 0;if(!s||e){let t=new Float32Array(3*i);for(let n=0;n<i;n++){let i=f.getX(n),s=f.getY(n),r=f.getZ(n);if(e){let t=e[0]*i+e[1]*s+e[2]*r,n=e[3]*i+e[4]*s+e[5]*r,a=e[6]*i+e[7]*s+e[8]*r,o=Math.hypot(t,n,a);o>1e-12?(i=t/o,s=n/o,r=a/o):(i=t,s=n,r=a)}t[3*n]=i,t[3*n+1]=s,t[3*n+2]=r}m.normals=t}}let v=e.getAttribute("uv");if(v&&v.count===i){let e=new Float32Array(2*i);for(let t=0;t<i;t++)e[2*t]=v.getX(t),e[2*t+1]=v.getY(t);m.uvs=e}return m}(a.geometry,o);return c?{data:{id:l.uuid,name:l.name,geometry:a.data?.geometry?.type,...c}}:{warning:`spline.getGeometry: "${l.name}" has no readable geometry — only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(t,s)=>{let a=r(t);if(a){let{position:t,rotation:n,scale:i,visible:r}=s;return t&&("number"==typeof t.x&&(a.position.x=t.x),"number"==typeof t.y&&(a.position.y=t.y),"number"==typeof t.z&&(a.position.z=t.z)),n&&("number"==typeof n.x&&(a.rotation.x=n.x*He.DEG2RAD),"number"==typeof n.y&&(a.rotation.y=n.y*He.DEG2RAD),"number"==typeof n.z&&(a.rotation.z=n.z*He.DEG2RAD)),i&&("number"==typeof i.x&&(a.scale.x=i.x),"number"==typeof i.y&&(a.scale.y=i.y),"number"==typeof i.z&&(a.scale.z=i.z)),"boolean"==typeof r&&(a.playModeVisible=r),a.updateMatrix(),e.requestRender(),!0}let o=i(t);if(!o)return!1;let{position:l,rotation:c,scale:h,visible:d,geometry:u,material:p}=s;if(u&&"object"==typeof u&&n){let e=n.findEntity(o.uuid);if(e){let{vertices:t,normals:i,uvs:s,indices:r,...a}=u;An(t)&&n.shared.updateEntityGeometryVertices(e,{vertices:t,normals:An(i)?i:void 0,uvs:An(s)?s:void 0,indices:An(r)?r:void 0}),Object.keys(a).length>0&&n.shared.updateEntityGeometryParams(e,a)}}if(p&&"object"==typeof p&&n){let e=n.findEntity(o.uuid);e&&n.shared.updateEntityMaterialParams(e,p)}return l&&("number"==typeof l.x&&(o.position.x=l.x),"number"==typeof l.y&&(o.position.y=l.y),"number"==typeof l.z&&(o.position.z=l.z)),c&&("number"==typeof c.x&&(o.rotation.x=c.x*He.DEG2RAD),"number"==typeof c.y&&(o.rotation.y=c.y*He.DEG2RAD),"number"==typeof c.z&&(o.rotation.z=c.z*He.DEG2RAD)),h&&("number"==typeof h.x&&(o.scale.x=h.x),"number"==typeof h.y&&(o.scale.y=h.y),"number"==typeof h.z&&(o.scale.z=h.z)),"boolean"==typeof d&&(o.visible=d),e.requestRender(),!0},createObject:async(t,n)=>xn(await e.createObject(t,n)),createCustomMaterial:t=>e.createCustomMaterial(t),setMaterial:(t,n)=>e.setMaterial(t,n),cloneObject:(t,n)=>xn(e.cloneObject(t,n)),removeObject:t=>e.removeObject(t),spawnObject:(t,r)=>{if(!n)return{warning:"spline.spawnObject: not available in this runtime integration."};let a=i(t),o=a?n.findEntity(a.uuid):void 0;if(!o)return{warning:`spline.spawnObject: no object named "${t}" to use as a template.`};if(s.size>=500)return{warning:"spline.spawnObject: spawn budget reached (500 live copies) — destroyObject old copies (or reuse them) instead of spawning more."};let l=n.shared.spawnRuntimeClone(o,r??{});return l?(s.set(l.uuid,l),e.requestRender(),{object:On(l)}):{warning:`spline.spawnObject: "${t}" cannot be spawned from.`}},destroyObject:t=>{let i=r(t);return!(!n||!i||(s.delete(i.uuid),n.shared.destroyRuntimeClone(i),e.requestRender(),0))},setInstanceTransforms:(t,s)=>{if(!n)return-1;let r=i(t),a=r?n.findEntity(r.uuid):void 0;if(!a)return-1;let o=n.shared.setEntityInstanceTransforms(a,s);return o>=0&&e.requestRender(),o},emitEvent:(e,t,n)=>{let s=i(t);return s?(n?s.emitEventReverse(e):s.emitEvent(e),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${t}".`}},requestRender:()=>e.requestRender(),addSplineEventListener:(t,n)=>{let i=e=>{n({target:{id:e.target?.id??"",name:e.target?.name??""}})};return e.addEventListener(t,i),()=>e.removeEventListener(t,i)},getCanvas:()=>t}}var kn=class{constructor(e,t,n){this.iframe=e,this.bridge=t,this.observer=n}static mount(e,t,n,i){if(typeof document>"u")return null;let s=t.parentElement;if(!s)return null;"static"===getComputedStyle(s).position&&(s.style.position="relative");let r=document.createElement("iframe");r.setAttribute("sandbox","allow-scripts allow-forms allow-pointer-lock"),r.title="Spline HTML content";let a=r.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(s),r.srcdoc=function(e){let t=`<script>${zt}<\/script>`,n=/<head(\s[^>]*)?>/i.exec(e);if(n){let i=n.index+n[0].length;return e.slice(0,i)+t+e.slice(i)}let i=/<html(\s[^>]*)?>/i.exec(e);if(i){let n=i.index+i[0].length;return e.slice(0,n)+`<head>${t}</head>`+e.slice(n)}return t+e}(n),s.insertBefore(r,t.nextSibling);let c=new qt(r,Sn(e,t,i),(e,t)=>{"warn"===e?console.warn(`[spline html] ${t}`):"error"===e&&console.error(`[spline html] ${t}`)});return c.attach(),new kn(r,c,l)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}},Rn="data-spline-html-content",Tn=`\n[${Rn}] { pointer-events: none; }\n[${Rn}] > * { pointer-events: auto; }\n[${Rn}] [data-spline-passthrough] { pointer-events: none; }\n`,Dn=class{constructor(e,t,n,i,s){this.container=e,this.host=t,this.observer=n,this.previousSplineGlobal=i,this.removeLateLifecycleShim=s}static mount(e,t,n,i){if(typeof document>"u")return null;let s=t.parentElement;if(!s)return null;"static"===getComputedStyle(s).position&&(s.style.position="relative");let r=document.createElement("div");r.setAttribute(Rn,"");let a=r.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(s);let c=document.createElement("style");c.textContent=Tn,r.appendChild(c);let h=(new DOMParser).parseFromString(n,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let e of d)e.remove();for(let e of Array.from(h.head.children))("STYLE"===e.tagName||"LINK"===e.tagName&&"stylesheet"===e.rel)&&r.appendChild(e);for(;h.body.firstChild;)r.appendChild(h.body.firstChild);s.insertBefore(r,t.nextSibling);let u=new Map,p=new Wt(Sn(e,t,i),(e,t)=>{"warn"===e?console.warn(`[spline html] ${t}`):"error"===e&&console.error(`[spline html] ${t}`)},(e,t)=>{let n=u.get(e);if(n)for(let e of n)try{e(t)}catch(e){console.error(e)}}),m=(e,t)=>{try{return Promise.resolve(p.execute(e,t))}catch(e){return Promise.reject(e)}},f={ready:Promise.resolve(),setVariable:(e,t)=>m("setVariable",[e,t]),setVariables:e=>m("setVariables",[e]),getVariable:e=>m("getVariable",[e]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:e=>m("findObjectByName",[e]),findObjectById:e=>m("findObjectById",[e]),getGeometry:(e,t)=>m("getGeometry",[e,t??{}]),updateObject:(e,t)=>m("updateObject",[e,t]),createObject:(e,t)=>m("createObject",[e,t??{}]),createCustomMaterial:e=>m("createCustomMaterial",[e]),setMaterial:(e,t)=>m("setMaterial",[e,t]),cloneObject:(e,t)=>m("cloneObject",[e,t??{}]),removeObject:e=>m("removeObject",[e]),spawnObject:(e,t)=>m("spawnObject",[e,t??{}]),destroyObject:e=>m("destroyObject",[e]),setInstanceTransforms:(e,t)=>m("setInstanceTransforms",[e,t??null]),emitEvent:(e,t)=>m("emitEvent",[e,t]),emitEventReverse:(e,t)=>m("emitEventReverse",[e,t]),requestRender:()=>m("requestRender",[]),addEventListener:(e,t)=>{if("function"!=typeof t)return;let n=u.get(e);n||(n=new Set,u.set(e,n),m("listenEvent",[e])),n.add(t)},removeEventListener:(e,t)=>{let n=u.get(e);!n||(n.delete(t),0===n.size&&(u.delete(e),m("unlistenEvent",[e])))}},v=window.spline;window.spline=f;let y=function(){if(typeof document>"u"||"loading"===document.readyState)return()=>{};let e=[],t=(t,n)=>{let i=new Set,s=t.addEventListener.bind(t),r=t.removeEventListener.bind(t);Object.defineProperty(t,"addEventListener",{configurable:!0,writable:!0,value:(e,r,a)=>{if(s(e,r,a),!n.includes(e)||null==r)return;let o={type:e,listener:r};i.add(o),queueMicrotask(()=>{!i.delete(o)||((e,t,n)=>{let i=new Event(n);try{"function"==typeof t?t.call(e,i):t.handleEvent?.(i)}catch(e){console.error(e)}})(t,o.listener,o.type)})}}),Object.defineProperty(t,"removeEventListener",{configurable:!0,writable:!0,value:(e,t,n)=>{r(e,t,n);for(let n of i)n.type===e&&n.listener===t&&i.delete(n)}}),e.push(()=>{delete t.addEventListener,delete t.removeEventListener,i.clear()})};t(document,["DOMContentLoaded"]),t(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:e=>{"function"==typeof e&&queueMicrotask(()=>{try{e.call(window,new Event("load"))}catch(e){console.error(e)}})}}),e.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let t of e)t()}}();for(let e of d){let t=document.createElement("script");for(let n of Array.from(e.attributes))t.setAttribute(n.name,n.value);e.src?t.async=!1:t.textContent=e.textContent,r.appendChild(t)}return new Dn(r,p,l,v,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),void 0!==window.spline&&(window.spline=this.previousSplineGlobal)}};function Vn(e){return"object"==typeof e&&null!==e&&!0===e.isMaterial}function Ln(e){if("function"==typeof e.material)throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation — this entry point does not support it.");if(!Vn(e.material))return{options:e};let t=e.material;if(!0===t.isNodeMaterial){let n=L()?.NodeMaterial;if(void 0!==n&&t instanceof n)return{options:{...e,material:void 0},material:t};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => …) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, …).")}if(!0===t.isShaderMaterial)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend — port the shader to TSL with app.createCustomMaterial((three) => …), or use a built-in material (MeshStandardMaterial, …).");return{options:{...e,material:void 0},material:t}}var In=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Gn="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Un={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Bn={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Kn={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data — clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data — clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data — clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime — clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto — clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame — clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime — clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime — clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime — clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime — clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor — clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},Nn={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},Fn={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function zn(e,t){return void 0===e?[t[0],t[1],t[2]]:Array.isArray(e)?[e[0]??t[0],e[1]??t[1],e[2]??t[2]]:[e.x??t[0],e.y??t[1],e.z??t[2]]}function Wn(e){return"number"==typeof e?[e,e,e]:zn(e,[1,1,1])}function Hn(e){let t=new N(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function qn(e,t){let n=e.material??(void 0!==e.color?{color:e.color}:void 0);if(void 0===n)return Oe.defaultColorMaterial($n(Ie),"physical","layer1","layer2");if("string"==typeof n){for(let[e,i]of Object.entries(t.shared.materials))if(e===n||i.name===n)return e;if(function(e){let t=e.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)||/^(rgb|hsl)a?\(/.test(t)||void 0!==Je.NAMES[t]}(n))return Oe.defaultColorMaterial(Hn(n),"physical","layer1","layer2");throw new Error(`createObject: material '${n}' matches no shared material in this document (available: ${function(e){let t=Object.entries(e.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>"'undefined'"!==e);return t.length?t.join(", "):"(none)"}(t)}) and is not a valid CSS color.`)}if("function"==typeof n)throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation — this entry point does not support it.");if(Vn(n))throw new Error("createObject: a three.js material instance cannot be stored in the document — this entry point does not support it.");let i=void 0!==n.color?Hn(n.color):$n(Ie),s=Oe.defaultColorMaterial(i,"physical","layer1","layer2"),r=s.layers.find(e=>"light"===e.data.type);if(r){let e={};void 0!==n.roughness&&(e.roughness=n.roughness),void 0!==n.metalness&&(e.metalness=n.metalness),void 0!==n.reflectivity&&(e.reflectivity=n.reflectivity),Object.assign(r.data,e)}if(void 0!==n.alpha){let e=s.layers.find(e=>"color"===e.data.type);e&&Object.assign(e.data,{alpha:n.alpha})}return s}function $n(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function Yn(e){let t=De.defaultData("TextGeometry"),{text:n,...i}=e,s=i.fontSize;return void 0!==s&&void 0===i.width&&(i.width=350*s/16),void 0!==s&&void 0===i.height&&(i.height=50*s/16),Object.assign(t,i),void 0!==n&&Object.assign(t,{text:{textValue:String(n)}}),t}function Xn(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function Qn(e,t){return Yt({userData:{type:e,...T[e].normalizeInputs({parameters:t})}})}function Zn(e,t,n){let{objectType:i,geometryType:s}=e,r=function(e){let t={};for(let[n,i]of Object.entries(e))!In.has(n)&&void 0!==i&&(t[n]=i);return t}(t),a={states:new xe,events:new xe,timelineAnimations:new Ce};if("Mesh"===i&&s){if("NonParametricGeometry"===s){let{geometry:e,doubleSide:i}=function(e){let t=Xn(e.vertices);if(!t||t.length<9||t.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let n=t.length/3;if(n>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${n}); keep it under 60000.`);let i=Xn(e.indices);if(i&&i.length){let e=i.find(e=>!Number.isInteger(e)||e<0||e>=n);if(void 0!==e)throw new Error(`createObject('CustomMesh'): index ${e} is out of range (mesh has ${n} vertices).`)}else i=null;let s=new nt;s.setAttribute("position",new tt(t,3));let r=Xn(e.normals),a=null!==r&&r.length===t.length;a&&s.setAttribute("normal",new tt(r,3));let o=Xn(e.uvs);o&&o.length===2*n&&s.setAttribute("uv",new tt(o,2));let l=!1;if(!a){let e=i??Array.from({length:n},(e,t)=>t),{closed:s,inverted:r}=function(e,t){let n=e.length/3,i=new Map,s=new Array(n);for(let t=0;t<n;t++){let n=`${Math.round(1e4*e[3*t])},${Math.round(1e4*e[3*t+1])},${Math.round(1e4*e[3*t+2])}`,r=i.get(n);void 0===r?(i.set(n,t),s[t]=t):s[t]=r}let r=new Map;for(let e=0;e+2<t.length;e+=3){let n=s[t[e]],i=s[t[e+1]],a=s[t[e+2]];for(let[e,t]of[[n,i],[i,a],[a,n]]){if(e===t)continue;let n=e<t?e+"_"+t:t+"_"+e;r.set(n,(r.get(n)??0)+1)}}let a=r.size>0;for(let e of r.values())if(2!==e){a=!1;break}if(!a)return{closed:!1,inverted:!1};let o=0;for(let n=0;n+2<t.length;n+=3){let i=3*t[n],s=3*t[n+1],r=3*t[n+2],a=e[i],l=e[i+1],c=e[i+2],h=e[s],d=e[s+1],u=e[s+2],p=e[r],m=e[r+1],f=e[r+2];o+=a*(d*f-u*m)+l*(u*p-h*f)+c*(h*m-d*p)}return{closed:!0,inverted:o<0}}(t,e);if(s&&r){for(let t=0;t+2<e.length;t+=3){let n=e[t+1];e[t+1]=e[t+2],e[t+2]=n}i=e}else s||(l=!0)}return i&&s.setIndex(i),a||s.computeVertexNormals(),{geometry:Yt({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:s.toJSON().data}),doubleSide:l}}(r);Object.assign(a,Be.defaultData,{geometry:e,materials:[qn(t,n)]}),i&&(a.side=2)}else Object.assign(a,Be.defaultData,{geometry:"TextGeometry"===s?Yn(r):Qn(s,r),material:qn(t,n)});void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow)}else"Empty"===i?Object.assign(a,Ge.defaultData):(Object.assign(a,he.defaultData(i),r),void 0!==t.color&&(a.color=Hn(t.color)));a.visible=t.visible??!0,a.position=zn(t.position,[0,0,0]),a.rotation=zn(t.rotation,[0,0,0]),a.scale=Wn(t.scale);let o=(s&&Nn[s])??Fn[i]??i;return a.name=t.name??Jn(o,n.scene.objects),a}function Jn(e,t){let n=new Set;if(t.traverse((e,t)=>{n.add(t.name??"")}),!n.has(e))return e;let i=2;for(;n.has(`${e} ${i}`);)i++;return`${e} ${i}`}function ei(e,t){let n=He.generateUUID();if("Component"===e.data.type)return{data:{...de.fromComponentData(e),name:e.data.name+" Instance"},id:n,fi:e.fi,children:[]};t[e.id]=n;let i=e.data;return"Empty"===i.type&&i.animations?.length&&(i={...i,animations:i.animations.map(([e,t,n])=>{let i=He.generateUUID(),s=n.indexOf(e);return[i,t,-1!==s?n.slice(0,s)+i+n.slice(s+e.length):n]})}),{...e,id:n,data:i,children:e.children.map(e=>ei(e,t))}}function ti(e){let t={},n=ei(e,t);return ke(n,t)}function ni(e){let t=Array.isArray(e)?e[0]:e,n=t.layers?.map(ii)??[],i=t.layers?.find(e=>"light"===e.type);return{layers:n,alpha:i?.node.alphaOverride?.value??1}}function ii(e){return"texture"===e.type||"video"===e.type||"matcap"===e.type?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}var si=new N(0,0,0,1),ri={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]},ai=new qe;function oi(e){let t=new N(0,0,0,1);try{t.setStyle(e)}catch(e){console.error(e)}return t}var li=class{constructor(e,{renderOnDemand:t,renderMode:n="auto",wasmPath:i,renderer:s,htmlContentMode:r="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=e=>{if(this.time=e,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!("manual"===this.renderMode&&!this._renderRequested||"auto"===this.renderMode&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<K?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{"ParticleSystem"===e.type&&(e.update(this.dt),this._skipRender=!1),Z(e)&&(!0!==this._renderer?.isWebGPUSplineRenderer&&e.warnClassicFallbackOnce(),e.isSimulating&&(e.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),!0===this._renderer.lastFrameIncomplete&&(this._skipRender=!1),!0===this._renderer.skyAnimationActive&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=e=>{if(this._renderer){if(1===this._viewportMode&&this._frameView&&(this._frameView.frameSize=ai.set(this._viewportWidth,this._viewportHeight)),e){let e=this._viewportWidth,t=this._viewportHeight;this._renderer.setSize(e-1,t-1,!1),this._renderer.setSize(e,t,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera){let e=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera("fullscreen"!==e),"PerspectiveCamera"===this._camera.cameraType&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()}this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=ie(this._resize,10),this._onScroll=e=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=r,this.renderMode=t?"auto":n,void 0!==i&&(this._wasmPath=se(i,"/")),this._rendererBackend=s??"webgl",void 0===s){let e=null;try{e=new URLSearchParams(window.location.search).get("renderer")}catch{}"webgpu"===e||"webgl"===e||"webgl2"===e?this._rendererBackend="webgl2"===e?"webgl":e:(this._rendererAuto=!0,this._rendererBackend=typeof navigator<"u"&&"gpu"in navigator?"webgpu":"webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&import("./runtime-Perfs-KMJFDYHU.js").then(({Perfs:e})=>{this._perfs=new e({x:10,y:10})}),x(e)}async _createRenderer(){if("webgpu"===this._rendererBackend&&this._rendererAuto)try{await(navigator.gpu?.requestAdapter())||(this._rendererBackend="webgl")}catch{this._rendererBackend="webgl"}if("webgpu"===this._rendererBackend)try{let{createWebGPUSplineRenderer:e,isWebGPUSupported:t}=await import("./runtime-webgpu-HA7LX6HX.js");t();let n=!0,i=!1,s=!1!==this._data?.scene.publish?.asyncShaderCompilation;try{let e=new URLSearchParams(window.location.search),t=e.get("bundles");"rerecord"===t?n="rerecord":("off"===t||"0"===t||"false"===t||"no"===t)&&(n=!1),i="1"===e.get("forcegl");let r=e.get("asynccomp");"off"===r||"0"===r||"false"===r||"no"===r?s=!1:("on"===r||"1"===r||"true"===r||"always"===r)&&(s=!0)}catch{}let r=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!i&&n,forceWebGL:i,asyncCompilation:!i&&s});return r.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},r.skyAnimationAllowed=!0,r}catch(e){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",e),this._rendererBackend="webgl"}{let{SplineRenderer:e,rendererGlobals:t}=await import("./runtime-classicRuntime-K34VIFGP.js");try{"off"===new URLSearchParams(window.location.search).get("taa")&&(t.taaEnabled.value=!1)}catch{}return new e({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let e=window.devicePixelRatio||1,t=this.canvas.clientWidth||300,n=this.canvas.clientHeight||150;this.canvas.width=t*e,this.canvas.height=n*e;let i=this.canvas.getContext("2d");i&&(i.scale(e,e),i.fillStyle="rgba(127, 127, 127, 0.85)",i.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",i.textAlign="center",i.textBaseline="middle",i.fillText("This scene requires a WebGPU-capable browser.",t/2,n/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(e,t,n){(function(e){let t="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";e.endsWith(".spline")?console.warn(t+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(t)})(e),this.disposed=!1;let i=await(await fetch(e,n)).arrayBuffer();await this.start(i,{variables:t})}async start(e,{interactive:t=!0,variables:s}={}){if(this.disposed)return;a.init();let o=await async function(e){let[t,n]=Te(Ve.deserialize(new Uint8Array(e)));if(130!==(t.schema??0)){let{updateDocumentSchema:e}=await import("./runtime-updater-A22NUPB5.js");e(t)}return n.result().data}(e);this._data=o;let l=function(e){let t=[];return e.scene.objects.traverse((e,n)=>{"Mesh"===n.type&&"NonParametricGeometry"===n.geometry.type&&void 0!==n.geometry.data.draco&&t.push(n)}),t}(o);o.version&&(0,Cn.default)(o.version,"2.0.11")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),void 0!==this._wasmPath&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),Ke(this._wasmPath));let c=async function(e){{let t={particles:()=>import("./runtime-particles-WY5ERTQY.js"),hair:()=>import("./runtime-hair-LL7HBW3N.js"),"shape-blends":()=>import("./runtime-shapeBlends-QL2RV3WU.js"),"vector-shapes":()=>import("./runtime-vectorShapes-LG23IGW6.js"),"3d-paths":()=>import("./runtime-paths-EBK4AK5D.js"),cloners:()=>import("./runtime-cloners-3Y3EIRQD.js"),components:()=>import("./runtime-components-OIRGNZ53.js"),text:()=>import("./runtime-text-BIQDLMVM.js"),"ui-2d":()=>import("./runtime-ui2d-3SFWWIHX.js"),"game-controls":()=>import("./runtime-gameControls-AJVDYQ34.js"),"collision-bvh":()=>import("./runtime-collisionBVH-CQUE6RZV.js"),mousehover:()=>import("./runtime-mouseHover-VNG5G3EV.js"),scroll:()=>import("./runtime-scroll-PJN2KY5P.js"),dragdrop:()=>import("./runtime-dragDrop-XMMLZ4DN.js"),tracking:()=>import("./runtime-tracking-OGGWBM2F.js"),resize:()=>import("./runtime-resize-ARFL653M.js"),conditional:()=>import("./runtime-conditional-66QFNGF3.js"),variables:()=>import("./runtime-variables-MHCE3K3T.js"),"api-services":()=>import("./runtime-apiServices-KSRZJMJI.js"),"ai-assistant":()=>import("./runtime-aiAssistant-L3HFJZ2G.js"),textinputs:()=>import("./runtime-textInputs-PBVRLIAG.js"),audio:()=>import("./runtime-audio-CNGZPKC5.js"),video:()=>import("./runtime-video-YA2L3X6S.js"),"create-destroy":()=>import("./runtime-createDestroy-IXF6AHPT.js"),"scene-transition":()=>import("./runtime-sceneTransition-U767Q26P.js"),timeline:()=>import("./runtime-timeline-FZBQAKBM.js"),transitions:()=>import("./runtime-transitions-UZMSVIQQ.js"),"misc-actions":()=>import("./runtime-miscActions-MYXVSOXT.js")},n=function(e){let t=new Set,n=!1,i=!1;for(let s of $(e,e=>{"GameControl"===e&&(n=!0),"Trigger"===e&&(i=!0)}))t.add(s);try{e.scene.objects.traverse((e,n)=>{dn(n,t)});let n=e.shared.lib?.components;if(n){let e=Object.keys(n);e.length>0&&t.add("components");for(let i of e)un(n[i]?.asset,t)}}catch{for(let e of hn)t.add(e)}return n&&t.add("game-controls"),(i||t.has("game-controls"))&&t.add("collision-bvh"),t}(e);await Promise.all([...n].map(e=>t[e]()))}}(o);await Promise.all([c,l.length&&vn(this._wasmPath),f(o)&&Q(this._wasmPath),k(o)&&R(this._wasmPath),me.physicsEnabled(o.scene.objects)&&j(this._wasmPath),z(o)&&w(),n(o)&&i(),H(o)&&W(),E(o)&&c.then(()=>le()?.loadHanaUIRUNTIME()),P(o)&&A(this._wasmPath)].filter(Boolean)),l.length&&await bn(l),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let h=o.scene.publish.renderer;if(this._rendererAuto&&"webgl"===h)this._rendererBackend="webgl";else if(this._rendererAuto&&"webgpu"===h){if("webgpu"!==this._rendererBackend||!await(navigator.gpu?.requestAdapter().catch(()=>null)))return void this._failWebGPURequired();this._rendererAuto=!1}let u=function(e){let t=new Set;return e.scene.objects.traverse((e,n)=>{if("Page"!==n.type)return;let i=n.postprocessing;if(i&&"object"==typeof i&&!0===i.enabled)for(let[e,n]of Object.entries(i))"enabled"!==e&&n&&"object"==typeof n&&!0===n.enabled&&t.add(e)}),[...t]}(o);if("webgpu"===this._rendererBackend)try{await Promise.all([import("./runtime-webgpu-HA7LX6HX.js"),(p=u,Pn(p,jn,"webgpu"))]),this._renderer||(this._renderer=await this._createRenderer())}catch(e){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",e),this._rendererBackend="webgl"}var p;"webgpu"!==this._rendererBackend&&await Promise.all([import("./runtime-classicRuntime-K34VIFGP.js"),Mn(u)]),D("webgpu"===this._rendererBackend?"webgpu":"webgl");let v=new fn(o);if(v.resetPersonalCameraFromDocumentData(),this._scene=v.scene,this._sharedAssetsManager=v.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:e}=await import("./runtime-mergeStaticGeometries-SLURKUQL.js"),t=performance.now();e(o,v.scene);let n=performance.now();console.log("Merged geometries in ",n-t," ms")}f(o)&&this._scene.traverse(e=>{y(e)&&e.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(e=>{ne(e)&&e.pendingMediaLoad&&e.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(e=>{"ParticleSystem"===e.type&&(e.wakeUp(),e.data.autoPlay?e.start():e.stop()),Z(e)&&e.setPlayMode(!0)});let b=Object.keys(o.shared.fonts).map(e=>this._sharedAssetsManager.getFont(e).loadingPromise);if(Promise.all(b).then(()=>{this.disposed||(v.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),z(o)&&M(o)&&await Promise.all(b),E(o)){let e=[];this._scene.traverseEntity(t=>{(te(t)||t instanceof m)&&t.uiCanvas&&e.push(t.uiCanvas)}),await Promise.all(e.map(e=>e.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),r(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=!0===o.scene.publish.hdTransmission;let e=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t=this._getPixelRatio(e()?o.scene.publish.settings.web.pixelRatioMobile:o.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(t),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),o.shared.images.SplineWatermark){let e=this._sharedAssetsManager.getImage("SplineWatermark");await e.loadPromise;let t=e.getTexture(1001);this._renderer.pipeline.setWatermark(t)}}n(o)&&this._scene.initializeSplatViewer(),void 0!==o.scene.blueNoiseTextureData&&this._renderer.pipeline.updateBlueNoiseTexture(o.scene.blueNoiseTextureData);let g=Object.values(o.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):("fullscreen"===g.preset?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=g.size[0],this._viewportHeight=g.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new cn(this._renderer,this._camera,new qe(this._viewportWidth,this._viewportHeight),new qe(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(g.allowResponsive??!1)&&"fullscreen"===g.preset),t){let e=new d(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,g);this._scene.updateMatrixWorld(!0),this._controls=new C(e),this._animationControls=new En(this._scene,this._requestRenderAutoMode),this._eventManager=new ln(o.scene.publish,this._controls,this._animationControls,e,o.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),void 0!==s&&this.setVariables(s),0===this.dt&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let _=o.scene.publish.htmlContent?.html;if(t&&_&&"none"!==this._htmlContentMode){let e={shared:this._sharedAssetsManager,findEntity:e=>this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)};this._htmlContentOverlay=("inline"===this._htmlContentMode?Dn.mount(this,this.canvas,_,e):kn.mount(this,this.canvas,_,e))??void 0}}setVariables(e){if(void 0!==this._data){let t=Object.entries(e);for(let[e,n]of t)this.setVariable(e,n)}}setVariable(e,t){let n=this._getVariableByName(e);if(n&&!("dynamicVariableType"in n.data)){let e=t;"number"==typeof n.data.value?e="number"==typeof t?t:"boolean"==typeof t?!0===t?1:0:parseFloat(t):"boolean"==typeof n.data.value?e="number"==typeof t?!!t:"boolean"==typeof t?t:"false"!==t.toLocaleLowerCase()&&!!t:"string"!=typeof n.data.value&&void 0!==n.data.value.textValue&&(e=t.toString());let i="string"==typeof e?{textValue:e}:e;this._sharedAssetsManager?.updateVariable(n.id,i),this.requestRender(),this._requestRenderAutoMode()}else void 0===n?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in n.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`)}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{void 0===e[t.data.name]&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let e=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(e)}}_getVariableValue(e){return"string"!=typeof e&&ye.isTextValue(e)?ye.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(t=>t.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(!(t.uuid===Le||this._scene.isInvisibleObjects(t)||t instanceof m)){let n=this._createProxyObject(t);n&&e.push(n)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof _&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=oi(e);this._scene?.activePage.setBackgroundColor(t),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,F(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{Nt.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),void 0!==this._resizeObserverTimeout&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,S(this.canvas),document.removeEventListener("scroll",this._onScroll),a.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){if(!this._scene)return;let n,i=this._scene;if(null==e)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(e=>{e instanceof m&&(n=e.name)});let r=this._sharedAssetsManager,o={shared:r,scene:this._scene},l=t=>{if(null===t||"Base State"===t)return null;if(t&&e.data.states){let n=e.data.states.find(e=>e.data.name===t);return n?n.id:void 0}},c="material"in e?e.material:void 0,h=e.materialOverride,d={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:n,material:h??(c?ni(c):void 0),parentUuid:e.parent instanceof m||e instanceof s?void 0:e.parent?.uuid,emitEvent(t){e.dispatchEvent({type:"userEvent",eventName:t})},emitEventReverse(t){e.dispatchEvent({type:"userEvent",eventName:t,reverse:!0})},hide(){e.visible&&(e.visible=!1,o.shared.requestRender())},show(){e.visible||(e.visible=!0,o.shared.requestRender())},get state(){let t=e.stateSelection;if(null!==t)return e.data.states.find(({id:e})=>e===t)?.data.name},set state(t){let n;if(void 0!==t){let i="string"==typeof t?e.data.states.find(({id:e})=>e===t):e.data.states[t];if(i)n=i.id;else{let e="string"==typeof t?l(t):void 0;e&&(n=e)}}e.changeSelectedState(n??null,o),e.currentState=n??null,e.dispatchEvent({type:"completeState",state:n??null}),o.shared.requestRender()},transition(n){let s=t();if(null===s)return ae("transitions","obj.transition()"),{transition(e){return this},play(){return this},pause(){return this},reset(){return this},seek(e){return this}};let o,c=this,h=a.timeline({autoplay:n.autoPlay??!0}),d={transition({from:t,to:n,duration:a,delay:d,...u}){let p=l(t);void 0===p&&(p=o);let m=l(n);o=m;let f=new s(e,p,m,{state:m,repeat:0,delay:d??0,delayDirection:"start-once",direction:"normal",duration:a??1e3,...u,...6===u.easing?fe.defaultData:5===u.easing?ve.defaultData:{}},r,!1,i.activePage);return h.add({...f.params,begin:()=>{(t&&p||"Base State"===t&&!p)&&(c.state=p??void 0)},complete:()=>{c.state=m??void 0}},h.duration),this},play(){return h.play(),this},pause(){return h.pause(),this},reset(){return h.reset(),this},seek(e){return h.seek(e),this}};return d.transition(n),d},set color(t){let n=oi(t);if(v.is(e))return void(e.color=n);if(!("Mesh"===e.type&&"material"in e&&e instanceof U))return;let i={r:n.r,g:n.g,b:n.b,a:n.a},s=e.materialOverride;if(void 0!==s){let e=s.color;return void(!0===e?.isColor&&"function"==typeof e.setStyle&&(e.setStyle(t),o.shared.requestRender()))}let r=Array.isArray(e.material)?e.material[0]:e.material,a=r.data.layers.find(e=>"color"===e.data.type)?.id;if(a)r.updateByOp({type:0,path:["layers",a],props:{color:{...i}}},r.data,o);else{let e=r.data,t=e.layers.find(e=>"light"===e.data.type);if(!t)return;let n=0===e.layers.indexOf(t)?t:null,s=e.layers.at(n?e.layers.indexOf(n)+1:0),a={type:4,fi:n?n.fi+(s?(s.fi-n.fi)/2:1):s?s.fi/2:1,id:He.generateUUID(),data:{...Ae.defaultData("color"),color:i},localIndex:0},l=e.layers.insertAfterHelper(n?.id??null,1),c=e.layers.runOp({...a,fi:l[0]}).data;Object.assign(r.data,{layers:c}),r.updateByOp({...a,path:["layers"]},r.data,o)}}},u=Nt(d,(t,n)=>{let i=e[t],s=t.split(".");"material"===s[0]&&c&&void 0===h&&function(e,t,n){let i=Array.isArray(n)?n[0]:n;if("layers"===e[0]){let n=parseInt(e[1]),s=i.layers[n],r=e[2];s&&r&&function(e,t,n){let i=e[0];try{if(function(e,t){return!!ri[t]?.includes(e)}(i,n.type,e.slice(1)))if("colors"===i){if(e.length<2)throw new Error("You cannot mutate the colors array, only its items");let s=parseInt(e[1]),r=n.getValue(i)?.[s];if(!r)throw new Error("Color index out of range");si.setStyle(t),r.set(si.r,si.g,si.b,si.a)}else n.getValue(i)?.setStyle(t);else if("texture"===i||"video"===i){let i=n.color;!function(e,t,n,i){let s=e[0];if("repeat"===s||"offset"===s||"rotation"===s){let n=i.getNode("mat"),r=n&&"function"==typeof n.updateMatrix?n:i.getValue("mat");if(!r)return;if("rotation"===s)r.rotation=parseFloat(t);else{let n=e[1];if(void 0===n)t instanceof Array&&2===t.length&&Object.assign(r,{[s]:t});else{let e=r[s],i=0===parseInt(n)?[parseFloat(t),e[1]]:[e[0],parseFloat(t)];Object.assign(r,{[s]:i})}}r.updateMatrix()}else"wrapping"===s||"minFilter"===s||"magFilter"===s?"wrapping"===s?n.texture.wrap=t:n.texture[s]=t:"image"===s&&"data"===e[1]&&n.texture.image.updateSrc(t)}(e.slice(1),t,i,n)}else{let s=e[1],r=n.getValue(i);r?.isVector3&&void 0!==s||r?.isVector2&&void 0!==s?r.setComponent(parseInt(s),t):n.setValue(i,t)}}catch(e){console.error("Error setting material value",e)}}(e.slice(2),t,s)}else"alpha"===e[0]&&i.layers.forEach(e=>{"light"===e.type&&void 0!==e.node.alphaOverride&&(e.node.alphaOverride.value=t,t<1&&(i.transparent=!0))})}(s.slice(1),n,c),"object"!=typeof i&&Object.getOwnPropertyDescriptor(e,t)?.writable&&(e[t]=n),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,u),u}setUIWasmUrl(e){oe(e)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let n;if("string"==typeof t){if(!t.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let e=await(await fetch(t)).arrayBuffer();n=new Uint8Array(e)}}else n=t;let i=Ve.deserialize(n),s="data"in i&&void 0!==i.data.draco;s&&await vn(this._wasmPath);let r=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!r)return void console.warn(`Object ${e} not found`);if("Mesh"!==r.data.type||!(r instanceof U))return void console.warn(`Object ${e} is not a mesh`);let a=r,o={...a.data,geometry:i};s&&await bn([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let e of a.data.states){let t={...e.data};a.states||(a.states={}),a.states[e.id]=ue.patch(o,t)}return n}_applyDocumentTransaction(e){this._data=e.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let t of e.actual){let e=t.path;Array.isArray(e)&&2===e.length&&"scene"===e[0]&&"objects"===e[1]&&this._scene?.updateTreeByOp({...t,path:[]},this._sharedAssetsManager)}}_findEntity(e){return this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)}_resolveParentId(e){if(void 0===e)return this._scene.activePage.uuid;let t="string"==typeof e?e:e.uuid,n=this._findEntity(t);if(!n)throw new Error(`parent '${t}' — no object with that name or uuid in the scene.`);return n.uuid}async createCustomMaterial(e){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if("function"!=typeof e)throw new Error("createCustomMaterial: expected a factory function — createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let t=L();if(void 0===t&&("webgpu"===this._rendererBackend&&(await import("./runtime-webgpu-HA7LX6HX.js"),t=L()),void 0===t))throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline — pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let n=e(t);if("object"!=typeof n||null===n||!0!==n.isMaterial)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives — e.g. (three) => new three.MeshStandardNodeMaterial().");return n}async setMaterial(e,t){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let n=this._scene;if(!n)throw new Error("setMaterial: no scene loaded — call load() or start() first.");let i="string"==typeof e?e:e.uuid,s=this._findEntity(i);if(!s)throw new Error(`setMaterial: '${i}' — no object with that name or uuid in the scene.`);if(!(s instanceof U))throw new Error(`setMaterial: '${i}' is not a mesh — lights, groups, and cameras have no material.`);let r="function"==typeof t?await this.createCustomMaterial(t):t;if("webgpu"!==V())throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline — pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=Ln({material:r});if(void 0===a.material)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(a.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),a.material}async createObject(e,t={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,i=this._data;if(!n||!i)throw new Error("createObject: no scene loaded — call load() or start() first.");let s=function(e){if("string"!=typeof e||0===e.length)throw new Error(`createObject: expected a type name string — one of ${Gn}.`);let t=e.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),n=Bn[t];if(n)return{objectType:n};let i=Un[t];if(i)return{objectType:"Mesh",geometryType:i};let s=Kn[t];throw s?new Error(`createObject: '${e}' is not supported — ${s}`):new Error(`createObject: '${e}' is not a creatable Spline type — use one of ${Gn}, e.g. createObject('Cube', { width: 200 }).`)}(e);"function"==typeof t.material&&(t={...t,material:await this.createCustomMaterial(t.material)});let r,a,{options:o,material:l}=Ln(t);if(void 0!==l){if("Mesh"!==s.objectType)throw new Error("createObject: a three.js material instance only applies to mesh types — lights and groups have no material.");if("webgpu"!==V())throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline — pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if("TextGeometry"===s.geometryType){if(await import("./runtime-text-BIQDLMVM.js"),!re("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature — re-export the scene with a Text object present, or load the full runtime build.");if(await w(),a=t.font??Se,void 0===i.shared.fonts[a]){if(a!==Se){let e=Object.keys(i.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document — available fonts: ${e||"(none)"}.`)}r={name:Se,url:Re}}}let c=this._resolveParentId(t.parent),h=Zn(s,o,i),d=He.generateUUID(),[u,p]=Te(i);r&&(u.shared.fonts[Se]=r),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let m=p.result();if(r&&this._sharedAssetsManager.addFont(Se,r),void 0!==a){let e=this._sharedAssetsManager.getFont(a);e&&await e.loadingPromise}this._applyDocumentTransaction(m);let f=n.find(d);return void 0!==l&&f.setMaterialOverride(l,{scene:n,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(f)}cloneObject(e,t={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let n=this._scene,i=this._data;if(!n||!i)throw new Error("cloneObject: no scene loaded — call load() or start() first.");let s="string"==typeof e?e:e?.uuid,r=s?this._findEntity(s):void 0;if(!r)throw new Error(`cloneObject: '${s}' — no object with that name or uuid in the scene.`);if(r instanceof m)throw new Error("cloneObject: pages cannot be cloned.");let a=i.scene.objects.get(r.uuid);if(!a)throw new Error(`cloneObject: '${s}' is not part of the document tree (expanded clones and instanced children cannot be cloned — clone their source object instead).`);let o=function(e,t,n){let i={...e.data};return void 0!==t.position&&(i.position=zn(t.position,[0,0,0])),void 0!==t.rotation&&(i.rotation=zn(t.rotation,[0,0,0])),void 0!==t.scale&&(i.scale=Wn(t.scale)),void 0!==t.visible&&(i.visible=t.visible),i.name=t.name??Jn(`${e.data.name??"Object"} Copy`,n),{...e,data:i}}(ti(a),t,i.scene.objects),l=void 0!==t.parent?this._resolveParentId(t.parent):i.scene.objects.parent(r.uuid)??null,c=void 0!==t.parent?null:r.uuid,[h,d]=Te(i);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=n.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(e){let t=this._scene,n=this._data;if(this.disposed||!t||!n)return!1;let i="string"==typeof e?e:e?.uuid,s=i?this._findEntity(i):void 0;if(!s)return!1;if(s instanceof m)throw new Error("removeObject: pages cannot be removed.");if("PerspectiveCamera"===s.data.type||"OrthographicCamera"===s.data.type)throw new Error("removeObject: cameras cannot be removed.");if(void 0===n.scene.objects.get(s.uuid))throw new Error(`removeObject: '${i}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let r=[];s.traverseEntity(e=>{r.push(e.uuid)});let[a,o]=Te(n);a.scene.objects.delete(s.uuid),this._applyDocumentTransaction(o.result());for(let e of r){let t=this._proxyObjectCache.get(e);t&&(Nt.unsubscribe(t),this._proxyObjectCache.delete(e))}return this._requestRenderAutoMode(),!0}};export{li as Application,Ue as Axis,pe as Easing,ge as GradientType,ce as NoiseType,Me as PatternStyle,_e as ProjectionType,be as Side,Ee as TextureFilter,Pe as ToonType,je as VoronoiStyle,we as Wrapping};
1
+ import{a as e,c as t}from"./runtime-chunk-KGZNRID6.js";import{c as n,d as i,f as s}from"./runtime-chunk-E3QYEXEP.js";import{a as r}from"./runtime-chunk-E753C25I.js";import{a}from"./runtime-chunk-R43XZP65.js";import"./runtime-chunk-TD5YRDN7.js";import{a as o,b as l,c,d as h,e as d}from"./runtime-chunk-HN7CSPUY.js";import"./runtime-chunk-SRQQYOPW.js";import{a as u,b as p}from"./runtime-chunk-NBYTQLIB.js";import{h as m}from"./runtime-chunk-WGMSWSKD.js";import"./runtime-chunk-3CMVQQOR.js";import{a as f,c as v,f as y}from"./runtime-chunk-3O7PY43O.js";import"./runtime-chunk-TU4KDRKR.js";import{a as b,c as g}from"./runtime-chunk-DZNU62CT.js";import"./runtime-chunk-SNCE2TY4.js";import{c as w}from"./runtime-chunk-T53JMQSH.js";import{a as E}from"./runtime-chunk-FTVQTRM7.js";import{a as _,b as j,e as P,h as M,j as C,m as O}from"./runtime-chunk-SFPD5AFA.js";import"./runtime-chunk-N2ZRGNPR.js";import{a as A,d as x,e as S}from"./runtime-chunk-VAVYZ35B.js";import"./runtime-chunk-FQNSP44B.js";import"./runtime-chunk-M424ONWP.js";import"./runtime-chunk-W44H46BZ.js";import{a as k}from"./runtime-chunk-UX2PD5MY.js";import"./runtime-chunk-K67GTQLJ.js";import"./runtime-chunk-3A4X5B7V.js";import"./runtime-chunk-DMDTTYNN.js";import{D as R,H as T,J as D,K as V,R as L,b as I,ba as G,da as U,ea as B,f as K,h as N,j as F,o as z}from"./runtime-chunk-UBSXIKOG.js";import"./runtime-chunk-4YV3EXSU.js";import{a as W,b as H}from"./runtime-chunk-NSD7DU3P.js";import{c as q,d as $,f as Y,g as X}from"./runtime-chunk-WGBR2HLR.js";import{n as Z}from"./runtime-chunk-6ARRPM23.js";import{b as J,c as Q,e as ee,f as te,h as ne}from"./runtime-chunk-2PT2WH66.js";import{a as ie,i as se}from"./runtime-chunk-4KZXQGUQ.js";import"./runtime-chunk-VGEECQH4.js";import{b as re,c as ae,k as oe,l as le}from"./runtime-chunk-TZCHGFVF.js";import{$ as ce,Aa as he,Ca as de,Ea as ue,F as pe,Fa as me,G as fe,H as ve,Ha as ye,U as be,X as ge,Y as we,Z as Ee,_ as _e,aa as je,ba as Pe,ca as Me,e as Ce,ea as Oe,fa as Ae,g as xe,ga as Se,h as ke,ha as Re,m as Te,oa as De,p as Ve,w as Le,x as Ie,xa as Ge,y as Ue,ya as Be}from"./runtime-chunk-D3BWEUN6.js";import{a as Ke}from"./runtime-chunk-Y3BMDVJ7.js";import{$c as Ne,Ab as Fe,Bb as ze,Cb as We,Cc as He,Dc as qe,Ec as $e,Fc as Ye,Ke as Xe,Oc as Ze,Pc as Je,Tc as Qe,Xc as et,bd as tt,dd as nt,oe as it}from"./runtime-chunk-BVVSZMXD.js";import{a as st,b as rt}from"./runtime-chunk-ML3Z74BL.js";var at=st((e,t)=>{t.exports=function(e,t){for(var n=e.split("."),i=t.split("."),s=0;s<3;s++){var r=Number(n[s]),a=Number(i[s]);if(r>a)return 1;if(a>r)return-1;if(!isNaN(r)&&isNaN(a))return 1;if(isNaN(r)&&!isNaN(a))return-1}return 0}}),ot=".",lt=Symbol("target"),ct=Symbol("unsubscribe");function ht(e){return e instanceof Date||e instanceof Set||e instanceof Map||e instanceof WeakSet||e instanceof WeakMap||ArrayBuffer.isView(e)}var dt=Array.isArray;function ut(e){return"symbol"==typeof e}var pt={after:(e,t)=>dt(e)?e.slice(t.length):""===t?e:e.slice(t.length+1),concat:(e,t)=>dt(e)?(e=[...e],t&&e.push(t),e):t&&void 0!==t.toString?(""!==e&&(e+=ot),ut(t)?e+t.toString():e+t):e,initial:e=>{if(dt(e))return e.slice(0,-1);if(""===e)return e;let t=e.lastIndexOf(ot);return-1===t?"":e.slice(0,t)},last:e=>{if(dt(e))return e[e.length-1]||"";if(""===e)return e;let t=e.lastIndexOf(ot);return-1===t?e:e.slice(t+1)},walk:(e,t)=>{if(dt(e))for(let n of e)t(n);else if(""!==e){let n=0,i=e.indexOf(ot);if(-1===i)t(e);else for(;n<e.length;)-1===i&&(i=e.length),t(e.slice(n,i)),n=i+1,i=e.indexOf(ot,n)}},get(e,t){return this.walk(t,t=>{e&&(e=e[t])}),e}};function mt(e,t,n){return e.isUnsubscribed||t.ignoreSymbols&&ut(n)||t.ignoreUnderscores&&"_"===n.charAt(0)||"ignoreKeys"in t&&t.ignoreKeys.includes(n)}var ft=class{constructor(e){this._equals=e,this._proxyCache=new WeakMap,this._pathCache=new WeakMap,this.isUnsubscribed=!1}_getDescriptorCache(){return void 0===this._descriptorCache&&(this._descriptorCache=new WeakMap),this._descriptorCache}_getProperties(e){let t=this._getDescriptorCache(),n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n}_getOwnPropertyDescriptor(e,t){if(this.isUnsubscribed)return Reflect.getOwnPropertyDescriptor(e,t);let n=this._getProperties(e),i=n[t];return void 0===i&&(i=Reflect.getOwnPropertyDescriptor(e,t),n[t]=i),i}getProxy(e,t,n,i){if(this.isUnsubscribed)return e;let s=e[i],r=s||e;this._pathCache.set(r,t);let a=this._proxyCache.get(r);return void 0===a&&(a=void 0===s?new Proxy(e,n):e,this._proxyCache.set(r,a)),a}getPath(e){return this.isUnsubscribed?void 0:this._pathCache.get(e)}isDetached(e,t){return!Object.is(e,pt.get(t,this.getPath(e)))}defineProperty(e,t,n){return!!Reflect.defineProperty(e,t,n)&&(this.isUnsubscribed||(this._getProperties(e)[t]=n),!0)}setProperty(e,t,n,i,s){if(!this._equals(s,n)||!(t in e)){let s=this._getOwnPropertyDescriptor(e,t);return void 0!==s&&"set"in s?Reflect.set(e,t,n,i):Reflect.set(e,t,n)}return!0}deleteProperty(e,t,n){if(Reflect.deleteProperty(e,t)){if(!this.isUnsubscribed){let i=this._getDescriptorCache().get(e);i&&(delete i[t],this._pathCache.delete(n))}return!0}return!1}isSameDescriptor(e,t,n){let i=this._getOwnPropertyDescriptor(t,n);return void 0!==e&&void 0!==i&&Object.is(e.value,i.value)&&(e.writable||!1)===(i.writable||!1)&&(e.enumerable||!1)===(i.enumerable||!1)&&(e.configurable||!1)===(i.configurable||!1)&&e.get===i.get&&e.set===i.set}isGetInvariant(e,t){let n=this._getOwnPropertyDescriptor(e,t);return void 0!==n&&!0!==n.configurable&&!0!==n.writable}unsubscribe(){this._descriptorCache=null,this._pathCache=null,this._proxyCache=null,this.isUnsubscribed=!0}};function vt(e){return"[object Object]"===toString.call(e)}function yt(){return!0}function bt(e,t){return e.length!==t.length||e.some((e,n)=>t[n]!==e)}var gt=new Set(["hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]),wt=new Set(["concat","includes","indexOf","join","keys","lastIndexOf"]),Et={push:yt,pop:yt,shift:yt,unshift:yt,copyWithin:bt,reverse:bt,sort:bt,splice:bt,flat:bt,fill:bt},_t=new Set([...gt,...wt,...Object.keys(Et)]);function jt(e,t){if(e.size!==t.size)return!0;for(let n of e)if(!t.has(n))return!0;return!1}var Pt=["keys","values","entries"],Mt=new Set(["has","toString"]),Ct={add:jt,clear:jt,delete:jt,forEach:jt},Ot=new Set([...Mt,...Object.keys(Ct),...Pt]);function At(e,t){if(e.size!==t.size)return!0;let n;for(let[i,s]of e)if(n=t.get(i),n!==s||void 0===n&&!t.has(i))return!0;return!1}var xt=new Set([...Mt,"get"]),St={set:At,clear:At,delete:At,forEach:At},kt=new Set([...xt,...Object.keys(St),...Pt]),Rt=class{constructor(e,t,n,i){this._path=t,this._isChanged=!1,this._clonedCache=new Set,this._hasOnValidate=i,this._changes=i?[]:null,this.clone=void 0===t?e:this._shallowClone(e)}static isHandledMethod(e){return gt.has(e)}_shallowClone(e){let t=e;if(vt(e))t={...e};else if(dt(e))t=[...e];else if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set([...e].map(e=>this._shallowClone(e)));else if(e instanceof Map){t=new Map;for(let[n,i]of e.entries())t.set(n,this._shallowClone(i))}return this._clonedCache.add(t),t}preferredThisArg(e,t,n,i){return e?(dt(i)?this._onIsChanged=Et[t]:i instanceof Set?this._onIsChanged=Ct[t]:i instanceof Map&&(this._onIsChanged=St[t]),i):n}update(e,t,n){let i=pt.after(e,this._path);if("length"!==t){let e=this.clone;pt.walk(i,t=>{e&&e[t]&&(this._clonedCache.has(e[t])||(e[t]=this._shallowClone(e[t])),e=e[t])}),this._hasOnValidate&&this._changes.push({path:i,property:t,previous:n}),e&&e[t]&&(e[t]=n)}this._isChanged=!0}undo(e){let t;for(let n=this._changes.length-1;-1!==n;n--)t=this._changes[n],pt.get(e,t.path)[t.property]=t.previous}isChanged(e){return void 0===this._onIsChanged?this._isChanged:this._onIsChanged(this.clone,e)}},Tt=class extends Rt{static isHandledMethod(e){return _t.has(e)}},Dt=class extends Rt{undo(e){e.setTime(this.clone.getTime())}isChanged(e,t){return!t(this.clone.valueOf(),e.valueOf())}},Vt=class extends Rt{static isHandledMethod(e){return Ot.has(e)}undo(e){for(let t of this.clone)e.add(t);for(let t of e)this.clone.has(t)||e.delete(t)}},Lt=class extends Rt{static isHandledMethod(e){return kt.has(e)}undo(e){for(let[t,n]of this.clone.entries())e.set(t,n);for(let t of e.keys())this.clone.has(t)||e.delete(t)}},It=class extends Rt{constructor(e,t,n,i){super(void 0,t,n,i),this._arg1=n[0],this._weakValue=e.has(this._arg1)}isChanged(e){return this._weakValue!==e.has(this._arg1)}undo(e){this._weakValue&&!e.has(this._arg1)?e.add(this._arg1):e.delete(this._arg1)}},Gt=class extends Rt{constructor(e,t,n,i){super(void 0,t,n,i),this._weakKey=n[0],this._weakHas=e.has(this._weakKey),this._weakValue=e.get(this._weakKey)}isChanged(e){return this._weakValue!==e.get(this._weakKey)}undo(e){let t=e.has(this._weakKey);this._weakHas&&!t?e.set(this._weakKey,this._weakValue):!this._weakHas&&t?e.delete(this._weakKey):this._weakValue!==e.get(this._weakKey)&&e.set(this._weakKey,this._weakValue)}},Ut=class{constructor(e){this._stack=[],this._hasOnValidate=e}static isHandledType(e){return vt(e)||dt(e)||ht(e)}static isHandledMethod(e,t){return vt(e)?Rt.isHandledMethod(t):dt(e)?Tt.isHandledMethod(t):e instanceof Set?Vt.isHandledMethod(t):e instanceof Map?Lt.isHandledMethod(t):ht(e)}get isCloning(){return this._stack.length>0}start(e,t,n){let i=Rt;dt(e)?i=Tt:e instanceof Date?i=Dt:e instanceof Set?i=Vt:e instanceof Map?i=Lt:e instanceof WeakSet?i=It:e instanceof WeakMap&&(i=Gt),this._stack.push(new i(e,t,n,this._hasOnValidate))}update(e,t,n){this._stack[this._stack.length-1].update(e,t,n)}preferredThisArg(e,t,n){let{name:i}=e,s=Ut.isHandledMethod(n,i);return this._stack[this._stack.length-1].preferredThisArg(s,i,t,n)}isChanged(e,t,n){return this._stack[this._stack.length-1].isChanged(e,t,n)}undo(e){void 0!==this._previousClone&&this._previousClone.undo(e)}stop(){return this._previousClone=this._stack.pop(),this._previousClone.clone}},Bt={equals:Object.is,isShallow:!1,pathAsArray:!1,ignoreSymbols:!1,ignoreUnderscores:!1,ignoreDetached:!1,details:!1},Kt=(e,t,n={})=>{n={...Bt,...n};let i=Symbol("ProxyTarget"),{equals:s,isShallow:r,ignoreDetached:a,details:o}=n,l=new ft(s),c="function"==typeof n.onValidate,h=new Ut(c),d=(e,t,i,s,r)=>!c||h.isCloning||!0===n.onValidate(pt.concat(l.getPath(e),t),i,s,r),u=(t,i,s,r)=>{!mt(l,n,i)&&(!a||!l.isDetached(t,e))&&p(l.getPath(t),i,s,r)},p=(e,n,i,s,r)=>{h.isCloning?h.update(e,n,s):t(pt.concat(e,n),i,s,r)},m=e=>e&&(e[i]||e),f=(t,s,o,c)=>function(e){return("object"==typeof e?null===e:"function"!=typeof e)||e instanceof RegExp}(t)||"constructor"===o||r&&!Ut.isHandledMethod(s,o)||mt(l,n,o)||l.isGetInvariant(s,o)||a&&l.isDetached(s,e)?t:(void 0===c&&(c=l.getPath(s)),l.getProxy(t,pt.concat(c,o),v,i)),v={get(e,t,n){if(ut(t)){if(t===i||t===lt)return e;if(t===ct&&!l.isUnsubscribed&&0===l.getPath(e).length)return l.unsubscribe(),e}let s=ht(e)?Reflect.get(e,t):Reflect.get(e,t,n);return f(s,e,t)},set(e,t,n,r){n=m(n);let a=e[i]||e,o=a[t];if(s(o,n)&&t in e)return!0;let c=d(e,t,n,o);return c&&l.setProperty(a,t,n,r,o)?(u(e,t,e[t],o),!0):!c},defineProperty(e,t,n){if(!l.isSameDescriptor(n,e,t)){let i=e[t];d(e,t,n.value,i)&&l.defineProperty(e,t,n,i)&&u(e,t,n.value,i)}return!0},deleteProperty(e,t){if(!Reflect.has(e,t))return!0;let n=Reflect.get(e,t),i=d(e,t,void 0,n);return i&&l.deleteProperty(e,t,n)?(u(e,t,void 0,n),!0):!i},apply(t,n,r){let a=n[i]||n;if(l.isUnsubscribed)return Reflect.apply(t,a,r);if((!1===o||!0!==o&&!o.includes(t.name))&&Ut.isHandledType(a)){let i=pt.initial(l.getPath(t)),o=Ut.isHandledMethod(a,t.name);h.start(a,i,r);let c=Reflect.apply(t,h.preferredThisArg(t,n,a),o?r.map(e=>m(e)):r),u=h.isChanged(a,s),y=h.stop();if(Ut.isHandledType(c)&&o&&(n instanceof Map&&"get"===t.name&&(i=pt.concat(i,r[0])),c=l.getProxy(c,i,v)),u){let n={name:t.name,args:r,result:c},s=h.isCloning?pt.initial(i):i,o=h.isCloning?pt.last(i):"";d(pt.get(e,s),o,a,y,n)?p(s,o,a,y,n):h.undo(a)}return(n instanceof Map||n instanceof Set)&&function(e){return"object"==typeof e&&"function"==typeof e.next}(c)?function(e,t,n,i,s){let r=e.next;if("entries"===t.name)e.next=function(){let e=r.call(this);return!1===e.done&&(e.value[0]=s(e.value[0],t,e.value[0],i),e.value[1]=s(e.value[1],t,e.value[0],i)),e};else if("values"===t.name){let a=n[lt].keys();e.next=function(){let e=r.call(this);return!1===e.done&&(e.value=s(e.value,t,a.next().value,i)),e}}else e.next=function(){let e=r.call(this);return!1===e.done&&(e.value=s(e.value,t,e.value,i)),e};return e}(c,t,n,i,f):c}return Reflect.apply(t,n,r)}},y=l.getProxy(e,n.pathAsArray?[]:"",v);return t=t.bind(y),c&&(n.onValidate=n.onValidate.bind(y)),y};Kt.target=e=>e&&e[lt]||e,Kt.unsubscribe=e=>e[ct]||e;var Nt=Kt,Ft="__splineHtmlContent",zt=`(function () {\n\t'use strict';\n\tvar MARKER = ${JSON.stringify(Ft)};\n\tvar callSeq = 1;\n\tvar pending = {};\n\tvar listeners = {};\n\tvar acked = false;\n\tvar readyResolve;\n\tvar readyPromise = new Promise(function (resolve) { readyResolve = resolve; });\n\n\tfunction post(msg) {\n\t\tmsg[MARKER] = true;\n\t\ttry {\n\t\t\twindow.parent.postMessage(msg, '*');\n\t\t} catch (e) { /* parent gone — nothing to do */ }\n\t}\n\n\tfunction call(method, args) {\n\t\treturn new Promise(function (resolve, reject) {\n\t\t\tvar id = callSeq++;\n\t\t\tpending[id] = { resolve: resolve, reject: reject };\n\t\t\tpost({ kind: 'call', id: id, method: method, args: args });\n\t\t});\n\t}\n\n\t// ---- the public API ----------------------------------------------------\n\tvar spline = {\n\t\t/** Resolves once the editor has acknowledged the frame. */\n\t\tready: readyPromise,\n\t\tsetVariable: function (name, value) { return call('setVariable', [name, value]); },\n\t\tsetVariables: function (variables) { return call('setVariables', [variables]); },\n\t\tgetVariable: function (name) { return call('getVariable', [name]); },\n\t\tgetVariables: function () { return call('getVariables', []); },\n\t\tgetAllObjects: function () { return call('getAllObjects', []); },\n\t\tfindObjectByName: function (name) { return call('findObjectByName', [name]); },\n\t\tfindObjectById: function (id) { return call('findObjectById', [id]); },\n\t\t/** Read a mesh's live geometry ({vertexCount, triangleCount, indexed, bounds, vertices: Float32Array, indices?, normals?, uvs?}); options {space: 'local'|'world'}. Resolves undefined (with a console warning) when unreadable. */\n\t\tgetGeometry: function (nameOrId, options) { return call('getGeometry', [nameOrId, options || {}]); },\n\t\t/** Runtime-only transform/visibility update ({position,rotation,scale,visible}; rotation in degrees). */\n\t\tupdateObject: function (nameOrId, props) { return call('updateObject', [nameOrId, props]); },\n\t\t/** Runtime-only object creation ('Cube', 'Sphere', …, 'Text', 'Group', lights); resolves to the new object's snapshot. */\n\t\tcreateObject: function (type, options) {\n\t\t\t// A three.js material instance or createCustomMaterial factory can't cross\n\t\t\t// the postMessage boundary (textures/callbacks/functions fail\n\t\t\t// structured clone) — fail loud, not with a cryptic DataCloneError.\n\t\t\tif (options && options.material && (\n\t\t\t\toptions.material.isMaterial === true ||\n\t\t\t\ttypeof options.material === 'function'\n\t\t\t)) {\n\t\t\t\treturn Promise.reject(new Error(\n\t\t\t\t\t'createObject: custom three.js materials need the inline ' +\n\t\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t\t'cannot carry them. Use a color/PBR bag or shared material ' +\n\t\t\t\t\t'name here instead.'\n\t\t\t\t));\n\t\t\t}\n\t\t\treturn call('createObject', [type, options || {}]);\n\t\t},\n\t\t/** Custom three.js/TSL materials — inline HTML-content mode only; the\n\t\t * factory function cannot cross this sandboxed transport. */\n\t\tcreateCustomMaterial: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'createCustomMaterial: custom three.js materials need the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry the factory function or the material it returns.'\n\t\t\t));\n\t\t},\n\t\t/** Replace a mesh's material with a custom three.js material — inline\n\t\t * HTML-content mode only; neither factories nor instances can cross\n\t\t * this sandboxed transport. */\n\t\tsetMaterial: function () {\n\t\t\treturn Promise.reject(new Error(\n\t\t\t\t'setMaterial: custom three.js materials need the inline ' +\n\t\t\t\t'HTML-content mode (the editor Preview/Play frame and web ' +\n\t\t\t\t'exports); this embed runs the sandboxed mode, whose transport ' +\n\t\t\t\t'cannot carry the factory function or the material it returns.'\n\t\t\t));\n\t\t},\n\t\t/** Runtime-only deep clone of an existing object; resolves to the clone's snapshot. */\n\t\tcloneObject: function (nameOrId, options) { return call('cloneObject', [nameOrId, options || {}]); },\n\t\t/** Removes an object (and its subtree); resolves to false when none matched. */\n\t\tremoveObject: function (nameOrId) { return call('removeObject', [nameOrId]); },\n\t\t/** Spawn a runtime-only copy of a template object; resolves to its snapshot ({id,...}) or undefined. */\n\t\tspawnObject: function (templateNameOrId, options) { return call('spawnObject', [templateNameOrId, options || {}]); },\n\t\t/** Remove a spawned copy by id (or assigned name). Spawned objects only. */\n\t\tdestroyObject: function (idOrName) { return call('destroyObject', [idOrName]); },\n\t\t/** Per-copy transform writes on a cloner ([{position,rotation,scale}|null, ...]; degrees); null clears all. Resolves to the copy count. */\n\t\tsetInstanceTransforms: function (nameOrId, transforms) { return call('setInstanceTransforms', [nameOrId, transforms === undefined ? null : transforms]); },\n\t\t/** Trigger a Spline event on an object (requires Play mode). */\n\t\temitEvent: function (eventName, nameOrUuid) { return call('emitEvent', [eventName, nameOrUuid]); },\n\t\temitEventReverse: function (eventName, nameOrUuid) { return call('emitEventReverse', [eventName, nameOrUuid]); },\n\t\trequestRender: function () { return call('requestRender', []); },\n\t\taddEventListener: function (eventName, cb) {\n\t\t\tif (typeof cb !== 'function') return;\n\t\t\tif (!listeners[eventName]) {\n\t\t\t\tlisteners[eventName] = [];\n\t\t\t\tcall('listenEvent', [eventName]);\n\t\t\t}\n\t\t\tlisteners[eventName].push(cb);\n\t\t},\n\t\tremoveEventListener: function (eventName, cb) {\n\t\t\tvar list = listeners[eventName];\n\t\t\tif (!list) return;\n\t\t\tvar i = list.indexOf(cb);\n\t\t\tif (i !== -1) list.splice(i, 1);\n\t\t\tif (list.length === 0) {\n\t\t\t\tdelete listeners[eventName];\n\t\t\t\tcall('unlistenEvent', [eventName]);\n\t\t\t}\n\t\t},\n\t};\n\twindow.spline = spline;\n\n\t// ---- editor -> frame ---------------------------------------------------\n\twindow.addEventListener('message', function (event) {\n\t\tif (event.source !== window.parent) return;\n\t\tvar data = event.data;\n\t\tif (!data || data[MARKER] !== true) return;\n\t\tif (data.kind === 'ready-ack') {\n\t\t\tacked = true;\n\t\t\treadyResolve();\n\t\t} else if (data.kind === 'result') {\n\t\t\tvar entry = pending[data.id];\n\t\t\tif (!entry) return;\n\t\t\tdelete pending[data.id];\n\t\t\tif (data.ok) entry.resolve(data.value);\n\t\t\telse entry.reject(new Error(data.error || 'spline bridge call failed'));\n\t\t} else if (data.kind === 'event') {\n\t\t\tvar list = listeners[data.eventName];\n\t\t\tif (!list) return;\n\t\t\tfor (var i = 0; i < list.length; i++) {\n\t\t\t\ttry {\n\t\t\t\t\tlist[i](data.payload);\n\t\t\t\t} catch (e) {\n\t\t\t\t\treportError(e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t// ---- console + error capture --------------------------------------------\n\tfunction stringify(value, depth) {\n\t\ttry {\n\t\t\tif (typeof value === 'string') return value;\n\t\t\tif (value instanceof Error) return value.stack || String(value);\n\t\t\tif (typeof value === 'function') return '[function ' + (value.name || 'anonymous') + ']';\n\t\t\tif (value === undefined) return 'undefined';\n\t\t\tvar seen = [];\n\t\t\tvar json = JSON.stringify(value, function (k, v) {\n\t\t\t\tif (typeof v === 'object' && v !== null) {\n\t\t\t\t\tif (seen.indexOf(v) !== -1) return '[circular]';\n\t\t\t\t\tseen.push(v);\n\t\t\t\t}\n\t\t\t\tif (typeof v === 'function') return '[function]';\n\t\t\t\treturn v;\n\t\t\t});\n\t\t\treturn json === undefined ? String(value) : json;\n\t\t} catch (e) {\n\t\t\ttry { return String(value); } catch (e2) { return '[unserializable]'; }\n\t\t}\n\t}\n\n\tfunction sendConsole(level, args) {\n\t\tvar parts = [];\n\t\tfor (var i = 0; i < args.length; i++) parts.push(stringify(args[i]));\n\t\tvar text = parts.join(' ');\n\t\tif (text.length > 4000) text = text.slice(0, 4000) + '…';\n\t\tpost({ kind: 'console', level: level, text: text });\n\t}\n\n\t['log', 'info', 'warn', 'error'].forEach(function (level) {\n\t\tvar original = console[level];\n\t\tconsole[level] = function () {\n\t\t\tsendConsole(level, arguments);\n\t\t\tif (original) original.apply(console, arguments);\n\t\t};\n\t});\n\n\tfunction reportError(error) {\n\t\tsendConsole('error', [error instanceof Error ? error : String(error)]);\n\t}\n\twindow.addEventListener('error', function (event) {\n\t\tsendConsole('error', [event.message + (event.filename ? ' (' + event.filename + ':' + event.lineno + ')' : '')]);\n\t});\n\twindow.addEventListener('unhandledrejection', function (event) {\n\t\tsendConsole('error', ['Unhandled promise rejection: ' + stringify(event.reason)]);\n\t});\n\n\t// ---- input passthrough ---------------------------------------------------\n\t// A pointer that goes DOWN on the page background belongs to the 3D scene\n\t// until it is released; one that goes down on generated UI never forwards.\n\tvar forwardedPointers = {};\n\n\tfunction isBackground(target) {\n\t\tif (!target || target === document || target === document.documentElement || target === document.body) {\n\t\t\treturn true;\n\t\t}\n\t\tif (target.closest && target.closest('[data-spline-passthrough]')) return true;\n\t\treturn false;\n\t}\n\n\tfunction baseInput(e, type) {\n\t\treturn {\n\t\t\ttype: type,\n\t\t\tx: e.clientX,\n\t\t\ty: e.clientY,\n\t\t\tbutton: e.button,\n\t\t\tbuttons: e.buttons,\n\t\t\tpointerId: e.pointerId,\n\t\t\tpointerType: e.pointerType,\n\t\t\tisPrimary: e.isPrimary,\n\t\t\tmovementX: e.movementX,\n\t\t\tmovementY: e.movementY,\n\t\t\tshiftKey: e.shiftKey,\n\t\t\tctrlKey: e.ctrlKey,\n\t\t\taltKey: e.altKey,\n\t\t\tmetaKey: e.metaKey,\n\t\t};\n\t}\n\n\tdocument.addEventListener('pointerdown', function (e) {\n\t\tif (!isBackground(e.target)) return;\n\t\tforwardedPointers[e.pointerId] = true;\n\t\tpost({ kind: 'input', event: baseInput(e, 'pointerdown') });\n\t}, true);\n\n\tdocument.addEventListener('pointermove', function (e) {\n\t\tif (!forwardedPointers[e.pointerId] && !isBackground(e.target)) return;\n\t\tpost({ kind: 'input', event: baseInput(e, 'pointermove') });\n\t}, true);\n\n\t['pointerup', 'pointercancel'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\tvar wasForwarded = forwardedPointers[e.pointerId];\n\t\t\tdelete forwardedPointers[e.pointerId];\n\t\t\tif (!wasForwarded && !isBackground(e.target)) return;\n\t\t\tpost({ kind: 'input', event: baseInput(e, type) });\n\t\t}, true);\n\t});\n\n\t['click', 'dblclick'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\tif (!isBackground(e.target)) return;\n\t\t\tpost({ kind: 'input', event: baseInput(e, type) });\n\t\t}, true);\n\t});\n\n\tdocument.addEventListener('wheel', function (e) {\n\t\tif (!isBackground(e.target)) return;\n\t\te.preventDefault();\n\t\tvar msg = baseInput(e, 'wheel');\n\t\tmsg.deltaX = e.deltaX;\n\t\tmsg.deltaY = e.deltaY;\n\t\tmsg.deltaMode = e.deltaMode;\n\t\t// The legacy wheelDelta fields carry the trackpad-vs-mouse signature\n\t\t// the editor's pan/zoom discrimination reads (wheelDeltaY === -3*dY\n\t\t// on trackpads) — a reconstructed WheelEvent loses them, turning\n\t\t// two-finger pans into zooms. Forward them verbatim.\n\t\tif (typeof e.wheelDeltaX === 'number') msg.wheelDeltaX = e.wheelDeltaX;\n\t\tif (typeof e.wheelDeltaY === 'number') msg.wheelDeltaY = e.wheelDeltaY;\n\t\tpost({ kind: 'input', event: msg });\n\t}, { capture: true, passive: false });\n\n\t['keydown', 'keyup'].forEach(function (type) {\n\t\tdocument.addEventListener(type, function (e) {\n\t\t\t// Never steal keys from the page's own form fields.\n\t\t\tvar t = e.target;\n\t\t\tif (t && (t.tagName === 'INPUT' || t.tagName === 'TEXTAREA' || t.isContentEditable)) return;\n\t\t\tpost({ kind: 'input', event: {\n\t\t\t\ttype: type,\n\t\t\t\tkey: e.key,\n\t\t\t\tcode: e.code,\n\t\t\t\trepeat: e.repeat,\n\t\t\t\tshiftKey: e.shiftKey,\n\t\t\t\tctrlKey: e.ctrlKey,\n\t\t\t\taltKey: e.altKey,\n\t\t\t\tmetaKey: e.metaKey,\n\t\t\t} });\n\t\t}, true);\n\t});\n\n\t// ---- handshake -----------------------------------------------------------\n\t// Announce readiness and KEEP announcing until the editor acks. A single\n\t// 'ready' can race the editor attaching its listener (or land while the\n\t// editor is busy); code that awaits spline.ready would then hang forever.\n\t// The editor acks every 'ready' (and posts a proactive ack on attach), so\n\t// this settles within one round-trip in the normal case.\n\tpost({ kind: 'ready' });\n\tvar readyRetry = setInterval(function () {\n\t\tif (acked) {\n\t\t\tclearInterval(readyRetry);\n\t\t\treturn;\n\t\t}\n\t\tpost({ kind: 'ready' });\n\t}, 250);\n})();`,Wt=class{constructor(e,t,n){this.deps=e,this.onConsole=t,this.onEvent=n,this.disposed=!1,this.eventUnsubs=new Map,this.variablePollHandle=null,this.lastVariables=null}dispose(){this.disposed=!0;for(let e of this.eventUnsubs.values())e();this.eventUnsubs.clear(),this.stopVariablePolling()}execute(e,t){let n=this.deps;switch(e){case"setVariable":{let e=n.setVariable(String(t[0]),t[1]);return e.warning&&this.onConsole("warn",e.warning),e.ok}case"setVariables":{let e=t[0]??{},i=!0;for(let[t,s]of Object.entries(e)){let e=n.setVariable(t,s);e.warning&&this.onConsole("warn",e.warning),i=i&&e.ok}return i}case"getVariable":return n.getVariable(String(t[0]));case"getVariables":return n.getVariables();case"getAllObjects":return n.getAllObjects();case"findObjectByName":case"findObjectById":return n.findObject(String(t[0]));case"getGeometry":{let e=n.getGeometry(String(t[0]),t[1]??{});return e.warning&&this.onConsole("warn",e.warning),e.data}case"updateObject":return n.updateObject(String(t[0]),t[1]??{});case"createObject":return n.createObject(String(t[0]),t[1]??{});case"createCustomMaterial":if(void 0===n.createCustomMaterial)throw new Error("createCustomMaterial: not available on this surface — custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.createCustomMaterial(t[0]);case"setMaterial":if(void 0===n.setMaterial)throw new Error("setMaterial: not available on this surface — custom three.js/TSL materials need the inline HTML-content mode (editor Preview/Play and web exports).");return n.setMaterial(String(t[0]),t[1]);case"cloneObject":return n.cloneObject(String(t[0]),t[1]??{});case"removeObject":return n.removeObject(String(t[0]));case"spawnObject":{let e=n.spawnObject(String(t[0]),t[1]??{});return e.warning&&this.onConsole("warn",e.warning),e.object}case"destroyObject":return n.destroyObject(String(t[0]));case"setInstanceTransforms":{let e=null===t[1]||void 0===t[1]?null:t[1],i=n.setInstanceTransforms(String(t[0]),e);return i<0&&this.onConsole("warn",`spline.setInstanceTransforms: "${String(t[0])}" has no cloner — make the object a cloner first (its copies are what this drives).`),i}case"emitEvent":case"emitEventReverse":{let i=n.emitEvent(String(t[0]),String(t[1]),"emitEventReverse"===e);return i.warning&&this.onConsole("warn",i.warning),i.ok}case"requestRender":return n.requestRender(),!0;case"listenEvent":{let e=String(t[0]);return"variableChange"===e?this.startVariablePolling():this.eventUnsubs.has(e)||this.eventUnsubs.set(e,n.addSplineEventListener(e,t=>{this.onEvent(e,t)})),!0}case"unlistenEvent":{let e=String(t[0]);return"variableChange"===e?this.stopVariablePolling():(this.eventUnsubs.get(e)?.(),this.eventUnsubs.delete(e)),!0}default:throw new Error(`Unknown spline bridge method: ${e}`)}}startVariablePolling(){null===this.variablePollHandle&&(this.lastVariables=this.deps.getVariables(),this.variablePollHandle=window.setInterval(()=>{if(this.disposed)return;let e=this.deps.getVariables(),t=function(e,t){let n=[];for(let i of Object.keys(t))e[i]!==t[i]&&n.push({name:i,value:t[i]});return n}(this.lastVariables??{},e);this.lastVariables=e;for(let e of t)this.onEvent("variableChange",e)},100))}stopVariablePolling(){null!==this.variablePollHandle&&(window.clearInterval(this.variablePollHandle),this.variablePollHandle=null),this.lastVariables=null}};function Ht(e,t,n,i){return[e[0]*t+e[4]*n+e[8]*i+e[12],e[1]*t+e[5]*n+e[9]*i+e[13],e[2]*t+e[6]*n+e[10]*i+e[14]]}var qt=class{constructor(e,t,n){this.iframe=e,this.deps=t,this.onConsole=n,this.disposed=!1,this.handshakeSeen=!1,this.handshakeTimer=null,this.onMessage=e=>{if(this.disposed||e.source!==this.iframe.contentWindow)return;let t=e.data;var n;"object"!=typeof(n=t)||null===n||!0!==n[Ft]||"string"!=typeof n.kind||this.handleMessage(t)},this.host=new Wt(t,n,(e,t)=>{this.sendEvent(e,t)})}attach(){window.addEventListener("message",this.onMessage),this.send({[Ft]:!0,kind:"ready-ack"}),this.handshakeTimer=window.setTimeout(()=>{this.handshakeTimer=null,!this.handshakeSeen&&!this.disposed&&this.onConsole("warn","The HTML content frame has not initialized (no signal from its scripts yet) — if the page looks frozen, check for errors in its code.")},6e3)}dispose(){this.disposed=!0,window.removeEventListener("message",this.onMessage),this.host.dispose(),null!==this.handshakeTimer&&(window.clearTimeout(this.handshakeTimer),this.handshakeTimer=null)}handleMessage(e){switch(e.kind){case"ready":this.handshakeSeen=!0,this.send({[Ft]:!0,kind:"ready-ack"});break;case"console":this.onConsole(e.level,e.text);break;case"call":{let t;try{t=Promise.resolve(this.host.execute(e.method,e.args))}catch(e){t=Promise.reject(e)}t.then(t=>{this.send({[Ft]:!0,kind:"result",id:e.id,ok:!0,value:t,error:void 0})},t=>{let n=t instanceof Error?t.message:String(t);this.send({[Ft]:!0,kind:"result",id:e.id,ok:!1,value:void 0,error:n}),this.onConsole("error",n)});break}case"input":this.dispatchInput(e.event)}}send(e){this.iframe.contentWindow?.postMessage(e,"*")}sendEvent(e,t){this.send({[Ft]:!0,kind:"event",eventName:e,payload:t})}dispatchInput(e){let t=this.deps.getCanvas();if(!t)return;let n=this.iframe.getBoundingClientRect(),i={bubbles:!0,cancelable:!0,view:window,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey};switch(e.type){case"pointerdown":case"pointermove":case"pointerup":case"pointercancel":t.dispatchEvent(new PointerEvent(e.type,{...i,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,button:e.button,buttons:e.buttons,pointerId:e.pointerId,pointerType:e.pointerType,isPrimary:e.isPrimary,movementX:e.movementX,movementY:e.movementY}));break;case"click":case"dblclick":t.dispatchEvent(new MouseEvent(e.type,{...i,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,button:e.button,buttons:e.buttons}));break;case"wheel":{let s=new WheelEvent("wheel",{...i,clientX:(e.x??0)+n.left,clientY:(e.y??0)+n.top,deltaX:e.deltaX,deltaY:e.deltaY,deltaMode:e.deltaMode});"number"==typeof e.wheelDeltaX&&Object.defineProperty(s,"wheelDeltaX",{value:e.wheelDeltaX}),"number"==typeof e.wheelDeltaY&&Object.defineProperty(s,"wheelDeltaY",{value:e.wheelDeltaY}),t.dispatchEvent(s);break}case"keydown":case"keyup":t.dispatchEvent(new KeyboardEvent(e.type,{...i,key:e.key,code:e.code,repeat:e.repeat}))}}};function $t(e){let t=e.points.length/7,n=new xe;for(let i=0;i<t;i++){let t=7*i,s=e.points[t+0],r=e.points[t+1],a=e.points[t+2],o=e.points[t+3],l=e.points[t+4],c=e.points[t+5],h=e.points[t+6];n.push({fi:i,id:He.generateUUID(),data:{roundness:h,position:[s,r],areControlsDirectionsMirrored:!0,controlPrevious:{position:[a,o]},controlNext:{position:[l,c]}}})}return{points:n,isClosed:e.isClosed,roundness:e.roundness,shapeHoles:e.shapeHoles?.map(e=>$t(e))??[]}}function Yt(e){let{userData:t,uuid:n,...i}=e;if(void 0===t||"NonParametricGeometry"===t.type)return function(e){let t,{userData:n,data:i}=e,s=i?.groups,r=i?.attributes??{},a=i?.morphAttributes??{},o=i?.interleavedBuffers,l=i?.arrayBuffers,c=i?.index;void 0!==r.position&&Array.isArray(r.position.array)&&(t=function(e){let t=1/0,n=1/0,i=1/0,s=-1/0,r=-1/0,a=-1/0;for(let o=0;o<e.length;o+=3){let l=e[o],c=e[o+1],h=e[o+2];t=Math.min(t,l),n=Math.min(n,c),i=Math.min(i,h),s=Math.max(s,l),r=Math.max(r,c),a=Math.max(a,h)}return{width:s-t,height:r-n,depth:a-i}}(r.position.array));let h={...void 0===n?{}:n.parameters,data:{attributes:r,morphAttributes:a,interleavedBuffers:o,arrayBuffers:l},...void 0===t?{}:t,type:"NonParametricGeometry"};return void 0!==c&&Object.assign(h.data,{index:c}),void 0!==s&&Object.assign(h.data,{groups:s.map(e=>({...e,materialIndex:e.materialIndex??0}))}),h}(e);if("SubdivGeometry"===t.type){let e="SubdivGeometry",n=i.data?.attributes;if(void 0===n?.positionWASM){let e=new nt;if(void 0===n?.position||void 0===n?.faceMap)return null;let t=n.position.array,s=n.faceMap.array,r=i.data.index.array;e.setAttribute("position",new tt(t,3)),e.setIndex(new Ne(r,1));let a=I(e),o=[],l=new Array(s[s.length-1]+1).fill(3),c=a.getIndex().array;for(let e=0,t=s.length;e<t;)s[e]===s[e+1]?(l[s[e]]++,o.push(...new Set(c.slice(3*e,3*e+6))),e+=2):(o.push(...c.slice(3*e,3*e+3)),e++);n.indexWASM={array:o},n.positionWASM=a.attributes.position,n.verticesPerFaceWASM={array:l}}if(void 0===n?.positionWASM||0===n?.positionWASM.length||void 0===n?.indexWASM||0===n?.indexWASM.length||void 0===n?.verticesPerFaceWASM||0===n?.verticesPerFaceWASM.length)return null;let s={type:e,...Jt(n.positionWASM.array)};s.subdivisions=t.parameters.subdivisions;for(let e in n)"positionWASM"===e?s[e]=new Float32Array(n[e].array):"indexWASM"===e?s[e]=new Int32Array(n[e].array):"verticesPerFaceWASM"===e&&(s[e]=new Int8Array(n[e].array));return s.scaleBaked=[1,1,1],s}let s=t.type,r=t.parameters;return"VectorGeometry"===s?(r.extrudeDepth&&(r.depth=r.extrudeDepth),{...r,width:100,height:100,shape:$t(t.shape),type:s}):"LatheGeometry"===s?{...t.parameters,type:s,points:(t?.parameters.points??[]).map(e=>[e.x,e.y])}:(r.extrudeDepth&&(r.depth=r.extrudeDepth),{...r,type:s})}new Ze,new $e,new Je,new Ye,new Ye;var Xt=new et,Zt=new Ye;function Jt(e){return Xt.setFromArray(e),Xt.getSize(Zt),{width:Zt.x,height:Zt.y,depth:Zt.z}}var Qt=class{constructor(e,t,n,i,s,r){if(this.id=e,this.data=t,this.object=n,this.entered=!1,("KeyDown"===t.type||"KeyUp"===t.type||"KeyPress"===t.type)&&!t.key)throw new Error("Missing property");this.actions=Y(t,t.actions,i,s,r,n)}disconnect(){X(this.actions)}dispatchHeld(e){this.actions.Create.forEach(t=>{e&&t.dispatchThrottled.cancel(),t.dispatchThrottled()})}dispatch(e=!1){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),"MousePress"===this.data.type||"KeyPress"===this.data.type?this.entered||(this.entered=!0,this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStart())):(this.actions.Transition.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.Transition.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.SwitchCamera.some(e=>e.playing&&"Toggle"!==e.data.runMode)||this.actions.SwitchCamera.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.Animation.forEach(e=>{"Toggle"===e.data.runMode?e.toggle():e.play()}),this.actions.TimelineAnimation.forEach(e=>{"runMode"in e.data&&"Toggle"===e.data.runMode?e.toggle():e.play()})),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),!1===e&&this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}dispatchRelease(){this.entered&&(this.entered=!1,this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Particles.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent()),this.actions.Create.forEach(e=>e.dispatchStop()))}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.Link.forEach(e=>{e.dispatch()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{e.dispatchBasic()}),this.actions.Video.forEach(e=>{e.dispatchBasic()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()}),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch())}},en=class extends b{constructor(e,t,n){super(e),this.eventManager=t,this.useForRaycastProperty=n,this.objectsPerTypes={MouseDown:[],MouseUp:[],MousePress:[],KeyDown:[],KeyUp:[],KeyPress:[]},this.canvasMouseEvents=[],this.eventsPerObjects={MouseDown:{},MouseUp:{},MousePress:{},KeyDown:{},KeyUp:{},KeyPress:{}},this.heldKeys={},this.heldKeysPress={},this._prevObjects=[],this.sceneInterects=null,this.onCanvasRaycast=e=>{if(!0===this.useForRaycastProperty&&null===this.sceneInterects){this.eventContext.updateRaycaster(e);let{raycaster:t,page:n}=this.eventContext,i=o(t,n,[],!0);this.sceneInterects=i,i.length&&(this.eventContext.sharedAssets.raycastProperty={x:i[0].point.x,y:i[0].point.y,z:i[0].point.z,objX:i[0].object.matrixWorld.elements[12],objY:i[0].object.matrixWorld.elements[13],objZ:i[0].object.matrixWorld.elements[14]})}},this.onCanvasMouseDown=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{("MouseDown"===t.data.type||"MousePress"===t.data.type)&&(this.onCanvasRaycast(e),t.dispatch())})},this.onCanvasMouseUp=e=>{(e.target===this.eventContext.domElement||"SPLINE-VIEWER"===e.target.tagName)&&this.canvasMouseEvents.forEach(t=>{"MouseUp"===t.data.type?(this.onCanvasRaycast(e),t.dispatch()):"MousePress"===t.data.type&&t.dispatchRelease()})},this.onMouseDown=e=>{A.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseDown"))},this.onMouseUp=e=>{A.length>1||(this.eventContext.updateRaycaster(e),this.handleMouseEvent("MouseUp"))},this.onMousePressDown=e=>{A.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent())},this.onMousePressRelease=e=>{A.length>1||(this.eventContext.updateRaycaster(e),this.handleMousePressEvent(!0))},this.onKeyDown=e=>{this.heldKeys[e.key]||(this.handleKeyEvent(e,"KeyDown"),this.handleKeyEventHeld(e,"KeyDown",!0)),this.heldKeys[e.key]=!0},this.onKeyUp=e=>{this.handleKeyEvent(e,"KeyUp"),this.handleKeyEventHeld(e,"KeyUp",!0)},this.onKeyPressDown=e=>{this.heldKeysPress[e.key]?this.handleKeyEventHeld(e,"KeyPress"):(this.handleKeyEvent(e,"KeyPress"),this.handleKeyEventHeld(e,"KeyPress",!0)),this.heldKeysPress[e.key]=!0},this.onKeyPressUp=e=>{this.handleKeyEvent(e,"KeyPress",!0)},this.releaseHeldKey=e=>{delete this.heldKeys[e.key]},this.releaseHeldKeyPress=e=>{delete this.heldKeysPress[e.key]},this._onUserEvent=({eventName:e,target:t,reverse:n})=>{if(!e||!t)return;let i=u(e);i&&("MouseDown"===i||"MouseUp"===i||"MousePress"===i?(t.dispatchEvent({type:"beginEvent",eventName:i}),this.eventsPerObjects[i]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent(n)}),this.canvasMouseEvents.forEach(e=>{e.dispatchUserEvent(n)})):("KeyDown"===i||"KeyUp"===i||"KeyPress"===i)&&(t.dispatchEvent({type:"beginEvent",eventName:i}),this.eventsPerObjects[i]?.[t.uuid]?.forEach(e=>{e.dispatchUserEvent()})))}}connect(){let{page:e,sharedAssets:t,domElement:n}=this.eventContext,i=(n,i)=>{if(!n.data?.events.length)return;let s=["MouseDown","MouseUp","MousePress","KeyDown","KeyUp","KeyPress"];for(let r of s){let s=this.eventsPerObjects[r];if(n.data.events.filter(({data:e})=>e.type===r&&!0!==e.disabled).forEach(({id:i,data:r})=>{try{let a=new Qt(i,r,n,e,t,this.eventManager);a.actions.Video.length&&(this.hasVideoAction=!0),"MouseDown"!==r.type&&"MouseUp"!==r.type&&"MousePress"!==r.type||"Canvas"!==r.mode&&"Window"!==r.mode?(s[n.uuid]?s[n.uuid].some(e=>e.id===a.id)||s[n.uuid].push(a):s[n.uuid]=[a],Q(n)&&n.traverseChildren(e=>{if(!e.visible)return!0;e instanceof B&&"shapeBlendNode"in e.data.geometry&&2!==e.data.geometry.shapeBlendNode?.operation&&(s[e.uuid]?s[e.uuid].push(a):s[e.uuid]=[a])})):this.canvasMouseEvents.push(a)}catch(e){}}),s[n.uuid]?.length&&(this.objectsPerTypes[r].push(!ee(n)||"MouseDown"!==r&&"MouseUp"!==r&&"MousePress"!==r?n:i),Q(n))){let e=this.objectsPerTypes[r];n.traverseChildren(t=>{if(!t.visible)return!0;t instanceof B&&-1===e.indexOf(t)&&e.push(t)})}}};e.traverseEntity(e=>{(te(e)||e instanceof m)&&e.frame?.traverse(t=>{i(t,e)}),i(e)}),this.heldKeys={},this.heldKeysPress={},this.domEventsNeeded.clear(),n.addEventListener("pointerdown",this.onCanvasMouseDown),n.addEventListener("pointerup",this.onCanvasMouseUp),(this.objectsPerTypes.MouseDown?.length||this.useForRaycastProperty)&&(this.domEventsNeeded.add("pointerdown"),n.addEventListener("pointerdown",this.onMouseDown)),this.objectsPerTypes.MouseUp?.length&&(this.domEventsNeeded.add("pointerup"),n.addEventListener("pointerup",this.onMouseUp)),this.objectsPerTypes.MousePress?.length&&(this.domEventsNeeded.add("pointerdown"),n.addEventListener("pointerdown",this.onMousePressDown),this.domEventsNeeded.add("pointerup"),n.addEventListener("pointerup",this.onMousePressRelease)),this.objectsPerTypes.KeyDown?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keyup",this.releaseHeldKey)),this.objectsPerTypes.KeyUp?.length&&(this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyUp)),this.objectsPerTypes.KeyPress?.length&&(this.domEventsNeeded.add("keydown"),document.addEventListener("keydown",this.onKeyPressDown),document.addEventListener("keyup",this.releaseHeldKeyPress),this.domEventsNeeded.add("keyup"),document.addEventListener("keyup",this.onKeyPressUp)),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.addEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.addEventListener("userEvent",this._onUserEvent)})}disconnect(){let{domElement:e}=this.eventContext;this.domEventsNeeded.clear(),this.heldKeys={},this.heldKeysPress={},e.removeEventListener("pointerdown",this.onCanvasMouseDown),e.removeEventListener("pointerup",this.onCanvasMouseUp),e.removeEventListener("pointerdown",this.onMouseDown),e.removeEventListener("pointerdown",this.onMousePressDown),e.removeEventListener("pointerup",this.onMouseUp),e.removeEventListener("pointerup",this.onMousePressRelease),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keyup",this.onKeyUp),document.removeEventListener("keydown",this.onKeyPressDown),document.removeEventListener("keyup",this.onKeyPressUp),document.removeEventListener("keyup",this.releaseHeldKey),Object.values(this.eventsPerObjects).forEach(e=>{Object.values(e).forEach(e=>{e.forEach(e=>{e.disconnect()})})}),this.canvasMouseEvents.forEach(e=>{e.disconnect()}),Object.entries(this.objectsPerTypes).forEach(([e,t])=>{t.forEach(e=>{e.removeEventListener("userEvent",this._onUserEvent)})}),this.canvasMouseEvents.forEach(e=>{e.object.removeEventListener("userEvent",this._onUserEvent)})}handleMouseEvent(e){let{stopRaycast:t,raycaster:n,page:i,pointerScreen:s}=this.eventContext,r=this.objectsPerTypes[e],a=r.filter(e=>!ee(e));if((r.length||this.useForRaycastProperty)&&(!i.uiCanvas||!c(i,[s.x,s.y],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))){if(t||this.useForRaycastProperty){let s;if(null===this.sceneInterects?s=o(n,i,a,this.useForRaycastProperty):(s=this.sceneInterects,this.sceneInterects=null),this.useForRaycastProperty&&s.length&&(this.eventContext.sharedAssets.raycastProperty={x:s[0].point.x,y:s[0].point.y,z:s[0].point.z,objX:s[0].object.matrixWorld.elements[12],objY:s[0].object.matrixWorld.elements[13],objZ:s[0].object.matrixWorld.elements[14]}),t){let t=[s[0]?.uv?.x??0,s[0]?.uv?.y??0];l(s).forEach(n=>{te(n)&&c(n,t,Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}),this.eventsPerObjects[e][n.uuid]&&this.handleObjectMouseEventDispatch(n,e)})}}t||a.forEach(t=>{let i=h(n,t);i&&(this.handleObjectMouseEventDispatch(t,e),te(t)&&c(t,[i?.uv?.x??0,i?.uv?.y??0],Object.keys(this.eventsPerObjects[e]),t=>{this.handleObjectMouseEventDispatch(t,e)}))})}}handleMousePressEvent(e=!1){let t="MousePress",n=this.objectsPerTypes[t],i=n.filter(e=>!ee(e)),s=[];if(n.length){if(!e){let{stopRaycast:e,raycaster:n,page:r,pointerScreen:a}=this.eventContext,d=!1;if(r.uiCanvas&&(d=c(r,[a.x,a.y],Object.keys(this.eventsPerObjects[t]),e=>{s.push(e)})),e&&!d){let e=o(n,r,i);s=l(e),e.forEach(e=>{te(e.object)&&c(e.object,[e?.uv?.x??0,e?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{s.push(e)})})}else i.forEach(e=>{let i=h(n,e);i&&(s.push(e),te(e)&&c(e,[i?.uv?.x??0,i?.uv?.y??0],Object.keys(this.eventsPerObjects[t]),e=>{s.push(e)}))})}this._prevObjects.length&&this._prevObjects.forEach(e=>{s.includes(e)||this.handleObjectMouseEventDispatchRelease(e,t)}),s.length&&s.forEach(e=>{this.handleObjectMouseEventDispatch(e,t)}),this._prevObjects=s}}handleObjectMouseEventDispatch(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatch()})}handleObjectMouseEventDispatchRelease(e,t){e.dispatchEvent({type:"beginEvent",eventName:t}),this.eventsPerObjects[t]?.[e.uuid]?.forEach(e=>{e.dispatchRelease()})}handleKeyEvent(e,t,n=!1){this.objectsPerTypes[t].forEach(i=>{let s=this.eventsPerObjects[t][i.uuid];s.some(({data:t})=>"key"in t&&t.key===e.key)&&i.dispatchEvent({type:"beginEvent",eventName:t}),s.forEach(t=>{"key"in t.data&&t.data.key===e.key&&(n?t.dispatchRelease():t.dispatch(!0))})})}handleKeyEventHeld(e,t,n=!1){this.objectsPerTypes[t].forEach(i=>{this.eventsPerObjects[t][i.uuid].forEach(t=>{"key"in t.data&&t.data.key===e.key&&t.dispatchHeld(n)})})}},tn=e=>!0===e?.isPlayAudioAction,nn=e=>!0===e?.isPauseAudioAction,sn=e=>!0===e?.isPlayVideoAction,rn=e=>!0===e?.isPauseVideoAction,an=class{constructor(e,t,n,i,s,r){this.id=e,this.data=t,this.object=n,this.actions=Y(t,t.actions,i,s,r,n)}disconnect(){X(this.actions)}dispatch(){this.actions.Transition.forEach(e=>{e.play()}),this.actions.Animation.forEach(e=>{e.play()}),this.actions.TimelineAnimation.forEach(e=>{e.play()}),this.actions.SwitchCamera.forEach(e=>{e.play()}),this.actions.SceneTransition.forEach(e=>{e.dispatch()}),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatchFromStart()}),this.actions.Destroy.forEach(e=>{e.dispatchFromStart()})}dispatchAfter(e){this.actions.Audio.forEach(t=>{(t.interaction.data.triggerAfter??"any")===e&&(tn(t.interaction)?t.interaction.audioPlayer?.play():nn(t.interaction)&&t.interaction.dispatch())}),this.actions.Video.forEach(t=>{let n=t.interaction.data.triggerAfter??"autoplay";n===e&&(sn(t.interaction)?t.interaction.play("autoplay"===n):rn(t.interaction)&&t.interaction.dispatch())}),this.actions.Particles.forEach(t=>{(t.data.triggerAfter??"any")===e&&t.dispatchBasic()})}async seekVideos(e){let t=[];this.actions.Video.forEach(n=>{"autoplay"===(n.interaction.data.triggerAfter??"autoplay")&&sn(n.interaction)&&t.push(n.interaction.seek(e))}),await Promise.all(t)}pauseVideos(){this.actions.Video.forEach(e=>{sn(e.interaction)&&e.interaction.pause()})}dispatchUserEvent(e){this.actions.Transition.forEach(e=>{e.object.currentTransitionEvent!==this&&(e.object.currentTransitionEvent=this,e.init())}),e?(this.actions.Transition.forEach(e=>e.reverseFromCurrent()),this.actions.Animation.forEach(e=>e.reverseFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.reverseFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.reverseFromCurrent())):(this.actions.Transition.forEach(e=>e.playFromCurrent()),this.actions.Animation.forEach(e=>e.playFromCurrent()),this.actions.TimelineAnimation.forEach(e=>e.playFromCurrent()),this.actions.SwitchCamera.forEach(e=>e.playFromCurrent())),this.actions.SceneTransition.forEach(e=>e.dispatch()),this.actions.Reset.forEach(e=>e.dispatch()),this.actions.SetVariable.forEach(e=>e.checkConditions()),this.actions.SetVariable.forEach(e=>e.dispatch()),this.actions.DynamicVariablePlay.forEach(e=>e.dispatch()),this.actions.ClearLocalStorage.forEach(e=>e.dispatch()),this.actions.UserAPI.forEach(e=>e.dispatch()),this.actions.Create.forEach(e=>{e.dispatch()}),this.actions.Destroy.forEach(e=>{e.dispatch()}),this.actions.Audio.forEach(e=>{tn(e.interaction)?e.interaction.audioPlayer?.play():nn(e.interaction)&&e.interaction.dispatch()}),this.actions.Video.forEach(e=>{sn(e.interaction)?e.interaction.play():rn(e.interaction)&&e.interaction.dispatch()}),this.actions.Particles.forEach(e=>{e.dispatchBasic()})}},on=class extends b{constructor(e,t){super(e),this.eventManager=t,this.eventsPerObject=new Map,this.eventsAfterPerObject=new Map,this.onMouseDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("mouseDown")})})},this.onKeyDown=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("keyDown")})})},this.onAny=()=>{let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("any")})})},this.onSceneTransitionAudioVideoPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.actions.Audio.forEach(e=>{tn(e.interaction)&&e.interaction.audioPlayer?.play()}),e.actions.Video.forEach(e=>{let t=e.interaction.data.triggerAfter??"autoplay";sn(e.interaction)&&e.interaction.play("autoplay"===t)}),e.actions.Particles.forEach(e=>{e.dispatchBasic()})})})},this.onPlay=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>{e.dispatchAfter("autoplay")})})},this.seekVideos=async e=>{let t=[];[...this.eventsAfterPerObject.entries()].forEach(([n,i])=>{!n.data.visible||i.forEach(n=>{t.push(n.seekVideos(e))})}),await Promise.all(t)},this.pauseVideos=()=>{[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{t.forEach(e=>{e.pauseVideos()})})},this.onUserEvent=({eventName:e,target:t,reverse:n})=>{if(!e||!t)return;let i=u(e);i&&"Start"===i&&(ee(t)||t.dispatchEvent({type:"beginEvent",eventName:"Start"}),this.eventsPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(n)}),this.eventsAfterPerObject.get(t)?.forEach(e=>{e.dispatchUserEvent(n)}))}}connect(){let{sharedAssets:e,page:t}=this.eventContext,n=n=>{if(n.data?.events.length)for(let{id:i,data:s}of n.data.events){if(s.disabled||"Start"!==s.type)continue;let r=new an(i,s,n,t,e,this.eventManager);(r.actions.Transition.length||r.actions.TimelineAnimation.length||r.actions.Animation.length||r.actions.SwitchCamera.length||r.actions.Create.length||r.actions.Destroy.length||r.actions.SceneTransition.length||r.actions.Reset.length||r.actions.SetVariable.length||r.actions.DynamicVariablePlay.length||r.actions.ClearLocalStorage.length||r.actions.UserAPI.length)&&(this.eventsPerObject.has(n)?this.eventsPerObject.get(n)?.push(r):this.eventsPerObject.set(n,[r])),r.actions.Audio.length&&(this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(r):this.eventsAfterPerObject.set(n,[r])),r.actions.Video.length&&(this.hasVideoAction=!0,this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(r):this.eventsAfterPerObject.set(n,[r])),r.actions.Particles.length&&(this.eventsAfterPerObject.has(n)?this.eventsAfterPerObject.get(n)?.push(r):this.eventsAfterPerObject.set(n,[r]))}};if(t.traverseEntity(e=>{(te(e)||e instanceof m)&&e.frame?.traverse(e=>{n(e)}),n(e)}),[...this.eventsAfterPerObject.values()].some(e=>e.length)){if(0===this.eventManager.activateCount){let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.addEventListener("pointerdown",this.onMouseDown,{once:!0}),n.addEventListener("mousedown",this.onMouseDown,{once:!0}),document.addEventListener("keydown",this.onKeyDown,{once:!0}),n.addEventListener("pointerdown",this.onAny),n.addEventListener("mousedown",this.onAny),document.addEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.addEventListener("userEvent",this.onUserEvent)})}else this.onSceneTransitionAudioVideoPlay();this.onPlay()}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.dispatchEvent({type:"beginEvent",eventName:"Start"}),t.forEach(e=>e.dispatch()),e.addEventListener("userEvent",this.onUserEvent)})}disconnect(){if([...this.eventsAfterPerObject.values()].some(e=>e.length)){let{domElement:e,isExport:t}=this.eventContext,n=t?document:e;n.removeEventListener("pointerdown",this.onMouseDown),n.removeEventListener("mousedown",this.onMouseDown),document.removeEventListener("keydown",this.onKeyDown),n.removeEventListener("pointerdown",this.onAny),n.removeEventListener("mousedown",this.onAny),document.removeEventListener("keydown",this.onAny),[...this.eventsAfterPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())})}[...this.eventsPerObject.entries()].forEach(([e,t])=>{e.removeEventListener("userEvent",this.onUserEvent),t.forEach(e=>e.disconnect())}),this.eventsPerObject.clear(),this.eventsAfterPerObject.clear()}},ln=class{constructor(e,t,n,i,s){this.publish=e,this.controlsManager=t,this.animationControls=n,this.eventContext=i,this.sharedVariables=s,this.isEnabled=!1,this.activateCount=0,this.needsMouse=!1,this.needsRaycast=!1,this.onTouchMovePreventScroll=e=>{let t=window.parent!==window,n=document.documentElement.scrollHeight>document.documentElement.clientHeight||document.documentElement.scrollWidth>document.documentElement.clientWidth;(e.touches.length>1||this.preventTouchScroll||!1===t&&!1===n)&&e.preventDefault()},this.onMouseWheelPreventScroll=e=>{this.preventScroll&&e.preventDefault()},this.onMouseMove=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:e.buttons>0}},this.onMouseDown=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!0}},this.onMouseUp=e=>{this.eventContext.sharedAssets.mouseProperty={...this.getMousePosition(e),pressed:!1}},this.getMousePosition=e=>{let{domRect:t}=this.eventContext,{pageX:n,pageY:i}=e.touches?.length>0?e.touches[0]:e;return{x:n-(t.left+window.scrollX),y:i-(t.top+window.scrollY)}},this.stopRaycast=e.stopRaycast,this.preventScroll=e.preventScroll,this.preventTouchScroll=e.preventTouchScroll,this.hideCursor=e.hideCursor,this.requestRender=i.requestRender}warnMissingEventFeatures(){this.eventContext.page.traverseEntity(e=>{for(let t of e.dataPatched.events){if(!0===t.data.disabled)continue;let e=t.data.type;if(void 0!==this.handlers[e])continue;let n=q[e];void 0!==n&&ae(n,`a "${e}" event`)}})}activate(e=!1){if(this.isEnabled)return;this.isEnabled=!0,this.initializeActionsDependentStates(),this.needsMouse&&(this.eventContext.domElement.addEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.addEventListener("pointerdown",this.onMouseDown));let t={eventContext:this.eventContext,eventManager:this,sharedVariables:this.sharedVariables,needsMouse:this.needsMouse,needsRaycast:this.needsRaycast};this.handlers={};let n=(e,n)=>{let i=g(e);void 0!==i?this.handlers[e]=i(t):void 0!==n&&(this.handlers[e]=n())};n("Spline",()=>new p(this.eventContext)),n("VariableChange"),n("API"),n("WEBHOOK"),n("AIAssistantListener"),n("AIAssistantTrigger"),n("Conditional"),n("Start",()=>new on(this.eventContext,this)),n("Basic",()=>new en(this.eventContext,this,this.needsRaycast)),n("MouseHover"),n("Scroll"),n("Follow"),n("DragDrop"),n("LookAt"),n("Resize"),n("Textfields"),this.warnMissingEventFeatures();let{page:i,domElement:s}=this.eventContext;this.hideCursor&&(s.style.cursor="none"),i.traverseEntity(e=>{e.addEventListener("requestRender",this.requestRender)}),Object.values(this.handlers).forEach(e=>e.connect()),s.addEventListener("wheel",this.onMouseWheelPreventScroll),s.addEventListener("touchmove",this.onTouchMovePreventScroll),this.activateCount++,e||this.eventContext.sharedAssets.openAIRealtime?.connect()}deactivate(e=!1){if(!this.isEnabled)return;this.isEnabled=!1,this.eventContext.domElement.removeEventListener("pointermove",this.onMouseMove),this.eventContext.domElement.removeEventListener("pointerdown",this.onMouseDown),this.eventContext.domElement.removeEventListener("pointerup",this.onMouseUp),this.eventContext.sharedAssets.mouseProperty=null,this.eventContext.sharedAssets.raycastProperty=null;let{page:t,domElement:n}=this.eventContext;n.style.cursor="",Object.values(this.handlers).forEach(e=>e.disconnect()),this.controlsManager.gameControl?.disposeActions(),this.controlsManager.disconnectEvents(),t.traverseEntity(e=>{e.removeEventListener("requestRender",this.requestRender),e.destroyedInAction=!1}),n.removeEventListener("touchmove",this.onTouchMovePreventScroll),n.removeEventListener("wheel",this.onMouseWheelPreventScroll),this.animationControls.onExitPlayMode(),e||this.eventContext.sharedAssets.openAIRealtime?.disconnect()}dispose(){this.deactivate(),Object.values(this.handlers).forEach(e=>e.dispose())}get isPaused(){return this.isEnabled}pause(){this.deactivate()}resume(){this.activate()}reset(){this.deactivate(!0),this.activate(!0),this.controlsManager.deactivate(),this.controlsManager.activate(this),this.controlsManager.page.updateMatrixWorld(!0),this.controlsManager.rebuildBVH()}updateUseWindowEvents(e){let t=this.isEnabled;t&&this.deactivate(),this.eventContext.useWindowEvents=e,t&&this.activate()}initializeActionsDependentStates(){let e=this.eventContext.sharedAssets;e.resetDynamicVariablePlayState();let t=n=>{if("Conditional"===n.data.type&&(n.data.ifActions.forEach(t),n.data.elseActions.forEach(t)),"Conditional"===n.data.type||"SetVariable"===n.data.type)for(let e of"Conditional"===n.data.type?n.data.condition:n.data.expression)"id"in e&&Array.isArray(e.id)&&("mouse"===e.id[0]&&(this.needsMouse=!0),"raycast"===e.id[0]&&(this.needsRaycast=!0));"DynamicVariablePlay"===n.data.type&&""!==n.data.variableId&&("Play"===n.data.mode||"PlayPause"===n.data.mode||"Toggle"===n.data.mode)&&e.setDynamicVariablePlayState(n.data.variableId,"Stopped")};this.eventContext.page.traverseEntity(e=>{if(e.data?.events.length)for(let n of e.data.events)if("VariableChange"===n.data.type&&("mouseProperty"===n.data.variableId&&(this.needsMouse=!0),"raycastProperty"===n.data.variableId&&(this.needsRaycast=!0)),"Conditional"===n.data.type)for(let e of["inActions","outActions"])n.data[e].forEach(t);else if("DragDrop"===n.data.type)for(let e of["drag","drop"])n.data.dragDropActions[e].forEach(t);else if("GameControl"===n.data.type)for(let e of["idle","move","jump","run"])n.data.gameActions[e].forEach(t);else if("Resize"===n.data.type)for(let e of n.data.breakpoints)e.data.actions.forEach(t);else"LookAt"===n.data.type||"API"===n.data.type||n.data.actions.forEach(t)})}},cn=class{constructor(e,t,n,i,s){this._aspect=1,this.enableResponsive=!1,this._renderer=e,this._camera=t,this._frameSize=(new qe).copy(n),this._editorSize=(new qe).copy(i),this._aspect=t.aspect,this._fov=s??t.fov}set frameSize(e){this._frameSize.copy(e)}updateRenderer(){!this._renderer||this._renderer.setSize(this._frameSize.x,this._frameSize.y)}updateViewport(){if(!this._renderer||!this._camera||"PerspectiveCamera"!==this._camera.cameraType)return;let e=this._frameSize.x,t=this._frameSize.y,n=this._editorSize.y;this._aspect=e/t,t<=n&&(this._camera.zoom*=n/t),this._renderer.setViewport(0,0,e,t)}updateCamera(e=!0){if(this._camera)if("PerspectiveCamera"===this._camera.cameraType){let t=this._frameSize.y,n=this._editorSize.y,i=this._fov;if(e&&t>n){i*=t/n,i*=1-((t-1080)/1080*14+1)/100}this._camera.aspect=this._aspect,this._camera.fov=i,this._camera.updateProjectionMatrix()}else this._camera.setViewplaneSize(this._frameSize.x,this._frameSize.y,this.enableResponsive)}setCamera(e){this._camera=e,this._aspect=e.aspect,this._fov=e.fov}revert(){let e=window.innerWidth,t=window.innerHeight;this._renderer&&(this._renderer.setViewport(0,0,e,t),this._renderer.setSize(e,t)),this._camera&&(this._camera.aspect=e/t,this._camera.fov=this._fov,this._camera.setViewplaneSize(e,t,this.enableResponsive),this._camera.updateProjectionMatrix())}},hn=["particles","hair","shape-blends","vector-shapes","3d-paths","cloners","components","text","ui-2d","game-controls","collision-bvh","transitions"];function dn(e,t){switch(e.type){case"Particle":case"ParticleCollider":t.add("particles");break;case"Hair":t.add("hair");break;case"Page":{null!=e.publish?.gameControlObject&&t.add("game-controls"),(null!=e.uiScene||void 0!==e.uiFrame)&&t.add("ui-2d");let n=e.uiScene?.objects;if(void 0!==n){if("function"!=typeof n.traverse)throw new Error("unrecognized uiScene shape");n.traverse((e,n)=>{dn(n,t)})}break}}switch(e.geometry?.type){case"ShapeBlendGeometry":t.add("shape-blends");break;case"VectorGeometry":t.add("vector-shapes");break;case"PathGeometry":t.add("3d-paths");break;case"UIGeometry":t.add("ui-2d");break;case"TextGeometry":case"InputGeometry":t.add("text")}("Component"===e.type||"Instance"===e.type)&&t.add("components"),null!=e.cloner&&t.add("cloners");let n=e.timelineAnimations;void 0!==n&&Object.keys(n).length>0&&t.add("timeline");let i=e.states;if(null!=i)if(Array.isArray(i))i.length>0&&t.add("transitions");else{if("object"!=typeof i)throw new Error("unrecognized states shape");Object.keys(i).length>0&&t.add("transitions")}}function un(e,t){if(e&&(e.data&&dn(e.data,t),e.children))for(let n of e.children)un(n,t)}var pn,mn,fn=class{get sharedAssets(){return this.shared}constructor(e,t={},n=!0){this.shared=new G(e.shared,t,!0,n),this.scene=new s(e.scene,this.sharedAssets),this.shared.setEntityOpContext({scene:this.scene,shared:this.shared})}reset(e,t){this.scene.clearScene(),this.sharedAssets.reset(e.shared),this.scene.resetAfterClear(e.scene,this.sharedAssets)}resetPersonalCameraFromDocumentData(){for(let e of this.scene.children)e instanceof m&&!e.uiScene&&e.personalCamera.updateState(e.data.camera,{scene:this.scene,shared:this.shared})}dispose(){this.scene.dispose(),this.shared.dispose()}gc(){this.scene.releaseInstanceGroups(),this.shared.geometryCache.startGc(),this.shared.geometryCache2.startGc(),this.scene.traverseEntity(e=>{e instanceof B&&e.markGeometryAsReachable(this.shared)}),this.shared.geometryCache.endGc(),this.shared.geometryCache2.endGc()}};function vn(e){return mn||(mn=import("./runtime-DRACOLoader-5OLRBTT3.js").then(({DRACOLoader:t})=>((pn=new t).setDecoderPath(void 0!==e?`${e}/`:"https://www.gstatic.com/draco/versioned/decoders/1.5.2/").preload(),pn.decoderPending))),mn}async function yn(e){if(pn){let t,n={attributeIDs:pn.defaultAttributeIDs,attributeTypes:pn.defaultAttributeTypes,useUniqueIDs:!1};try{t=await pn.decodeGeometry(new Int8Array(e).buffer,n)}catch(e){console.error(e)}if(t)return{index:t.index?{array:t.index.array}:void 0,attributes:Object.entries(t.attributes).map(([e,t])=>({name:e,itemSize:t.itemSize,array:t.array}))}}return null}async function bn(e){for(let t of e){let e=await yn(t.geometry.data.draco);if(e){let n=t.geometry.data;e.index&&(n.index={array:e.index.array,itemSize:1,normalized:!1,type:"Uint32Array"});let i={};e.attributes.forEach(({name:e,array:t,itemSize:n})=>{i[e]={array:t,itemSize:n,type:"Float32Array",normalized:!1}}),n.attributes=i,n.draco=void 0}}}function gn(e){let t=this._clip.duration,n=this._clip.start??0,i=this.loop,s=this.time+e,r=this._loopCount,a=i===We;if(0===e)return-1===r||!a||1&~r?s:t-(s-n);if(i===Fe){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else{if(!(s<0)){this.time=s;break e}s=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),s>=t||s<n){let i=Math.floor((s-n)/(t-n));s-=(t-n)*i,r+=Math.abs(i);let o=this.repetitions-r;if(o<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,a||(s=e>0?t:n,1===this.repetitions&&(s=t)),this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===o){let t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=s;if(a&&!(1&~r))return t-(s-n)}return s}var wn=!1,En=class{constructor(e,t,n,i){this.scene=e,this.requestRender=t,this.updateDisplayProgress=n,this.animationInspectorState=i,this.clipIdToAction={},this.activeClip=null,this.needsUpdate=!1,this.addClip=e=>{"Empty"===e.data.type&&Array.isArray(e.data.animations)&&e.data.animations.forEach((t,n)=>{let i=t[0]+"/";if(Array.isArray(e.identity)?i+=e.identity[0]:i+=e.uuid,this.clipIdToAction[i])return;let s=it.parse(JSON.parse(t[2]));e.animations[n]=s;let r=this.mixer.clipAction(s,e);!1===wn&&(Object.getPrototypeOf(r)._updateTime=gn,wn=!0),r.clampWhenFinished=!0,this.clipIdToAction[i]=r})},this.mixer=new Xe(e),this.scene.traverseEntity(this.addClip)}deleteClip(e,t){let n=this.scene.find(t);if(!n)return;let i=n.animations.find(t=>t.uuid===e);if(!i)return;let s=this.clipIdToAction[e];!s||(s.stop(),this.mixer.uncacheClip(i),delete this.clipIdToAction[e],n.animations=n.animations.filter(t=>t.uuid!==e))}get isPlaying(){return Object.values(this.clipIdToAction).some(e=>e.isRunning())}playFromInspector(e){this.mixer.stopAllAction();let t=this.clipIdToAction[e];!t||(t.play(),this.activeClip=t.getClip(),this.scene.markShadowsDirty(),this.requestRender())}onExitPlayMode(){Object.values(this.clipIdToAction).forEach(e=>{e.repetitions=1/0,e.loop=ze}),this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}play(e){let t=e.clipId+"/"+e.object,n=this.clipIdToAction[t];if(n)return e&&(e.repeat>=0&&(n.repetitions=e.repeat+1),"pingpong"===e.direction&&0!==e.repeat&&(n.loop=We)),n.play(),n.paused=!1,this.requestRender(),n}resumeFromInspector(e){let t=this.clipIdToAction[e];!t||(t.play(),t.paused=!1,this.scene.markShadowsDirty(),this.requestRender())}pauseFromInspector(e){let t=this.clipIdToAction[e];!t||(t.paused=!0)}stop(){this.mixer.stopAllAction(),this.scene.markShadowsDirty(),this.requestRender()}update(e){if(this.needsUpdate)this.needsUpdate=!1;else if(!1===this.isPlaying||this.animationInspectorState?.isScrubbing)return;this.mixer.update(e/1e3),this.activeClip&&this.updateDisplayProgress(Math.round(this.mixer.time/this.activeClip.duration*(this.maxFrames-1)%(this.maxFrames-1))),this.requestRender()}get maxFrames(){return e(this.activeClip??void 0)}setProgressFromInspector(e,t){if(!this.clipIdToAction[t])return;this.activeClip!==this.clipIdToAction[t].getClip()&&this.playFromInspector(t);let n=this.clipIdToAction[t].paused;this.clipIdToAction[t].paused=!1,this.mixer.setTime(Math.min(e/(this.maxFrames-1),.9999)*this.activeClip.duration),this.scene.markShadowsDirty(),this.requestRender(),n&&(this.clipIdToAction[t].paused=!0)}},_n={bloom:()=>import("./runtime-bloom-2RFMVZQ7.js"),chromaticAberration:()=>import("./runtime-chromaticAberration-RWVAY3QZ.js"),vignette:()=>import("./runtime-vignette-B5W47RG2.js"),noise:()=>import("./runtime-noise-RIVY2SBP.js"),hueSaturation:()=>import("./runtime-hueSaturation-6PRKHQSJ.js"),brightnessContrast:()=>import("./runtime-brightnessContrast-XQS55SYB.js"),depthOfField:()=>import("./runtime-depthOfField-RNAILIMC.js"),pixelation:()=>import("./runtime-pixelation-VIGYNJ6A.js")},jn={bloom:()=>import("./runtime-fxBloom-B4TFLFRV.js"),depthOfField:()=>import("./runtime-fxDepthOfField-OB66CUJW.js")};function Pn(e,t,n){return Promise.all(e.map(e=>t[e]?.().catch(t=>{console.warn(`[spline] Failed to load the ${e} postprocessing effect (${n}); the effect will be skipped.`,t)}))).then(()=>{})}function Mn(e){return Pn(e,_n,"webgl")}var Cn=rt(at(),1);function On(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function An(e){return{id:e.uuid,name:e.name,type:e.object.data?.type??e.object.type,visible:!1!==e.playModeVisible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*He.RAD2DEG,y:e.rotation.y*He.RAD2DEG,z:e.rotation.z*He.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z},spawned:!0}}function xn(e){return{id:e.uuid,name:e.name,type:e.type??"Object",visible:e.visible,position:{x:e.position.x,y:e.position.y,z:e.position.z},rotation:{x:e.rotation.x*He.RAD2DEG,y:e.rotation.y*He.RAD2DEG,z:e.rotation.z*He.RAD2DEG},scale:{x:e.scale.x,y:e.scale.y,z:e.scale.z}}}function Sn(e,t,n){let i=t=>e.findObjectById(t)??e.findObjectByName(t),s=new Map,r=e=>{let t=s.get(e);if(t)return t;for(let t of s.values())if(t.name===e)return t};return{setVariable:(t,n)=>t in e.getVariables()?(e.setVariable(t,n),{ok:!0}):{ok:!1,warning:`spline.setVariable: no variable named "${t}" in this scene.`},getVariable:t=>e.getVariable(t),getVariables:()=>e.getVariables(),getAllObjects:()=>e.getAllObjects().map(xn),findObject:e=>{let t=i(e);return t?xn(t):void 0},getGeometry:(e,t)=>{if(!n)return{warning:"spline.getGeometry: not available in this runtime integration."};let s=r(e),a=s?s.object:(()=>{let t=i(e);return t?n.findEntity(t.uuid):void 0})();if(!a)return{warning:`spline.getGeometry: no object named "${e}" (names/ids come from getAllObjects).`};let o,l=s??a;"world"===t.space&&(l.updateWorldMatrix?.(!0,!1),o=l.matrixWorld?.elements);let c=function(e,t){let n=e?.getAttribute("position");if(!n||!n.count)return null;let i=n.count,s=t??null,r=e.getIndex?.()??null,a=Math.floor((r?r.count:i)/3),o=1/0,l=1/0,c=1/0,h=-1/0,d=-1/0,u=-1/0,p=new Float32Array(3*i);for(let e=0;e<i;e++){let t=n.getX(e),i=n.getY(e),r=n.getZ(e);s&&([t,i,r]=Ht(s,t,i,r)),t<o&&(o=t),i<l&&(l=i),r<c&&(c=r),t>h&&(h=t),i>d&&(d=i),r>u&&(u=r),p[3*e]=t,p[3*e+1]=i,p[3*e+2]=r}let m={space:s?"world":"local",vertexCount:i,triangleCount:a,indexed:null!==r,bounds:{min:[o,l,c],max:[h,d,u],size:[h-o,d-l,u-c]},vertices:p};if(r){let e=new Uint32Array(r.count);for(let t=0;t<r.count;t++)e[t]=r.getX(t);m.indices=e}let f=e.getAttribute("normal");if(f&&f.count===i){let e=s?function(e){let t=e[0],n=e[4],i=e[8],s=e[1],r=e[5],a=e[9],o=e[2],l=e[6],c=e[10],h=t*(r*c-a*l)-n*(s*c-a*o)+i*(s*l-r*o);if(!isFinite(h)||Math.abs(h)<1e-12)return null;let d=1/h,u=[(r*c-a*l)*d,(i*l-n*c)*d,(n*a-i*r)*d,(a*o-s*c)*d,(t*c-i*o)*d,(i*s-t*a)*d,(s*l-r*o)*d,(n*o-t*l)*d,(t*r-n*s)*d];return[u[0],u[3],u[6],u[1],u[4],u[7],u[2],u[5],u[8]]}(s):void 0;if(!s||e){let t=new Float32Array(3*i);for(let n=0;n<i;n++){let i=f.getX(n),s=f.getY(n),r=f.getZ(n);if(e){let t=e[0]*i+e[1]*s+e[2]*r,n=e[3]*i+e[4]*s+e[5]*r,a=e[6]*i+e[7]*s+e[8]*r,o=Math.hypot(t,n,a);o>1e-12?(i=t/o,s=n/o,r=a/o):(i=t,s=n,r=a)}t[3*n]=i,t[3*n+1]=s,t[3*n+2]=r}m.normals=t}}let v=e.getAttribute("uv");if(v&&v.count===i){let e=new Float32Array(2*i);for(let t=0;t<i;t++)e[2*t]=v.getX(t),e[2*t+1]=v.getY(t);m.uvs=e}return m}(a.geometry,o);return c?{data:{id:l.uuid,name:l.name,geometry:a.data?.geometry?.type,...c}}:{warning:`spline.getGeometry: "${l.name}" has no readable geometry — only meshes do (lights, cameras and groups have none; read a group's child meshes instead).`}},updateObject:(t,s)=>{let a=r(t);if(a){let{position:t,rotation:n,scale:i,visible:r}=s;return t&&("number"==typeof t.x&&(a.position.x=t.x),"number"==typeof t.y&&(a.position.y=t.y),"number"==typeof t.z&&(a.position.z=t.z)),n&&("number"==typeof n.x&&(a.rotation.x=n.x*He.DEG2RAD),"number"==typeof n.y&&(a.rotation.y=n.y*He.DEG2RAD),"number"==typeof n.z&&(a.rotation.z=n.z*He.DEG2RAD)),i&&("number"==typeof i.x&&(a.scale.x=i.x),"number"==typeof i.y&&(a.scale.y=i.y),"number"==typeof i.z&&(a.scale.z=i.z)),"boolean"==typeof r&&(a.playModeVisible=r),a.updateMatrix(),e.requestRender(),!0}let o=i(t);if(!o)return!1;let{position:l,rotation:c,scale:h,visible:d,geometry:u,material:p}=s;if(u&&"object"==typeof u&&n){let e=n.findEntity(o.uuid);if(e){let{vertices:t,normals:i,uvs:s,indices:r,...a}=u;On(t)&&n.shared.updateEntityGeometryVertices(e,{vertices:t,normals:On(i)?i:void 0,uvs:On(s)?s:void 0,indices:On(r)?r:void 0}),Object.keys(a).length>0&&n.shared.updateEntityGeometryParams(e,a)}}if(p&&"object"==typeof p&&n){let e=n.findEntity(o.uuid);e&&n.shared.updateEntityMaterialParams(e,p)}return l&&("number"==typeof l.x&&(o.position.x=l.x),"number"==typeof l.y&&(o.position.y=l.y),"number"==typeof l.z&&(o.position.z=l.z)),c&&("number"==typeof c.x&&(o.rotation.x=c.x*He.DEG2RAD),"number"==typeof c.y&&(o.rotation.y=c.y*He.DEG2RAD),"number"==typeof c.z&&(o.rotation.z=c.z*He.DEG2RAD)),h&&("number"==typeof h.x&&(o.scale.x=h.x),"number"==typeof h.y&&(o.scale.y=h.y),"number"==typeof h.z&&(o.scale.z=h.z)),"boolean"==typeof d&&(o.visible=d),e.requestRender(),!0},createObject:async(t,n)=>xn(await e.createObject(t,n)),createCustomMaterial:t=>e.createCustomMaterial(t),setMaterial:(t,n)=>e.setMaterial(t,n),cloneObject:(t,n)=>xn(e.cloneObject(t,n)),removeObject:t=>e.removeObject(t),spawnObject:(t,r)=>{if(!n)return{warning:"spline.spawnObject: not available in this runtime integration."};let a=i(t),o=a?n.findEntity(a.uuid):void 0;if(!o)return{warning:`spline.spawnObject: no object named "${t}" to use as a template.`};if(s.size>=500)return{warning:"spline.spawnObject: spawn budget reached (500 live copies) — destroyObject old copies (or reuse them) instead of spawning more."};let l=n.shared.spawnRuntimeClone(o,r??{});return l?(s.set(l.uuid,l),e.requestRender(),{object:An(l)}):{warning:`spline.spawnObject: "${t}" cannot be spawned from.`}},destroyObject:t=>{let i=r(t);return!(!n||!i||(s.delete(i.uuid),n.shared.destroyRuntimeClone(i),e.requestRender(),0))},setInstanceTransforms:(t,s)=>{if(!n)return-1;let r=i(t),a=r?n.findEntity(r.uuid):void 0;if(!a)return-1;let o=n.shared.setEntityInstanceTransforms(a,s);return o>=0&&e.requestRender(),o},emitEvent:(e,t,n)=>{let s=i(t);return s?(n?s.emitEventReverse(e):s.emitEvent(e),{ok:!0}):{ok:!1,warning:`spline.emitEvent: no object named "${t}".`}},requestRender:()=>e.requestRender(),addSplineEventListener:(t,n)=>{let i=e=>{n({target:{id:e.target?.id??"",name:e.target?.name??""}})};return e.addEventListener(t,i),()=>e.removeEventListener(t,i)},getCanvas:()=>t}}var kn=class{constructor(e,t,n){this.iframe=e,this.bridge=t,this.observer=n}static mount(e,t,n,i){if(typeof document>"u")return null;let s=t.parentElement;if(!s)return null;"static"===getComputedStyle(s).position&&(s.style.position="relative");let r=document.createElement("iframe");r.setAttribute("sandbox","allow-scripts allow-forms allow-pointer-lock"),r.title="Spline HTML content";let a=r.style;a.position="absolute",a.border="0",a.background="transparent",a.pointerEvents="auto",a.colorScheme="normal";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(s),r.srcdoc=function(e){let t=`<script>${zt}<\/script>`,n=/<head(\s[^>]*)?>/i.exec(e);if(n){let i=n.index+n[0].length;return e.slice(0,i)+t+e.slice(i)}let i=/<html(\s[^>]*)?>/i.exec(e);if(i){let n=i.index+i[0].length;return e.slice(0,n)+`<head>${t}</head>`+e.slice(n)}return t+e}(n),s.insertBefore(r,t.nextSibling);let c=new qt(r,Sn(e,t,i),(e,t)=>{"warn"===e?console.warn(`[spline html] ${t}`):"error"===e&&console.error(`[spline html] ${t}`)});return c.attach(),new kn(r,c,l)}dispose(){this.bridge.dispose(),this.observer.disconnect(),this.iframe.remove()}},Rn="data-spline-html-content",Tn=`\n[${Rn}] { pointer-events: none; }\n[${Rn}] > * { pointer-events: auto; }\n[${Rn}] [data-spline-passthrough] { pointer-events: none; }\n`,Dn=class{constructor(e,t,n,i,s){this.container=e,this.host=t,this.observer=n,this.previousSplineGlobal=i,this.removeLateLifecycleShim=s}static mount(e,t,n,i){if(typeof document>"u")return null;let s=t.parentElement;if(!s)return null;"static"===getComputedStyle(s).position&&(s.style.position="relative");let r=document.createElement("div");r.setAttribute(Rn,"");let a=r.style;a.position="absolute",a.overflow="hidden";let o=()=>{a.left=`${t.offsetLeft}px`,a.top=`${t.offsetTop}px`,a.width=`${t.offsetWidth}px`,a.height=`${t.offsetHeight}px`};o();let l=new ResizeObserver(o);l.observe(t),l.observe(s);let c=document.createElement("style");c.textContent=Tn,r.appendChild(c);let h=(new DOMParser).parseFromString(n,"text/html"),d=Array.from(h.querySelectorAll("script"));for(let e of d)e.remove();for(let e of Array.from(h.head.children))("STYLE"===e.tagName||"LINK"===e.tagName&&"stylesheet"===e.rel)&&r.appendChild(e);for(;h.body.firstChild;)r.appendChild(h.body.firstChild);s.insertBefore(r,t.nextSibling);let u=new Map,p=new Wt(Sn(e,t,i),(e,t)=>{"warn"===e?console.warn(`[spline html] ${t}`):"error"===e&&console.error(`[spline html] ${t}`)},(e,t)=>{let n=u.get(e);if(n)for(let e of n)try{e(t)}catch(e){console.error(e)}}),m=(e,t)=>{try{return Promise.resolve(p.execute(e,t))}catch(e){return Promise.reject(e)}},f={ready:Promise.resolve(),setVariable:(e,t)=>m("setVariable",[e,t]),setVariables:e=>m("setVariables",[e]),getVariable:e=>m("getVariable",[e]),getVariables:()=>m("getVariables",[]),getAllObjects:()=>m("getAllObjects",[]),findObjectByName:e=>m("findObjectByName",[e]),findObjectById:e=>m("findObjectById",[e]),getGeometry:(e,t)=>m("getGeometry",[e,t??{}]),updateObject:(e,t)=>m("updateObject",[e,t]),createObject:(e,t)=>m("createObject",[e,t??{}]),createCustomMaterial:e=>m("createCustomMaterial",[e]),setMaterial:(e,t)=>m("setMaterial",[e,t]),cloneObject:(e,t)=>m("cloneObject",[e,t??{}]),removeObject:e=>m("removeObject",[e]),spawnObject:(e,t)=>m("spawnObject",[e,t??{}]),destroyObject:e=>m("destroyObject",[e]),setInstanceTransforms:(e,t)=>m("setInstanceTransforms",[e,t??null]),emitEvent:(e,t)=>m("emitEvent",[e,t]),emitEventReverse:(e,t)=>m("emitEventReverse",[e,t]),requestRender:()=>m("requestRender",[]),addEventListener:(e,t)=>{if("function"!=typeof t)return;let n=u.get(e);n||(n=new Set,u.set(e,n),m("listenEvent",[e])),n.add(t)},removeEventListener:(e,t)=>{let n=u.get(e);!n||(n.delete(t),0===n.size&&(u.delete(e),m("unlistenEvent",[e])))}},v=window.spline;window.spline=f;let y=function(){if(typeof document>"u"||"loading"===document.readyState)return()=>{};let e=[],t=(t,n)=>{let i=new Set,s=t.addEventListener.bind(t),r=t.removeEventListener.bind(t);Object.defineProperty(t,"addEventListener",{configurable:!0,writable:!0,value:(e,r,a)=>{if(s(e,r,a),!n.includes(e)||null==r)return;let o={type:e,listener:r};i.add(o),queueMicrotask(()=>{!i.delete(o)||((e,t,n)=>{let i=new Event(n);try{"function"==typeof t?t.call(e,i):t.handleEvent?.(i)}catch(e){console.error(e)}})(t,o.listener,o.type)})}}),Object.defineProperty(t,"removeEventListener",{configurable:!0,writable:!0,value:(e,t,n)=>{r(e,t,n);for(let n of i)n.type===e&&n.listener===t&&i.delete(n)}}),e.push(()=>{delete t.addEventListener,delete t.removeEventListener,i.clear()})};t(document,["DOMContentLoaded"]),t(window,["load"]);let n=Object.getOwnPropertyDescriptor(window,"onload");return Object.defineProperty(window,"onload",{configurable:!0,get:()=>null,set:e=>{"function"==typeof e&&queueMicrotask(()=>{try{e.call(window,new Event("load"))}catch(e){console.error(e)}})}}),e.push(()=>{n?Object.defineProperty(window,"onload",n):delete window.onload}),()=>{for(let t of e)t()}}();for(let e of d){let t=document.createElement("script");for(let n of Array.from(e.attributes))t.setAttribute(n.name,n.value);e.src?t.async=!1:t.textContent=e.textContent,r.appendChild(t)}return new Dn(r,p,l,v,y)}dispose(){this.removeLateLifecycleShim(),this.host.dispose(),this.observer.disconnect(),this.container.remove(),void 0!==window.spline&&(window.spline=this.previousSplineGlobal)}};function Vn(e){return"object"==typeof e&&null!==e&&!0===e.isMaterial}function Ln(e){if("function"==typeof e.material)throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation — this entry point does not support it.");if(!Vn(e.material))return{options:e};let t=e.material;if(!0===t.isNodeMaterial){let n=L()?.NodeMaterial;if(void 0!==n&&t instanceof n)return{options:{...e,material:void 0},material:t};throw new Error("createObject: this TSL NodeMaterial comes from your own three/webgpu module instance, which cannot compile in the runtime's bundled three. Build it with app.createCustomMaterial((three) => …) instead, or use a built-in material (MeshStandardMaterial, MeshBasicMaterial, …).")}if(!0===t.isShaderMaterial)throw new Error("createObject: a GLSL ShaderMaterial cannot compile on the WebGPU backend — port the shader to TSL with app.createCustomMaterial((three) => …), or use a built-in material (MeshStandardMaterial, …).");return{options:{...e,material:void 0},material:t}}var In=new Set(["name","parent","position","rotation","scale","visible","castShadow","receiveShadow","color","material"]),Gn="'Cube', 'Sphere', 'Plane', 'Rectangle', 'Ellipse', 'Triangle', 'Polygon', 'Star', 'Cone', 'Cylinder', 'Pyramid', 'Torus', 'TorusKnot', 'Dodecahedron', 'Icosahedron', 'Helix', 'Backdrop', 'Lathe', 'Text', 'CustomMesh', 'Group', 'PointLight', 'SpotLight', 'DirectionalLight'",Un={cube:"CubeGeometry",box:"CubeGeometry",sphere:"SphereGeometry",plane:"PlaneGeometry",rectangle:"RectangleGeometry",ellipse:"EllipseGeometry",circle:"EllipseGeometry",triangle:"TriangleGeometry",polygon:"PolygonGeometry",star:"StarGeometry",cone:"ConeGeometry",cylinder:"CylinderGeometry",pyramid:"PyramidGeometry",torus:"TorusGeometry",torusknot:"TorusKnotGeometry",dodecahedron:"DodecahedronGeometry",icosahedron:"IcosahedronGeometry",helix:"HelixGeometry",backdrop:"BackdropGeometry",lathe:"LatheGeometry",text:"TextGeometry",custommesh:"NonParametricGeometry",nonparametric:"NonParametricGeometry"},Bn={group:"Empty",empty:"Empty",pointlight:"PointLight",spotlight:"SpotLight",directionallight:"DirectionalLight"},Kn={shapeblend:"Shape Blends are built from member meshes in the editor and cannot be created empty.",path:"Path shapes need authored path data — clone an existing one with cloneObject() instead.",vector:"Vector shapes need authored shape data — clone an existing one with cloneObject() instead.",shape:"Vector shapes need authored shape data — clone an existing one with cloneObject() instead.",boolean:"Boolean operations are not creatable at runtime — clone an existing Boolean object with cloneObject() instead.",decal:"Decals need a surface to project onto — clone an existing Decal with cloneObject() instead.",ui:"UI objects need a 2D frame — clone an existing one with cloneObject() instead.",input:"Text inputs are not creatable at runtime — clone an existing one with cloneObject() instead.",particle:"Particle emitters are not creatable at runtime — clone an existing one with cloneObject() instead.",particlecollider:"Particle forces are not creatable at runtime — clone an existing one with cloneObject() instead.",hair:"Hair systems are not creatable at runtime — clone an existing one with cloneObject() instead.",camera:"Cameras are not creatable at runtime.",perspectivecamera:"Cameras are not creatable at runtime.",orthographiccamera:"Cameras are not creatable at runtime.",hemispherelight:"Hemisphere lights are not creatable at runtime.",splat:"Splats are not creatable at runtime.",page:"Pages are not creatable at runtime.",component:"Components are authored in the editor.",instance:"Instances are authored in the editor — clone an existing one with cloneObject() instead.",bone:"Bones are not creatable at runtime.",mesh:"pass the shape name directly, e.g. createObject('Cube')."},Nn={CubeGeometry:"Cube",SphereGeometry:"Sphere",PlaneGeometry:"Plane",RectangleGeometry:"Rectangle",EllipseGeometry:"Ellipse",TriangleGeometry:"Triangle",PolygonGeometry:"Pentagon",StarGeometry:"Star",ConeGeometry:"Cone",CylinderGeometry:"Cylinder",PyramidGeometry:"Pyramid",TorusGeometry:"Torus",TorusKnotGeometry:"Torus Knot",DodecahedronGeometry:"Dodecahedron",IcosahedronGeometry:"Icosahedron",HelixGeometry:"Helix",BackdropGeometry:"Backdrop",LatheGeometry:"Lathe",TextGeometry:"Text",NonParametricGeometry:"Custom Mesh"},Fn={Empty:"Group",PointLight:"Point Light",SpotLight:"Spot Light",DirectionalLight:"Directional Light"};function zn(e,t){return void 0===e?[t[0],t[1],t[2]]:Array.isArray(e)?[e[0]??t[0],e[1]??t[1],e[2]??t[2]]:[e.x??t[0],e.y??t[1],e.z??t[2]]}function Wn(e){return"number"==typeof e?[e,e,e]:zn(e,[1,1,1])}function Hn(e){let t=new N(0,0,0,1);return t.setStyle(e),{r:t.r,g:t.g,b:t.b}}function qn(e,t){let n=e.material??(void 0!==e.color?{color:e.color}:void 0);if(void 0===n)return Ae.defaultColorMaterial($n(Ie),"physical","layer1","layer2");if("string"==typeof n){for(let[e,i]of Object.entries(t.shared.materials))if(e===n||i.name===n)return e;if(function(e){let t=e.trim().toLowerCase();return/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)||/^(rgb|hsl)a?\(/.test(t)||void 0!==Qe.NAMES[t]}(n))return Ae.defaultColorMaterial(Hn(n),"physical","layer1","layer2");throw new Error(`createObject: material '${n}' matches no shared material in this document (available: ${function(e){let t=Object.entries(e.shared.materials).map(([,e])=>`'${e.name}'`).filter(e=>"'undefined'"!==e);return t.length?t.join(", "):"(none)"}(t)}) and is not a valid CSS color.`)}if("function"==typeof n)throw new Error("createObject: a (three) => material factory must be resolved to a material instance before object creation — this entry point does not support it.");if(Vn(n))throw new Error("createObject: a three.js material instance cannot be stored in the document — this entry point does not support it.");let i=void 0!==n.color?Hn(n.color):$n(Ie),s=Ae.defaultColorMaterial(i,"physical","layer1","layer2"),r=s.layers.find(e=>"light"===e.data.type);if(r){let e={};void 0!==n.roughness&&(e.roughness=n.roughness),void 0!==n.metalness&&(e.metalness=n.metalness),void 0!==n.reflectivity&&(e.reflectivity=n.reflectivity),Object.assign(r.data,e)}if(void 0!==n.alpha){let e=s.layers.find(e=>"color"===e.data.type);e&&Object.assign(e.data,{alpha:n.alpha})}return s}function $n(e){return{r:(e>>16&255)/255,g:(e>>8&255)/255,b:(255&e)/255}}function Yn(e){let t=De.defaultData("TextGeometry"),{text:n,...i}=e,s=i.fontSize;return void 0!==s&&void 0===i.width&&(i.width=350*s/16),void 0!==s&&void 0===i.height&&(i.height=50*s/16),Object.assign(t,i),void 0!==n&&Object.assign(t,{text:{textValue:String(n)}}),t}function Xn(e){return Array.isArray(e)?e:!ArrayBuffer.isView(e)||e instanceof DataView?null:Array.from(e)}function Zn(e,t){return Yt({userData:{type:e,...T[e].normalizeInputs({parameters:t})}})}function Jn(e,t,n){let{objectType:i,geometryType:s}=e,r=function(e){let t={};for(let[n,i]of Object.entries(e))!In.has(n)&&void 0!==i&&(t[n]=i);return t}(t),a={states:new xe,events:new xe,timelineAnimations:new Ce};if("Mesh"===i&&s){if("NonParametricGeometry"===s){let{geometry:e,doubleSide:i}=function(e){let t=Xn(e.vertices);if(!t||t.length<9||t.length%3!=0)throw new Error("createObject('CustomMesh'): `vertices` must be a flat number[] of x,y,z triples (length a multiple of 3, at least one triangle).");let n=t.length/3;if(n>6e4)throw new Error(`createObject('CustomMesh'): too many vertices (${n}); keep it under 60000.`);let i=Xn(e.indices);if(i&&i.length){let e=i.find(e=>!Number.isInteger(e)||e<0||e>=n);if(void 0!==e)throw new Error(`createObject('CustomMesh'): index ${e} is out of range (mesh has ${n} vertices).`)}else i=null;let s=new nt;s.setAttribute("position",new tt(t,3));let r=Xn(e.normals),a=null!==r&&r.length===t.length;a&&s.setAttribute("normal",new tt(r,3));let o=Xn(e.uvs);o&&o.length===2*n&&s.setAttribute("uv",new tt(o,2));let l=!1;if(!a){let e=i??Array.from({length:n},(e,t)=>t),{closed:s,inverted:r}=function(e,t){let n=e.length/3,i=new Map,s=new Array(n);for(let t=0;t<n;t++){let n=`${Math.round(1e4*e[3*t])},${Math.round(1e4*e[3*t+1])},${Math.round(1e4*e[3*t+2])}`,r=i.get(n);void 0===r?(i.set(n,t),s[t]=t):s[t]=r}let r=new Map;for(let e=0;e+2<t.length;e+=3){let n=s[t[e]],i=s[t[e+1]],a=s[t[e+2]];for(let[e,t]of[[n,i],[i,a],[a,n]]){if(e===t)continue;let n=e<t?e+"_"+t:t+"_"+e;r.set(n,(r.get(n)??0)+1)}}let a=r.size>0;for(let e of r.values())if(2!==e){a=!1;break}if(!a)return{closed:!1,inverted:!1};let o=0;for(let n=0;n+2<t.length;n+=3){let i=3*t[n],s=3*t[n+1],r=3*t[n+2],a=e[i],l=e[i+1],c=e[i+2],h=e[s],d=e[s+1],u=e[s+2],p=e[r],m=e[r+1],f=e[r+2];o+=a*(d*f-u*m)+l*(u*p-h*f)+c*(h*m-d*p)}return{closed:!0,inverted:o<0}}(t,e);if(s&&r){for(let t=0;t+2<e.length;t+=3){let n=e[t+1];e[t+1]=e[t+2],e[t+2]=n}i=e}else s||(l=!0)}return i&&s.setIndex(i),a||s.computeVertexNormals(),{geometry:Yt({userData:{type:"NonParametricGeometry",parameters:{subdivisions:0}},data:s.toJSON().data}),doubleSide:l}}(r);Object.assign(a,Be.defaultData,{geometry:e,materials:[qn(t,n)]}),i&&(a.side=2)}else Object.assign(a,Be.defaultData,{geometry:"TextGeometry"===s?Yn(r):Zn(s,r),material:qn(t,n)});void 0!==t.castShadow&&(a.castShadow=t.castShadow),void 0!==t.receiveShadow&&(a.receiveShadow=t.receiveShadow)}else"Empty"===i?Object.assign(a,Ge.defaultData):(Object.assign(a,he.defaultData(i),r),void 0!==t.color&&(a.color=Hn(t.color)));a.visible=t.visible??!0,a.position=zn(t.position,[0,0,0]),a.rotation=zn(t.rotation,[0,0,0]),a.scale=Wn(t.scale);let o=(s&&Nn[s])??Fn[i]??i;return a.name=t.name??Qn(o,n.scene.objects),a}function Qn(e,t){let n=new Set;if(t.traverse((e,t)=>{n.add(t.name??"")}),!n.has(e))return e;let i=2;for(;n.has(`${e} ${i}`);)i++;return`${e} ${i}`}function ei(e,t){let n=He.generateUUID();if("Component"===e.data.type)return{data:{...de.fromComponentData(e),name:e.data.name+" Instance"},id:n,fi:e.fi,children:[]};t[e.id]=n;let i=e.data;return"Empty"===i.type&&i.animations?.length&&(i={...i,animations:i.animations.map(([e,t,n])=>{let i=He.generateUUID(),s=n.indexOf(e);return[i,t,-1!==s?n.slice(0,s)+i+n.slice(s+e.length):n]})}),{...e,id:n,data:i,children:e.children.map(e=>ei(e,t))}}function ti(e){let t={},n=ei(e,t);return ke(n,t)}function ni(e){let t=Array.isArray(e)?e[0]:e,n=t.layers?.map(ii)??[],i=t.layers?.find(e=>"light"===e.type);return{layers:n,alpha:i?.node.alphaOverride?.value??1}}function ii(e){return"texture"===e.type||"video"===e.type||"matcap"===e.type?{...e.data,updateTexture:t=>e.color.texture.image.updateSrc(t)}:{...e.data}}var si=new N(0,0,0,1),ri={color:["color"],cavity:[],dust:["color"],fresnel:["color"],normal:[],gradient:["colors"],depth:["colors"],texture:[],video:[],noise:["colorA","colorB","colorC","colorD"],toon:["colors","shadowColor"],outline:["outlineColor","contourColor"],transmission:["attenuationColor"],reflection:[],matcap:[],pattern:["colorA","colorB"],vertexColor:[],light:[],displace:[],rainbow:[],particle:[]},ai=new qe;function oi(e){let t=new N(0,0,0,1);try{t.setStyle(e)}catch(e){console.error(e)}return t}var li=class{constructor(e,{renderOnDemand:t,renderMode:n="auto",wasmPath:i,renderer:s,htmlContentMode:r="sandbox"}={}){if(this._rendererBackend="webgl",this._rendererAuto=!1,this._rendererConfigured=!1,this._viewportMode=1,this._viewportWidth=window.innerWidth,this._viewportHeight=window.innerHeight,this._proxyObjectCache=new Map,this._htmlContentMode="sandbox",this._variablesCache=new Map,this._isPaused=!1,this._renderRequested=!1,this._skipRender=!1,this.time=performance.now(),this.dt=0,this.currentTAAFrame=0,this.disposed=!1,this._requestRenderAutoMode=()=>{this._skipRender=!1},this.requestRender=()=>{this._renderRequested=!0},this.render=e=>{if(this.time=e,this._lastTime&&(this.dt=this.time-this._lastTime),this._lastTime=this.time,this._perfs?.start(),this._renderer)if(this._isPaused||!("manual"===this.renderMode&&!this._renderRequested||"auto"===this.renderMode&&this._skipRender)){if(this._renderRequested=!1,this._skipRender=!0,this._controls&&(this._skipRender=this._controls.update(this.dt)??!1),this._eventManager&&(this._eventManager.handlers?.Start?.hasVideoAction||this._eventManager.handlers?.Basic?.hasVideoAction||this._eventManager.handlers?.Conditional?.hasVideoAction)&&(this._skipRender=!1),this._animationControls?.update(this.dt),this._skipRender?(this.currentTAAFrame++,this.currentTAAFrame<K?this._skipRender=!1:this.currentTAAFrame=0):this.currentTAAFrame=0,this._scene?.traverseVisibleEntity(e=>{"ParticleSystem"===e.type&&(e.update(this.dt),this._skipRender=!1),J(e)&&(!0!==this._renderer?.isWebGPUSplineRenderer&&e.warnClassicFallbackOnce(),e.isSimulating&&(e.update(this.dt),this._skipRender=!1))}),this._scene&&this._scene.activeCamera!==this._camera&&(this._camera=this._scene.activeCamera),this._eventManager?.isEnabled&&(this._eventManager.handlers?.Follow?.onAnimationFrameDamping(),this._eventManager.handlers?.LookAt?.onAnimationFrameDamping(),this._eventManager.handlers?.DragDrop?.onAnimationFrameDamping()),this._scene&&this._camera){if(this._scene.pathConstraints.applyConstraints(this._scene),this._renderer.sceneTransitionTimeRemaining>0){this._renderer.sceneTransitionTimeRemaining-=this.dt;let e=Math.min(1,1-this._renderer.sceneTransitionTimeRemaining/this._renderer.sceneTransitionDuration);this._renderer.pipeline.sceneTransitionPass.uniforms.mixRatio.value=e,this._skipRender=!1}else this._renderer.pipeline.sceneTransitionFromTexture=null;this._renderer.renderSplineScene(this._scene,this._camera),!0===this._renderer.lastFrameIncomplete&&(this._skipRender=!1),!0===this._renderer.skyAnimationActive&&(this._skipRender=!1)}this.canvas.dispatchEvent(this._renderedEvent),this._perfs?.end()}else this._perfs?.end();else this._perfs?.end()},this._resize=e=>{if(this._renderer){if(1===this._viewportMode&&this._frameView&&(this._frameView.frameSize=ai.set(this._viewportWidth,this._viewportHeight)),e){let e=this._viewportWidth,t=this._viewportHeight;this._renderer.setSize(e-1,t-1,!1),this._renderer.setSize(e,t,!1)}else this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1);if(this._camera=this._scene?.activeCamera,this._scene?.updateViewPlaneSize(this._frameView?.frameSize?.x??this._viewportWidth,this._frameView?.frameSize?.y??this._viewportHeight,this._frameView?.enableResponsive??!1),this._camera){let e=Object.values(this._data?.frames??{})[0].preset??"fullscreen";this._frameView?.setCamera(this._camera),this._frameView?.updateCamera("fullscreen"!==e),"PerspectiveCamera"===this._camera.cameraType&&(this._camera.aspect=this._viewportWidth/this._viewportHeight),this._camera.updateProjectionMatrix()}this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect()),this._requestRenderAutoMode()}},this._debouncedResize=ie(this._resize,10),this._onScroll=e=>{this.eventManager&&(this.eventManager.eventContext.domRect=this.canvas.getBoundingClientRect())},this.canvas=e,this._htmlContentMode=r,this.renderMode=t?"auto":n,void 0!==i&&(this._wasmPath=se(i,"/")),this._rendererBackend=s??"webgl",void 0===s){let e=null;try{e=new URLSearchParams(window.location.search).get("renderer")}catch{}"webgpu"===e||"webgl"===e||"webgl2"===e?this._rendererBackend="webgl2"===e?"webgl":e:(this._rendererAuto=!0,this._rendererBackend=typeof navigator<"u"&&"gpu"in navigator?"webgpu":"webgl")}this._renderedEvent=new CustomEvent("rendered",{bubbles:!0}),Object.defineProperty(this._renderedEvent,"target",{writable:!1,value:this}),window.location.search.includes("perfs")&&import("./runtime-Perfs-KMJFDYHU.js").then(({Perfs:e})=>{this._perfs=new e({x:10,y:10})}),x(e)}async _createRenderer(){if("webgpu"===this._rendererBackend&&this._rendererAuto)try{await(navigator.gpu?.requestAdapter())||(this._rendererBackend="webgl")}catch{this._rendererBackend="webgl"}if("webgpu"===this._rendererBackend)try{let{createWebGPUSplineRenderer:e,isWebGPUSupported:t}=await import("./runtime-webgpu-2J3TE4FB.js");t();let n=!0,i=!1,s=!1!==this._data?.scene.publish?.asyncShaderCompilation;try{let e=new URLSearchParams(window.location.search),t=e.get("bundles");"rerecord"===t?n="rerecord":("off"===t||"0"===t||"false"===t||"no"===t)&&(n=!1),i="1"===e.get("forcegl");let r=e.get("asynccomp");"off"===r||"0"===r||"false"===r||"no"===r?s=!1:("on"===r||"1"===r||"true"===r||"always"===r)&&(s=!0)}catch{}let r=await e({canvas:this.canvas,antialias:!1,alpha:!0,powerPreference:"high-performance",sceneBundles:!i&&n,forceWebGL:i,asyncCompilation:!i&&s});return r.onBackgroundWorkReady=()=>{this._skipRender=!1,this._renderRequested=!0},r.skyAnimationAllowed=!0,r}catch(e){console.error("[spline] Failed to initialize the WebGPU renderer, falling back to WebGL:",e),this._rendererBackend="webgl"}{let{SplineRenderer:e,rendererGlobals:t}=await import("./runtime-classicRuntime-XD52Z3ID.js");try{"off"===new URLSearchParams(window.location.search).get("taa")&&(t.taaEnabled.value=!1)}catch{}return new e({canvas:this.canvas,antialias:!1,alpha:!0,stencil:!1,depth:!1,powerPreference:"high-performance"})}}_failWebGPURequired(){console.error('[spline] This scene was exported for WebGPU only and this browser does not provide a WebGPU adapter. Re-export with renderer "Both" or "WebGL 2" to support this browser.');try{let e=window.devicePixelRatio||1,t=this.canvas.clientWidth||300,n=this.canvas.clientHeight||150;this.canvas.width=t*e,this.canvas.height=n*e;let i=this.canvas.getContext("2d");i&&(i.scale(e,e),i.fillStyle="rgba(127, 127, 127, 0.85)",i.font="13px system-ui, -apple-system, Segoe UI, Roboto, sans-serif",i.textAlign="center",i.textBaseline="middle",i.fillText("This scene requires a WebGPU-capable browser.",t/2,n/2))}catch{}this.canvas.dispatchEvent(new CustomEvent("splineerror",{bubbles:!0,detail:{reason:"webgpu-required"}}))}async load(e,t,n){(function(e){let t="The Spline Runtime only accepts .splinecode files that are generated from Spline export panel.";e.endsWith(".spline")?console.warn(t+" The .spline files are only meant to be used by the Editor."):e.endsWith(".splinecode")||console.warn(t)})(e),this.disposed=!1;let i=await(await fetch(e,n)).arrayBuffer();await this.start(i,{variables:t})}async start(e,{interactive:t=!0,variables:s}={}){if(this.disposed)return;a.init();let o=await async function(e){let[t,n]=Te(Ve.deserialize(new Uint8Array(e)));if(130!==(t.schema??0)){let{updateDocumentSchema:e}=await import("./runtime-updater-A22NUPB5.js");e(t)}return n.result().data}(e);this._data=o;let l=function(e){let t=[];return e.scene.objects.traverse((e,n)=>{"Mesh"===n.type&&"NonParametricGeometry"===n.geometry.type&&void 0!==n.geometry.data.draco&&t.push(n)}),t}(o);o.version&&(0,Cn.default)(o.version,"2.0.12")>0&&console.warn("Your .splinecode file is more recent than the library. Please upgrade @splinetool/runtime to the latest version."),void 0!==this._wasmPath&&(this.setUIWasmUrl(`${this._wasmPath}/hana-ui.wasm`),Ke(this._wasmPath));let c=async function(e){{let t={particles:()=>import("./runtime-particles-E7XPFZHE.js"),hair:()=>import("./runtime-hair-RGFARTLM.js"),"shape-blends":()=>import("./runtime-shapeBlends-KRYJJPAK.js"),"vector-shapes":()=>import("./runtime-vectorShapes-5G7BQGJ6.js"),"3d-paths":()=>import("./runtime-paths-EZZ2EKYD.js"),cloners:()=>import("./runtime-cloners-7P25TLWX.js"),components:()=>import("./runtime-components-KE6NSJIH.js"),text:()=>import("./runtime-text-FMV3CA36.js"),"ui-2d":()=>import("./runtime-ui2d-KV2KXS4A.js"),"game-controls":()=>import("./runtime-gameControls-KXHLXQUL.js"),"collision-bvh":()=>import("./runtime-collisionBVH-CQUE6RZV.js"),mousehover:()=>import("./runtime-mouseHover-ATG5LR7E.js"),scroll:()=>import("./runtime-scroll-2YNJT2VF.js"),dragdrop:()=>import("./runtime-dragDrop-FB4BVR5B.js"),tracking:()=>import("./runtime-tracking-EMTZIN3W.js"),resize:()=>import("./runtime-resize-MUZH7MEA.js"),conditional:()=>import("./runtime-conditional-66QFNGF3.js"),variables:()=>import("./runtime-variables-MHCE3K3T.js"),"api-services":()=>import("./runtime-apiServices-KSRZJMJI.js"),"ai-assistant":()=>import("./runtime-aiAssistant-L3HFJZ2G.js"),textinputs:()=>import("./runtime-textInputs-CYBDVKZW.js"),audio:()=>import("./runtime-audio-CNGZPKC5.js"),video:()=>import("./runtime-video-YA2L3X6S.js"),"create-destroy":()=>import("./runtime-createDestroy-HT4FKH5P.js"),"scene-transition":()=>import("./runtime-sceneTransition-RUIJWZQL.js"),timeline:()=>import("./runtime-timeline-3FHFLHWF.js"),transitions:()=>import("./runtime-transitions-VL46OOZE.js"),"misc-actions":()=>import("./runtime-miscActions-QTP3QTK2.js")},n=function(e){let t=new Set,n=!1,i=!1;for(let s of $(e,e=>{"GameControl"===e&&(n=!0),"Trigger"===e&&(i=!0)}))t.add(s);try{e.scene.objects.traverse((e,n)=>{dn(n,t)});let n=e.shared.lib?.components;if(n){let e=Object.keys(n);e.length>0&&t.add("components");for(let i of e)un(n[i]?.asset,t)}}catch{for(let e of hn)t.add(e)}return n&&t.add("game-controls"),(i||t.has("game-controls"))&&t.add("collision-bvh"),t}(e);await Promise.all([...n].map(e=>t[e]()))}}(o);await Promise.all([c,l.length&&vn(this._wasmPath),f(o)&&Z(this._wasmPath),k(o)&&R(this._wasmPath),me.physicsEnabled(o.scene.objects)&&j(this._wasmPath),z(o)&&w(),n(o)&&i(),H(o)&&W(),E(o)&&c.then(()=>le()?.loadHanaUIRUNTIME()),P(o)&&O(this._wasmPath)].filter(Boolean)),l.length&&await bn(l),this._eventManager?.deactivate(),this._controls?.deactivate(),this._scene?.dispose();let h=o.scene.publish.renderer;if(this._rendererAuto&&"webgl"===h)this._rendererBackend="webgl";else if(this._rendererAuto&&"webgpu"===h){if("webgpu"!==this._rendererBackend||!await(navigator.gpu?.requestAdapter().catch(()=>null)))return void this._failWebGPURequired();this._rendererAuto=!1}let u=function(e){let t=new Set;return e.scene.objects.traverse((e,n)=>{if("Page"!==n.type)return;let i=n.postprocessing;if(i&&"object"==typeof i&&!0===i.enabled)for(let[e,n]of Object.entries(i))"enabled"!==e&&n&&"object"==typeof n&&!0===n.enabled&&t.add(e)}),[...t]}(o);if("webgpu"===this._rendererBackend)try{await Promise.all([import("./runtime-webgpu-2J3TE4FB.js"),(p=u,Pn(p,jn,"webgpu"))]),this._renderer||(this._renderer=await this._createRenderer())}catch(e){console.error("[spline] Failed to load the WebGPU material backend, using WebGL:",e),this._rendererBackend="webgl"}var p;"webgpu"!==this._rendererBackend&&await Promise.all([import("./runtime-classicRuntime-XD52Z3ID.js"),Mn(u)]),D("webgpu"===this._rendererBackend?"webgpu":"webgl");let v=new fn(o);if(v.resetPersonalCameraFromDocumentData(),this._scene=v.scene,this._sharedAssetsManager=v.sharedAssets,this._camera=this._scene.activeCamera,window.location.search.includes("merge-geometries")){let{mergeStaticGeometries:e}=await import("./runtime-mergeStaticGeometries-GWJX3PTU.js"),t=performance.now();e(o,v.scene);let n=performance.now();console.log("Merged geometries in ",n-t," ms")}f(o)&&this._scene.traverse(e=>{y(e)&&e.recomputeBoolean()}),this._sharedAssetsManager.setRequestRender(()=>{this._requestRenderAutoMode(),this._scene?.traverse(e=>{ne(e)&&e.pendingMediaLoad&&e.update({scene:this._scene,shared:this._sharedAssetsManager})})}),this._scene?.traverse(e=>{"ParticleSystem"===e.type&&(e.wakeUp(),e.data.autoPlay?e.start():e.stop()),J(e)&&e.setPlayMode(!0)});let b=Object.keys(o.shared.fonts).map(e=>this._sharedAssetsManager.getFont(e).loadingPromise);if(Promise.all(b).then(()=>{this.disposed||(v.scene.markNeedsUpdateRendererDirty(),this._requestRenderAutoMode())}),z(o)&&M(o)&&await Promise.all(b),E(o)){let e=[];this._scene.traverseEntity(t=>{(te(t)||t instanceof m)&&t.uiCanvas&&e.push(t.uiCanvas)}),await Promise.all(e.map(e=>e.promise))}if(this._scene.rewriteEventsBeforeGoToPlayMode(),r(this._scene.activePage,this._sharedAssetsManager),this._renderer||(this._renderer=await this._createRenderer()),!this._rendererConfigured){this._rendererConfigured=!0,this._renderer.hdTransmission=!0===o.scene.publish.hdTransmission;let e=()=>/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),t=this._getPixelRatio(e()?o.scene.publish.settings.web.pixelRatioMobile:o.scene.publish.settings.web.pixelRatioDesktop);if(this._renderer.setPixelRatio(t),this._renderer.pipeline.enableUIOverlay(),this._renderer.pipeline.addEventListener("smaaloaded",this._requestRenderAutoMode),o.shared.images.SplineWatermark){let e=this._sharedAssetsManager.getImage("SplineWatermark");await e.loadPromise;let t=e.getTexture(1001);this._renderer.pipeline.setWatermark(t)}}n(o)&&this._scene.initializeSplatViewer(),void 0!==o.scene.blueNoiseTextureData&&this._renderer.pipeline.updateBlueNoiseTexture(o.scene.blueNoiseTextureData);let g=Object.values(o.frames)[0];if(this._frameView?this._frameView.setCamera(this._camera):("fullscreen"===g.preset?(this._viewportMode=1,this.canvas.style.display="block",this.canvas.parentElement&&(this._viewportWidth=this.canvas.parentElement.clientWidth||300,this.canvas.style.width="100%"),this.canvas.parentElement&&(this._viewportHeight=this.canvas.parentElement.clientHeight||150,this.canvas.style.height="100%")):(this._viewportMode=2,this._viewportWidth=g.size[0],this._viewportHeight=g.size[1],this.canvas.style.width=`${this._viewportWidth}px`,this.canvas.style.height=`${this._viewportHeight}px`),this._renderer.setSize(this._viewportWidth,this._viewportHeight,!1),this._frameView=new cn(this._renderer,this._camera,new qe(this._viewportWidth,this._viewportHeight),new qe(window.innerWidth,window.innerHeight)),this._frameView.enableResponsive=(g.allowResponsive??!1)&&"fullscreen"===g.preset),t){let e=new d(this._renderer,this.data.scene.publish,this._scene,()=>this._scene.activeCamera,this._sharedAssetsManager,this._requestRenderAutoMode,!0,g);this._scene.updateMatrixWorld(!0),this._controls=new C(e),this._animationControls=new En(this._scene,this._requestRenderAutoMode),this._eventManager=new ln(o.scene.publish,this._controls,this._animationControls,e,o.shared.variables),this._eventManager.activate(),this._controls.activate(this._eventManager)}this._resize(),this._scene.activePage.data.postprocessing.depthOfField.enabled&&Promise.all(this._sharedAssetsManager.getImageLoadPromises()).then(()=>{this.disposed||this._resize(!0)}),void 0!==s&&this.setVariables(s),0===this.dt&&(this.render(performance.now()),setTimeout(()=>{this._renderer?.setAnimationLoop(this.render)},0)),this._resizeObserverTimeout=setTimeout(()=>{!this._resizeObserver&&this.canvas.parentElement&&(this._resizeObserver=new ResizeObserver(()=>{this._viewportWidth=this.canvas.clientWidth,this._viewportHeight=this.canvas.clientHeight,this._debouncedResize()}),this._resizeObserver.observe(this.canvas.parentElement))},300),document.addEventListener("scroll",this._onScroll),this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0;let _=o.scene.publish.htmlContent?.html;if(t&&_&&"none"!==this._htmlContentMode){let e={shared:this._sharedAssetsManager,findEntity:e=>this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)};this._htmlContentOverlay=("inline"===this._htmlContentMode?Dn.mount(this,this.canvas,_,e):kn.mount(this,this.canvas,_,e))??void 0}}setVariables(e){if(void 0!==this._data){let t=Object.entries(e);for(let[e,n]of t)this.setVariable(e,n)}}setVariable(e,t){let n=this._getVariableByName(e);if(n&&!("dynamicVariableType"in n.data)){let e=t;"number"==typeof n.data.value?e="number"==typeof t?t:"boolean"==typeof t?!0===t?1:0:parseFloat(t):"boolean"==typeof n.data.value?e="number"==typeof t?!!t:"boolean"==typeof t?t:"false"!==t.toLocaleLowerCase()&&!!t:"string"!=typeof n.data.value&&void 0!==n.data.value.textValue&&(e=t.toString());let i="string"==typeof e?{textValue:e}:e;this._sharedAssetsManager?.updateVariable(n.id,i),this.requestRender(),this._requestRenderAutoMode()}else void 0===n?console.warn(`No variable named ${e} was found in your Spline file. Make sure to create it from Spline editor.`):"dynamicVariableType"in n.data&&console.warn(`Dynamic variables like ${e} cannot be updated from code.`)}getVariables(){let e={};return this._data&&this._data.shared.variables.forEach(t=>{void 0===e[t.data.name]&&(e[t.data.name]=this._getVariableValue(this._sharedAssetsManager.getVariable(t.id)))}),e}getVariable(e){let t=this._getVariableByName(e);if(t){let e=this._sharedAssetsManager.getVariable(t.id);return this._getVariableValue(e)}}_getVariableValue(e){return"string"!=typeof e&&ye.isTextValue(e)?ye.getDisplayedValue(e):e}_getVariableByName(e){if(this._data){if(this._variablesCache.has(e))return this._variablesCache.get(e);let t=this._data.shared.variables.find(t=>t.data.name===e);return t&&this._variablesCache.set(e,t),t}}_getPixelRatio(e){switch(e){case 0:return window.devicePixelRatio;case 1:return 1;case 2:return 2}}findObjectById(e){let t=this._scene?.getObjectByProperty("uuid",e);return this._createProxyObject(t)}findObjectByName(e){let t=this._scene?.getObjectByName(e);return this._createProxyObject(t)}getAllObjects(){let e=[];return this._scene?.traverseEntity(t=>{if(!(t.uuid===Le||this._scene.isInvisibleObjects(t)||t instanceof m)){let n=this._createProxyObject(t);n&&e.push(n)}}),e}getSplineEvents(){return(this._eventManager?.handlers?.Spline).splineEvents}emitEvent(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEvent(e)}emitEventReverse(e,t){(this.findObjectById(t)||this.findObjectByName(t))?.emitEventReverse(e)}addEventListener(e,t){this.canvas.addEventListener(e,t)}removeEventListener(e,t){this.canvas.removeEventListener(e,t)}setZoom(e){this._controls?.orbitControls instanceof _&&this._controls?.orbitControls.setZoom(e)}get eventManager(){return this._eventManager}get controls(){return this._controls}setSize(e,t){this._viewportWidth=e,this._viewportHeight=t,this._viewportMode=2,this._resize()}setBackgroundColor(e){let t=oi(e);this._scene?.activePage.setBackgroundColor(t),this._requestRenderAutoMode()}dispose(){this.disposed=!0,this._htmlContentOverlay?.dispose(),this._htmlContentOverlay=void 0,this._eventManager?.dispose(),this._scene?.dispose(),this._scene=void 0,this._camera=void 0,F(),this._sharedAssetsManager?.setRequestRender(()=>{}),this._sharedAssetsManager?.dispose(),this._sharedAssetsManager=void 0,this._proxyObjectCache.forEach(e=>{Nt.unsubscribe(e)}),this._proxyObjectCache.clear(),this._variablesCache.clear(),this._renderer?.pipeline.removeEventListener("smaaloaded",this._requestRenderAutoMode),this._renderer?.setAnimationLoop(null),this._renderer?.dispose(),this._renderer=void 0,this._debouncedResize.cancel(),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),void 0!==this._resizeObserverTimeout&&(clearTimeout(this._resizeObserverTimeout),this._resizeObserverTimeout=void 0),this.canvas.style.width="",this.canvas.style.height="",this.canvas.removeAttribute("width"),this.canvas.removeAttribute("height"),this._frameView=void 0,this._controls?.deactivate(),this._controls=void 0,this._animationControls=void 0,this._eventManager?.eventContext.dispose(),this._eventManager=void 0,this._splatViewer=void 0,this._data=void 0,this._perfs=void 0,this.dt=0,this._lastTime=void 0,S(this.canvas),document.removeEventListener("scroll",this._onScroll),a.dispose()}get isStopped(){return this._isPaused}stop(){this._isPaused||(this._renderer?.setAnimationLoop(null),this._isPaused=!0,this._eventManager?.pause(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!1))}play(){!this._isPaused||(this._isPaused=!1,this._eventManager?.resume(),this._controls?.orbitControls&&(this._controls.orbitControls.enabled=!0),this._renderer?.setAnimationLoop(this.render))}setGlobalEvents(e){this._eventManager?.updateUseWindowEvents(e)}get data(){return this._data}_createProxyObject(e){if(!this._scene)return;let n,i=this._scene;if(null==e)return;if(this._proxyObjectCache.has(e.uuid))return this._proxyObjectCache.get(e.uuid);e.traverseAncestors(e=>{e instanceof m&&(n=e.name)});let r=this._sharedAssetsManager,o={shared:r,scene:this._scene},l=t=>{if(null===t||"Base State"===t)return null;if(t&&e.data.states){let n=e.data.states.find(e=>e.data.name===t);return n?n.id:void 0}},c="material"in e?e.material:void 0,h=e.materialOverride,d={name:e.name,uuid:e.uuid,visible:e.visible,intensity:e.intensity,position:e.position,rotation:e.rotation,scale:e.scale,type:e.data.type,page:n,material:h??(c?ni(c):void 0),parentUuid:e.parent instanceof m||e instanceof s?void 0:e.parent?.uuid,emitEvent(t){e.dispatchEvent({type:"userEvent",eventName:t})},emitEventReverse(t){e.dispatchEvent({type:"userEvent",eventName:t,reverse:!0})},hide(){e.visible&&(e.visible=!1,o.shared.requestRender())},show(){e.visible||(e.visible=!0,o.shared.requestRender())},get state(){let t=e.stateSelection;if(null!==t)return e.data.states.find(({id:e})=>e===t)?.data.name},set state(t){let n;if(void 0!==t){let i="string"==typeof t?e.data.states.find(({id:e})=>e===t):e.data.states[t];if(i)n=i.id;else{let e="string"==typeof t?l(t):void 0;e&&(n=e)}}e.changeSelectedState(n??null,o),e.currentState=n??null,e.dispatchEvent({type:"completeState",state:n??null}),o.shared.requestRender()},transition(n){let s=t();if(null===s)return ae("transitions","obj.transition()"),{transition(e){return this},play(){return this},pause(){return this},reset(){return this},seek(e){return this}};let o,c=this,h=a.timeline({autoplay:n.autoPlay??!0}),d={transition({from:t,to:n,duration:a,delay:d,...u}){let p=l(t);void 0===p&&(p=o);let m=l(n);o=m;let f=new s(e,p,m,{state:m,repeat:0,delay:d??0,delayDirection:"start-once",direction:"normal",duration:a??1e3,...u,...6===u.easing?fe.defaultData:5===u.easing?ve.defaultData:{}},r,!1,i.activePage);return h.add({...f.params,begin:()=>{(t&&p||"Base State"===t&&!p)&&(c.state=p??void 0)},complete:()=>{c.state=m??void 0}},h.duration),this},play(){return h.play(),this},pause(){return h.pause(),this},reset(){return h.reset(),this},seek(e){return h.seek(e),this}};return d.transition(n),d},set color(t){let n=oi(t);if(v.is(e))return void(e.color=n);if(!("Mesh"===e.type&&"material"in e&&e instanceof U))return;let i={r:n.r,g:n.g,b:n.b,a:n.a},s=e.materialOverride;if(void 0!==s){let e=s.color;return void(!0===e?.isColor&&"function"==typeof e.setStyle&&(e.setStyle(t),o.shared.requestRender()))}let r=Array.isArray(e.material)?e.material[0]:e.material,a=r.data.layers.find(e=>"color"===e.data.type)?.id;if(a)r.updateByOp({type:0,path:["layers",a],props:{color:{...i}}},r.data,o);else{let e=r.data,t=e.layers.find(e=>"light"===e.data.type);if(!t)return;let n=0===e.layers.indexOf(t)?t:null,s=e.layers.at(n?e.layers.indexOf(n)+1:0),a={type:4,fi:n?n.fi+(s?(s.fi-n.fi)/2:1):s?s.fi/2:1,id:He.generateUUID(),data:{...Oe.defaultData("color"),color:i},localIndex:0},l=e.layers.insertAfterHelper(n?.id??null,1),c=e.layers.runOp({...a,fi:l[0]}).data;Object.assign(r.data,{layers:c}),r.updateByOp({...a,path:["layers"]},r.data,o)}}},u=Nt(d,(t,n)=>{let i=e[t],s=t.split(".");"material"===s[0]&&c&&void 0===h&&function(e,t,n){let i=Array.isArray(n)?n[0]:n;if("layers"===e[0]){let n=parseInt(e[1]),s=i.layers[n],r=e[2];s&&r&&function(e,t,n){let i=e[0];try{if(function(e,t){return!!ri[t]?.includes(e)}(i,n.type,e.slice(1)))if("colors"===i){if(e.length<2)throw new Error("You cannot mutate the colors array, only its items");let s=parseInt(e[1]),r=n.getValue(i)?.[s];if(!r)throw new Error("Color index out of range");si.setStyle(t),r.set(si.r,si.g,si.b,si.a)}else n.getValue(i)?.setStyle(t);else if("texture"===i||"video"===i){let i=n.color;!function(e,t,n,i){let s=e[0];if("repeat"===s||"offset"===s||"rotation"===s){let n=i.getNode("mat"),r=n&&"function"==typeof n.updateMatrix?n:i.getValue("mat");if(!r)return;if("rotation"===s)r.rotation=parseFloat(t);else{let n=e[1];if(void 0===n)t instanceof Array&&2===t.length&&Object.assign(r,{[s]:t});else{let e=r[s],i=0===parseInt(n)?[parseFloat(t),e[1]]:[e[0],parseFloat(t)];Object.assign(r,{[s]:i})}}r.updateMatrix()}else"wrapping"===s||"minFilter"===s||"magFilter"===s?"wrapping"===s?n.texture.wrap=t:n.texture[s]=t:"image"===s&&"data"===e[1]&&n.texture.image.updateSrc(t)}(e.slice(1),t,i,n)}else{let s=e[1],r=n.getValue(i);r?.isVector3&&void 0!==s||r?.isVector2&&void 0!==s?r.setComponent(parseInt(s),t):n.setValue(i,t)}}catch(e){console.error("Error setting material value",e)}}(e.slice(2),t,s)}else"alpha"===e[0]&&i.layers.forEach(e=>{"light"===e.type&&void 0!==e.node.alphaOverride&&(e.node.alphaOverride.value=t,t<1&&(i.transparent=!0))})}(s.slice(1),n,c),"object"!=typeof i&&Object.getOwnPropertyDescriptor(e,t)?.writable&&(e[t]=n),this._requestRenderAutoMode(),e.updateMatrix()});return this._proxyObjectCache.set(e.uuid,u),u}setUIWasmUrl(e){oe(e)}pauseGameControls(){this._eventManager?.controlsManager.gameControl?.pause()}resumeGameControls(){this._eventManager?.controlsManager.gameControl?.resume()}async swapGeometry(e,t){let n;if("string"==typeof t){if(!t.endsWith(".splinegeometry"))throw new Error("Only .splinegeometry format is supported");{let e=await(await fetch(t)).arrayBuffer();n=new Uint8Array(e)}}else n=t;let i=Ve.deserialize(n),s="data"in i&&void 0!==i.data.draco;s&&await vn(this._wasmPath);let r=this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e);if(!r)return void console.warn(`Object ${e} not found`);if("Mesh"!==r.data.type||!(r instanceof U))return void console.warn(`Object ${e} is not a mesh`);let a=r,o={...a.data,geometry:i};s&&await bn([o]),a.updateByOp({type:0,path:[],props:{geometry:o.geometry}},o,{shared:this._sharedAssetsManager,scene:this._scene},!1);for(let e of a.data.states){let t={...e.data};a.states||(a.states={}),a.states[e.id]=ue.patch(o,t)}return n}_applyDocumentTransaction(e){this._data=e.data,this._scene&&(this._scene.data=this._data.scene),this._sharedAssetsManager&&(this._sharedAssetsManager.data=this._data.shared);for(let t of e.actual){let e=t.path;Array.isArray(e)&&2===e.length&&"scene"===e[0]&&"objects"===e[1]&&this._scene?.updateTreeByOp({...t,path:[]},this._sharedAssetsManager)}}_findEntity(e){return this._scene?.getObjectByProperty("uuid",e)??this._scene?.getObjectByName(e)}_resolveParentId(e){if(void 0===e)return this._scene.activePage.uuid;let t="string"==typeof e?e:e.uuid,n=this._findEntity(t);if(!n)throw new Error(`parent '${t}' — no object with that name or uuid in the scene.`);return n.uuid}async createCustomMaterial(e){if(this.disposed)throw new Error("createCustomMaterial: this Application was disposed.");if("function"!=typeof e)throw new Error("createCustomMaterial: expected a factory function — createCustomMaterial((three) => new three.MeshStandardNodeMaterial()).");let t=L();if(void 0===t&&("webgpu"===this._rendererBackend&&(await import("./runtime-webgpu-2J3TE4FB.js"),t=L()),void 0===t))throw new Error("createCustomMaterial: requires the webgpu backend (the runtime default where WebGPU is available). This Application is on the classic WebGL pipeline — pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let n=e(t);if("object"!=typeof n||null===n||!0!==n.isMaterial)throw new Error("createCustomMaterial: the factory must return a three.js material built from the namespace it receives — e.g. (three) => new three.MeshStandardNodeMaterial().");return n}async setMaterial(e,t){if(this.disposed)throw new Error("setMaterial: this Application was disposed.");let n=this._scene;if(!n)throw new Error("setMaterial: no scene loaded — call load() or start() first.");let i="string"==typeof e?e:e.uuid,s=this._findEntity(i);if(!s)throw new Error(`setMaterial: '${i}' — no object with that name or uuid in the scene.`);if(!(s instanceof U))throw new Error(`setMaterial: '${i}' is not a mesh — lights, groups, and cameras have no material.`);let r="function"==typeof t?await this.createCustomMaterial(t):t;if("webgpu"!==V())throw new Error("setMaterial: custom three.js materials require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline — pass { renderer: 'webgpu' } or drop any ?renderer=webgl2 override.");let a=Ln({material:r});if(void 0===a.material)throw new Error("setMaterial: expected a three.js material instance or a (three) => material factory.");return s.setMaterialOverride(a.material,{scene:n,shared:this._sharedAssetsManager}),this._proxyObjectCache.delete(s.uuid),this._requestRenderAutoMode(),a.material}async createObject(e,t={}){if(this.disposed)throw new Error("createObject: this Application was disposed.");let n=this._scene,i=this._data;if(!n||!i)throw new Error("createObject: no scene loaded — call load() or start() first.");let s=function(e){if("string"!=typeof e||0===e.length)throw new Error(`createObject: expected a type name string — one of ${Gn}.`);let t=e.replace(/Geometry$/i,"").replace(/[\s_-]/g,"").toLowerCase(),n=Bn[t];if(n)return{objectType:n};let i=Un[t];if(i)return{objectType:"Mesh",geometryType:i};let s=Kn[t];throw s?new Error(`createObject: '${e}' is not supported — ${s}`):new Error(`createObject: '${e}' is not a creatable Spline type — use one of ${Gn}, e.g. createObject('Cube', { width: 200 }).`)}(e);"function"==typeof t.material&&(t={...t,material:await this.createCustomMaterial(t.material)});let r,a,{options:o,material:l}=Ln(t);if(void 0!==l){if("Mesh"!==s.objectType)throw new Error("createObject: a three.js material instance only applies to mesh types — lights and groups have no material.");if("webgpu"!==V())throw new Error("createObject: three.js material instances require the webgpu backend (the runtime default where WebGPU is available). This scene is running the classic WebGL pipeline — pass { renderer: 'webgpu' } to the Application, or drop any ?renderer=webgl2 override.")}if("TextGeometry"===s.geometryType){if(await import("./runtime-text-FMV3CA36.js"),!re("text"))throw new Error("createObject: this runtime build was compiled without the 'text' feature — re-export the scene with a Text object present, or load the full runtime build.");if(await w(),a=t.font??Se,void 0===i.shared.fonts[a]){if(a!==Se){let e=Object.keys(i.shared.fonts).join(", ");throw new Error(`createObject: font '${a}' is not in this document — available fonts: ${e||"(none)"}.`)}r={name:Se,url:Re}}}let c=this._resolveParentId(t.parent),h=Jn(s,o,i),d=He.generateUUID(),[u,p]=Te(i);r&&(u.shared.fonts[Se]=r),u.scene.objects.insertAfter(c,null,[{id:d,data:h,children:[]}]);let m=p.result();if(r&&this._sharedAssetsManager.addFont(Se,r),void 0!==a){let e=this._sharedAssetsManager.getFont(a);e&&await e.loadingPromise}this._applyDocumentTransaction(m);let f=n.find(d);return void 0!==l&&f.setMaterialOverride(l,{scene:n,shared:this._sharedAssetsManager}),this._requestRenderAutoMode(),this._createProxyObject(f)}cloneObject(e,t={}){if(this.disposed)throw new Error("cloneObject: this Application was disposed.");let n=this._scene,i=this._data;if(!n||!i)throw new Error("cloneObject: no scene loaded — call load() or start() first.");let s="string"==typeof e?e:e?.uuid,r=s?this._findEntity(s):void 0;if(!r)throw new Error(`cloneObject: '${s}' — no object with that name or uuid in the scene.`);if(r instanceof m)throw new Error("cloneObject: pages cannot be cloned.");let a=i.scene.objects.get(r.uuid);if(!a)throw new Error(`cloneObject: '${s}' is not part of the document tree (expanded clones and instanced children cannot be cloned — clone their source object instead).`);let o=function(e,t,n){let i={...e.data};return void 0!==t.position&&(i.position=zn(t.position,[0,0,0])),void 0!==t.rotation&&(i.rotation=zn(t.rotation,[0,0,0])),void 0!==t.scale&&(i.scale=Wn(t.scale)),void 0!==t.visible&&(i.visible=t.visible),i.name=t.name??Qn(`${e.data.name??"Object"} Copy`,n),{...e,data:i}}(ti(a),t,i.scene.objects),l=void 0!==t.parent?this._resolveParentId(t.parent):i.scene.objects.parent(r.uuid)??null,c=void 0!==t.parent?null:r.uuid,[h,d]=Te(i);h.scene.objects.insertAfter(l,c,[o]),this._applyDocumentTransaction(d.result());let u=n.find(o.id);return this._requestRenderAutoMode(),this._createProxyObject(u)}removeObject(e){let t=this._scene,n=this._data;if(this.disposed||!t||!n)return!1;let i="string"==typeof e?e:e?.uuid,s=i?this._findEntity(i):void 0;if(!s)return!1;if(s instanceof m)throw new Error("removeObject: pages cannot be removed.");if("PerspectiveCamera"===s.data.type||"OrthographicCamera"===s.data.type)throw new Error("removeObject: cameras cannot be removed.");if(void 0===n.scene.objects.get(s.uuid))throw new Error(`removeObject: '${i}' is not part of the document tree (expanded clones and instanced children cannot be removed individually).`);let r=[];s.traverseEntity(e=>{r.push(e.uuid)});let[a,o]=Te(n);a.scene.objects.delete(s.uuid),this._applyDocumentTransaction(o.result());for(let e of r){let t=this._proxyObjectCache.get(e);t&&(Nt.unsubscribe(t),this._proxyObjectCache.delete(e))}return this._requestRenderAutoMode(),!0}};export{li as Application,Ue as Axis,pe as Easing,ge as GradientType,ce as NoiseType,Me as PatternStyle,_e as ProjectionType,be as Side,Ee as TextureFilter,Pe as ToonType,je as VoronoiStyle,we as Wrapping};