@splinetool/runtime 2.0.3 → 2.0.5

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 (334) hide show
  1. package/build/hana-ui.js +46 -31
  2. package/build/hana-ui.js.br +0 -0
  3. package/build/hana-ui.js.gz +0 -0
  4. package/build/hana-ui.wasm +0 -0
  5. package/build/hana-ui.wasm.br +0 -0
  6. package/build/hana-ui.wasm.gz +0 -0
  7. package/build/runtime-aiAssistant-RMA2DMFU.js +1 -0
  8. package/build/runtime-aiAssistant-RMA2DMFU.js.br +0 -0
  9. package/build/runtime-aiAssistant-RMA2DMFU.js.gz +0 -0
  10. package/build/runtime-apiServices-KA4FEP5Y.js +1 -0
  11. package/build/runtime-apiServices-KA4FEP5Y.js.br +0 -0
  12. package/build/runtime-apiServices-KA4FEP5Y.js.gz +0 -0
  13. package/build/{runtime-audio-Y3GYW4YQ.js → runtime-audio-BQSRM3W2.js} +1 -1
  14. package/build/runtime-audio-BQSRM3W2.js.br +0 -0
  15. package/build/runtime-audio-BQSRM3W2.js.gz +0 -0
  16. package/build/{runtime-chunk-RAAW7WHN.js → runtime-chunk-243VQV5T.js} +1 -1
  17. package/build/runtime-chunk-243VQV5T.js.br +0 -0
  18. package/build/runtime-chunk-243VQV5T.js.gz +0 -0
  19. package/build/{runtime-chunk-W7THORYR.js → runtime-chunk-2657LZHS.js} +1 -1
  20. package/build/runtime-chunk-2657LZHS.js.br +0 -0
  21. package/build/runtime-chunk-2657LZHS.js.gz +0 -0
  22. package/build/{runtime-chunk-Z5OH244S.js → runtime-chunk-5XUI4Z6R.js} +1 -1
  23. package/build/runtime-chunk-5XUI4Z6R.js.br +0 -0
  24. package/build/runtime-chunk-5XUI4Z6R.js.gz +0 -0
  25. package/build/{runtime-chunk-MC3OVJQU.js → runtime-chunk-6WHNEYAL.js} +1 -1
  26. package/build/runtime-chunk-6WHNEYAL.js.br +0 -0
  27. package/build/runtime-chunk-6WHNEYAL.js.gz +0 -0
  28. package/build/{runtime-chunk-D2IFC55F.js → runtime-chunk-CDZQF4NV.js} +1 -1
  29. package/build/runtime-chunk-CDZQF4NV.js.br +0 -0
  30. package/build/runtime-chunk-CDZQF4NV.js.gz +0 -0
  31. package/build/{runtime-chunk-ZHNGVKGZ.js → runtime-chunk-DNWPGXEC.js} +1 -1
  32. package/build/runtime-chunk-DNWPGXEC.js.br +0 -0
  33. package/build/runtime-chunk-DNWPGXEC.js.gz +0 -0
  34. package/build/{runtime-chunk-TQBPVLGB.js → runtime-chunk-DSGSWXCQ.js} +1 -1
  35. package/build/runtime-chunk-DSGSWXCQ.js.br +0 -0
  36. package/build/runtime-chunk-DSGSWXCQ.js.gz +0 -0
  37. package/build/{runtime-chunk-6UQ4Z4JG.js → runtime-chunk-DZOSSY2K.js} +1 -1
  38. package/build/runtime-chunk-DZOSSY2K.js.br +0 -0
  39. package/build/runtime-chunk-DZOSSY2K.js.gz +0 -0
  40. package/build/{runtime-chunk-BCJEHBXX.js → runtime-chunk-EGI7ABC6.js} +1 -1
  41. package/build/runtime-chunk-EGI7ABC6.js.br +0 -0
  42. package/build/runtime-chunk-EGI7ABC6.js.gz +0 -0
  43. package/build/{runtime-chunk-D6NWJJTR.js → runtime-chunk-F7OUYIT6.js} +1 -1
  44. package/build/runtime-chunk-F7OUYIT6.js.br +0 -0
  45. package/build/runtime-chunk-F7OUYIT6.js.gz +0 -0
  46. package/build/{runtime-chunk-4FAMJWEB.js → runtime-chunk-IGBRWWDI.js} +1 -1
  47. package/build/runtime-chunk-IGBRWWDI.js.br +0 -0
  48. package/build/runtime-chunk-IGBRWWDI.js.gz +0 -0
  49. package/build/{runtime-chunk-Y2GFSK5L.js → runtime-chunk-IK4H7UNI.js} +1 -1
  50. package/build/runtime-chunk-IK4H7UNI.js.br +0 -0
  51. package/build/runtime-chunk-IK4H7UNI.js.gz +0 -0
  52. package/build/{runtime-chunk-SQKBNW2G.js → runtime-chunk-J4FFQBNR.js} +1 -1
  53. package/build/runtime-chunk-J4FFQBNR.js.br +0 -0
  54. package/build/runtime-chunk-J4FFQBNR.js.gz +0 -0
  55. package/build/runtime-chunk-LALFWESO.js +1 -0
  56. package/build/runtime-chunk-LALFWESO.js.br +0 -0
  57. package/build/runtime-chunk-LALFWESO.js.gz +0 -0
  58. package/build/{runtime-chunk-PXPQZ7SX.js → runtime-chunk-NIDXMSZY.js} +1 -1
  59. package/build/runtime-chunk-NIDXMSZY.js.br +0 -0
  60. package/build/runtime-chunk-NIDXMSZY.js.gz +0 -0
  61. package/build/{runtime-chunk-U5ACSO5E.js → runtime-chunk-OTAMLWBD.js} +1 -1
  62. package/build/runtime-chunk-OTAMLWBD.js.br +0 -0
  63. package/build/runtime-chunk-OTAMLWBD.js.gz +0 -0
  64. package/build/{runtime-chunk-NGWM5WPD.js → runtime-chunk-P2QJHRIH.js} +1 -1
  65. package/build/runtime-chunk-P2QJHRIH.js.br +0 -0
  66. package/build/runtime-chunk-P2QJHRIH.js.gz +0 -0
  67. package/build/runtime-chunk-PLJ25O2X.js +1 -0
  68. package/build/runtime-chunk-PLJ25O2X.js.br +0 -0
  69. package/build/runtime-chunk-PLJ25O2X.js.gz +0 -0
  70. package/build/runtime-chunk-PRQYD4EW.js +1 -0
  71. package/build/runtime-chunk-PRQYD4EW.js.br +0 -0
  72. package/build/runtime-chunk-PRQYD4EW.js.gz +0 -0
  73. package/build/runtime-chunk-QPB2TL3G.js +1 -0
  74. package/build/runtime-chunk-QPB2TL3G.js.br +0 -0
  75. package/build/runtime-chunk-QPB2TL3G.js.gz +0 -0
  76. package/build/runtime-chunk-QVC5UDJO.js +1 -0
  77. package/build/runtime-chunk-QVC5UDJO.js.br +0 -0
  78. package/build/runtime-chunk-QVC5UDJO.js.gz +0 -0
  79. package/build/{runtime-chunk-MVRGHRTL.js → runtime-chunk-RSPDUS6G.js} +1 -1
  80. package/build/runtime-chunk-RSPDUS6G.js.br +0 -0
  81. package/build/runtime-chunk-RSPDUS6G.js.gz +0 -0
  82. package/build/{runtime-chunk-EXHPAC6T.js → runtime-chunk-RWL6KR5S.js} +1 -1
  83. package/build/runtime-chunk-RWL6KR5S.js.br +0 -0
  84. package/build/runtime-chunk-RWL6KR5S.js.gz +0 -0
  85. package/build/{runtime-chunk-ZULFQKQK.js → runtime-chunk-SXDO5LXF.js} +1 -1
  86. package/build/runtime-chunk-SXDO5LXF.js.br +0 -0
  87. package/build/runtime-chunk-SXDO5LXF.js.gz +0 -0
  88. package/build/{runtime-chunk-Q4H7PFTE.js → runtime-chunk-U6S2BBR7.js} +1 -1
  89. package/build/runtime-chunk-U6S2BBR7.js.br +0 -0
  90. package/build/runtime-chunk-U6S2BBR7.js.gz +0 -0
  91. package/build/{runtime-chunk-G5XH52BM.js → runtime-chunk-V3U2TPGQ.js} +1 -1
  92. package/build/runtime-chunk-V3U2TPGQ.js.br +0 -0
  93. package/build/runtime-chunk-V3U2TPGQ.js.gz +0 -0
  94. package/build/{runtime-chunk-32ZE2X4C.js → runtime-chunk-Y365A3K5.js} +1 -1
  95. package/build/runtime-chunk-Y365A3K5.js.br +0 -0
  96. package/build/runtime-chunk-Y365A3K5.js.gz +0 -0
  97. package/build/runtime-chunk-YWT6AWL4.js +1 -0
  98. package/build/runtime-chunk-YWT6AWL4.js.br +0 -0
  99. package/build/runtime-chunk-YWT6AWL4.js.gz +0 -0
  100. package/build/{runtime-classicRuntime-IFIIFBNS.js → runtime-classicRuntime-BD2WFYXF.js} +1 -1
  101. package/build/runtime-classicRuntime-BD2WFYXF.js.br +0 -0
  102. package/build/runtime-classicRuntime-BD2WFYXF.js.gz +0 -0
  103. package/build/runtime-cloners-ST66KGZH.js +1 -0
  104. package/build/runtime-cloners-ST66KGZH.js.br +1 -0
  105. package/build/runtime-cloners-ST66KGZH.js.gz +0 -0
  106. package/build/{runtime-components-LNJJ3QLB.js → runtime-components-RLXFVT5A.js} +1 -1
  107. package/build/runtime-components-RLXFVT5A.js.br +0 -0
  108. package/build/runtime-components-RLXFVT5A.js.gz +0 -0
  109. package/build/runtime-conditional-DCOFCW5I.js +1 -0
  110. package/build/runtime-conditional-DCOFCW5I.js.br +0 -0
  111. package/build/runtime-conditional-DCOFCW5I.js.gz +0 -0
  112. package/build/{runtime-createDestroy-DWI7C4WO.js → runtime-createDestroy-4PG4ZWLI.js} +1 -1
  113. package/build/runtime-createDestroy-4PG4ZWLI.js.br +0 -0
  114. package/build/runtime-createDestroy-4PG4ZWLI.js.gz +0 -0
  115. package/build/{runtime-dragDrop-46CHKTIE.js → runtime-dragDrop-CTXPZ6OW.js} +1 -1
  116. package/build/runtime-dragDrop-CTXPZ6OW.js.br +0 -0
  117. package/build/runtime-dragDrop-CTXPZ6OW.js.gz +0 -0
  118. package/build/runtime-gameControls-LUALVLF5.js +1 -0
  119. package/build/runtime-gameControls-LUALVLF5.js.br +0 -0
  120. package/build/runtime-gameControls-LUALVLF5.js.gz +0 -0
  121. package/build/runtime-hair-JNRT3G3X.js +1 -0
  122. package/build/runtime-hair-JNRT3G3X.js.br +1 -0
  123. package/build/runtime-hair-JNRT3G3X.js.gz +0 -0
  124. package/build/{runtime-mergeStaticGeometries-O5XKFANJ.js → runtime-mergeStaticGeometries-QDKIDV27.js} +1 -1
  125. package/build/runtime-mergeStaticGeometries-QDKIDV27.js.br +0 -0
  126. package/build/runtime-mergeStaticGeometries-QDKIDV27.js.gz +0 -0
  127. package/build/{runtime-miscActions-IRARI4E6.js → runtime-miscActions-FCQTXDEH.js} +1 -1
  128. package/build/runtime-miscActions-FCQTXDEH.js.br +0 -0
  129. package/build/runtime-miscActions-FCQTXDEH.js.gz +0 -0
  130. package/build/runtime-mouseHover-GP5TEPLG.js +1 -0
  131. package/build/runtime-mouseHover-GP5TEPLG.js.br +0 -0
  132. package/build/runtime-mouseHover-GP5TEPLG.js.gz +0 -0
  133. package/build/{runtime-particles-INK4LA4P.js → runtime-particles-VMYZZSAL.js} +1 -1
  134. package/build/runtime-particles-VMYZZSAL.js.br +0 -0
  135. package/build/runtime-particles-VMYZZSAL.js.gz +0 -0
  136. package/build/{runtime-paths-LRTW3RNL.js → runtime-paths-TGU7JOOY.js} +1 -1
  137. package/build/runtime-paths-TGU7JOOY.js.br +0 -0
  138. package/build/runtime-paths-TGU7JOOY.js.gz +0 -0
  139. package/build/runtime-resize-O3Y2XS2Q.js +1 -0
  140. package/build/runtime-resize-O3Y2XS2Q.js.br +0 -0
  141. package/build/runtime-resize-O3Y2XS2Q.js.gz +0 -0
  142. package/build/{runtime-sceneTransition-X7RGRC3W.js → runtime-sceneTransition-4DDTFDJN.js} +1 -1
  143. package/build/runtime-sceneTransition-4DDTFDJN.js.br +0 -0
  144. package/build/runtime-sceneTransition-4DDTFDJN.js.gz +0 -0
  145. package/build/{runtime-scroll-VK7XXJPE.js → runtime-scroll-ET44H7JC.js} +1 -1
  146. package/build/runtime-scroll-ET44H7JC.js.br +0 -0
  147. package/build/runtime-scroll-ET44H7JC.js.gz +0 -0
  148. package/build/runtime-shapeBlends-3FCSH6PN.js +1 -0
  149. package/build/runtime-shapeBlends-3FCSH6PN.js.br +2 -0
  150. package/build/runtime-shapeBlends-3FCSH6PN.js.gz +0 -0
  151. package/build/{runtime-text-KC66JGLC.js → runtime-text-UQIUL5X6.js} +1 -1
  152. package/build/runtime-text-UQIUL5X6.js.br +0 -0
  153. package/build/runtime-text-UQIUL5X6.js.gz +0 -0
  154. package/build/{runtime-textInputs-Y7CREUMS.js → runtime-textInputs-E72WPYQU.js} +1 -1
  155. package/build/runtime-textInputs-E72WPYQU.js.br +0 -0
  156. package/build/runtime-textInputs-E72WPYQU.js.gz +0 -0
  157. package/build/runtime-timeline-2VAMFUOE.js +1 -0
  158. package/build/runtime-timeline-2VAMFUOE.js.br +0 -0
  159. package/build/runtime-timeline-2VAMFUOE.js.gz +0 -0
  160. package/build/{runtime-tracking-FA45SGZJ.js → runtime-tracking-E72XXGER.js} +1 -1
  161. package/build/runtime-tracking-E72XXGER.js.br +0 -0
  162. package/build/runtime-tracking-E72XXGER.js.gz +0 -0
  163. package/build/{runtime-transitions-A7UP5OMB.js → runtime-transitions-JOHZRI2L.js} +1 -1
  164. package/build/runtime-transitions-JOHZRI2L.js.br +0 -0
  165. package/build/runtime-transitions-JOHZRI2L.js.gz +0 -0
  166. package/build/runtime-ui2d-PJKKRE32.js +1 -0
  167. package/build/runtime-ui2d-PJKKRE32.js.br +0 -0
  168. package/build/runtime-ui2d-PJKKRE32.js.gz +0 -0
  169. package/build/{runtime-variables-U36KPJ5V.js → runtime-variables-Q6Q2JCGI.js} +1 -1
  170. package/build/runtime-variables-Q6Q2JCGI.js.br +0 -0
  171. package/build/runtime-variables-Q6Q2JCGI.js.gz +0 -0
  172. package/build/{runtime-vectorShapes-MA6PKTF5.js → runtime-vectorShapes-FKC6EQWI.js} +1 -1
  173. package/build/runtime-vectorShapes-FKC6EQWI.js.br +0 -0
  174. package/build/runtime-vectorShapes-FKC6EQWI.js.gz +0 -0
  175. package/build/{runtime-video-7GHZOZRJ.js → runtime-video-DUDXGADJ.js} +1 -1
  176. package/build/runtime-video-DUDXGADJ.js.br +0 -0
  177. package/build/runtime-video-DUDXGADJ.js.gz +0 -0
  178. package/build/runtime-webgpu-TBHSGHNI.js +1 -0
  179. package/build/runtime-webgpu-TBHSGHNI.js.br +0 -0
  180. package/build/runtime-webgpu-TBHSGHNI.js.gz +0 -0
  181. package/build/runtime.cjs +325 -325
  182. package/build/runtime.js +1 -1
  183. package/build/runtime.js.br +0 -0
  184. package/build/runtime.js.gz +0 -0
  185. package/build/runtime.standalone.js +1 -1
  186. package/build/runtime.standalone.js.br +0 -0
  187. package/build/runtime.standalone.js.gz +0 -0
  188. package/build/runtime.standalone.webgl.js +1 -1
  189. package/build/runtime.standalone.webgl.js.br +0 -0
  190. package/build/runtime.standalone.webgl.js.gz +0 -0
  191. package/build/runtime.standalone.webgpu.js +1 -1
  192. package/build/runtime.standalone.webgpu.js.br +0 -0
  193. package/build/runtime.standalone.webgpu.js.gz +0 -0
  194. package/build/runtime.standalone.webgpu.micro.js +1 -1
  195. package/build/runtime.standalone.webgpu.micro.js.br +0 -0
  196. package/build/runtime.standalone.webgpu.micro.js.gz +0 -0
  197. package/build/runtime.standalone.webgpu.min.js +1 -1
  198. package/build/runtime.standalone.webgpu.min.js.br +0 -0
  199. package/build/runtime.standalone.webgpu.min.js.gz +0 -0
  200. package/package.json +1 -1
  201. package/build/runtime-aiAssistant-XJVJ7TQB.js +0 -1
  202. package/build/runtime-aiAssistant-XJVJ7TQB.js.br +0 -0
  203. package/build/runtime-aiAssistant-XJVJ7TQB.js.gz +0 -0
  204. package/build/runtime-apiServices-KAO5SQJZ.js +0 -1
  205. package/build/runtime-apiServices-KAO5SQJZ.js.br +0 -0
  206. package/build/runtime-apiServices-KAO5SQJZ.js.gz +0 -0
  207. package/build/runtime-audio-Y3GYW4YQ.js.br +0 -0
  208. package/build/runtime-audio-Y3GYW4YQ.js.gz +0 -0
  209. package/build/runtime-chunk-32ZE2X4C.js.br +0 -0
  210. package/build/runtime-chunk-32ZE2X4C.js.gz +0 -0
  211. package/build/runtime-chunk-4FAMJWEB.js.br +0 -0
  212. package/build/runtime-chunk-4FAMJWEB.js.gz +0 -0
  213. package/build/runtime-chunk-6UQ4Z4JG.js.br +0 -0
  214. package/build/runtime-chunk-6UQ4Z4JG.js.gz +0 -0
  215. package/build/runtime-chunk-BCJEHBXX.js.br +0 -0
  216. package/build/runtime-chunk-BCJEHBXX.js.gz +0 -0
  217. package/build/runtime-chunk-D2IFC55F.js.br +0 -0
  218. package/build/runtime-chunk-D2IFC55F.js.gz +0 -0
  219. package/build/runtime-chunk-D6NWJJTR.js.br +0 -0
  220. package/build/runtime-chunk-D6NWJJTR.js.gz +0 -0
  221. package/build/runtime-chunk-EXHPAC6T.js.br +0 -0
  222. package/build/runtime-chunk-EXHPAC6T.js.gz +0 -0
  223. package/build/runtime-chunk-G5XH52BM.js.br +0 -0
  224. package/build/runtime-chunk-G5XH52BM.js.gz +0 -0
  225. package/build/runtime-chunk-MC3OVJQU.js.br +0 -0
  226. package/build/runtime-chunk-MC3OVJQU.js.gz +0 -0
  227. package/build/runtime-chunk-MM75L5X4.js +0 -1
  228. package/build/runtime-chunk-MM75L5X4.js.br +0 -0
  229. package/build/runtime-chunk-MM75L5X4.js.gz +0 -0
  230. package/build/runtime-chunk-MVRGHRTL.js.br +0 -0
  231. package/build/runtime-chunk-MVRGHRTL.js.gz +0 -0
  232. package/build/runtime-chunk-NGWM5WPD.js.br +0 -0
  233. package/build/runtime-chunk-NGWM5WPD.js.gz +0 -0
  234. package/build/runtime-chunk-NRJDJMQZ.js +0 -1
  235. package/build/runtime-chunk-NRJDJMQZ.js.br +0 -0
  236. package/build/runtime-chunk-NRJDJMQZ.js.gz +0 -0
  237. package/build/runtime-chunk-PXPQZ7SX.js.br +0 -0
  238. package/build/runtime-chunk-PXPQZ7SX.js.gz +0 -0
  239. package/build/runtime-chunk-Q4H7PFTE.js.br +0 -0
  240. package/build/runtime-chunk-Q4H7PFTE.js.gz +0 -0
  241. package/build/runtime-chunk-QFGFABLH.js +0 -1
  242. package/build/runtime-chunk-QFGFABLH.js.br +0 -0
  243. package/build/runtime-chunk-QFGFABLH.js.gz +0 -0
  244. package/build/runtime-chunk-RAAW7WHN.js.br +0 -0
  245. package/build/runtime-chunk-RAAW7WHN.js.gz +0 -0
  246. package/build/runtime-chunk-SQKBNW2G.js.br +0 -0
  247. package/build/runtime-chunk-SQKBNW2G.js.gz +0 -0
  248. package/build/runtime-chunk-TQBPVLGB.js.br +0 -0
  249. package/build/runtime-chunk-TQBPVLGB.js.gz +0 -0
  250. package/build/runtime-chunk-U5ACSO5E.js.br +0 -0
  251. package/build/runtime-chunk-U5ACSO5E.js.gz +0 -0
  252. package/build/runtime-chunk-W7THORYR.js.br +0 -0
  253. package/build/runtime-chunk-W7THORYR.js.gz +0 -0
  254. package/build/runtime-chunk-XTKPUDRE.js +0 -1
  255. package/build/runtime-chunk-XTKPUDRE.js.br +0 -0
  256. package/build/runtime-chunk-XTKPUDRE.js.gz +0 -0
  257. package/build/runtime-chunk-XV2ZLRKD.js +0 -1
  258. package/build/runtime-chunk-XV2ZLRKD.js.br +0 -0
  259. package/build/runtime-chunk-XV2ZLRKD.js.gz +0 -0
  260. package/build/runtime-chunk-Y2GFSK5L.js.br +0 -0
  261. package/build/runtime-chunk-Y2GFSK5L.js.gz +0 -0
  262. package/build/runtime-chunk-Z5OH244S.js.br +0 -0
  263. package/build/runtime-chunk-Z5OH244S.js.gz +0 -0
  264. package/build/runtime-chunk-ZHNGVKGZ.js.br +0 -0
  265. package/build/runtime-chunk-ZHNGVKGZ.js.gz +0 -0
  266. package/build/runtime-chunk-ZLW3UWOA.js +0 -1
  267. package/build/runtime-chunk-ZLW3UWOA.js.br +0 -0
  268. package/build/runtime-chunk-ZLW3UWOA.js.gz +0 -0
  269. package/build/runtime-chunk-ZULFQKQK.js.br +0 -0
  270. package/build/runtime-chunk-ZULFQKQK.js.gz +0 -0
  271. package/build/runtime-classicRuntime-IFIIFBNS.js.br +0 -0
  272. package/build/runtime-classicRuntime-IFIIFBNS.js.gz +0 -0
  273. package/build/runtime-cloners-WEF7XIM4.js +0 -1
  274. package/build/runtime-cloners-WEF7XIM4.js.br +0 -2
  275. package/build/runtime-cloners-WEF7XIM4.js.gz +0 -0
  276. package/build/runtime-components-LNJJ3QLB.js.br +0 -0
  277. package/build/runtime-components-LNJJ3QLB.js.gz +0 -0
  278. package/build/runtime-conditional-3A423CXW.js +0 -1
  279. package/build/runtime-conditional-3A423CXW.js.br +0 -0
  280. package/build/runtime-conditional-3A423CXW.js.gz +0 -0
  281. package/build/runtime-createDestroy-DWI7C4WO.js.br +0 -0
  282. package/build/runtime-createDestroy-DWI7C4WO.js.gz +0 -0
  283. package/build/runtime-dragDrop-46CHKTIE.js.br +0 -0
  284. package/build/runtime-dragDrop-46CHKTIE.js.gz +0 -0
  285. package/build/runtime-gameControls-YA2YP4UH.js +0 -1
  286. package/build/runtime-gameControls-YA2YP4UH.js.br +0 -0
  287. package/build/runtime-gameControls-YA2YP4UH.js.gz +0 -0
  288. package/build/runtime-hair-XVWLJEZC.js +0 -1
  289. package/build/runtime-hair-XVWLJEZC.js.br +0 -3
  290. package/build/runtime-hair-XVWLJEZC.js.gz +0 -0
  291. package/build/runtime-mergeStaticGeometries-O5XKFANJ.js.br +0 -0
  292. package/build/runtime-mergeStaticGeometries-O5XKFANJ.js.gz +0 -0
  293. package/build/runtime-miscActions-IRARI4E6.js.br +0 -0
  294. package/build/runtime-miscActions-IRARI4E6.js.gz +0 -0
  295. package/build/runtime-mouseHover-3LVJJIFG.js +0 -1
  296. package/build/runtime-mouseHover-3LVJJIFG.js.br +0 -0
  297. package/build/runtime-mouseHover-3LVJJIFG.js.gz +0 -0
  298. package/build/runtime-particles-INK4LA4P.js.br +0 -0
  299. package/build/runtime-particles-INK4LA4P.js.gz +0 -0
  300. package/build/runtime-paths-LRTW3RNL.js.br +0 -0
  301. package/build/runtime-paths-LRTW3RNL.js.gz +0 -0
  302. package/build/runtime-resize-4OIVU46M.js +0 -1
  303. package/build/runtime-resize-4OIVU46M.js.br +0 -0
  304. package/build/runtime-resize-4OIVU46M.js.gz +0 -0
  305. package/build/runtime-sceneTransition-X7RGRC3W.js.br +0 -0
  306. package/build/runtime-sceneTransition-X7RGRC3W.js.gz +0 -0
  307. package/build/runtime-scroll-VK7XXJPE.js.br +0 -0
  308. package/build/runtime-scroll-VK7XXJPE.js.gz +0 -0
  309. package/build/runtime-shapeBlends-VLITROES.js +0 -1
  310. package/build/runtime-shapeBlends-VLITROES.js.br +0 -2
  311. package/build/runtime-shapeBlends-VLITROES.js.gz +0 -0
  312. package/build/runtime-text-KC66JGLC.js.br +0 -0
  313. package/build/runtime-text-KC66JGLC.js.gz +0 -0
  314. package/build/runtime-textInputs-Y7CREUMS.js.br +0 -0
  315. package/build/runtime-textInputs-Y7CREUMS.js.gz +0 -0
  316. package/build/runtime-timeline-KTMKRAZU.js +0 -1
  317. package/build/runtime-timeline-KTMKRAZU.js.br +0 -0
  318. package/build/runtime-timeline-KTMKRAZU.js.gz +0 -0
  319. package/build/runtime-tracking-FA45SGZJ.js.br +0 -0
  320. package/build/runtime-tracking-FA45SGZJ.js.gz +0 -0
  321. package/build/runtime-transitions-A7UP5OMB.js.br +0 -0
  322. package/build/runtime-transitions-A7UP5OMB.js.gz +0 -0
  323. package/build/runtime-ui2d-XLYMHVMW.js +0 -1
  324. package/build/runtime-ui2d-XLYMHVMW.js.br +0 -0
  325. package/build/runtime-ui2d-XLYMHVMW.js.gz +0 -0
  326. package/build/runtime-variables-U36KPJ5V.js.br +0 -0
  327. package/build/runtime-variables-U36KPJ5V.js.gz +0 -0
  328. package/build/runtime-vectorShapes-MA6PKTF5.js.br +0 -0
  329. package/build/runtime-vectorShapes-MA6PKTF5.js.gz +0 -0
  330. package/build/runtime-video-7GHZOZRJ.js.br +0 -0
  331. package/build/runtime-video-7GHZOZRJ.js.gz +0 -0
  332. package/build/runtime-webgpu-JPQ4VPBY.js +0 -1
  333. package/build/runtime-webgpu-JPQ4VPBY.js.br +0 -0
  334. package/build/runtime-webgpu-JPQ4VPBY.js.gz +0 -0
@@ -0,0 +1 @@
1
+ import{c as e}from"./runtime-chunk-TZCHGFVF.js";import{Ha as t,r}from"./runtime-chunk-OW6T4XFV.js";var i=new Map;function n(e,t){i.set(e,t)}var s=class{static get version(){return"1.3.8"}static toString(){return"JavaScript Expression Parser (JSEP) v"+s.version}static addUnaryOp(e){return s.max_unop_len=Math.max(e.length,s.max_unop_len),s.unary_ops[e]=1,s}static addBinaryOp(e,t,r){return s.max_binop_len=Math.max(e.length,s.max_binop_len),s.binary_ops[e]=t,r?s.right_associative.add(e):s.right_associative.delete(e),s}static addIdentifierChar(e){return s.additional_identifier_chars.add(e),s}static addLiteral(e,t){return s.literals[e]=t,s}static removeUnaryOp(e){return delete s.unary_ops[e],e.length===s.max_unop_len&&(s.max_unop_len=s.getMaxKeyLen(s.unary_ops)),s}static removeAllUnaryOps(){return s.unary_ops={},s.max_unop_len=0,s}static removeIdentifierChar(e){return s.additional_identifier_chars.delete(e),s}static removeBinaryOp(e){return delete s.binary_ops[e],e.length===s.max_binop_len&&(s.max_binop_len=s.getMaxKeyLen(s.binary_ops)),s.right_associative.delete(e),s}static removeAllBinaryOps(){return s.binary_ops={},s.max_binop_len=0,s}static removeLiteral(e){return delete s.literals[e],s}static removeAllLiterals(){return s.literals={},s}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(e){this.expr=e,this.index=0}static parse(e){return new s(e).parse()}static getMaxKeyLen(e){return Math.max(0,...Object.keys(e).map(e=>e.length))}static isDecimalDigit(e){return e>=48&&e<=57}static binaryPrecedence(e){return s.binary_ops[e]||0}static isIdentifierStart(e){return e>=65&&e<=90||e>=97&&e<=122||e>=128&&!s.binary_ops[String.fromCharCode(e)]||s.additional_identifier_chars.has(String.fromCharCode(e))}static isIdentifierPart(e){return s.isIdentifierStart(e)||s.isDecimalDigit(e)}throwError(e){let t=new Error(e+" at character "+this.index);throw t.index=this.index,t.description=e,t}runHook(e,t){if(s.hooks[e]){let r={context:this,node:t};return s.hooks.run(e,r),r.node}return t}searchHook(e){if(s.hooks[e]){let t={context:this};return s.hooks[e].find(function(e){return e.call(t.context,t),t.node}),t.node}}gobbleSpaces(){let e=this.code;for(;e===s.SPACE_CODE||e===s.TAB_CODE||e===s.LF_CODE||e===s.CR_CODE;)e=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let e=this.gobbleExpressions(),t=1===e.length?e[0]:{type:s.COMPOUND,body:e};return this.runHook("after-all",t)}gobbleExpressions(e){let t,r,i=[];for(;this.index<this.expr.length;)if(t=this.code,t===s.SEMCOL_CODE||t===s.COMMA_CODE)this.index++;else if(r=this.gobbleExpression())i.push(r);else if(this.index<this.expr.length){if(t===e)break;this.throwError('Unexpected "'+this.char+'"')}return i}gobbleExpression(){let e=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",e)}gobbleBinaryOp(){this.gobbleSpaces();let e=this.expr.substr(this.index,s.max_binop_len),t=e.length;for(;t>0;){if(s.binary_ops.hasOwnProperty(e)&&(!s.isIdentifierStart(this.code)||this.index+e.length<this.expr.length&&!s.isIdentifierPart(this.expr.charCodeAt(this.index+e.length))))return this.index+=t,e;e=e.substr(0,--t)}return!1}gobbleBinaryExpression(){let e,t,r,i,n,o,a,h,l;if(o=this.gobbleToken(),!o||(t=this.gobbleBinaryOp(),!t))return o;for(n={value:t,prec:s.binaryPrecedence(t),right_a:s.right_associative.has(t)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+t),i=[o,n,a];t=this.gobbleBinaryOp();){if(r=s.binaryPrecedence(t),0===r){this.index-=t.length;break}n={value:t,prec:r,right_a:s.right_associative.has(t)},l=t;let h=e=>n.right_a&&e.right_a?r>e.prec:r<=e.prec;for(;i.length>2&&h(i[i.length-2]);)a=i.pop(),t=i.pop().value,o=i.pop(),e={type:s.BINARY_EXP,operator:t,left:o,right:a},i.push(e);e=this.gobbleToken(),e||this.throwError("Expected expression after "+l),i.push(n,e)}for(h=i.length-1,e=i[h];h>1;)e={type:s.BINARY_EXP,operator:i[h-1].value,left:i[h-2],right:e},h-=2;return e}gobbleToken(){let e,t,r,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(e=this.code,s.isDecimalDigit(e)||e===s.PERIOD_CODE)return this.gobbleNumericLiteral();if(e===s.SQUOTE_CODE||e===s.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(e===s.OBRACK_CODE)i=this.gobbleArray();else{for(t=this.expr.substr(this.index,s.max_unop_len),r=t.length;r>0;){if(s.unary_ops.hasOwnProperty(t)&&(!s.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!s.isIdentifierPart(this.expr.charCodeAt(this.index+t.length)))){this.index+=r;let e=this.gobbleToken();return e||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:s.UNARY_EXP,operator:t,argument:e,prefix:!0})}t=t.substr(0,--r)}s.isIdentifierStart(e)?(i=this.gobbleIdentifier(),s.literals.hasOwnProperty(i.name)?i={type:s.LITERAL,value:s.literals[i.name],raw:i.name}:i.name===s.this_str&&(i={type:s.THIS_EXP})):e===s.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(e){this.gobbleSpaces();let t=this.code;for(;t===s.PERIOD_CODE||t===s.OBRACK_CODE||t===s.OPAREN_CODE||t===s.QUMARK_CODE;){let r;if(t===s.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==s.PERIOD_CODE)break;r=!0,this.index+=2,this.gobbleSpaces(),t=this.code}this.index++,t===s.OBRACK_CODE?(e={type:s.MEMBER_EXP,computed:!0,object:e,property:this.gobbleExpression()},this.gobbleSpaces(),t=this.code,t!==s.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):t===s.OPAREN_CODE?e={type:s.CALL_EXP,arguments:this.gobbleArguments(s.CPAREN_CODE),callee:e}:(t===s.PERIOD_CODE||r)&&(r&&this.index--,this.gobbleSpaces(),e={type:s.MEMBER_EXP,computed:!1,object:e,property:this.gobbleIdentifier()}),r&&(e.optional=!0),this.gobbleSpaces(),t=this.code}return e}gobbleNumericLiteral(){let e,t,r="";for(;s.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);if(this.code===s.PERIOD_CODE)for(r+=this.expr.charAt(this.index++);s.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);if(e=this.char,"e"===e||"E"===e){for(r+=this.expr.charAt(this.index++),e=this.char,("+"===e||"-"===e)&&(r+=this.expr.charAt(this.index++));s.isDecimalDigit(this.code);)r+=this.expr.charAt(this.index++);s.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+r+this.char+")")}return t=this.code,s.isIdentifierStart(t)?this.throwError("Variable names cannot start with a number ("+r+this.char+")"):(t===s.PERIOD_CODE||1===r.length&&r.charCodeAt(0)===s.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:s.LITERAL,value:parseFloat(r),raw:r}}gobbleStringLiteral(){let e="",t=this.index,r=this.expr.charAt(this.index++),i=!1;for(;this.index<this.expr.length;){let t=this.expr.charAt(this.index++);if(t===r){i=!0;break}if("\\"===t)switch(t=this.expr.charAt(this.index++),t){case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:e+=t}else e+=t}return i||this.throwError('Unclosed quote after "'+e+'"'),{type:s.LITERAL,value:e,raw:this.expr.substring(t,this.index)}}gobbleIdentifier(){let e=this.code,t=this.index;for(s.isIdentifierStart(e)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(e=this.code,s.isIdentifierPart(e));)this.index++;return{type:s.IDENTIFIER,name:this.expr.slice(t,this.index)}}gobbleArguments(e){let t=[],r=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let n=this.code;if(n===e){r=!0,this.index++,e===s.CPAREN_CODE&&i&&i>=t.length&&this.throwError("Unexpected token "+String.fromCharCode(e));break}if(n===s.COMMA_CODE){if(this.index++,i++,i!==t.length)if(e===s.CPAREN_CODE)this.throwError("Unexpected token ,");else if(e===s.CBRACK_CODE)for(let e=t.length;e<i;e++)t.push(null)}else if(t.length!==i&&0!==i)this.throwError("Expected comma");else{let e=this.gobbleExpression();(!e||e.type===s.COMPOUND)&&this.throwError("Expected comma"),t.push(e)}}return r||this.throwError("Expected "+String.fromCharCode(e)),t}gobbleGroup(){this.index++;let e=this.gobbleExpressions(s.CPAREN_CODE);if(this.code===s.CPAREN_CODE)return this.index++,1===e.length?e[0]:!!e.length&&{type:s.SEQUENCE_EXP,expressions:e};this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:s.ARRAY_EXP,elements:this.gobbleArguments(s.CBRACK_CODE)}}},o=new class{add(e,t,r){if("string"!=typeof arguments[0])for(let e in arguments[0])this.add(e,arguments[0][e],arguments[1]);else(Array.isArray(e)?e:[e]).forEach(function(e){this[e]=this[e]||[],t&&this[e][r?"unshift":"push"](t)},this)}run(e,t){this[e]=this[e]||[],this[e].forEach(function(e){e.call(t&&t.context?t.context:t,t)})}};Object.assign(s,{hooks:o,plugins:new class{constructor(e){this.jsep=e,this.registered={}}register(...e){e.forEach(e=>{if("object"!=typeof e||!e.name||!e.init)throw new Error("Invalid JSEP plugin format");this.registered[e.name]||(e.init(this.jsep),this.registered[e.name]=e)})}}(s),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},right_associative:new Set,additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"}),s.max_unop_len=s.getMaxKeyLen(s.unary_ops),s.max_binop_len=s.getMaxKeyLen(s.binary_ops);var a=e=>new s(e).parse();Object.getOwnPropertyNames(s).forEach(e=>{void 0===a[e]&&"prototype"!==e&&(a[e]=s[e])}),a.Jsep=s;var h={name:"ternary",init(e){e.hooks.add("after-expression",function(t){if(t.node&&this.code===e.QUMARK_CODE){this.index++;let r=t.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let n=this.gobbleExpression();if(n||this.throwError("Expected expression"),t.node={type:"ConditionalExpression",test:r,consequent:i,alternate:n},r.operator&&e.binary_ops[r.operator]<=.9){let i=r;for(;i.right.operator&&e.binary_ops[i.right.operator]<=.9;)i=i.right;t.node.test=i.right,i.right=t.node,t.node=r}}else this.throwError("Expected :")}})}};a.plugins.register(h);var l=["+","-","*","/","(",")","==","!=",">","<",">=","<=","and","or","!","%","^",","],c=["0","1","2","3","4","5","6","7","8","9","."],d=["sin","cos","tan","asin","acos","atan","atan2","sqrt","abs","log","exp","floor","ceil","round","min","max","random"];function p(e){return"string"==typeof e&&!isNaN(e)&&!isNaN(parseFloat(e))}function u(e,r,i="number"){let n,s,o="";for(let n=0;n<e.length;n++){let s=e[n];if("objType"in s&&"api"===s.objType){let e=JSON.parse(s.id),t=e[0],i=r.getUserAPI(t);if(void 0!==i&&"function"==typeof i.retrieveValue){let t=i.retrieveValue(e.slice(1));void 0!==t&&(o+=t)}continue}if("objType"in s&&"webhook"===s.objType){let e=JSON.parse(s.id),[t,i]=e,n=r.getUserWebhook(t);if(void 0!==n){let e=n.getParameterValue(i);void 0!==e&&(o+=e)}continue}if("objType"in s&&"aiAssistant"===s.objType){let e=r.openAIRealtime;if("objId"in s&&void 0!==s.objId){let t;if(r.scene.data.objects.traverse((e,r)=>{let i=r.events?.find(e=>e.id===s.objId);i&&(t=i)}),void 0!==t&&"AIAssistantListener"===t.data.type){let r=e?.computeAnalysisForListenerEvent(t.data);if(void 0!==r){o+=r;continue}}}o+=e?.voice??0;continue}if("id"in s){let a=e[n-1];if(n>0&&"id"in a)return void console.error("Two variables in a row",e);let h=r.getVariable(s.id),l=t.getDisplayedValue(h);"number"===i&&t.isTextValue(h)&&Array.isArray(h.textValue)&&1===h.textValue.length?l=parseFloat(l).toString():"boolean"===i&&t.isBoolean(h)?l=h?"true":"false":"boolean"===i&&t.isTextValue(h)&&!Array.isArray(h.textValue)&&(l='"'+l+'"'),o+=l;continue}"string"!==i?"and"!==s.name?"or"!==s.name?"True"!==s.name?"False"!==s.name?"boolean"!==i||p(s.name)||c.includes(s.name)||l.includes(s.name)||d.includes(s.name.replace(/\($/g,""))?o+=s.name:o+='"'+s.name+'"':o+="false":o+="true":o+="||":o+="&&":('"'!==s.name&&("+"!==s.name||s.escaped)&&(o+=s.name),"+"===s.name&&!s.escaped&&"\\"===o[o.length-1]&&(o=o.slice(0,-1)+s.name))}if("string"===i)return o;if(0===e.length){if("number"===i)return 0;if("boolean"===i)return!1}try{n=a(o)}catch(e){return void console.error(o,e)}try{s=f(n)}catch(e){console.error(o,n,e)}return s}function f(e){switch(e.type){case"BinaryExpression":switch(e.operator){case"==":return Number(f(e.left)===f(e.right));case"!=":return Number(f(e.left)!==f(e.right));case">":return Number(f(e.left)>f(e.right));case">=":return Number(f(e.left)>=f(e.right));case"<":return Number(f(e.left)<f(e.right));case"<=":return Number(f(e.left)<=f(e.right));case"+":return f(e.left)+f(e.right);case"-":return f(e.left)-f(e.right);case"*":return f(e.left)*f(e.right);case"/":return f(e.left)/f(e.right);case"%":return f(e.left)%f(e.right);case"&&":return f(e.left)&&f(e.right);case"||":return f(e.left)||f(e.right);case"^":return Math.pow(f(e.left),f(e.right));default:throw new Error("Unknown operator: "+e.operator)}case"UnaryExpression":switch(e.operator){case"-":return-f(e.argument);case"!":return Number(!f(e.argument));default:throw new Error("Unknown operator: "+e.operator)}case"Identifier":throw new Error("Unknown identifier: "+e.name);case"Literal":return e.value;case"CallExpression":if("Identifier"===e.callee.type){if("random"===e.callee.name){let t=0,r=1;if(e.arguments.length>=1)try{t=f(e.arguments[0])}catch(e){console.warn(e)}if(e.arguments.length>=2)try{r=f(e.arguments[1])}catch(e){console.warn(e)}return t=Math.min(r,t),r=Math.max(r,t),t+Math.random()*(r-t)}return Math[e.callee.name].apply(null,e.arguments.map(f))}throw new Error("Unknown node");default:throw new Error("Unknown node type: "+e.type)}}a.addBinaryOp("^",11,!0);var b={mousehover:!0,scroll:!0,dragdrop:!0,tracking:!0,resize:!0,conditional:!0,variables:!0,"api-services":!0,"ai-assistant":!0,textinputs:!0,audio:!0,video:!0,"create-destroy":!0,"scene-transition":!0,timeline:!0,transitions:!0,"misc-actions":!0},g=Object.keys(b),E={MouseHover:"mousehover",Scroll:"scroll",DragDrop:"dragdrop",Follow:"tracking",LookAt:"tracking",Resize:"resize",Conditional:"conditional",VariableChange:"variables",API:"api-services",WEBHOOK:"api-services",AIAssistantListener:"ai-assistant",AIAssistantTrigger:"ai-assistant"},x={Audio:"audio",Video:"video",Particles:"particles",Link:"misc-actions",Reset:"misc-actions",SwitchCamera:"misc-actions",ClearLocalStorage:"misc-actions",Create:"create-destroy",Destroy:"create-destroy",Transition:"transitions",Animation:"transitions",TimelineAnimation:"timeline",SceneTransition:"scene-transition",SetVariable:"variables",DynamicVariablePlay:"variables",UserAPI:"api-services"};function y(e){return"object"==typeof e&&null!==e}var m=class extends Error{};function _(e,t){void 0!==t&&t in b&&e.add(t)}function A(e,t){let r=new Set,i=e=>{if(void 0!==e){if(!Array.isArray(e))throw new m;for(let t of e){if(!y(t))throw new m;n(t.data)}}},n=e=>{if(!y(e)||"string"!=typeof e.type)throw new m;_(r,x[e.type]),"Conditional"===e.type&&(i(e.ifActions),i(e.elseActions))},s=e=>{if(!y(e)||"string"!=typeof e.type)throw new m;if(!0!==e.disabled){if(t?.(e.type),_(r,E[e.type]),i(e.actions),i(e.inActions),i(e.outActions),i(e.successActions),i(e.errorActions),void 0!==e.dragDropActions){if(!y(e.dragDropActions))throw new m;for(let t of Object.values(e.dragDropActions))i(t)}if(void 0!==e.gameActions){if(!y(e.gameActions))throw new m;for(let t of Object.values(e.gameActions))i(t)}if(void 0!==e.breakpoints){if(!Array.isArray(e.breakpoints))throw new m;for(let t of e.breakpoints){if(!y(t)||!y(t.data))throw new m;i(t.data.actions)}}}},o=e=>{if(!y(e))throw new m;(e=>{let t=e.events;if(void 0!==t)if(Array.isArray(t))for(let e of t){if(!y(e))throw new m;s(e.data)}else{if(!y(t))throw new m;for(let e of Object.values(t))s(e)}})(e),"Mesh"===e.type&&y(e.geometry)&&"InputGeometry"===e.geometry.type&&r.add("textinputs"),"Page"===e.type&&y(e.uiScene)&&a(e.uiScene.objects)},a=e=>{if(!y(e)||"function"!=typeof e.traverse)throw new m;e.traverse((e,t)=>{o(t)})},h=e=>{if(!y(e))throw new m;void 0!==e.data&&o(e.data);let t=e.children;if(void 0!==t){if(!Array.isArray(t))throw new m;for(let e of t)h(e)}};try{a(e.scene.objects);let t=e.shared;if(void 0!==t){if(!y(t))throw new m;let e=t.variables;if(void 0!==e){if(!Array.isArray(e))throw new m;for(let t of e){if(!y(t)||!y(t.data))throw new m;"dynamicVariableType"in t.data&&r.add("variables")}}let i=t.userAPIs;if(void 0!==i){if(!y(i))throw new m;for(let e of Object.values(i)){let t=y(e)?e.integration:void 0;y(t)&&"VoiceAssistant"===t.type?r.add("ai-assistant"):r.add("api-services")}}let n=t.userWebhooks;if(void 0!==n){if(!y(n))throw new m;Object.keys(n).length>0&&r.add("api-services")}let s=t.lib;if(void 0!==s){if(!y(s))throw new m;let e=s.components;if(void 0!==e){if(!y(e))throw new m;for(let t of Object.values(e)){if(!y(t))throw new m;void 0!==t.asset&&h(t.asset)}}}}}catch{return new Set(g)}return r}function C(e,t){if(void 0===t)return!0;if(0===t.expression.length)return!1;let r=u(t.expression,e,"boolean");return t.negate?!r:!!r}function O(t,n,s,o,a,h){let l={Audio:[],Video:[],Particles:[],Link:[],Destroy:[],Create:[],Reset:[],Transition:[],TimelineAnimation:[],SwitchCamera:[],Animation:[],SceneTransition:[],SetVariable:[],DynamicVariablePlay:[],ClearLocalStorage:[],UserAPI:[]},c=n=>({id:d,data:p})=>{try{if("Conditional"===p.type)return void(r[t.type].includes("Conditional")&&(p.ifActions.forEach(c({expression:p.condition,negate:!1})),p.elseActions.forEach(c({expression:p.condition,negate:!0}))));if(!r[t.type].includes(p.type))return;let u=function(e){return i.get(e)}(p.type);if(void 0===u)return void e(x[p.type]??"misc-actions",`a "${p.type}" action`);let f=u({id:d,data:p,object:h,page:s,shared:o,eventManager:a,eventType:t.type,actionCondition:n});null!=f&&p.type in l&&l[p.type].push(f)}catch(e){}};return n.forEach(c()),l}function w(e){Object.values(e).forEach(e=>{e.forEach(e=>{"function"==typeof e.dispose&&e.dispose()})})}export{u as a,n as b,E as c,A as d,C as e,O as f,w as g};
@@ -1 +1 @@
1
- import{a as t}from"./runtime-chunk-6UQ4Z4JG.js";import{d as e}from"./runtime-chunk-D2IFC55F.js";import{Sc as s}from"./runtime-chunk-VGN7YHB7.js";var r=class extends(e(s,t)){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),"Empty"===this.data.type&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&1===Object.keys(t).length&&e.scene.reloadSplats()}};export{r as a};
1
+ import{a as t}from"./runtime-chunk-DZOSSY2K.js";import{d as e}from"./runtime-chunk-CDZQF4NV.js";import{Sc as s}from"./runtime-chunk-VGN7YHB7.js";var r=class extends(e(s,t)){constructor(t,e){super(),this.super_Entity(t,e),this.objectHelper.update(),"Empty"===this.data.type&&(this.objectHelper.visible=!1)}updateState(t,e){this.updateState_Entity(t,e),"buffer"in t&&1===Object.keys(t).length&&e.scene.reloadSplats()}};export{r as a};
@@ -1 +1 @@
1
- import{v as e}from"./runtime-chunk-ZLW3UWOA.js";import{Ec as t,Fc as a,Fd as s,Gc as i,Ge as r,Ib as n,Oc as h,Tc as o,Wd as l,Xd as d,Zc as c,kd as u,ld as g}from"./runtime-chunk-VGN7YHB7.js";var p=null;function b(e){p=e}function m(){return p}var S=null;function f(e){S=e}function M(){return S}var y=new o;function x(e,t,a){return y.setRGB(e,t,a,n),{r:y.r,g:y.g,b:y.b}}var R=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t,w=e=>Array.isArray(e)&&"number"==typeof e[0]&&"number"==typeof e[1]?[e[0],e[1]]:[0,0];function v(e,t,a){let s,i=R(e.angle,0),[r,n]=w(e.offset),[h,o]=w(e.morph),l=e.colors??[],d=e.steps??[],c=Math.min(10,l.length,d.length);if(0===c)return[1,1,1,1];if(1===e.gradientType){let e=3*(t+h)-(t+r)-1,l=3*(a+o)-(a+n)-1;s=Math.hypot(e,l)+i}else if(2===e.gradientType){let e=-1*Math.atan2(t+h-.5+r,a+o-.5+n),l=i/Math.PI/-2+.5*e/Math.PI;s=l-Math.floor(l)}else{let e=.5+h/(0!==t?t:1e-6),l=o/(0!==a?a:1e-6),d=Math.cos(i)*e-Math.sin(i)*l,c=Math.sin(i)*e+Math.cos(i)*l,u=d*d+c*c;s=u>1e-12?(((t-.5+r)/2+d/2)*d+((a-.5+n)/2+c/2)*c)/u:0}let u=l[0][0],g=l[0][1],p=l[0][2],b=l[0][3];for(let t=1;t<c;t++){let a=d[t-1],i=d[t]-a,r=0!==i?Math.min(1,Math.max(0,(s-a)/i)):s>=a?1:0;e.smooth&&(r=r*r*(3-2*r)),u+=(l[t][0]-u)*r,g+=(l[t][1]-g)*r,p+=(l[t][2]-p)*r,b+=(l[t][3]-b)*r}return[u,g,p,b]}function A(e,t){let a=e,s=a?.data?.layers;if(s&&"function"==typeof s.forEach){let e=t,a=[];return s.forEach(t=>{let s=t.data;if(!1===s.visible||!0===s.isMask)return;let i=R(s.alpha,1);if(!(i<=0))if("color"===s.type){let t,r=s.color;"string"==typeof r?t="function"==typeof e?.color?e.color(r):void 0:r&&"number"==typeof r.r&&(t=r),t&&a.push({kind:"color",layer:s,rgb:{...x(t.r,t.g,t.b),a:t.a??1},alpha:i})}else"gradient"===s.type&&a.push({kind:"gradient",layer:s,alpha:i})}),0===a.length?null:(e,t)=>{let s=1,i=1,r=1,n=!0;for(let h of a){let a,o,l,d;if("color"===h.kind)({r:a,g:o,b:l}=h.rgb),d=h.rgb.a;else{let[s,i,r,n]=v(h.layer,e,t);({r:a,g:o,b:l}=x(s,i,r)),d=n}let c=n?1:Math.min(1,Math.max(0,d*h.alpha));s+=(a-s)*c,i+=(o-i)*c,r+=(l-r)*c,n=!1}return{r:s,g:i,b:r}}}if(a?.color&&!0===a.color.isColor){let{r:e,g:t,b:s}=a.color;return()=>({r:e,g:t,b:s})}return null}var j=32,I=16384,W=32*I,H=100;function O(e,t){if("torus"===e){let e=t()*Math.PI*2,a=t()*Math.PI*2,s=Math.cos(e),i=Math.sin(e),r=Math.cos(a),n=Math.sin(a);return{x:(1.4+.7*r)*s,y:-(1.4+.7*r)*i,z:.7*n,nx:r*s,ny:-r*i,nz:n,cr:1,cg:1,cb:1}}if("cylinder"===e){let e=t()*Math.PI*2,a=Math.cos(e),s=Math.sin(e);return{x:.8*a,y:1.6*(t()-.5),z:.8*s,nx:a,ny:0,nz:s,cr:1,cg:1,cb:1}}let a=t()*Math.PI*2,s=2*t()-1,i=Math.acos(s),r=Math.sin(i)*Math.cos(a),n=Math.cos(i),h=Math.sin(i)*Math.sin(a);return{x:r,y:n,z:h,nx:r,ny:n,nz:h,cr:1,cg:1,cb:1}}function C(e){let{geometry:t,matrix:a}=e,s=t.getAttribute("position");if(!s||s.count<3)return null;let r=t.getAttribute("normal"),n=t.getAttribute("uv"),h=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:s.count/3;if(l<1)return null;let d=(e,t)=>o?o.getX(3*e+t):3*e+t,c=a?a.elements:null,u=a?(new i).getNormalMatrix(a).elements:null,g=e=>{let t=s.getX(e),a=s.getY(e),i=s.getZ(e);return c?c[0]*t+c[4]*a+c[8]*i+c[12]:t},p=e=>{let t=s.getX(e),a=s.getY(e),i=s.getZ(e);return c?c[1]*t+c[5]*a+c[9]*i+c[13]:a},b=e=>{let t=s.getX(e),a=s.getY(e),i=s.getZ(e);return c?c[2]*t+c[6]*a+c[10]*i+c[14]:i},m=new Float64Array(l),S=0;for(let e=0;e<l;e++){let t=d(e,0),a=d(e,1),s=d(e,2),i=g(t),r=p(t),n=b(t),h=g(a)-i,o=p(a)-r,l=b(a)-n,c=g(s)-i,u=p(s)-r,f=b(s)-n,M=o*f-l*u,y=l*c-h*f,x=h*u-o*c;S+=.5*Math.sqrt(M*M+y*y+x*x),m[e]=S}return S<=0?null:{total:S,sample:(t,a)=>{let s=0,i=l-1;for(;s<i;){let e=s+i>>1;m[e]<t?s=e+1:i=e}let o=s,c=d(o,0),S=d(o,1),f=d(o,2),M=a(),y=a();M+y>1&&(M=1-M,y=1-y);let x,R,w,v=1-M-y,A=g(c)*v+g(S)*M+g(f)*y,j=p(c)*v+p(S)*M+p(f)*y,I=b(c)*v+b(S)*M+b(f)*y;if(r){if(x=r.getX(c)*v+r.getX(S)*M+r.getX(f)*y,R=r.getY(c)*v+r.getY(S)*M+r.getY(f)*y,w=r.getZ(c)*v+r.getZ(S)*M+r.getZ(f)*y,u){let e=u[0]*x+u[3]*R+u[6]*w,t=u[1]*x+u[4]*R+u[7]*w,a=u[2]*x+u[5]*R+u[8]*w;x=e,R=t,w=a}}else{let e=g(c),t=p(c),a=b(c),s=g(S)-e,i=p(S)-t,r=b(S)-a,n=g(f)-e,h=p(f)-t,o=b(f)-a;x=i*o-r*h,R=r*n-s*o,w=s*h-i*n}let W=Math.sqrt(x*x+R*R+w*w)||1,H=1,O=1,C=1;if(h)H=h.getX(c)*v+h.getX(S)*M+h.getX(f)*y,O=h.getY(c)*v+h.getY(S)*M+h.getY(f)*y,C=h.getZ(c)*v+h.getZ(S)*M+h.getZ(f)*y;else if(e.sampleColor){let t=n?n.getX(c)*v+n.getX(S)*M+n.getX(f)*y:.5,a=n?n.getY(c)*v+n.getY(S)*M+n.getY(f)*y:.5,s=e.sampleColor(t,a);s&&(H=s.r,O=s.g,C=s.b)}return{x:A,y:j,z:I,nx:x/W,ny:R/W,nz:w/W,cr:H,cg:O,cb:C}}}}function F(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),I),a=function(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(e.seed??1337),s="object"===e.shape&&e.sampler,i=s?e.samplerRadius??H:H,r=new Float32Array(4*W),n=new Float32Array(W),h=new Float32Array(4*I).fill(1);for(let o=0;o<t;o++){let t=s?e.sampler(a):O(e.shape,a),l=s?t.x:t.x*i,d=s?t.y:t.y*i,c=s?t.z:t.z*i,{nx:u,ny:g,nz:p}=t;h[4*o+0]=t.cr,h[4*o+1]=t.cg,h[4*o+2]=t.cb;let b,m,S,f=32*o,M=(1.8+.8*a())*e.hairLength*i/31,y=.5+1.5*a(),x=(.02+.06*a())*i;Math.abs(g)<.99?(b=-p,m=0,S=u):(b=1,m=0,S=0);let R=Math.sqrt(b*b+m*m+S*S)||1;for(let e=0;e<32;e++){let t=e/31,a=t*t*.4*i,s=x*Math.sin(t*y*Math.PI*2),h=4*(f+e);r[h+0]=l+u*M*e+s*b/R,r[h+1]=d+g*M*e-a+s*m/R,r[h+2]=c+p*M*e+s*S/R,r[h+3]=0===e?0:1,e<31&&(n[f+e]=M)}}return{initialPositions:r,restLengths:n,unitScale:i,rootColors:h}}var k=1/60,z=4,L=new h,P=new t,G=new a,X=new a,B=class extends e{constructor(e,t,a){super(e,t),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=a,this.data=t,this.geometry.setAttribute("position",new c(new Float32Array(0),3)),this.material=new u({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new g(new l(H,48,32),new u({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let s=new r;s.setAttribute("position",new c(new Float32Array(12),3)),s.setIndex([0,2,1,2,3,1]),s.instanceCount=0,this.ribbonMesh=new g(s,new u({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=t.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:t.guideStrands,hairLength:t.hairLength,spreadRadius:t.spreadRadius,headShape:t.headShape,baseObjectId:t.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*k*2))}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer — the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((void 0!==e.guideStrands||void 0!==e.hairLength||void 0!==e.spreadRadius||void 0!==e.headShape||void 0!==e.baseObjectId)&&this.regenerate(),(void 0!==e.headShape||void 0!==e.baseObjectId)&&this.applyScalpState(),void 0!==e.headColor){let t=this.scalpMesh.material;!0===t.isMeshBasicMaterial&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,n)}(void 0!==e.castShadow||void 0!==e.receiveShadow)&&this.applyShadowState(),void 0!==e.autoPlay&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(null===t||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let a=null===t||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),a&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:a,hairLength:s}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,"object"===e&&t){let e=this.context.scene.find(t);if(e){this.baseFoundAtRegen=!0,e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?function(e){let t=[];for(let a of e){let e=C(a);e&&t.push(e)}if(0===t.length)return null;let a=new Float64Array(t.length),s=0;for(let e=0;e<t.length;e++)s+=t[e].total,a[e]=s;return s<=0?null:e=>{let i=e()*s,r=0,n=t.length-1;for(;r<n;){let e=r+n>>1;a[e]<i?r=e+1:n=e}let h=0===r?i:i-a[r-1];return t[r].sample(h,e)}}(t.sources):null;if(this.baseSourceGeomsAtRegen=t?.sources.map(e=>e.geometry)??[],this.baseSourceHashesAtRegen=t?.hashes??[],this.baseColorHashAtRegen=t?.colorHash??0,t&&i){let r=this.baseWorldScale(e),n=Math.max(t.radius*r,.001);this.baseScaleAtRegen=r;let h=r;return F({shape:"object",guideStrands:a,hairLength:s,sampler:e=>{let t=i(e);return{...t,x:t.x*h,y:t.y*h,z:t.z*h}},samplerRadius:n})}}}return F({shape:"object"===e?"sphere":e,guideStrands:a,hairLength:s})}collectBaseSources(e){let t=[],a=[],s=0,i=0;L.copy(e.matrixWorld).invert();let r=L.clone(),n=o=>{if(!0===o.isHairSystem||o!==e&&!1===o.visible)return;let l=o.geometry;if(!0===o.isMesh&&l&&(l.getAttribute("position")?.count??0)>=3){let n=o===e?void 0:(new h).multiplyMatrices(r,o.matrixWorld),d=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:n,sampleColor:A(d,this.context.shared)??void 0}),a.push(B.matrixHash(n)),i+=function(e,t){let a=e,s=0,i=1,r=e=>{s+=e*i,i+=1},n=a?.data?.layers;if(n&&"function"==typeof n.forEach){let e=t;n.forEach(t=>{let a=t.data;if(!1!==a.visible)if("color"===a.type){let t=a.color,s="string"==typeof t?"function"==typeof e?.color?e.color(t):void 0:t;s&&"number"==typeof s.r&&(r(s.r),r(s.g),r(s.b)),r(R(a.alpha,1))}else if("gradient"===a.type){let e=a;for(let t of e.colors??[])r(t[0]),r(t[1]),r(t[2]),r(t[3]);for(let t of e.steps??[])r(t);r(R(e.angle,0)),r(e.gradientType),r(e.smooth?1:0)}})}else a?.color&&!0===a.color.isColor&&(r(a.color.r),r(a.color.g),r(a.color.b));return s}(d,this.context.shared),null===l.boundingSphere&&l.computeBoundingSphere();let c=l.boundingSphere;if(c){let e=0,t=1;n?(G.copy(c.center).applyMatrix4(n),e=G.length(),t=B.matrixMaxScale(n)):e=c.center.length(),s=Math.max(s,e+c.radius*t)}}for(let e of o.children)n(e)};return n(e),0===t.length?null:{sources:t,hashes:a,radius:Math.max(s,.001),colorHash:i}}static matrixHash(e){if(!e)return 0;let t=e.elements,a=0;for(let e=0;e<16;e++)a+=t[e]*(e+1);return a}static matrixMaxScale(e){let t=e.elements,a=Math.hypot(t[0],t[1],t[2]),s=Math.hypot(t[4],t[5],t[6]),i=Math.hypot(t[8],t[9],t[10]);return Math.max(a,s,i,1e-6)}baseWorldScale(e){return L.copy(e.matrixWorld).decompose(G,P,X),Math.max(Math.abs(X.x),Math.abs(X.y),Math.abs(X.z),1e-6)}get widthWorldScale(){return"object"===this.data.headShape&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if("object"!==this.data.headShape||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),a=t?.sources??[],s=t?.hashes??[],i=this.baseSourceGeomsAtRegen,r=this.baseSourceHashesAtRegen,n=a.length!==i.length;if(!n)for(let e=0;e<a.length;e++)if(a[e].geometry!==i[e]||Math.abs(s[e]-r[e])>1e-4*Math.max(Math.abs(r[e]),1)){n=!0;break}if(!n&&"object"===this.data.hairColorSource&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(n=!0),!n&&a.length>0){let t=this.baseWorldScale(e);n=Math.abs(t-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}n&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t="object"===e&&null!==this.data.baseObjectId;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry="torus"===e?new d(140,70,24,48):"cylinder"===e?new s(80,80,160,48,1):new l(H,48,32))}boneTransform(e,t){let a=this.matrixWorld;if("object"===this.data.headShape&&this.data.baseObjectId){let e=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;e&&(a=e)}L.copy(a).decompose(t,e,X)}raycast(e,t){if(!this.scalpMesh.visible)return;let a=[];this.scalpMesh.raycast(e,a);for(let e of a)e.object=this,t.push(e)}get shadowBoundsRadius(){return this.roots.unitScale*(1.5+2.6*Math.max(this.data.hairLength,0))}updateEntityBoxSize(e,t){let a=this.shadowBoundsRadius;e.set(0,0,0),t.set(a,a,a)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),M()?.release(this)}};export{b as a,m as b,f as c,M as d,j as e,I as f,W as g,H as h,k as i,z as j,B as k};
1
+ import{v as e}from"./runtime-chunk-PLJ25O2X.js";import{Ec as t,Fc as a,Fd as s,Gc as i,Ge as r,Ib as n,Oc as h,Tc as o,Wd as l,Xd as d,Zc as c,kd as u,ld as g}from"./runtime-chunk-VGN7YHB7.js";var p=null;function b(e){p=e}function m(){return p}var S=null;function f(e){S=e}function M(){return S}var y=new o;function x(e,t,a){return y.setRGB(e,t,a,n),{r:y.r,g:y.g,b:y.b}}var R=(e,t)=>"number"==typeof e&&Number.isFinite(e)?e:t,w=e=>Array.isArray(e)&&"number"==typeof e[0]&&"number"==typeof e[1]?[e[0],e[1]]:[0,0];function v(e,t,a){let s,i=R(e.angle,0),[r,n]=w(e.offset),[h,o]=w(e.morph),l=e.colors??[],d=e.steps??[],c=Math.min(10,l.length,d.length);if(0===c)return[1,1,1,1];if(1===e.gradientType){let e=3*(t+h)-(t+r)-1,l=3*(a+o)-(a+n)-1;s=Math.hypot(e,l)+i}else if(2===e.gradientType){let e=-1*Math.atan2(t+h-.5+r,a+o-.5+n),l=i/Math.PI/-2+.5*e/Math.PI;s=l-Math.floor(l)}else{let e=.5+h/(0!==t?t:1e-6),l=o/(0!==a?a:1e-6),d=Math.cos(i)*e-Math.sin(i)*l,c=Math.sin(i)*e+Math.cos(i)*l,u=d*d+c*c;s=u>1e-12?(((t-.5+r)/2+d/2)*d+((a-.5+n)/2+c/2)*c)/u:0}let u=l[0][0],g=l[0][1],p=l[0][2],b=l[0][3];for(let t=1;t<c;t++){let a=d[t-1],i=d[t]-a,r=0!==i?Math.min(1,Math.max(0,(s-a)/i)):s>=a?1:0;e.smooth&&(r=r*r*(3-2*r)),u+=(l[t][0]-u)*r,g+=(l[t][1]-g)*r,p+=(l[t][2]-p)*r,b+=(l[t][3]-b)*r}return[u,g,p,b]}function A(e,t){let a=e,s=a?.data?.layers;if(s&&"function"==typeof s.forEach){let e=t,a=[];return s.forEach(t=>{let s=t.data;if(!1===s.visible||!0===s.isMask)return;let i=R(s.alpha,1);if(!(i<=0))if("color"===s.type){let t,r=s.color;"string"==typeof r?t="function"==typeof e?.color?e.color(r):void 0:r&&"number"==typeof r.r&&(t=r),t&&a.push({kind:"color",layer:s,rgb:{...x(t.r,t.g,t.b),a:t.a??1},alpha:i})}else"gradient"===s.type&&a.push({kind:"gradient",layer:s,alpha:i})}),0===a.length?null:(e,t)=>{let s=1,i=1,r=1,n=!0;for(let h of a){let a,o,l,d;if("color"===h.kind)({r:a,g:o,b:l}=h.rgb),d=h.rgb.a;else{let[s,i,r,n]=v(h.layer,e,t);({r:a,g:o,b:l}=x(s,i,r)),d=n}let c=n?1:Math.min(1,Math.max(0,d*h.alpha));s+=(a-s)*c,i+=(o-i)*c,r+=(l-r)*c,n=!1}return{r:s,g:i,b:r}}}if(a?.color&&!0===a.color.isColor){let{r:e,g:t,b:s}=a.color;return()=>({r:e,g:t,b:s})}return null}var j=32,I=16384,W=32*I,H=100;function O(e,t){if("torus"===e){let e=t()*Math.PI*2,a=t()*Math.PI*2,s=Math.cos(e),i=Math.sin(e),r=Math.cos(a),n=Math.sin(a);return{x:(1.4+.7*r)*s,y:-(1.4+.7*r)*i,z:.7*n,nx:r*s,ny:-r*i,nz:n,cr:1,cg:1,cb:1}}if("cylinder"===e){let e=t()*Math.PI*2,a=Math.cos(e),s=Math.sin(e);return{x:.8*a,y:1.6*(t()-.5),z:.8*s,nx:a,ny:0,nz:s,cr:1,cg:1,cb:1}}let a=t()*Math.PI*2,s=2*t()-1,i=Math.acos(s),r=Math.sin(i)*Math.cos(a),n=Math.cos(i),h=Math.sin(i)*Math.sin(a);return{x:r,y:n,z:h,nx:r,ny:n,nz:h,cr:1,cg:1,cb:1}}function C(e){let{geometry:t,matrix:a}=e,s=t.getAttribute("position");if(!s||s.count<3)return null;let r=t.getAttribute("normal"),n=t.getAttribute("uv"),h=t.getAttribute("color"),o=t.getIndex(),l=o?o.count/3:s.count/3;if(l<1)return null;let d=(e,t)=>o?o.getX(3*e+t):3*e+t,c=a?a.elements:null,u=a?(new i).getNormalMatrix(a).elements:null,g=e=>{let t=s.getX(e),a=s.getY(e),i=s.getZ(e);return c?c[0]*t+c[4]*a+c[8]*i+c[12]:t},p=e=>{let t=s.getX(e),a=s.getY(e),i=s.getZ(e);return c?c[1]*t+c[5]*a+c[9]*i+c[13]:a},b=e=>{let t=s.getX(e),a=s.getY(e),i=s.getZ(e);return c?c[2]*t+c[6]*a+c[10]*i+c[14]:i},m=new Float64Array(l),S=0;for(let e=0;e<l;e++){let t=d(e,0),a=d(e,1),s=d(e,2),i=g(t),r=p(t),n=b(t),h=g(a)-i,o=p(a)-r,l=b(a)-n,c=g(s)-i,u=p(s)-r,f=b(s)-n,M=o*f-l*u,y=l*c-h*f,x=h*u-o*c;S+=.5*Math.sqrt(M*M+y*y+x*x),m[e]=S}return S<=0?null:{total:S,sample:(t,a)=>{let s=0,i=l-1;for(;s<i;){let e=s+i>>1;m[e]<t?s=e+1:i=e}let o=s,c=d(o,0),S=d(o,1),f=d(o,2),M=a(),y=a();M+y>1&&(M=1-M,y=1-y);let x,R,w,v=1-M-y,A=g(c)*v+g(S)*M+g(f)*y,j=p(c)*v+p(S)*M+p(f)*y,I=b(c)*v+b(S)*M+b(f)*y;if(r){if(x=r.getX(c)*v+r.getX(S)*M+r.getX(f)*y,R=r.getY(c)*v+r.getY(S)*M+r.getY(f)*y,w=r.getZ(c)*v+r.getZ(S)*M+r.getZ(f)*y,u){let e=u[0]*x+u[3]*R+u[6]*w,t=u[1]*x+u[4]*R+u[7]*w,a=u[2]*x+u[5]*R+u[8]*w;x=e,R=t,w=a}}else{let e=g(c),t=p(c),a=b(c),s=g(S)-e,i=p(S)-t,r=b(S)-a,n=g(f)-e,h=p(f)-t,o=b(f)-a;x=i*o-r*h,R=r*n-s*o,w=s*h-i*n}let W=Math.sqrt(x*x+R*R+w*w)||1,H=1,O=1,C=1;if(h)H=h.getX(c)*v+h.getX(S)*M+h.getX(f)*y,O=h.getY(c)*v+h.getY(S)*M+h.getY(f)*y,C=h.getZ(c)*v+h.getZ(S)*M+h.getZ(f)*y;else if(e.sampleColor){let t=n?n.getX(c)*v+n.getX(S)*M+n.getX(f)*y:.5,a=n?n.getY(c)*v+n.getY(S)*M+n.getY(f)*y:.5,s=e.sampleColor(t,a);s&&(H=s.r,O=s.g,C=s.b)}return{x:A,y:j,z:I,nx:x/W,ny:R/W,nz:w/W,cr:H,cg:O,cb:C}}}}function F(e){let t=Math.min(Math.max(1,Math.floor(e.guideStrands)),I),a=function(e){let t=e>>>0;return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}(e.seed??1337),s="object"===e.shape&&e.sampler,i=s?e.samplerRadius??H:H,r=new Float32Array(4*W),n=new Float32Array(W),h=new Float32Array(4*I).fill(1);for(let o=0;o<t;o++){let t=s?e.sampler(a):O(e.shape,a),l=s?t.x:t.x*i,d=s?t.y:t.y*i,c=s?t.z:t.z*i,{nx:u,ny:g,nz:p}=t;h[4*o+0]=t.cr,h[4*o+1]=t.cg,h[4*o+2]=t.cb;let b,m,S,f=32*o,M=(1.8+.8*a())*e.hairLength*i/31,y=.5+1.5*a(),x=(.02+.06*a())*i;Math.abs(g)<.99?(b=-p,m=0,S=u):(b=1,m=0,S=0);let R=Math.sqrt(b*b+m*m+S*S)||1;for(let e=0;e<32;e++){let t=e/31,a=t*t*.4*i,s=x*Math.sin(t*y*Math.PI*2),h=4*(f+e);r[h+0]=l+u*M*e+s*b/R,r[h+1]=d+g*M*e-a+s*m/R,r[h+2]=c+p*M*e+s*S/R,r[h+3]=0===e?0:1,e<31&&(n[f+e]=M)}}return{initialPositions:r,restLengths:n,unitScale:i,rootColors:h}}var k=1/60,P=4,z=new h,L=new t,X=new a,G=new a,B=class extends e{constructor(e,t,a){super(e,t),this.type="HairSystem",this.isHairSystem=!0,this.simRunning=!1,this.previewRequested=!1,this.playModeActive=!1,this.pendingSimSeconds=0,this.simTime=0,this.resetRequested=!0,this.generation=0,this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,this.classicFallbackWarned=!1,this.regenSnapshot=null,this.context=a,this.data=t,this.geometry.setAttribute("position",new c(new Float32Array(0),3)),this.material=new u({colorWrite:!1,depthWrite:!1}),this.frustumCulled=!1,this.scalpMesh=new g(new l(H,48,32),new u({color:5448477})),this.scalpMesh.name="HairScalp",this.add(this.scalpMesh);let s=new r;s.setAttribute("position",new c(new Float32Array(12),3)),s.setIndex([0,2,1,2,3,1]),s.instanceCount=0,this.ribbonMesh=new g(s,new u({visible:!1})),this.ribbonMesh.name="HairRibbons",this.ribbonMesh.frustumCulled=!1,this.ribbonMesh.visible=!1,this.ribbonMesh.matrixAutoUpdate=!1,this.ribbonMesh.updateMatrixWorld=()=>{this.ribbonMesh.matrixWorld.identity()},this.ribbonMesh.updateWorldMatrix=()=>{this.ribbonMesh.matrixWorld.identity()},this.add(this.ribbonMesh),this.activeGuideStrands=t.guideStrands,this.roots=this.buildRoots(),this.regenSnapshot={guideStrands:t.guideStrands,hairLength:t.hairLength,spreadRadius:t.spreadRadius,headShape:t.headShape,baseObjectId:t.baseObjectId},this.applyScalpState(),this.applyShadowState(),this.syncSimRunning()}update(e){!this.simRunning||(this.pendingSimSeconds=Math.min(this.pendingSimSeconds+e/1e3,4*k*2))}get isSimulating(){return(this.simRunning||this.resetRequested)&&this.visible}startPreview(){this.previewRequested=!0,this.syncSimRunning()}stopPreview(){this.previewRequested=!1,this.syncSimRunning()}setPlayMode(e){this.playModeActive=e,e&&this.resetSimulation(),this.syncSimRunning()}resetSimulation(){this.resetRequested=!0,this.pendingSimSeconds=0,this.simTime=0}warnClassicFallbackOnce(){this.classicFallbackWarned||(this.classicFallbackWarned=!0,console.warn("[spline] Hair System strands require the WebGPU renderer — the WebGL fallback shows only the scalp. Reload with ?renderer=webgpu in a WebGPU-capable browser."))}syncSimRunning(){this.simRunning=this.playModeActive||this.previewRequested||this.data.autoPlay}updateState(e,t){super.updateState(e,t),this.updateHairState(e)}updateHairState(e){if((void 0!==e.guideStrands||void 0!==e.hairLength||void 0!==e.spreadRadius||void 0!==e.headShape||void 0!==e.baseObjectId)&&this.regenerate(),(void 0!==e.headShape||void 0!==e.baseObjectId)&&this.applyScalpState(),void 0!==e.headColor){let t=this.scalpMesh.material;!0===t.isMeshBasicMaterial&&t.color.setRGB(e.headColor.r,e.headColor.g,e.headColor.b,n)}(void 0!==e.castShadow||void 0!==e.receiveShadow)&&this.applyShadowState(),void 0!==e.autoPlay&&this.syncSimRunning()}applyShadowState(){let e=this.data.castShadow??!0,t=this.data.receiveShadow??!0;this.scalpMesh.castShadow=e,this.scalpMesh.receiveShadow=t,this.ribbonMesh.castShadow=e,this.ribbonMesh.receiveShadow=t}regenerate(){this.activeGuideStrands=Math.max(1,Math.min(Math.floor(this.data.guideStrands),16384)),this.roots=this.buildRoots(),this.generation++,this.regenSnapshot={guideStrands:this.data.guideStrands,hairLength:this.data.hairLength,spreadRadius:this.data.spreadRadius,headShape:this.data.headShape,baseObjectId:this.data.baseObjectId},this.resetSimulation()}checkDataDrift(){let e=this.data,t=this.regenSnapshot;if(null===t||t.guideStrands!==e.guideStrands||t.hairLength!==e.hairLength||t.spreadRadius!==e.spreadRadius||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId){let a=null===t||t.headShape!==e.headShape||t.baseObjectId!==e.baseObjectId;this.regenerate(),a&&this.applyScalpState()}this.syncSimRunning(),this.applyShadowState(),this.checkBaseDrift()}buildRoots(){let{headShape:e,baseObjectId:t,guideStrands:a,hairLength:s}=this.data;if(this.baseFoundAtRegen=!1,this.baseSourceGeomsAtRegen=[],this.baseSourceHashesAtRegen=[],this.baseColorHashAtRegen=0,this.baseScaleAtRegen=0,"object"===e&&t){let e=this.context.scene.find(t);if(e){this.baseFoundAtRegen=!0,e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),i=t?function(e){let t=[];for(let a of e){let e=C(a);e&&t.push(e)}if(0===t.length)return null;let a=new Float64Array(t.length),s=0;for(let e=0;e<t.length;e++)s+=t[e].total,a[e]=s;return s<=0?null:e=>{let i=e()*s,r=0,n=t.length-1;for(;r<n;){let e=r+n>>1;a[e]<i?r=e+1:n=e}let h=0===r?i:i-a[r-1];return t[r].sample(h,e)}}(t.sources):null;if(this.baseSourceGeomsAtRegen=t?.sources.map(e=>e.geometry)??[],this.baseSourceHashesAtRegen=t?.hashes??[],this.baseColorHashAtRegen=t?.colorHash??0,t&&i){let r=this.baseWorldScale(e),n=Math.max(t.radius*r,.001);this.baseScaleAtRegen=r;let h=r;return F({shape:"object",guideStrands:a,hairLength:s,sampler:e=>{let t=i(e);return{...t,x:t.x*h,y:t.y*h,z:t.z*h}},samplerRadius:n})}}}return F({shape:"object"===e?"sphere":e,guideStrands:a,hairLength:s})}collectBaseSources(e){let t=[],a=[],s=0,i=0;z.copy(e.matrixWorld).invert();let r=z.clone(),n=o=>{if(!0===o.isHairSystem||o!==e&&!1===o.visible)return;let l=o.geometry;if(!0===o.isMesh&&l&&(l.getAttribute("position")?.count??0)>=3){let n=o===e?void 0:(new h).multiplyMatrices(r,o.matrixWorld),d=Array.isArray(o.material)?o.material[0]:o.material;t.push({geometry:l,matrix:n,sampleColor:A(d,this.context.shared)??void 0}),a.push(B.matrixHash(n)),i+=function(e,t){let a=e,s=0,i=1,r=e=>{s+=e*i,i+=1},n=a?.data?.layers;if(n&&"function"==typeof n.forEach){let e=t;n.forEach(t=>{let a=t.data;if(!1!==a.visible)if("color"===a.type){let t=a.color,s="string"==typeof t?"function"==typeof e?.color?e.color(t):void 0:t;s&&"number"==typeof s.r&&(r(s.r),r(s.g),r(s.b)),r(R(a.alpha,1))}else if("gradient"===a.type){let e=a;for(let t of e.colors??[])r(t[0]),r(t[1]),r(t[2]),r(t[3]);for(let t of e.steps??[])r(t);r(R(e.angle,0)),r(e.gradientType),r(e.smooth?1:0)}})}else a?.color&&!0===a.color.isColor&&(r(a.color.r),r(a.color.g),r(a.color.b));return s}(d,this.context.shared),null===l.boundingSphere&&l.computeBoundingSphere();let c=l.boundingSphere;if(c){let e=0,t=1;n?(X.copy(c.center).applyMatrix4(n),e=X.length(),t=B.matrixMaxScale(n)):e=c.center.length(),s=Math.max(s,e+c.radius*t)}}for(let e of o.children)n(e)};return n(e),0===t.length?null:{sources:t,hashes:a,radius:Math.max(s,.001),colorHash:i}}static matrixHash(e){if(!e)return 0;let t=e.elements,a=0;for(let e=0;e<16;e++)a+=t[e]*(e+1);return a}static matrixMaxScale(e){let t=e.elements,a=Math.hypot(t[0],t[1],t[2]),s=Math.hypot(t[4],t[5],t[6]),i=Math.hypot(t[8],t[9],t[10]);return Math.max(a,s,i,1e-6)}baseWorldScale(e){return z.copy(e.matrixWorld).decompose(X,L,G),Math.max(Math.abs(G.x),Math.abs(G.y),Math.abs(G.z),1e-6)}get widthWorldScale(){return"object"===this.data.headShape&&this.data.baseObjectId&&this.baseScaleAtRegen>0?this.baseScaleAtRegen:1}checkBaseDrift(){if("object"!==this.data.headShape||!this.data.baseObjectId)return;let e=this.context.scene.find(this.data.baseObjectId);if(!e)return;if(!this.baseFoundAtRegen)return void this.regenerate();e.updateWorldMatrix(!0,!0);let t=this.collectBaseSources(e),a=t?.sources??[],s=t?.hashes??[],i=this.baseSourceGeomsAtRegen,r=this.baseSourceHashesAtRegen,n=a.length!==i.length;if(!n)for(let e=0;e<a.length;e++)if(a[e].geometry!==i[e]||Math.abs(s[e]-r[e])>1e-4*Math.max(Math.abs(r[e]),1)){n=!0;break}if(!n&&"object"===this.data.hairColorSource&&(t?.colorHash??0)!==this.baseColorHashAtRegen&&(n=!0),!n&&a.length>0){let t=this.baseWorldScale(e);n=Math.abs(t-this.baseScaleAtRegen)>.001*Math.max(this.baseScaleAtRegen,1e-6)}n&&this.regenerate()}applyScalpState(){let e=this.data.headShape,t="object"===e&&null!==this.data.baseObjectId;this.scalpMesh.visible=!t,!t&&(this.scalpMesh.geometry.dispose(),this.scalpMesh.geometry="torus"===e?new d(140,70,24,48):"cylinder"===e?new s(80,80,160,48,1):new l(H,48,32))}boneTransform(e,t){let a=this.matrixWorld;if("object"===this.data.headShape&&this.data.baseObjectId){let e=this.context.scene.find(this.data.baseObjectId)?.matrixWorld;e&&(a=e)}z.copy(a).decompose(t,e,G)}raycast(e,t){if(!this.scalpMesh.visible)return;let a=[];this.scalpMesh.raycast(e,a);for(let e of a)e.object=this,t.push(e)}get shadowBoundsRadius(){return this.roots.unitScale*(1.5+2.6*Math.max(this.data.hairLength,0))}updateEntityBoxSize(e,t){let a=this.shadowBoundsRadius;e.set(0,0,0),t.set(a,a,a)}dispose(){super.dispose(),this.scalpMesh.geometry.dispose(),this.scalpMesh.material.dispose(),this.ribbonMesh.geometry.dispose(),this.ribbonMesh.material.dispose?.(),M()?.release(this)}};export{b as a,m as b,f as c,M as d,j as e,I as f,W as g,H as h,k as i,P as j,B as k};
@@ -1 +1 @@
1
- import{a as t}from"./runtime-chunk-6UQ4Z4JG.js";import{d as e}from"./runtime-chunk-D2IFC55F.js";import{Sc as s}from"./runtime-chunk-VGN7YHB7.js";var r=class extends(e(s,t)){constructor(t,e,s){super(),this.super_Entity(t,e),this.context=s,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}};export{r as a};
1
+ import{a as t}from"./runtime-chunk-DZOSSY2K.js";import{d as e}from"./runtime-chunk-CDZQF4NV.js";import{Sc as s}from"./runtime-chunk-VGN7YHB7.js";var r=class extends(e(s,t)){constructor(t,e,s){super(),this.super_Entity(t,e),this.context=s,this.objectHelper.update()}updateState(t,e){this.updateState_Entity(t,e)}};export{r as a};
@@ -1 +1 @@
1
- import{a as t}from"./runtime-chunk-RAAW7WHN.js";import{b as e}from"./runtime-chunk-D6NWJJTR.js";import{$ as i,C as r}from"./runtime-chunk-NRJDJMQZ.js";import{f as n,v as s}from"./runtime-chunk-ZLW3UWOA.js";import{c as a}from"./runtime-chunk-2PT2WH66.js";import{c as o}from"./runtime-chunk-4KZXQGUQ.js";import{M as l}from"./runtime-chunk-OW6T4XFV.js";import{Cc as h,Ec as d,Fc as c,Oc as u,Pc as p,Rc as m,Wc as f,qd as y}from"./runtime-chunk-VGN7YHB7.js";import{a as b,b as x}from"./runtime-chunk-ML3Z74BL.js";var g=x(b((t,e)=>{var i,r;i=t,r=function(){return t.importState=function(e){var i=new t;return i.importState(e),i},t;function t(){return function(t){var e=0,i=0,r=0,n=1;0==t.length&&(t=[+new Date]);var s=function(){var t=4022871197,e=function(e){e=e.toString();for(var i=0;i<e.length;i++){var r=.02519603282416938*(t+=e.charCodeAt(i));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)};return e.version="Mash 0.9",e}();e=s(" "),i=s(" "),r=s(" ");for(var a=0;a<t.length;a++)(e-=s(t[a]))<0&&(e+=1),(i-=s(t[a]))<0&&(i+=1),(r-=s(t[a]))<0&&(r+=1);s=null;var o=function(){var t=2091639*e+2.3283064365386963e-10*n;return e=i,i=r,r=t-(n=0|t)};return o.next=o,o.uint32=function(){return 4294967296*o()},o.fract53=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.version="Alea 0.9",o.args=t,o.exportState=function(){return[e,i,r,n]},o.importState=function(t){e=+t[0]||0,i=+t[1]||0,r=+t[2]||0,n=+t[3]||0},o}(Array.prototype.slice.call(arguments))}},"object"==typeof t?e.exports=r():"function"==typeof define&&define.amd?define(r):i.Alea=r()})()),M=.5*(Math.sqrt(3)-1),v=(3-Math.sqrt(3))/6,w=1/3,j=1/6,A=(Math.sqrt(5),Math.sqrt(5),t=>0|Math.floor(t)),S=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),F=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);function _(t){let e=new Uint8Array(512);for(let t=0;t<256;t++)e[t]=t;for(let i=0;i<255;i++){let r=i+~~(t()*(256-i)),n=e[i];e[i]=e[r],e[r]=n}for(let t=256;t<512;t++)e[t]=e[t-256];return e}var W=new f,z=class{constructor(t){this.weightAttribute=null;let e=t.geometry;if(!e.isBufferGeometry||3!==e.attributes.position.itemSize)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");e.index&&(e=e.toNonIndexed()),this.geometry=e,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let t=this.positionAttribute,e=new Float32Array(t.count/3);for(let i=0;i<t.count;i+=3){let r=1;W.a.fromBufferAttribute(t,i),W.b.fromBufferAttribute(t,i+1),W.c.fromBufferAttribute(t,i+2),r*=W.getArea(),e[i/3]=r}this.distribution=new Float32Array(t.count/3);let i=0;for(let t=0;t<e.length;t++)i+=e[t],this.distribution[t]=i;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e){if(this.distribution){let i=this.distribution[this.distribution.length-1],r=this.binarySearch(this.randomFunction()*i);return this.sampleFace(r,t,e)}}binarySearch(t){if(!this.distribution)return 0;let e=this.distribution,i=0,r=e.length-1,n=-1;for(;i<=r;){let s=Math.ceil((i+r)/2);if(0===s||e[s-1]<=t&&e[s]>t){n=s;break}t<e[s]?r=s-1:i=s+1}return n}sampleFace(t,e,i){let r=this.randomFunction(),n=this.randomFunction();return r+n>1&&(r=1-r,n=1-n),W.a.fromBufferAttribute(this.positionAttribute,3*t),W.b.fromBufferAttribute(this.positionAttribute,3*t+1),W.c.fromBufferAttribute(this.positionAttribute,3*t+2),e.set(0,0,0).addScaledVector(W.a,r).addScaledVector(W.b,n).addScaledVector(W.c,1-(r+n)),W.getNormal(i),this}},O={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},C={polygon_center:0,edge:1,vertex:2},N=(t,e)=>(i,r)=>e&&0!==i&&0!==t?t*r/100:0,P=(t,e)=>{let i=Math.abs(e),r=-1*i;return(t- -1)*(i-r)/2+r},T=new c,R=new c,V=new c,k=new c;function B(t,e){let i=V.fromArray(t),r=k.fromArray(e);R.copy(r).sub(i);let n=R.length();return R.normalize().multiplyScalar(.5*n),T.copy(i).add(R).toArray()}var U,D,I,q,E=new f,L=new c,G=new c,$=new c,H=class extends y{},J=class extends H{constructor(t,e){super(void 0,void 0,e),this.source=t,this.isClonerInstancedMesh=!0,this.hiddenMatrix=new u,this.pivotMatrix=new u,this.previousModelViewMatrix=new u,this.copyPreviousMatrix=!0,this.capacity=e,this.count=0,this.matrixAutoUpdate=!1}raycast(t,e){}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(let e of this.children)e.updateMatrixWorld(t)}updateWorldMatrix(t,e){let i=this.parent;if(t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),e)for(let t of this.children)t.updateWorldMatrix(!1,!0)}onAfterRender(t,e,i,r,n,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}get visible(){return!0!==this.source.cloner?.insideBoolean&&(this.source.visible||this.source.dataPatched.visible&&!0===this.source.dataPatched.cloner?.hideBase)}set visible(t){}get castShadow(){return this.source.castShadow}set castShadow(t){}get receiveShadow(){return this.source.receiveShadow}set receiveShadow(t){}get layers(){return this.source.layers}set layers(t){}get geometry(){return this.source.geometry}set geometry(t){}get material(){return this.source.material}set material(t){}get morphTargetInfluences(){return this.source.morphTargetInfluences}set morphTargetInfluences(t){}},Q=t=>.5*(1-Math.cos(t*Math.PI)),Z=class{constructor(){this.perlin=new Array(4096)}noise(t,e=0,i=0){if(null==this.perlin){this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=Math.random()}t<0&&(t=-t),e<0&&(e=-e),i<0&&(i=-i);let r,n,s,a,o,l=Math.floor(t),h=Math.floor(e),d=Math.floor(i),c=t-l,u=e-h,p=i-d,m=0,f=.5;for(let t=0;t<4;t++){let t=l+(h<<4)+(d<<8);r=Q(c),n=Q(u),s=this.perlin[4095&t],s+=r*(this.perlin[t+1&4095]-s),a=this.perlin[t+16&4095],a+=r*(this.perlin[t+16+1&4095]-a),s+=n*(a-s),t+=256,a=this.perlin[4095&t],a+=r*(this.perlin[t+1&4095]-a),o=this.perlin[t+16&4095],o+=r*(this.perlin[t+16+1&4095]-o),a+=n*(o-a),s+=Q(p)*(a-s),m+=s*f,f*=.5,l<<=1,c*=2,h<<=1,u*=2,d<<=1,p*=2,c>=1&&(l++,c--),u>=1&&(h++,u--),p>=1&&(d++,p--)}return m}noiseSeed(t){let e=(()=>{let t,e;return{setSeed(i){e=t=(i??4294967296*Math.random())>>>0},getSeed:()=>t,rand:()=>(e=(1664525*e+1013904223)%4294967296,e/4294967296)}})();e.setSeed(t),this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=e.rand()}},X=1e-4,K=new c,Y=new c;r.then(t=>{D=[(U=t).get_face_center,U.get_edge_midpoint,U.get_vertex_position],I=[U.get_face_normal,U.get_edge_normal,U.get_vertex_normal],q=[U.face_count,U.edge_count,U.vertex_count]}),new u;var tt=new u,et=new u,it=new u,rt=new u,nt=new u,st=new u,at=new u,ot=new c,lt=new c,ht=new c,dt=new c,ct=new c,ut=new c,pt=new c,mt=new c,ft=new c,yt=new c,bt=new c,xt=new p,gt=new d;function Mt(t){return t?t.version??t.data?.version??0:-1}function vt(t,e){return["number"==typeof t?.[0]?t[0]:"string"==typeof t?.[0]&&e?parseFloat(String(e.shared.getVariable(t[0])??"0")):0,"number"==typeof t?.[1]?t[1]:"string"==typeof t?.[1]&&e?parseFloat(String(e.shared.getVariable(t[1])??"0")):0,"number"==typeof t?.[2]?t[2]:"string"==typeof t?.[2]&&e?parseFloat(String(e.shared.getVariable(t[2])??"0")):0]}var wt=class{constructor(t,e){this.data=t,this.is3D=e,this.perlin=new Z,"perlin"===t.noiseType?(this.perlin.noiseSeed(t.seed),this.noise=e?(t,e,i)=>this.perlin.noise(t,e,i):t=>this.perlin.noise(t)):this.noise=e?function(t=Math.random){let e=_(t),i=new Float64Array(e).map(t=>F[t%12*3]),r=new Float64Array(e).map(t=>F[t%12*3+1]),n=new Float64Array(e).map(t=>F[t%12*3+2]);return function(t,s,a){let o,l,h,d,c,u,p,m,f,y,b=(t+s+a)*w,x=A(t+b),g=A(s+b),M=A(a+b),v=(x+g+M)*j,S=t-(x-v),F=s-(g-v),_=a-(M-v);S>=F?F>=_?(c=1,u=0,p=0,m=1,f=1,y=0):S>=_?(c=1,u=0,p=0,m=1,f=0,y=1):(c=0,u=0,p=1,m=1,f=0,y=1):F<_?(c=0,u=0,p=1,m=0,f=1,y=1):S<_?(c=0,u=1,p=0,m=0,f=1,y=1):(c=0,u=1,p=0,m=1,f=1,y=0);let W=S-c+j,z=F-u+j,O=_-p+j,C=S-m+2*j,N=F-f+2*j,P=_-y+2*j,T=S-1+.5,R=F-1+.5,V=_-1+.5,k=255&x,B=255&g,U=255&M,D=.6-S*S-F*F-_*_;if(D<0)o=0;else{let t=k+e[B+e[U]];D*=D,o=D*D*(i[t]*S+r[t]*F+n[t]*_)}let I=.6-W*W-z*z-O*O;if(I<0)l=0;else{let t=k+c+e[B+u+e[U+p]];I*=I,l=I*I*(i[t]*W+r[t]*z+n[t]*O)}let q=.6-C*C-N*N-P*P;if(q<0)h=0;else{let t=k+m+e[B+f+e[U+y]];q*=q,h=q*q*(i[t]*C+r[t]*N+n[t]*P)}let E=.6-T*T-R*R-V*V;if(E<0)d=0;else{let t=k+1+e[B+1+e[U+1]];E*=E,d=E*E*(i[t]*T+r[t]*R+n[t]*V)}return 32*(o+l+h+d)}}((0,g.default)(t.seed)):function(t=Math.random){let e=_(t),i=new Float64Array(e).map(t=>S[t%12*2]),r=new Float64Array(e).map(t=>S[t%12*2+1]);return function(t,n){let s,a,o=0,l=0,h=0,d=(t+n)*M,c=A(t+d),u=A(n+d),p=(c+u)*v,m=t-(c-p),f=n-(u-p);m>f?(s=1,a=0):(s=0,a=1);let y=m-s+v,b=f-a+v,x=m-1+2*v,g=f-1+2*v,w=255&c,j=255&u,S=.5-m*m-f*f;if(S>=0){let t=w+e[j];S*=S,o=S*S*(i[t]*m+r[t]*f)}let F=.5-y*y-b*b;if(F>=0){let t=w+s+e[j+a];F*=F,l=F*F*(i[t]*y+r[t]*b)}let _=.5-x*x-g*g;if(_>=0){let t=w+1+e[j+1];_*=_,h=_*_*(i[t]*x+r[t]*g)}return 70*(o+l+h)}}((0,g.default)(t.seed??""))}},jt=class extends(n(m)){constructor(t,e){super(),this.parameters=e,this.isCloner=!0,this.objectForSample=void 0,this._pendingMediaLoad=!1,this.random=null,this.surfaceSamplerCache=null,this.surfacePointsCache=null,this.object=t}resetOnMove(){this.removeFromParent(),this.parent=null}removeFromParent(){return super.removeFromParent(),this.instancedMesh?.removeFromParent(),this}dispose(){this.removeFromParent(),this._disposeInstancedMesh(),this._invalidateBoolean()}_invalidateBoolean(){this.object instanceof s&&this.object.onClonerLayoutUpdated()}expandClones(t){if(null===this.parent)this.updateState(this.parameters,t);else{for(let t of this.children)t instanceof i&&t.expand();this._syncInstancedMesh()}}invalidateTransform(t){this.matrixWorldNeedsUpdate=!0}onObjUpdateMatrix(){"toObject"!==this.parameters.type&&(this.matrixWorldNeedsUpdate=!0)}update(t){switch(this._updateCount(t),this.parameters.type){case"radial":this._updateRadial(this.parameters,t);break;case"linear":this._updateLinear(this.parameters,t);break;case"grid":this._updateGrid(this.parameters,t);break;case"toObject":this._updateToObject(this.parameters,t)}for(let t of this.children){let e=t.transformOverride;void 0!==e&&(t.position.fromArray(e.position),t.rotation.fromArray(e.rotation),t.scale.fromArray(e.scale)),t.updateMatrix(),t.hasNonUniformScale&&(t.updateMatrixWorld(),t.updateMatrixWorldRigid())}this._syncInstancedMesh(),this._invalidateBoolean()}get instancingActive(){return void 0!==this.instancedMesh}get insideBoolean(){return null!==this.parent&&"booleanOp"in this.parent}_instancingEligible(){if(!0!==this.parameters.instanced)return!1;let t=this.object;return!(t.entityChildrenCount()>0||!0!==t.isMesh||a(t)||!0===t.isDecalObject)}_syncInstancedMesh(){if(!this._instancingEligible())return void this._disposeInstancedMesh();let t=this.instancedMesh;if(void 0!==t&&t.capacity<this.children.length&&(this._disposeInstancedMesh(),t=void 0),void 0===t){let e=Math.max(8,Math.ceil(1.5*this.children.length));t=this.instancedMesh=new J(this.object,e)}t.matrix=this.matrix,t.hiddenMatrix=this.hiddenMatrix,t.matrixWorldNeedsUpdate=!0,t.parent!==this.parent&&(t.removeFromParent(),this.parent?.add(t)),this.syncInstanceMatrices()}syncInstanceMatrices(){this._invalidateBoolean();let t=this.instancedMesh;if(void 0===t)return;let e=0;for(let i of this.children)!1!==i.playModeVisible&&(et.multiplyMatrices(i.hiddenMatrix,i.matrix).multiply(i.pivotMatrix),t.setMatrixAt(e++,et));t.count=e,t.instanceMatrix.needsUpdate=!0,t.boundingSphere=null}_disposeInstancedMesh(){let t=this.instancedMesh;void 0!==t&&(this.instancedMesh=void 0,t.removeFromParent(),t.dispose())}_updateCount(t,e){let r;if(void 0!==e)r=e;else{let e=vt(this.parameters.grid.count,t);r="grid"===this.parameters.type?Math.round(e[0])*Math.round(e[1])*Math.round(e[2]):this.parameters.count}if("toObject"===this.parameters.type)if(this.parameters.toObject.object){if(void 0===e&&"random"!==this.parameters.toObject.spreadType)return}else r=0;if(this.children.length!==r)if(this.children.length<r)for(let t=0,e=r-this.children.length;t<e;++t){let t=new i(this.object);t.expand(),this.add(t)}else for(;this.children.length>r;){let t=this.children.pop();t.parent=null,t.dispatchEvent({type:"removed"}),this.dispatchEvent({type:"childremoved",child:t})}}getRandom(t,e=!1){return(null===this.random||this.random.data.seed!==t.seed||this.random.data.noiseType!==t.noiseType||this.random.is3D!==e)&&(this.random=new wt(t,e)),this.random}_updateRadial(t,e){let i,r=t.radial,n=r.start*h.DEG2RAD,s=n-r.end*h.DEG2RAD,a=vt(r.rotation,e),o=new p(a[0],a[1],a[2]);switch(r.axis){case"z":i=new c(0,0,1);break;case"y":i=new c(0,1,0);break;default:i=new c(1,0,0)}let d=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,u=!0===this.parameters.randomness&&0!==d.strength?this.getRandom(d):null,m=vt(r.scale,e),f=vt(r.position,e),y=vt(d.scale,e),b=vt(d.position,e),x=vt(d.rotation,e),g=s/t.count,M=N(d.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let s=t*(d.freqScale/10)+d.movement,a=null===u?0:u.noise(s,s,s),l=t+1;e.scale.x=m[0]+M(l,P(a,y[0]))||X,e.scale.y=m[1]+M(l,P(a,y[1]))||X,e.scale.z=m[2]+M(l,P(a,y[2]))||X;let h=g*t-n;switch(r.axis){default:case"x":xt.set(0,h,0);break;case"y":xt.set(0,0,h);break;case"z":xt.set(h,0,0)}pt.copy(i).applyQuaternion(gt.setFromEuler(xt)).multiplyScalar(r.radius),e.position.set(pt.x+(f[0]+M(l,P(a,b[0]))),pt.y+(f[1]+M(l,P(a,b[1]))),pt.z+(f[2]+M(l,P(a,b[2]))));let c=M(l,P(a,x[0])),p=M(l,P(a,x[1])),v=M(l,P(a,x[2]));!0===r.alignment?e.rotation.set(xt.x+(o.x+c),xt.y+(o.y+p),xt.z+(o.z+v)):e.rotation.set(o.x+c,o.y+p,o.z+v)}}_updateLinear(t,e){if("linear"!==t.type)throw new Error;let i=t.linear,r=vt(i.rotation,e),n=vt(i.scale,e),s=vt(i.position,e),a=new p(r[0]??0,r[1]??0,r[2]??0),o=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,h=vt(o.rotation,e),d=vt(o.scale,e),c=vt(o.position,e),u=!0===this.parameters.randomness&&0!==o.strength?this.getRandom(o):null,m=N(o.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let i=t*(o.freqScale/10)+o.movement,r=null===u?0:u.noise(i,i,i),l=t+1,p=m(l,P(r,h[0])),f=m(l,P(r,h[1])),y=m(l,P(r,h[2]));e.scale.x=1+(n[0]-1)*t+m(l,P(r,d[0]))||X,e.scale.y=1+(n[1]-1)*t+m(l,P(r,d[1]))||X,e.scale.z=1+(n[2]-1)*t+m(l,P(r,d[2]))||X,e.rotation.set(a.x*t+p,a.y*t+f,a.z*t+y),e.position.x=s[0]*t+m(l,P(r,c[0])),e.position.y=s[1]*t+m(l,P(r,c[1])),e.position.z=s[2]*t+m(l,P(r,c[2]))}}_updateGrid(t,e){let i=0,r=t.grid,n=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,s=vt(n.scale,e),a=vt(n.rotation,e),o=vt(n.position,e),h=!0===this.parameters.randomness&&0!==n.strength?this.getRandom(n,!0):null,d=N(n.strength,this.parameters.randomness),u=vt(r.count,e),p=vt(r.size,e);if(!0===r.useCenter){let t={x:u[0]%2==0?2:1,y:u[1]%2==0?2:1,z:u[2]%2==0?2:1},e=new c(p[0]*(u[0]-t.x)*.5,p[1]*(u[1]-t.y)*.5,p[2]*(u[2]-t.z)*.5);for(let t=0;t<u[0];t++)for(let r=0;r<u[1];r++)for(let l=0;l<u[2];l++){let c=this.children[i++];if(!c)continue;let u=null===h?0:h.noise((t+1)*(n.freqScale/10)+n.movement,(r+1)*(n.freqScale/10)+n.movement,(l+1)*(n.freqScale/10)+n.movement);c.scale.x=1+d(i,P(u,s[0]))||X,c.scale.y=1+d(i,P(u,s[1]))||X,c.scale.z=1+d(i,P(u,s[2]))||X;let m=d(i,P(u,a[0])),f=d(i,P(u,a[1])),y=d(i,P(u,a[2]));c.rotation.set(m,f,y),c.position.x=p[0]*t-e.x+d(i,P(u,o[0])),c.position.y=p[1]*r-e.y+d(i,P(u,o[1])),c.position.z=p[2]*l-e.z+d(i,P(u,o[2]))}}else for(let t=0;t<u[0];t++)for(let e=0;e<u[1];e++)for(let r=0;r<u[2];r++){let l=this.children[i++];if(!l)continue;let c=null===h?0:h.noise((t+1)*(n.freqScale/10)+n.movement,(e+1)*(n.freqScale/10)+n.movement,(r+1)*(n.freqScale/10)+n.movement);l.scale.x=1+d(i,P(c,s[0]))||X,l.scale.y=1+d(i,P(c,s[1]))||X,l.scale.z=1+d(i,P(c,s[2]))||X;let u=d(i,P(c,a[0])),m=d(i,P(c,a[1])),f=d(i,P(c,a[2]));l.rotation.set(u,m,f),l.position.x=p[0]*t+d(i,P(c,o[0])),l.position.y=-p[1]*e+d(i,P(c,o[1])),l.position.z=-p[2]*r+d(i,P(c,o[2]))}}_updateToObject(i,r){if("toObject"!==i.type)throw new Error;let{toObject:n}=i,s=vt(n.rotation,r),a=vt(n.position,r),o=vt(n.scale,r),h=new p(s[0],s[1],s[2]),d=i.randomnessObject??l.defaultData([1,1,1]).randomnessObject,c=vt(d.rotation,r),u=vt(d.position,r),m=vt(d.scale,r),f=!0===this.parameters.randomness&&0!==d.strength?this.getRandom(d):null,y=N(d.strength,this.parameters.randomness);if(!n.object){for(let[,t]of this.children.entries())t.position.set(0,0,0),t.scale.setScalar(1),t.rotation.set(0,0,0);return this.objectForSample=void 0,void this.invalidateSurfaceCaches()}if(!this.objectForSample)return;if(this.objectForSample instanceof t){if(!this.objectForSample.font?.isLoaded||void 0===this.objectForSample.geometry.attributes.position)return void(this._pendingMediaLoad=!0);this._pendingMediaLoad=!1}if(void 0===this.objectForSample.geometry&&this.objectForSample.isAncestorOf(this.object.uuid))return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) seem to be a child/descendant of the object it's being cloned to. Please re-parent it so that they are siblings instead.`);let b=this.getSubdivData();if(b.length>0){let t=Math.round(b.length*n.count/100);this._updateCount(r,t)}else{let t=this.objectForSample.geometry.getAttribute("position");if(!t||isNaN(t.count)||0===t.count)return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`)}this.objectForSample.updateMatrixWorld();let x="random"===n.spreadType,M=null;x&&(M=this.getSurfaceSampler(),M.setRandomGenerator((0,g.default)(this.object.uuid+n.seed)));let v=O[n.axis],w=this.children;ot.fromArray(v),it.copy(this.object.hiddenMatrix).invert();let j=this.objectForSample instanceof e;j&&rt.copy(this.objectForSample.matrixWorld).invert(),"normal"!==n.align&&this.object.getWorldDirection(ut),yt.set(ot.y,ot.z,ot.x).normalize(),bt.copy(yt).cross(ot).normalize(),st.makeBasis(yt,ot,bt).invert();for(let[t,e]of w.entries()){let i=t*(d.freqScale/10)+d.movement,r=null===f?0:f.noise(i,i,i),s=t+1,l=y(s,P(r,c[0])),p=y(s,P(r,c[1])),g=y(s,P(r,c[2]));x?M.sample(ht,dt):(b.length&&(ht.fromArray(b[t].pos),dt.fromArray(b[t].norm)),j&&ht.applyMatrix4(rt)),ht.applyMatrix4(it),e.position.copy(ht);let v="normal"===n.align?dt:ut,w=lt.fromArray(a);lt.x+=y(s,P(r,u[0])),lt.y+=y(s,P(r,u[1])),lt.z+=y(s,P(r,u[2]));let A=Math.acos(v.dot(ot)),S=ct.crossVectors(ot,v).normalize(),F=tt.makeRotationAxis(S,A);mt.copy(v).cross(this.object.up).normalize(),ft.copy(mt).cross(v).normalize(),nt.makeBasis(mt,v,ft),at.multiplyMatrices(nt,st),xt.setFromRotationMatrix(at),w.applyMatrix4(F),e.position.add(w),e.rotation.set(xt.x+h.x+l,xt.y+h.y+p,xt.z+h.z+g),e.scale.set(1+o[0]+y(s,P(r,m[0]))||X,1+o[1]+y(s,P(r,m[1]))||X,1+o[2]+y(s,P(r,m[2]))||X),e.scale.multiply(this.object.scale),e.hiddenMatrix=this.object.hiddenMatrix}}getSurfaceSampler(){let t=this.objectForSample,e=t.geometry,i=e.getAttribute("position"),r=e.index,n=this.surfaceSamplerCache;if(null!==n&&n.geometry===e&&n.position===i&&n.positionVersion===Mt(i)&&n.index===r&&n.indexVersion===(null===r?-1:r.version))return n.sampler;let s=new z(t).build();return this.surfaceSamplerCache={geometry:e,position:i,positionVersion:Mt(i),index:r,indexVersion:null===r?-1:r.version,sampler:s},s}invalidateSurfaceCaches(){this.surfaceSamplerCache=null,this.surfacePointsCache=null}getSubdivData(){if(!this.objectForSample)return[];let t=this.parameters.toObject.spreadType;if("random"===t)return[];let i=this.objectForSample instanceof e,r=this.objectForSample.geometry;if(!i&&r){let e=this.surfacePointsCache,i=r.getAttribute("position");if(null!==e&&e.spreadType===t&&e.geometry===r&&e.position===i&&e.positionVersion===Mt(i)&&e.index===r.index&&e.indexVersion===(null===r.index?-1:r.index.version))return e.points}let n=new Map,s=(t,e)=>{let i=Math.round(1e4*t[0])+"_"+Math.round(1e4*t[1])+"_"+Math.round(1e4*t[2]),r=n.get(i);r?(r.pos[0]+=t[0],r.pos[1]+=t[1],r.pos[2]+=t[2],r.norm[0]+=e[0],r.norm[1]+=e[1],r.norm[2]+=e[2],r.count+=1):n.set(i,{pos:[...t],norm:[...e],count:1})};if(i){let e=this.objectForSample,i=C[t],r=q[i],n=D[i],a=I[i],o=r(e.subdivPointerNew);for(let t=0;t<=o-1;t++){let i=n(e.subdivPointerNew,t),r=a(e.subdivPointerNew,t);K.fromArray(i).applyMatrix4(e.matrixWorld),Y.fromArray(r),s(K.toArray(),Y.toArray())}}else(r.index?function(t){let e=[],i=Math.floor(t.index.count/3);for(let r=0;r<i;r++)if(L.fromArray(t.index.array,3*r),E.setFromAttributeAndIndices(t.attributes.position,L.x,L.y,L.z),E.getNormal(G),E.getMidpoint($),!(isNaN($.x)||isNaN($.y)||isNaN($.z))){let{a:t,b:i,c:r}=E,n=t.toArray(),s=i.toArray(),a=r.toArray(),o=t.distanceTo(i),l=i.distanceTo(r),h=r.distanceTo(t),d=B(n,s),c=B(s,a),u=B(a,n),p=[o,l,h],m=Math.max(...p),f=p.filter(t=>Math.round(t)===Math.round(m)).length>1,y=[],b=E.getMidpoint($).toArray();m===o&&!f&&(y=[c,u,u],b=d),m===l&&!f&&(y=[d,u,u],b=c),m===h&&!f&&(y=[d,c,c],b=u),f&&(y=[d,c,u]),e.push({vertices:[n,s,a],faceCenters:y,midpoint:b,norm:E.getNormal(G).toArray()})}return e}(r):function(t){let e=[],{position:i}=t.attributes;for(let t=0;t<i.count;t++){E.setFromAttributeAndIndices(i,3*t,3*t+1,3*t+2),E.getNormal(G),E.getMidpoint($);let r=E.a.toArray(),n=E.b.toArray(),s=E.c.toArray();e.push({vertices:[r,n,s],faceCenters:[B(r,n),B(n,s),B(s,r)],midpoint:$.toArray(),norm:G.toArray()})}return e}(r)).forEach((e,i)=>{"polygon_center"===t&&s(e.midpoint,e.norm),"vertex"===t&&(s(e.vertices[0],e.norm),s(e.vertices[1],e.norm),s(e.vertices[2],e.norm)),"edge"===t&&(s(e.faceCenters[0],e.norm),s(e.faceCenters[1],e.norm),s(e.faceCenters[2],e.norm))});let a=Array.from(n.values());for(let t of a)t.pos[0]/=t.count,t.pos[1]/=t.count,t.pos[2]/=t.count,t.norm[0]/=t.count,t.norm[1]/=t.count,t.norm[2]/=t.count;if(!i&&r){let e=r.getAttribute("position");this.surfacePointsCache={spreadType:t,geometry:r,position:e,positionVersion:Mt(e),index:r.index,indexVersion:null===r.index?-1:r.index.version,points:a}}return a}updateState(t,e){if(this.parameters=o(t),"toObject"!==this.parameters.type)this.invalidateSurfaceCaches(),(null===this.parent||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.hiddenMatrix=this.object.hiddenMatrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(null===this.parent||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent(),this.invalidateSurfaceCaches();let t=e.scene.find(this.parameters.toObject.object);this.objectForSample=t instanceof s?t:void 0,this.matrix=new u,this.hiddenMatrix=new u,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,t&&t.add(this)}this.update(e)}get pendingMediaLoad(){return this._pendingMediaLoad}};export{jt as a};
1
+ import{a as t}from"./runtime-chunk-243VQV5T.js";import{b as e}from"./runtime-chunk-F7OUYIT6.js";import{$ as i,C as r}from"./runtime-chunk-LALFWESO.js";import{f as n,v as s}from"./runtime-chunk-PLJ25O2X.js";import{c as a}from"./runtime-chunk-2PT2WH66.js";import{c as o}from"./runtime-chunk-4KZXQGUQ.js";import{M as l}from"./runtime-chunk-OW6T4XFV.js";import{Cc as h,Ec as d,Fc as c,Oc as u,Pc as p,Rc as m,Wc as f,qd as y}from"./runtime-chunk-VGN7YHB7.js";import{a as b,b as x}from"./runtime-chunk-ML3Z74BL.js";var g=x(b((t,e)=>{var i,r;i=t,r=function(){return t.importState=function(e){var i=new t;return i.importState(e),i},t;function t(){return function(t){var e=0,i=0,r=0,n=1;0==t.length&&(t=[+new Date]);var s=function(){var t=4022871197,e=function(e){e=e.toString();for(var i=0;i<e.length;i++){var r=.02519603282416938*(t+=e.charCodeAt(i));r-=t=r>>>0,t=(r*=t)>>>0,t+=4294967296*(r-=t)}return 2.3283064365386963e-10*(t>>>0)};return e.version="Mash 0.9",e}();e=s(" "),i=s(" "),r=s(" ");for(var a=0;a<t.length;a++)(e-=s(t[a]))<0&&(e+=1),(i-=s(t[a]))<0&&(i+=1),(r-=s(t[a]))<0&&(r+=1);s=null;var o=function(){var t=2091639*e+2.3283064365386963e-10*n;return e=i,i=r,r=t-(n=0|t)};return o.next=o,o.uint32=function(){return 4294967296*o()},o.fract53=function(){return o()+11102230246251565e-32*(2097152*o()|0)},o.version="Alea 0.9",o.args=t,o.exportState=function(){return[e,i,r,n]},o.importState=function(t){e=+t[0]||0,i=+t[1]||0,r=+t[2]||0,n=+t[3]||0},o}(Array.prototype.slice.call(arguments))}},"object"==typeof t?e.exports=r():"function"==typeof define&&define.amd?define(r):i.Alea=r()})()),v=.5*(Math.sqrt(3)-1),M=(3-Math.sqrt(3))/6,w=1/3,j=1/6,A=(Math.sqrt(5),Math.sqrt(5),t=>0|Math.floor(t)),S=new Float64Array([1,1,-1,1,1,-1,-1,-1,1,0,-1,0,1,0,-1,0,0,1,0,-1,0,1,0,-1]),F=new Float64Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]);function _(t){let e=new Uint8Array(512);for(let t=0;t<256;t++)e[t]=t;for(let i=0;i<255;i++){let r=i+~~(t()*(256-i)),n=e[i];e[i]=e[r],e[r]=n}for(let t=256;t<512;t++)e[t]=e[t-256];return e}var O=new f,W=class{constructor(t){this.weightAttribute=null;let e=t.geometry;if(!e.isBufferGeometry||3!==e.attributes.position.itemSize)throw new Error("THREE.MeshSurfaceSampler: Requires BufferGeometry triangle mesh.");e.index&&(e=e.toNonIndexed()),this.geometry=e,this.randomFunction=Math.random,this.positionAttribute=this.geometry.getAttribute("position"),this.distribution=null}build(){let t=this.positionAttribute,e=new Float32Array(t.count/3);for(let i=0;i<t.count;i+=3){let r=1;O.a.fromBufferAttribute(t,i),O.b.fromBufferAttribute(t,i+1),O.c.fromBufferAttribute(t,i+2),r*=O.getArea(),e[i/3]=r}this.distribution=new Float32Array(t.count/3);let i=0;for(let t=0;t<e.length;t++)i+=e[t],this.distribution[t]=i;return this}setRandomGenerator(t){return this.randomFunction=t,this}sample(t,e){if(this.distribution){let i=this.distribution[this.distribution.length-1],r=this.binarySearch(this.randomFunction()*i);return this.sampleFace(r,t,e)}}binarySearch(t){if(!this.distribution)return 0;let e=this.distribution,i=0,r=e.length-1,n=-1;for(;i<=r;){let s=Math.ceil((i+r)/2);if(0===s||e[s-1]<=t&&e[s]>t){n=s;break}t<e[s]?r=s-1:i=s+1}return n}sampleFace(t,e,i){let r=this.randomFunction(),n=this.randomFunction();return r+n>1&&(r=1-r,n=1-n),O.a.fromBufferAttribute(this.positionAttribute,3*t),O.b.fromBufferAttribute(this.positionAttribute,3*t+1),O.c.fromBufferAttribute(this.positionAttribute,3*t+2),e.set(0,0,0).addScaledVector(O.a,r).addScaledVector(O.b,n).addScaledVector(O.c,1-(r+n)),O.getNormal(i),this}},z={x:[1,0,0],"-x":[-1,0,0],y:[0,1,0],"-y":[0,-1,0],z:[0,0,1],"-z":[0,0,-1]},C={polygon_center:0,edge:1,vertex:2},N=(t,e)=>(i,r)=>e&&0!==i&&0!==t?t*r/100:0,P=(t,e)=>{let i=Math.abs(e),r=-1*i;return(t- -1)*(i-r)/2+r},T=new c,V=new c,k=new c,B=new c;function U(t,e){let i=k.fromArray(t),r=B.fromArray(e);V.copy(r).sub(i);let n=V.length();return V.normalize().multiplyScalar(.5*n),T.copy(i).add(V).toArray()}var I,R,q,D,E=new f,L=new c,G=new c,$=new c,Q=class extends y{},H=class extends Q{constructor(t,e){super(void 0,void 0,e),this.source=t,this.isClonerInstancedMesh=!0,this.hiddenMatrix=new u,this.pivotMatrix=new u,this.previousModelViewMatrix=new u,this.copyPreviousMatrix=!0,this.capacity=e,this.count=0,this.matrixAutoUpdate=!1}raycast(t,e){}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),this.matrixWorldNeedsUpdate=!1,t=!0);for(let e of this.children)e.updateMatrixWorld(t)}updateWorldMatrix(t,e){let i=this.parent;if(t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorld.multiply(this.pivotMatrix),e)for(let t of this.children)t.updateWorldMatrix(!1,!0)}onAfterRender(t,e,i,r,n,s){this.copyPreviousMatrix&&this.previousModelViewMatrix.copy(this.modelViewMatrix)}get visible(){return!0!==this.source.cloner?.insideBoolean&&(this.source.visible||this.source.dataPatched.visible&&!0===this.source.dataPatched.cloner?.hideBase)}set visible(t){}get castShadow(){return this.source.castShadow}set castShadow(t){}get receiveShadow(){return this.source.receiveShadow}set receiveShadow(t){}get layers(){return this.source.layers}set layers(t){}get geometry(){return this.source.geometry}set geometry(t){}get material(){return this.source.material}set material(t){}get morphTargetInfluences(){return this.source.morphTargetInfluences}set morphTargetInfluences(t){}},X=t=>.5*(1-Math.cos(t*Math.PI)),Y=class{constructor(){this.perlin=new Array(4096)}noise(t,e=0,i=0){if(null==this.perlin){this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=Math.random()}t<0&&(t=-t),e<0&&(e=-e),i<0&&(i=-i);let r,n,s,a,o,l=Math.floor(t),h=Math.floor(e),d=Math.floor(i),c=t-l,u=e-h,p=i-d,m=0,f=.5;for(let t=0;t<4;t++){let t=l+(h<<4)+(d<<8);r=X(c),n=X(u),s=this.perlin[4095&t],s+=r*(this.perlin[t+1&4095]-s),a=this.perlin[t+16&4095],a+=r*(this.perlin[t+16+1&4095]-a),s+=n*(a-s),t+=256,a=this.perlin[4095&t],a+=r*(this.perlin[t+1&4095]-a),o=this.perlin[t+16&4095],o+=r*(this.perlin[t+16+1&4095]-o),a+=n*(o-a),s+=X(p)*(a-s),m+=s*f,f*=.5,l<<=1,c*=2,h<<=1,u*=2,d<<=1,p*=2,c>=1&&(l++,c--),u>=1&&(h++,u--),p>=1&&(d++,p--)}return m}noiseSeed(t){let e=(()=>{let t,e;return{setSeed(i){e=t=(i??4294967296*Math.random())>>>0},getSeed:()=>t,rand:()=>(e=(1664525*e+1013904223)%4294967296,e/4294967296)}})();e.setSeed(t),this.perlin=new Array(4096);for(let t=0;t<4096;t++)this.perlin[t]=e.rand()}},Z=1e-4,J=new c,K=new c;r.then(t=>{R=[(I=t).get_face_center,I.get_edge_midpoint,I.get_vertex_position],q=[I.get_face_normal,I.get_edge_normal,I.get_vertex_normal],D=[I.face_count,I.edge_count,I.vertex_count]}),new u;var tt=new u,et=new u,it=new u,rt=new u,nt=new u,st=new u,at=new u,ot=new c,lt=new c,ht=new c,dt=new c,ct=new c,ut=new c,pt=new c,mt=new c,ft=new c,yt=new c,bt=new c,xt=new p,gt=new d;function vt(t){return t?t.version??t.data?.version??0:-1}function Mt(t,e){return["number"==typeof t?.[0]?t[0]:"string"==typeof t?.[0]&&e?parseFloat(String(e.shared.getVariable(t[0])??"0")):0,"number"==typeof t?.[1]?t[1]:"string"==typeof t?.[1]&&e?parseFloat(String(e.shared.getVariable(t[1])??"0")):0,"number"==typeof t?.[2]?t[2]:"string"==typeof t?.[2]&&e?parseFloat(String(e.shared.getVariable(t[2])??"0")):0]}var wt=class{constructor(t,e){this.data=t,this.is3D=e,this.perlin=new Y,"perlin"===t.noiseType?(this.perlin.noiseSeed(t.seed),this.noise=e?(t,e,i)=>this.perlin.noise(t,e,i):t=>this.perlin.noise(t)):this.noise=e?function(t=Math.random){let e=_(t),i=new Float64Array(e).map(t=>F[t%12*3]),r=new Float64Array(e).map(t=>F[t%12*3+1]),n=new Float64Array(e).map(t=>F[t%12*3+2]);return function(t,s,a){let o,l,h,d,c,u,p,m,f,y,b=(t+s+a)*w,x=A(t+b),g=A(s+b),v=A(a+b),M=(x+g+v)*j,S=t-(x-M),F=s-(g-M),_=a-(v-M);S>=F?F>=_?(c=1,u=0,p=0,m=1,f=1,y=0):S>=_?(c=1,u=0,p=0,m=1,f=0,y=1):(c=0,u=0,p=1,m=1,f=0,y=1):F<_?(c=0,u=0,p=1,m=0,f=1,y=1):S<_?(c=0,u=1,p=0,m=0,f=1,y=1):(c=0,u=1,p=0,m=1,f=1,y=0);let O=S-c+j,W=F-u+j,z=_-p+j,C=S-m+2*j,N=F-f+2*j,P=_-y+2*j,T=S-1+.5,V=F-1+.5,k=_-1+.5,B=255&x,U=255&g,I=255&v,R=.6-S*S-F*F-_*_;if(R<0)o=0;else{let t=B+e[U+e[I]];R*=R,o=R*R*(i[t]*S+r[t]*F+n[t]*_)}let q=.6-O*O-W*W-z*z;if(q<0)l=0;else{let t=B+c+e[U+u+e[I+p]];q*=q,l=q*q*(i[t]*O+r[t]*W+n[t]*z)}let D=.6-C*C-N*N-P*P;if(D<0)h=0;else{let t=B+m+e[U+f+e[I+y]];D*=D,h=D*D*(i[t]*C+r[t]*N+n[t]*P)}let E=.6-T*T-V*V-k*k;if(E<0)d=0;else{let t=B+1+e[U+1+e[I+1]];E*=E,d=E*E*(i[t]*T+r[t]*V+n[t]*k)}return 32*(o+l+h+d)}}((0,g.default)(t.seed)):function(t=Math.random){let e=_(t),i=new Float64Array(e).map(t=>S[t%12*2]),r=new Float64Array(e).map(t=>S[t%12*2+1]);return function(t,n){let s,a,o=0,l=0,h=0,d=(t+n)*v,c=A(t+d),u=A(n+d),p=(c+u)*M,m=t-(c-p),f=n-(u-p);m>f?(s=1,a=0):(s=0,a=1);let y=m-s+M,b=f-a+M,x=m-1+2*M,g=f-1+2*M,w=255&c,j=255&u,S=.5-m*m-f*f;if(S>=0){let t=w+e[j];S*=S,o=S*S*(i[t]*m+r[t]*f)}let F=.5-y*y-b*b;if(F>=0){let t=w+s+e[j+a];F*=F,l=F*F*(i[t]*y+r[t]*b)}let _=.5-x*x-g*g;if(_>=0){let t=w+1+e[j+1];_*=_,h=_*_*(i[t]*x+r[t]*g)}return 70*(o+l+h)}}((0,g.default)(t.seed??""))}},jt=class extends(n(m)){constructor(t,e){super(),this.parameters=e,this.isCloner=!0,this.objectForSample=void 0,this._pendingMediaLoad=!1,this.random=null,this.surfaceSamplerCache=null,this.surfacePointsCache=null,this.object=t}resetOnMove(){this.removeFromParent(),this.parent=null}removeFromParent(){return super.removeFromParent(),this.instancedMesh?.removeFromParent(),this}dispose(){this.removeFromParent(),this._disposeInstancedMesh(),this._invalidateBoolean()}_invalidateBoolean(){this.object instanceof s&&this.object.onClonerLayoutUpdated()}expandClones(t){if(null===this.parent)this.updateState(this.parameters,t);else{for(let t of this.children)t instanceof i&&t.expand();this._syncInstancedMesh()}}invalidateTransform(t){this.matrixWorldNeedsUpdate=!0}onObjUpdateMatrix(){"toObject"!==this.parameters.type&&(this.matrixWorldNeedsUpdate=!0)}update(t){switch(this._updateCount(t),this.parameters.type){case"radial":this._updateRadial(this.parameters,t);break;case"linear":this._updateLinear(this.parameters,t);break;case"grid":this._updateGrid(this.parameters,t);break;case"toObject":this._updateToObject(this.parameters,t)}for(let t of this.children){let e=t.transformOverride;void 0!==e&&(t.position.fromArray(e.position),t.rotation.fromArray(e.rotation),t.scale.fromArray(e.scale)),t.updateMatrix(),t.hasNonUniformScale&&(t.updateMatrixWorld(),t.updateMatrixWorldRigid())}this._syncInstancedMesh(),this._invalidateBoolean()}get instancingActive(){return void 0!==this.instancedMesh}get insideBoolean(){return null!==this.parent&&"booleanOp"in this.parent}_instancingEligible(){if(!0!==this.parameters.instanced)return!1;let t=this.object;return!(t.entityChildrenCount()>0||!0!==t.isMesh||a(t)||!0===t.isDecalObject)}_syncInstancedMesh(){if(!this._instancingEligible())return void this._disposeInstancedMesh();let t=this.instancedMesh;if(void 0!==t&&t.capacity<this.children.length&&(this._disposeInstancedMesh(),t=void 0),void 0===t){let e=Math.max(8,Math.ceil(1.5*this.children.length));t=this.instancedMesh=new H(this.object,e)}t.matrix=this.matrix,t.hiddenMatrix=this.hiddenMatrix,t.matrixWorldNeedsUpdate=!0,t.parent!==this.parent&&(t.removeFromParent(),this.parent?.add(t)),this.syncInstanceMatrices()}syncInstanceMatrices(){this._invalidateBoolean();let t=this.instancedMesh;if(void 0===t)return;let e=0;for(let i of this.children)!1!==i.playModeVisible&&(et.multiplyMatrices(i.hiddenMatrix,i.matrix).multiply(i.pivotMatrix),t.setMatrixAt(e++,et));t.count=e,t.instanceMatrix.needsUpdate=!0,t.boundingSphere=null}_disposeInstancedMesh(){let t=this.instancedMesh;void 0!==t&&(this.instancedMesh=void 0,t.removeFromParent(),t.dispose())}_updateCount(t,e){let r;if(void 0!==e)r=e;else{let e=Mt(this.parameters.grid.count,t);r="grid"===this.parameters.type?Math.round(e[0])*Math.round(e[1])*Math.round(e[2]):this.parameters.count}if("toObject"===this.parameters.type)if(this.parameters.toObject.object){if(void 0===e&&"random"!==this.parameters.toObject.spreadType)return}else r=0;if(this.children.length!==r)if(this.children.length<r)for(let t=0,e=r-this.children.length;t<e;++t){let t=new i(this.object);t.expand(),this.add(t)}else for(;this.children.length>r;){let t=this.children.pop();t.parent=null,t.dispatchEvent({type:"removed"}),this.dispatchEvent({type:"childremoved",child:t})}}getRandom(t,e=!1){return(null===this.random||this.random.data.seed!==t.seed||this.random.data.noiseType!==t.noiseType||this.random.is3D!==e)&&(this.random=new wt(t,e)),this.random}_updateRadial(t,e){let i,r=t.radial,n=r.start*h.DEG2RAD,s=n-r.end*h.DEG2RAD,a=Mt(r.rotation,e),o=new p(a[0],a[1],a[2]);switch(r.axis){case"z":i=new c(0,0,1);break;case"y":i=new c(0,1,0);break;default:i=new c(1,0,0)}let d=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,u=!0===this.parameters.randomness&&0!==d.strength?this.getRandom(d):null,m=Mt(r.scale,e),f=Mt(r.position,e),y=Mt(d.scale,e),b=Mt(d.position,e),x=Mt(d.rotation,e),g=s/t.count,v=N(d.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let s=t*(d.freqScale/10)+d.movement,a=null===u?0:u.noise(s,s,s),l=t+1;e.scale.x=m[0]+v(l,P(a,y[0]))||Z,e.scale.y=m[1]+v(l,P(a,y[1]))||Z,e.scale.z=m[2]+v(l,P(a,y[2]))||Z;let h=g*t-n;switch(r.axis){default:case"x":xt.set(0,h,0);break;case"y":xt.set(0,0,h);break;case"z":xt.set(h,0,0)}pt.copy(i).applyQuaternion(gt.setFromEuler(xt)).multiplyScalar(r.radius),e.position.set(pt.x+(f[0]+v(l,P(a,b[0]))),pt.y+(f[1]+v(l,P(a,b[1]))),pt.z+(f[2]+v(l,P(a,b[2]))));let c=v(l,P(a,x[0])),p=v(l,P(a,x[1])),M=v(l,P(a,x[2]));!0===r.alignment?e.rotation.set(xt.x+(o.x+c),xt.y+(o.y+p),xt.z+(o.z+M)):e.rotation.set(o.x+c,o.y+p,o.z+M)}}_updateLinear(t,e){if("linear"!==t.type)throw new Error;let i=t.linear,r=Mt(i.rotation,e),n=Mt(i.scale,e),s=Mt(i.position,e),a=new p(r[0]??0,r[1]??0,r[2]??0),o=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,h=Mt(o.rotation,e),d=Mt(o.scale,e),c=Mt(o.position,e),u=!0===this.parameters.randomness&&0!==o.strength?this.getRandom(o):null,m=N(o.strength,this.parameters.randomness);for(let[t,e]of this.children.entries()){let i=t*(o.freqScale/10)+o.movement,r=null===u?0:u.noise(i,i,i),l=t+1,p=m(l,P(r,h[0])),f=m(l,P(r,h[1])),y=m(l,P(r,h[2]));e.scale.x=1+(n[0]-1)*t+m(l,P(r,d[0]))||Z,e.scale.y=1+(n[1]-1)*t+m(l,P(r,d[1]))||Z,e.scale.z=1+(n[2]-1)*t+m(l,P(r,d[2]))||Z,e.rotation.set(a.x*t+p,a.y*t+f,a.z*t+y),e.position.x=s[0]*t+m(l,P(r,c[0])),e.position.y=s[1]*t+m(l,P(r,c[1])),e.position.z=s[2]*t+m(l,P(r,c[2]))}}_updateGrid(t,e){let i=0,r=t.grid,n=t.randomnessObject??l.defaultData([1,1,1]).randomnessObject,s=Mt(n.scale,e),a=Mt(n.rotation,e),o=Mt(n.position,e),h=!0===this.parameters.randomness&&0!==n.strength?this.getRandom(n,!0):null,d=N(n.strength,this.parameters.randomness),u=Mt(r.count,e),p=Mt(r.size,e);if(!0===r.useCenter){let t={x:u[0]%2==0?2:1,y:u[1]%2==0?2:1,z:u[2]%2==0?2:1},e=new c(p[0]*(u[0]-t.x)*.5,p[1]*(u[1]-t.y)*.5,p[2]*(u[2]-t.z)*.5);for(let t=0;t<u[0];t++)for(let r=0;r<u[1];r++)for(let l=0;l<u[2];l++){let c=this.children[i++];if(!c)continue;let u=null===h?0:h.noise((t+1)*(n.freqScale/10)+n.movement,(r+1)*(n.freqScale/10)+n.movement,(l+1)*(n.freqScale/10)+n.movement);c.scale.x=1+d(i,P(u,s[0]))||Z,c.scale.y=1+d(i,P(u,s[1]))||Z,c.scale.z=1+d(i,P(u,s[2]))||Z;let m=d(i,P(u,a[0])),f=d(i,P(u,a[1])),y=d(i,P(u,a[2]));c.rotation.set(m,f,y),c.position.x=p[0]*t-e.x+d(i,P(u,o[0])),c.position.y=p[1]*r-e.y+d(i,P(u,o[1])),c.position.z=p[2]*l-e.z+d(i,P(u,o[2]))}}else for(let t=0;t<u[0];t++)for(let e=0;e<u[1];e++)for(let r=0;r<u[2];r++){let l=this.children[i++];if(!l)continue;let c=null===h?0:h.noise((t+1)*(n.freqScale/10)+n.movement,(e+1)*(n.freqScale/10)+n.movement,(r+1)*(n.freqScale/10)+n.movement);l.scale.x=1+d(i,P(c,s[0]))||Z,l.scale.y=1+d(i,P(c,s[1]))||Z,l.scale.z=1+d(i,P(c,s[2]))||Z;let u=d(i,P(c,a[0])),m=d(i,P(c,a[1])),f=d(i,P(c,a[2]));l.rotation.set(u,m,f),l.position.x=p[0]*t+d(i,P(c,o[0])),l.position.y=-p[1]*e+d(i,P(c,o[1])),l.position.z=-p[2]*r+d(i,P(c,o[2]))}}_updateToObject(i,r){if("toObject"!==i.type)throw new Error;let{toObject:n}=i,s=Mt(n.rotation,r),a=Mt(n.position,r),o=Mt(n.scale,r),h=new p(s[0],s[1],s[2]),d=i.randomnessObject??l.defaultData([1,1,1]).randomnessObject,c=Mt(d.rotation,r),u=Mt(d.position,r),m=Mt(d.scale,r),f=!0===this.parameters.randomness&&0!==d.strength?this.getRandom(d):null,y=N(d.strength,this.parameters.randomness);if(!n.object){for(let[,t]of this.children.entries())t.position.set(0,0,0),t.scale.setScalar(1),t.rotation.set(0,0,0);return this.objectForSample=void 0,void this.invalidateSurfaceCaches()}if(!this.objectForSample)return;if(this.objectForSample instanceof t){if(!this.objectForSample.font?.isLoaded||void 0===this.objectForSample.geometry.attributes.position)return void(this._pendingMediaLoad=!0);this._pendingMediaLoad=!1}if(void 0===this.objectForSample.geometry&&this.objectForSample.isAncestorOf(this.object.uuid))return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) seem to be a child/descendant of the object it's being cloned to. Please re-parent it so that they are siblings instead.`);let b=this.getSubdivData();if(b.length>0){let t=Math.round(b.length*n.count/100);this._updateCount(r,t)}else{let t=this.objectForSample.geometry.getAttribute("position");if(!t||isNaN(t.count)||0===t.count)return void console.warn(`Oh no! The object "${this.object.name}" (${this.object.uuid}) cannot be cloned on the surface of "${this.objectForSample.name}" (${this.objectForSample.uuid}) because the latter does not have a valid geometry.`)}this.objectForSample.updateMatrixWorld();let x="random"===n.spreadType,v=null;x&&(v=this.getSurfaceSampler(),v.setRandomGenerator((0,g.default)(this.object.uuid+n.seed)));let M=z[n.axis],w=this.children;ot.fromArray(M),it.copy(this.object.hiddenMatrix).invert();let j=this.objectForSample instanceof e;j&&rt.copy(this.objectForSample.matrixWorld).invert(),"normal"!==n.align&&this.object.getWorldDirection(ut),yt.set(ot.y,ot.z,ot.x).normalize(),bt.copy(yt).cross(ot).normalize(),st.makeBasis(yt,ot,bt).invert();for(let[t,e]of w.entries()){let i=t*(d.freqScale/10)+d.movement,r=null===f?0:f.noise(i,i,i),s=t+1,l=y(s,P(r,c[0])),p=y(s,P(r,c[1])),g=y(s,P(r,c[2]));x?v.sample(ht,dt):(b.length&&(ht.fromArray(b[t].pos),dt.fromArray(b[t].norm)),j&&ht.applyMatrix4(rt)),ht.applyMatrix4(it),e.position.copy(ht);let M="normal"===n.align?dt:ut,w=lt.fromArray(a);lt.x+=y(s,P(r,u[0])),lt.y+=y(s,P(r,u[1])),lt.z+=y(s,P(r,u[2]));let A=Math.acos(M.dot(ot)),S=ct.crossVectors(ot,M).normalize(),F=tt.makeRotationAxis(S,A);mt.copy(M).cross(this.object.up).normalize(),ft.copy(mt).cross(M).normalize(),nt.makeBasis(mt,M,ft),at.multiplyMatrices(nt,st),xt.setFromRotationMatrix(at),w.applyMatrix4(F),e.position.add(w),e.rotation.set(xt.x+h.x+l,xt.y+h.y+p,xt.z+h.z+g),e.scale.set(1+o[0]+y(s,P(r,m[0]))||Z,1+o[1]+y(s,P(r,m[1]))||Z,1+o[2]+y(s,P(r,m[2]))||Z),e.scale.multiply(this.object.scale),e.hiddenMatrix=this.object.hiddenMatrix}}getSurfaceSampler(){let t=this.objectForSample,e=t.geometry,i=e.getAttribute("position"),r=e.index,n=this.surfaceSamplerCache;if(null!==n&&n.geometry===e&&n.position===i&&n.positionVersion===vt(i)&&n.index===r&&n.indexVersion===(null===r?-1:r.version))return n.sampler;let s=new W(t).build();return this.surfaceSamplerCache={geometry:e,position:i,positionVersion:vt(i),index:r,indexVersion:null===r?-1:r.version,sampler:s},s}invalidateSurfaceCaches(){this.surfaceSamplerCache=null,this.surfacePointsCache=null}getSubdivData(){if(!this.objectForSample)return[];let t=this.parameters.toObject.spreadType;if("random"===t)return[];let i=this.objectForSample instanceof e,r=this.objectForSample.geometry;if(!i&&r){let e=this.surfacePointsCache,i=r.getAttribute("position");if(null!==e&&e.spreadType===t&&e.geometry===r&&e.position===i&&e.positionVersion===vt(i)&&e.index===r.index&&e.indexVersion===(null===r.index?-1:r.index.version))return e.points}let n=new Map,s=(t,e)=>{let i=Math.round(1e4*t[0])+"_"+Math.round(1e4*t[1])+"_"+Math.round(1e4*t[2]),r=n.get(i);r?(r.pos[0]+=t[0],r.pos[1]+=t[1],r.pos[2]+=t[2],r.norm[0]+=e[0],r.norm[1]+=e[1],r.norm[2]+=e[2],r.count+=1):n.set(i,{pos:[...t],norm:[...e],count:1})};if(i){let e=this.objectForSample,i=C[t],r=D[i],n=R[i],a=q[i],o=r(e.subdivPointerNew);for(let t=0;t<=o-1;t++){let i=n(e.subdivPointerNew,t),r=a(e.subdivPointerNew,t);J.fromArray(i).applyMatrix4(e.matrixWorld),K.fromArray(r),s(J.toArray(),K.toArray())}}else(r.index?function(t){let e=[],i=Math.floor(t.index.count/3);for(let r=0;r<i;r++)if(L.fromArray(t.index.array,3*r),E.setFromAttributeAndIndices(t.attributes.position,L.x,L.y,L.z),E.getNormal(G),E.getMidpoint($),!(isNaN($.x)||isNaN($.y)||isNaN($.z))){let{a:t,b:i,c:r}=E,n=t.toArray(),s=i.toArray(),a=r.toArray(),o=t.distanceTo(i),l=i.distanceTo(r),h=r.distanceTo(t),d=U(n,s),c=U(s,a),u=U(a,n),p=[o,l,h],m=Math.max(...p),f=p.filter(t=>Math.round(t)===Math.round(m)).length>1,y=[],b=E.getMidpoint($).toArray();m===o&&!f&&(y=[c,u,u],b=d),m===l&&!f&&(y=[d,u,u],b=c),m===h&&!f&&(y=[d,c,c],b=u),f&&(y=[d,c,u]),e.push({vertices:[n,s,a],faceCenters:y,midpoint:b,norm:E.getNormal(G).toArray()})}return e}(r):function(t){let e=[],{position:i}=t.attributes;for(let t=0;t<i.count;t++){E.setFromAttributeAndIndices(i,3*t,3*t+1,3*t+2),E.getNormal(G),E.getMidpoint($);let r=E.a.toArray(),n=E.b.toArray(),s=E.c.toArray();e.push({vertices:[r,n,s],faceCenters:[U(r,n),U(n,s),U(s,r)],midpoint:$.toArray(),norm:G.toArray()})}return e}(r)).forEach((e,i)=>{"polygon_center"===t&&s(e.midpoint,e.norm),"vertex"===t&&(s(e.vertices[0],e.norm),s(e.vertices[1],e.norm),s(e.vertices[2],e.norm)),"edge"===t&&(s(e.faceCenters[0],e.norm),s(e.faceCenters[1],e.norm),s(e.faceCenters[2],e.norm))});let a=Array.from(n.values());for(let t of a)t.pos[0]/=t.count,t.pos[1]/=t.count,t.pos[2]/=t.count,t.norm[0]/=t.count,t.norm[1]/=t.count,t.norm[2]/=t.count;if(!i&&r){let e=r.getAttribute("position");this.surfacePointsCache={spreadType:t,geometry:r,position:e,positionVersion:vt(e),index:r.index,indexVersion:null===r.index?-1:r.index.version,points:a}}return a}updateState(t,e){if(this.parameters=o(t),"toObject"!==this.parameters.type)this.invalidateSurfaceCaches(),(null===this.parent||this.parent!==this.object)&&(this.removeFromParent(),this.object.parent?.add(this),this.matrix=this.object.matrix,this.hiddenMatrix=this.object.hiddenMatrix,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1);else if(null===this.parent||this.parent.uuid!==this.parameters.toObject.object){this.removeFromParent(),this.invalidateSurfaceCaches();let t=e.scene.find(this.parameters.toObject.object);this.objectForSample=t instanceof s?t:void 0,this.matrix=new u,this.hiddenMatrix=new u,this.matrixWorldNeedsUpdate=!0,this.matrixAutoUpdate=!1,t&&t.add(this)}this.update(e)}get pendingMediaLoad(){return this._pendingMediaLoad}};export{jt as a};
@@ -1 +1 @@
1
- import{a as e}from"./runtime-chunk-TU4KDRKR.js";import{W as o}from"./runtime-chunk-NRJDJMQZ.js";import{Dc as n,Fc as t,Jc as r}from"./runtime-chunk-VGN7YHB7.js";var i={enabled:!1},s=new WeakMap;function a(e){if(!i.enabled)return e;let o=s.get(e);return o||(o={...e,bloom:{...e.bloom,kernelSize:0},depthOfField:{...e.depthOfField,enabled:!1}},s.set(e,o)),o}var c=new WeakSet;function l(e){if(!e.isPointLight&&!e.isSpotLight&&!e.isDirectionalLight)return!1;if(i.enabled){if(!0===e.castShadow)return e.castShadow=!1,c.add(e),!0}else if(c.has(e)&&(c.delete(e),!1===e.castShadow))return e.castShadow=!0,!0;return!1}function u(i,s){switch(i.type){case"cavity":return function(e,o){return{...h(e,o),ridge:e.ridge,valley:e.valley}}(i,s);case"dust":return function(n,t){return{...h(n,t),color:e(n.color,t),coverage:o(n.coverage,t)??.2,softness:o(n.softness,t)??.2,noiseStrength:o(n.noiseStrength,t)??.2,noiseScale:o(n.noiseScale,t)??1}}(i,s);case"fresnel":return function(o,n){let{bias:t,scale:r,intensity:i,factor:s,color:a}=o;return{...h(o,n),color:e(a,n),bias:t,scale:r,intensity:i,factor:s}}(i,s);case"gradient":return function(e,o){let{gradientType:t,smooth:i,colors:s,steps:a,angle:c,offset:l,morph:u}=e;return{...h(e,o),gradientType:t,smooth:i,colors:s.map(e=>new r(e[0],e[1],e[2],e[3])),num:s.length,steps:a,offset:new n(...l.map(e=>"number"==typeof e?e:0)),morph:new n(...u.map(e=>"number"==typeof e?e:0)),angle:c}}(i,s);case"depth":return function(e,o){let{gradientType:n,near:i,far:s,isVector:a,isWorldSpace:c,origin:l,direction:u,colors:f,steps:p,smooth:m}=e;return{...h(e,o),gradientType:n,near:i,far:s,isVector:a,isWorldSpace:c,origin:new t(...l),direction:u?new t(...u):new t(1,0,0),colors:f.map(e=>void 0!==e?new r(e[0],e[1],e[2],e[3]):new r(0,0,0,0)),steps:p.slice(0,f.length),smooth:m}}(i,s);case"normal":return function(e,o){let{cnormal:n}=e;return{...h(e,o),cnormal:new t(n[0],n[1],n[2])}}(i,s);case"noise":return function(o,r){return{...h(o,r),scale:o.scale,move:o.move,fA:new n(...o.fA.map(e=>"number"==typeof e?e:0)),fB:new n(...o.fB.map(e=>"number"==typeof e?e:0)),size:new t(...o.size),distortion:new n(...o.distortion.map(e=>"number"==typeof e?e:0)),colorA:e(o.colorA,r),colorB:e(o.colorB,r),colorC:e(o.colorC,r),colorD:e(o.colorD,r),noiseType:o.noiseType,voronoiStyle:o.voronoiStyle,highCut:o.highCut,lowCut:o.lowCut,smoothness:o.smoothness,seed:o.seed,quality:o.quality}}(i,s);case"rainbow":return function(e,o){return{...h(e,o),filmThickness:e.filmThickness,movement:e.movement,wavelengths:new t(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new t(...e.offset)}}(i,s);case"toon":return function(o,n){return{...h(o,n),positioning:o.positioning,colors:o.colors.map(e=>new r(e[0],e[1],e[2],e[3])),num:o.colors.length,steps:o.steps,source:new t(...o.source),isWorldSpace:o.isWorldSpace,noiseStrength:o.noiseStrength,noiseScale:o.noiseScale,shadowColor:e(o.shadowColor,n),offset:new t(...o.offset)}}(i,s);case"outline":return function(o,n){return{...h(o,n),outlineColor:e(o.outlineColor,n),contourColor:e(o.contourColor,n),outlineWidth:o.outlineWidth,contourWidth:o.contourWidth,outlineThreshold:o.outlineThreshold,contourThreshold:o.contourThreshold,outlineSmoothing:o.outlineSmoothing,contourFrequency:o.contourFrequency,contourDirection:new t(...o.contourDirection),positionalLines:o.positionalLines,compensation:o.compensation}}(i,s);case"transmission":return function(o,n){return{...h(o,n),thickness:o.thickness,ior:o.ior,roughness:o.roughness,attenuationColor:void 0!==o.attenuationColor?e(o.attenuationColor,n):{r:1,g:1,b:1,a:1},attenuationDistance:o.attenuationDistance??0}}(i,s);case"reflection":return function(e,n){return{...h(e,n),blur:o(e.blur,n)??0,thickness:o(e.thickness,n)??.001,steps:o(e.steps,n)??60,stepSize:o(e.stepSize,n)??.005,tracingMode:e.tracingMode,mirror:e.mirror??0}}(i,s);case"pattern":return function(o,t){return{...h(o,t),style:o.style,projection:o.projection,axis:o.axis,blending:o.blending,offset:new n(...o.offset.map(e=>"number"==typeof e?e:0)),colorA:e(o.colorA,t),colorB:e(o.colorB,t),frequency:new n(...o.frequency.map(e=>"number"==typeof e?e:0)),size:o.size,variation:o.variation,smoothness:o.smoothness,zigzag:o.zigzag,rotation:o.rotation,vertical:new n(...o.vertical.map(e=>"number"==typeof e?e:0)),horizontal:new n(...o.horizontal.map(e=>"number"==typeof e?e:0)),sides:o.sides}}(i,s);case"vertexColor":return h(i,s);default:return function(o,n){return{...h(o,n),color:e(o.color,n)}}(i,s)}}function f(e){return{type:e.type}}function h(e,o){let{alpha:n,mode:t,isMask:r}=e,i="string"==typeof n?Number(o.getVariable(n)??100)/100:n;return{...f(e),alpha:i,mode:t,isMask:r}}export{i as a,a as b,l as c,u as d};
1
+ import{a as e}from"./runtime-chunk-TU4KDRKR.js";import{W as o}from"./runtime-chunk-LALFWESO.js";import{Dc as n,Fc as t,Jc as r}from"./runtime-chunk-VGN7YHB7.js";var i={enabled:!1},s=new WeakMap;function a(e){if(!i.enabled)return e;let o=s.get(e);return o||(o={...e,bloom:{...e.bloom,kernelSize:0},depthOfField:{...e.depthOfField,enabled:!1}},s.set(e,o)),o}var c=new WeakSet;function l(e){if(!e.isPointLight&&!e.isSpotLight&&!e.isDirectionalLight)return!1;if(i.enabled){if(!0===e.castShadow)return e.castShadow=!1,c.add(e),!0}else if(c.has(e)&&(c.delete(e),!1===e.castShadow))return e.castShadow=!0,!0;return!1}function u(i,s){switch(i.type){case"cavity":return function(e,o){return{...h(e,o),ridge:e.ridge,valley:e.valley}}(i,s);case"dust":return function(n,t){return{...h(n,t),color:e(n.color,t),coverage:o(n.coverage,t)??.2,softness:o(n.softness,t)??.2,noiseStrength:o(n.noiseStrength,t)??.2,noiseScale:o(n.noiseScale,t)??1}}(i,s);case"fresnel":return function(o,n){let{bias:t,scale:r,intensity:i,factor:s,color:a}=o;return{...h(o,n),color:e(a,n),bias:t,scale:r,intensity:i,factor:s}}(i,s);case"gradient":return function(e,o){let{gradientType:t,smooth:i,colors:s,steps:a,angle:c,offset:l,morph:u}=e;return{...h(e,o),gradientType:t,smooth:i,colors:s.map(e=>new r(e[0],e[1],e[2],e[3])),num:s.length,steps:a,offset:new n(...l.map(e=>"number"==typeof e?e:0)),morph:new n(...u.map(e=>"number"==typeof e?e:0)),angle:c}}(i,s);case"depth":return function(e,o){let{gradientType:n,near:i,far:s,isVector:a,isWorldSpace:c,origin:l,direction:u,colors:f,steps:p,smooth:m}=e;return{...h(e,o),gradientType:n,near:i,far:s,isVector:a,isWorldSpace:c,origin:new t(...l),direction:u?new t(...u):new t(1,0,0),colors:f.map(e=>void 0!==e?new r(e[0],e[1],e[2],e[3]):new r(0,0,0,0)),steps:p.slice(0,f.length),smooth:m}}(i,s);case"normal":return function(e,o){let{cnormal:n}=e;return{...h(e,o),cnormal:new t(n[0],n[1],n[2])}}(i,s);case"noise":return function(o,r){return{...h(o,r),scale:o.scale,move:o.move,fA:new n(...o.fA.map(e=>"number"==typeof e?e:0)),fB:new n(...o.fB.map(e=>"number"==typeof e?e:0)),size:new t(...o.size),distortion:new n(...o.distortion.map(e=>"number"==typeof e?e:0)),colorA:e(o.colorA,r),colorB:e(o.colorB,r),colorC:e(o.colorC,r),colorD:e(o.colorD,r),noiseType:o.noiseType,voronoiStyle:o.voronoiStyle,highCut:o.highCut,lowCut:o.lowCut,smoothness:o.smoothness,seed:o.seed,quality:o.quality}}(i,s);case"rainbow":return function(e,o){return{...h(e,o),filmThickness:e.filmThickness,movement:e.movement,wavelengths:new t(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new t(...e.offset)}}(i,s);case"toon":return function(o,n){return{...h(o,n),positioning:o.positioning,colors:o.colors.map(e=>new r(e[0],e[1],e[2],e[3])),num:o.colors.length,steps:o.steps,source:new t(...o.source),isWorldSpace:o.isWorldSpace,noiseStrength:o.noiseStrength,noiseScale:o.noiseScale,shadowColor:e(o.shadowColor,n),offset:new t(...o.offset)}}(i,s);case"outline":return function(o,n){return{...h(o,n),outlineColor:e(o.outlineColor,n),contourColor:e(o.contourColor,n),outlineWidth:o.outlineWidth,contourWidth:o.contourWidth,outlineThreshold:o.outlineThreshold,contourThreshold:o.contourThreshold,outlineSmoothing:o.outlineSmoothing,contourFrequency:o.contourFrequency,contourDirection:new t(...o.contourDirection),positionalLines:o.positionalLines,compensation:o.compensation}}(i,s);case"transmission":return function(o,n){return{...h(o,n),thickness:o.thickness,ior:o.ior,roughness:o.roughness,attenuationColor:void 0!==o.attenuationColor?e(o.attenuationColor,n):{r:1,g:1,b:1,a:1},attenuationDistance:o.attenuationDistance??0}}(i,s);case"reflection":return function(e,n){return{...h(e,n),blur:o(e.blur,n)??0,thickness:o(e.thickness,n)??.001,steps:o(e.steps,n)??60,stepSize:o(e.stepSize,n)??.005,tracingMode:e.tracingMode,mirror:e.mirror??0}}(i,s);case"pattern":return function(o,t){return{...h(o,t),style:o.style,projection:o.projection,axis:o.axis,blending:o.blending,offset:new n(...o.offset.map(e=>"number"==typeof e?e:0)),colorA:e(o.colorA,t),colorB:e(o.colorB,t),frequency:new n(...o.frequency.map(e=>"number"==typeof e?e:0)),size:o.size,variation:o.variation,smoothness:o.smoothness,zigzag:o.zigzag,rotation:o.rotation,vertical:new n(...o.vertical.map(e=>"number"==typeof e?e:0)),horizontal:new n(...o.horizontal.map(e=>"number"==typeof e?e:0)),sides:o.sides}}(i,s);case"vertexColor":return h(i,s);default:return function(o,n){return{...h(o,n),color:e(o.color,n)}}(i,s)}}function f(e){return{type:e.type}}function h(e,o){let{alpha:n,mode:t,isMask:r}=e,i="string"==typeof n?Number(o.getVariable(n)??100)/100:n;return{...f(e),alpha:i,mode:t,isMask:r}}export{i as a,a as b,l as c,u as d};
@@ -1 +1 @@
1
- import{a as t}from"./runtime-chunk-Q4H7PFTE.js";import{a as e}from"./runtime-chunk-ZULFQKQK.js";import{$ as i,ea as a}from"./runtime-chunk-NRJDJMQZ.js";import{e as n,h as s}from"./runtime-chunk-ZLW3UWOA.js";import{a as r}from"./runtime-chunk-2PT2WH66.js";import{Aa as o,Dc as l,Ec as h,Fc as p,Ja as d,Jc as c,Lc as f,Ma as u,Oc as v,Qe as m,Vc as x,Vd as y,Zc as g,ce as S,dd as b,de as T,ld as P,na as _,nc as z,nd as w,we as R}from"./runtime-chunk-VGN7YHB7.js";var O=new b;O.setAttribute("position",new g(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));var L=class extends T{constructor(t){super({...t,depthTest:!1,depthWrite:!1,glslVersion:z,vertexShader:"\n\t\t\t\tprecision highp float;\n\t\t\t\tin vec3 position;\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_Position = vec4(position, 1);\n\t\t\t\t}\n\t\t\t"})}customProgramCacheKey(){return""}};function k(){return{shapeInput:()=>"\n\t\t\tconst float posRowCoord = 0.1; \n\t\t\tconst float quatRowCoord = 0.3; \n\t\t\tconst float param1RowCoord = 0.5;\n\t\t\tconst float param2RowCoord = 0.7;\n\t\t\tconst float colorRowCoord = 0.9; \n\t\t\tuniform sampler2D shapesDataTexture;\n\t\t\tvec4 shapePos(float iin) { \n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, posRowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeQuat(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, quatRowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeParams1(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, param1RowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeParams2(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, param2RowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeColor(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, colorRowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t",getxyzi:"\n\t\t\t// this code must complement lookup\n\t\t\tfloat xi = mod(gl_FragCoord.x - 0.5, VOXEL_RESOLUTION);\n\t\t\tfloat yi = mod(gl_FragCoord.y - 0.5, VOXEL_RESOLUTION);\n\t\t\tfloat zi = floor((gl_FragCoord.x - 0.5) * INV_VOXEL_RESOLUTION) + floor((gl_FragCoord.y - 0.5) * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;\n\t\t",lookup:"\n\t\t\tuniform sampler2D potentialPassTexture;\n\t\t\tuniform sampler2D voxelPassTexture; \n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tvec4 look(float xi, float yi, float zi, sampler2D rt) {\n\t\t\t\tvec2 uv = vec2(\n\t\t\t\t\tmod(zi, Z_LAYERS_PER_ROW) + (xi + 0.5) / VOXEL_RESOLUTION,\n\t\t\t\t\tfloor(zi / Z_LAYERS_PER_ROW) + (yi + 0.5) / VOXEL_RESOLUTION\n\t\t\t\t); \n\t\t\t\tuv /= Z_LAYERS_PER_ROW;\n\t\t\t\treturn texture(rt, uv);\n\t\t\t}\n\t\t",getpart:"\n\t\t\tfloat getpart(inout float a, float b) {\n\t\t\t\tfloat t = floor(a/b);\n\t\t\t\tfloat r = a - t*b;\n\t\t\t\ta = t;\n\t\t\t\treturn r;\n\t\t\t}\n\t\t",triTable:new Float32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,1,1,8,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,2,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,10,2,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,2,9,9,2,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,2,8,10,2,8,9,10,-1,-1,-1,-1,-1,-1,-1,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,11,0,0,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,11,3,2,-1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,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]),numTrisTable:new Float32Array([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,2,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,2,3,4,4,3,3,4,4,3,4,5,5,2,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,4,2,3,3,4,3,4,2,3,3,4,4,5,4,5,3,2,3,4,4,3,4,5,3,2,4,5,5,4,5,2,4,1,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,4,3,4,4,5,3,2,4,3,4,3,5,2,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,4,3,4,4,3,4,5,5,4,4,3,5,2,5,4,2,1,2,3,3,4,3,4,4,5,3,4,4,5,2,3,3,2,3,4,4,5,4,5,5,2,4,3,5,4,3,2,4,1,3,4,4,5,4,5,3,4,4,5,5,2,3,4,2,1,2,3,3,2,3,4,2,1,3,2,4,1,2,1,1,0])}}var D=new R,U=null;function E(t){U=t}function M(){return U}var C=null;function F(t){C=t}function N(){return C}var I=null;function V(t){I=t}function B(){return I}var X=k(),A=24,W=96,H=!1,q=!0;try{let t=new URLSearchParams(window.location.search);H="0"===t.get("dbgsbstatic"),q="0"!==t.get("sb512")}catch{}function K(t){let e=t.getAttribute("position");return void 0===e?-1:1048576*(e.version??e.data?.version??0)+(e.count??0)%1048576}var j=class extends a{constructor(t,e,i){super(t,e,i),this.data=e,this.isShapeBlendEntity=!0,this.needsRebuild=!0,this.customDepthMaterialNeedsUpdate=!1,this._prevShapeData=null,this._prevSpan=-1,this._reach=new Float32Array(96),this._prevReach=new Float32Array(96),this._fieldDirtyFull=!0,this._fieldDirtyMin=new p,this._fieldDirtyMax=new p,this._maxBlendK=0,this._meshSdfBaked=new Map,this._meshSdfWanted=new Map,this._passesRenderer=null,this._npart=-1,this.spatialn=1,this.drawRangeNeedsForceUpdate=!0,this._resolutionLevel=-1,this._authoredResolutionLevel=-1,this.ultraFieldResolution=0,this.resolution=64,this.spatialDivisions=25,this.zLayersPerRow=8,this.basePyramidSize=512,this.pyramidTexture1Width=341,this.pyramidTexture1Height=256,this.pyramidTexture2Width=170,this.pyramidTexture2Height=128,this.numLevels=9,this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=0,this.bboxOffset=0,this.shapesDataTexture={value:void 0},this.spatialscene=new x,this.potentialPassScene=new x,this.voxelPassScene=new x,this._spatialPassRenderTargets=[],this._potentialPassRenderTargets=[],this._voxelPassRenderTargets=[],this._pyramidRenderTargets=[],this.geometry=new b,this.geometry.drawRange.count=0,this.spatialPassUniforms={span:{value:-1},shapesDataTexture:this.shapesDataTexture,npart:{value:this.npart},spatialn:{value:this.spatialn}},this.spatialMesh=new P(O,this.spatialPassMaterial()),this.spatialMesh.frustumCulled=!1,this.spatialscene.add(this.spatialMesh);let a=new w(X.triTable,16,256,u,o);a.needsUpdate=!0;let n=new w(X.numTrisTable,256,1,u,o);n.needsUpdate=!0,this.voxelPassUniforms={potentialPassTexture:{value:void 0},numTrisTable:{value:n}},this.voxelMesh=new P(O,this.voxelPassMaterial()),this.voxelMesh.frustumCulled=!1,this.voxelPassScene.add(this.voxelMesh),this.potentialPassUniforms={shapesDataTexture:this.shapesDataTexture,spatialPassTexture:{value:void 0},npart:{value:this.npart},spatialn:{value:this.spatialn}},this.potentialMesh=new P(O,this.potentialPassMaterial()),this.potentialMesh.frustumCulled=!1,this.potentialPassScene.add(this.potentialMesh),this.marchPassUniforms={triTable:{value:a},potentialPassTexture:{value:void 0},voxelPassTexture:{value:void 0},pyramidTexture1:{value:void 0},pyramidTexture1Size:{value:void 0},pyramidTexture2:{value:void 0},pyramidTexture2Size:{value:void 0}},this.frustumCulled=!1,this.onBeforeShadowPass=t=>{let e=at.call(this);if(0===this.npart)return void(this.geometry.drawRange.count=0);let i=this.material.root;if(i.shadersPatchedForShapeBlend){if(this.customDepthMaterialNeedsUpdate){this.customDepthMaterialNeedsUpdate=!1,this.customDepthMaterial=new S({vertexShader:i.vertexShader,fragmentShader:"\n\t\t\t\t\t\t#include <packing>\n\t\t\t\t\t\tvoid main()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n\t\t\t\t\t\t}\n\t\t\t\t\t",uniforms:i.uniforms,defines:this.material.defines}),this.isMeshDepthMaterial=!0,this.customDistanceMaterial=new S({vertexShader:i.vertexShader,fragmentShader:"\n\t\t\t\t\t#include <common>\n\t\t\t\t\t#include <packing>\n\t\t\t\t\tuniform vec3 referencePosition;\n\t\t\t\t\tuniform float nearDistance;\n\t\t\t\t\tuniform float farDistance;\n\t\t\t\t\t\n\t\t\t\t\tvarying vec3 vWPosition;\n\t\t\t\t\tvoid main()\n\t\t\t\t\t{\n\t\t\t\t\t\tfloat dist = length(vWPosition - referencePosition);\n\t\t\t\t\t\tdist = (dist - nearDistance) / (farDistance - nearDistance);\n\t\t\t\t\t\tdist = saturate(dist);\n\t\t\t\t\t\t\n\t\t\t\t\t\tgl_FragColor = packDepthToRGBA( dist );\n\t\t\t\t\t}",uniforms:{nearDistance:{value:0},farDistance:{value:0},referencePosition:{value:new p},opacity:{value:0},...i.uniforms},defines:this.material.defines});let t=this.customDistanceMaterial;t.referencePosition=new p,t.nearDistance=0,t.farDistance=0,t.opacity=1,t.isMeshDistanceMaterial=!0}}else this.patchVertexShaderForShapeBlend(i),i.shadersPatchedForShapeBlend=!0,this.customDepthMaterialNeedsUpdate=!0;this.spatialPassUniforms.npart.value=this.npart,this.spatialPassUniforms.spatialn.value=this.spatialn,this.potentialPassUniforms.npart.value=this.npart,this.potentialPassUniforms.spatialn.value=this.spatialn;let a=this.needsRebuild;if(this.needsRebuild){this.needsRebuild=!1,this.spatialMesh.material.defines.RES=this.resolutionLevel,this.spatialMesh.material.needsUpdate=!0,this.potentialMesh.material.defines.RES=this.resolutionLevel,this.potentialPassUniforms.spatialPassTexture.value=this.spatialPassRenderTarget.texture,this.potentialMesh.material.needsUpdate=!0,this.voxelMesh.material.defines.RES=this.resolutionLevel,this.voxelMesh.material.needsUpdate=!0,this.voxelPassUniforms.potentialPassTexture.value=this.potentialPassRenderTarget.texture,this.marchPassUniforms.potentialPassTexture.value=this.potentialPassRenderTarget.texture,this.marchPassUniforms.voxelPassTexture.value=this.voxelPassRenderTarget.textures[0],this.material.defines.RES=this.resolutionLevel,this.material.defines.LEVELS=this.pyramidLevelSizes.length,this.material.defines.LOOP=this.pyramidLevelSizes.length%2==0?this.pyramidLevelSizes.length-3:this.pyramidLevelSizes.length-2,this.material.defines.HALF=this.pyramidLevelSizes.length%2==0?1:0,this.material.needsUpdate=!0;let t=this.pyramidLevelSizes.length%2==0?0:1,e=this.pyramidLevelSizes.length%2==0?1:0;this.marchPassUniforms.pyramidTexture2.value=this.pyramidRenderTarget[t].texture,this.marchPassUniforms.pyramidTexture2Size.value=new l(this.pyramidRenderTarget[t].width,this.pyramidRenderTarget[t].height),this.marchPassUniforms.pyramidTexture1.value=this.pyramidRenderTarget[e].texture,this.marchPassUniforms.pyramidTexture1Size.value=new l(this.pyramidRenderTarget[e].width,this.pyramidRenderTarget[e].height),Object.assign(this.material.uniforms,this.marchPassUniforms)}if(!e&&!a&&!this.drawRangeNeedsForceUpdate&&this._passesRenderer===t)return;this._passesRenderer=t;let n=t.shadowMap.enabled;t.shadowMap.enabled=!1;let s=t.getRenderTarget();t.setRenderTarget(this.spatialPassRenderTarget),t.render(this.spatialscene,D),t.setRenderTarget(this.potentialPassRenderTarget),t.render(this.potentialPassScene,D),t.setRenderTarget(this.voxelPassRenderTarget),t.render(this.voxelPassScene,D),j.streamCompaction.renderPyramid(this.resolutionLevel,this.pyramidLevelSizes,t,this.voxelPassRenderTarget,this.pyramidRenderTarget).then(t=>{this.material.wireframe&&(3*t>this.geometry.attributes.position.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.dispose(),this.geometry=new b,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]},this.geometry.attributes.position=new g(new Float32Array(3*t*2),3)),(3*t>this.geometry.drawRange.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.drawRange.count=3*Math.floor(1.2*t),this.markSceneShadowsDirty()),this.drawRangeNeedsForceUpdate=!1}),t.shadowMap.enabled=n,t.setRenderTarget(s)}}markSceneShadowsDirty(){let t=this.parent;if(null!==t){for(;t.parent;)t=t.parent;t.markShadowsDirty?.()}}set npart(t){t!==this._npart&&(this.drawRangeNeedsForceUpdate=!0,this._npart=t,this.spatialn=Math.ceil(t/96))}get npart(){return this._npart}set resolutionLevel(t){let e=Math.min(q?9:8,Math.max(5,t));if(e===this._authoredResolutionLevel)return;this._authoredResolutionLevel=e,this.ultraFieldResolution=Math.pow(2,e);let i=Math.min(8,e);switch(this._resolutionLevel=i,this.resolution=Math.pow(2,i),this.resolutionLevel){case 5:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192],this.bboxSize=496,this.bboxOffset=-8;break;case 6:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=504,this.bboxOffset=-4;break;case 7:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192,384,768,1536],this.bboxSize=508,this.bboxOffset=-2;break;case 8:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096],this.bboxSize=510,this.bboxOffset=-1}this.pyramidTexture1Width=0,this.pyramidTexture2Width=0,this.pyramidTexture1Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-2],this.pyramidTexture2Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-3];for(let t=this.pyramidLevelSizes.length-2;t>=0;t--)(this.pyramidLevelSizes.length-2)%2==t%2?this.pyramidTexture1Width+=this.pyramidLevelSizes[t]:this.pyramidTexture2Width+=this.pyramidLevelSizes[t];this.basePyramidSize=this.pyramidLevelSizes[this.pyramidLevelSizes.length-1],this.zLayersPerRow=this.basePyramidSize/this.resolution,this.numLevels=this.pyramidLevelSizes.length-1,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]},this.needsRebuild=!0,this.customDepthMaterialNeedsUpdate=!0}get resolutionLevel(){return this._resolutionLevel}get spatialPassRenderTarget(){let t=this._spatialPassRenderTargets[this.resolutionLevel];return t||(t=new f(this.spatialDivisions*this.spatialn,this.spatialDivisions**2,{format:d,type:o,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:_,magFilter:_}),this._spatialPassRenderTargets[this.resolutionLevel]=t),t}get potentialPassRenderTarget(){let t=this._potentialPassRenderTargets[this.resolutionLevel];return t||(t=new f(this.basePyramidSize,this.basePyramidSize,{format:d,type:o,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:_,magFilter:_}),this._potentialPassRenderTargets[this.resolutionLevel]=t),t}get voxelPassRenderTarget(){let t=this._voxelPassRenderTargets[this.resolutionLevel];return t||(t=new f(this.basePyramidSize,this.basePyramidSize,{count:2,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:_,magFilter:_}),t.textures[0].format=d,t.textures[0].type=o,t.textures[1].format=u,t.textures[1].type=o,this._voxelPassRenderTargets[this.resolutionLevel]=t),t}get pyramidRenderTarget(){let t=this._pyramidRenderTargets[this.resolutionLevel];return t||(t=[new f(this.pyramidTexture1Width,this.pyramidTexture1Height,{format:d,type:o,stencilBuffer:!1,depthBuffer:!1,magFilter:_,minFilter:_}),new f(this.pyramidTexture2Width,this.pyramidTexture2Height,{format:d,type:o,stencilBuffer:!1,depthBuffer:!1,magFilter:_,minFilter:_})],this._pyramidRenderTargets[this.resolutionLevel]=t),t}updateState(t,e){let i=this.material;super.updateState(t,e),i!==this.material&&(this.needsRebuild=!0),t.geometry&&(this.resolutionLevel=t.geometry.resolutionLevel,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]}),t.wireframe&&!this.geometry.getAttribute("position")?this.geometry.setAttribute("position",new g(new Float32Array(3*this.geometry.drawRange.count),3)):!t.wireframe&&this.geometry.getAttribute("position")&&this.geometry.deleteAttribute("position")}spatialPassMaterial(){let t=`\n\t\t\tprecision highp float;\n\t\t\tout vec4 pc_FragColor;\n\t\t\tconst float spatialDivisions = ${this.spatialDivisions}.;\n\t\t\tuniform float span;\n\t\t\tuniform float npart;\n\t\t\tuniform float spatialn;\n\t\t\t${X.shapeInput()}\n\n\t\t\tvec3 low, high; \n\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tfloat spatialKey(float lowi) {\n\t\t\t\tfloat t = 0.;\n\t\t\t\tfor (float ii = 23.; ii >= 0.; ii--) {\n\t\t\t\t\tfloat i = ii + lowi;\n\t\t\t\t\tfloat iin = (i + 0.5) / 96.;\n\t\t\t\t\tvec4 shape = shapePos(iin);\n\t\t\t\t\tvec3 d = shape.xyz;\n\t\t\t\t\tfloat op = shape.w;\n\t\n\t\t\t\t\tt *= 2.;\n\t\t\t\t\tt += (\n\t\t\t\t\t\tlow.x < d.x && d.x < high.x &&\n\t\t\t\t\t\tlow.y < d.y && d.y < high.y &&\n\t\t\t\t\t\tlow.z < d.z && d.z < high.z &&\n\t\t\t\t\t\ti < npart || op == -2. \n\t\t\t\t\t) ? 1. : 0.;\n\t\t\t\t}\n\t\t\t\treturn t;\n\t\t\t}\n\n\t\t\t${X.getpart}\n\n\t\t\tvoid main() { \n\t\t\t\t\n\t\t\t\tvec3 div; \n\t\t\t\t\n\t\t\t\tfloat yz = float(gl_FragCoord.y - 0.5); \n\t\t\t\tdiv.y = getpart(yz, spatialDivisions);\n\t\t\t\tdiv.z = yz; \n\n\t\t\t\tfloat lx = float(gl_FragCoord.x - 0.5); \n\t\t\t\tfloat lowi = getpart(lx, spatialn) * 96.;\n\t\t\t\tdiv.x = lx;\n\n\t\t\t\tlow = div / spatialDivisions * 2. - 1. - span;\n\t\t\t\thigh = (div+1.) / spatialDivisions * 2. - 1. + span;\n\n\t\t\t\t\n\t\t\t\tpc_FragColor.x = spatialKey(lowi);\n\t\t\t\tpc_FragColor.y = spatialKey(lowi+24.);\n\t\t\t\tpc_FragColor.z = spatialKey(lowi+48.);\n\t\t\t\tpc_FragColor.w = spatialKey(lowi+72.);\n\t\t\t}\n\t\t`;return new L({name:"Spatial Pass",fragmentShader:t,uniforms:this.spatialPassUniforms})}potentialPassMaterial(){let t=`\n\t\t\tprecision highp float;\n\t\t\tout vec4 pc_FragColor;\n\n\t\t\t${X.shapeInput()}\n\t\t\tuniform sampler2D spatialPassTexture;\n\n\t\t\tconst float res = float(RES);\n\t\t\tconst float VOXEL_RESOLUTION = pow(2., res);\n\t\t\tconst float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));\n\t\t\tconst float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.;\n\t\t\tconst float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;\n\n\t\t\tuniform float npart;\n\t\t\tuniform float spatialn;\n\t\t\tconst float spatialDivisions = ${this.spatialDivisions}.;\n\t\t\tconst float spatialDivisions2 = spatialDivisions * spatialDivisions;\n\t\t\tconst float spatialDivisionsSub1 = spatialDivisions - 1.;\n\n\t\t\t${X.getpart}\n\n\t\t\tvec3 packRGBAToVec3(vec4 color) {\n\t\t\t\tuint r = uint(color.r * 255.);\n\t\t\t\tuint g = uint(color.g * 255.);\n\t\t\t\tuint combined = (r << 8) | g; \n\t\t\t\treturn vec3(float(combined) * 0.00001525902, color.b, color.a); \n\t\t\t}\n\n\t\t\tvoid applyQuaternionToVector(in vec4 q, inout vec3 v) {\n\t\t\t\tv += 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);\n\t\t\t}\n\n\t\t\t\n\n\n\n\t\t\t\n\t\t\tfloat smoothOperation(float op, float sdf, float d, float k) {\n\t\t\t \n\t\t\t \n\t\t\t\t\n\n\t\t\t\tfloat signSubtract = clamp(op, -1., 1.);\n\t\t\t\tfloat signIntersection = 2. * (op - signSubtract) + 1.;\n\t\t\t\tfloat h = clamp(\n\t\t\t\t\t0.5 + signSubtract * 0.5 * (sdf - signSubtract * signIntersection * d) / k,\n\t\t\t\t\t0.0,\n\t\t\t\t\t1.0\n\t\t\t\t);\n\t\t\t\treturn mix(sdf, signSubtract * signIntersection * d, h) - \n\t\t\t\t\t\t\t signSubtract * k * h * (1.0 - h);\n\t\t\t}\n\n\t\t\tfloat sdSphere( vec3 p, float s )\n\t\t\t{\n\t\t\t\treturn length(p)-s;\n\t\t\t}\n\n\t\t\tfloat sdEllipsoid( vec3 p, vec3 r )\n\t\t\t{\n\t\t\t\tfloat k0 = length(p/r);\n\t\t\t\tfloat k1 = length(p/(r*r));\n\t\t\t\treturn k0*(k0-1.0)/k1;\n\t\t\t}\n\n\t\t\tfloat sdBox( vec3 p, vec3 b )\n\t\t\t{\n\t\t\t\tvec3 q = abs(p) - b;\n\t\t\t\treturn length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0);\n\t\t\t}\n\n\t\t\tfloat sdTorus( vec3 p, vec2 t )\n\t\t\t{\n\t\t\t\tvec2 q = vec2(length(p.xy)-t.x,p.z);\n\t\t\t\treturn length(q)-t.y;\n\t\t\t}\n\n\t\t\tfloat sdCappedTorus( vec3 p, vec2 sc, float ra, float rb)\n\t\t\t{\n\t\t\t\tp.x = abs(p.x);\n\t\t\t\tfloat k = (sc.y*p.x>sc.x*p.y) ? dot(p.xy,sc) : length(p.xy);\n\t\t\t\treturn sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb;\n\t\t\t}\n\n\t\t\tfloat dot2( in vec2 v ) { return dot(v,v); }\n\t\t\tfloat sdCappedCone( vec3 p, float h, float r1, float r2 )\n\t\t\t{\n\t\t\t\tvec2 q = vec2( length(p.xz), p.y );\n\t\t\t\tvec2 k1 = vec2(r2,h);\n\t\t\t\tvec2 k2 = vec2(r2-r1,2.0*h);\n\t\t\t\tvec2 ca = vec2(q.x-min(q.x,(q.y<0.0)?r1:r2), abs(q.y)-h);\n\t\t\t\tvec2 cb = q - k1 + k2*clamp( dot(k1-q,k2)/dot2(k2), 0.0, 1.0 );\n\t\t\t\tfloat s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0;\n\t\t\t\treturn s*sqrt( min(dot2(ca),dot2(cb)) );\n\t\t\t}\n\n\t\t\tfloat sdCappedCylinder( vec3 p, float h, float r )\n\t\t\t{\n\t\t\t\tvec2 d = abs(vec2(length(p.xz),p.y)) - vec2(r,h);\n\t\t\t\treturn min(max(d.x,d.y),0.0) + length(max(d,0.0));\n\t\t\t}\n\n\t\t\tfloat maxBlend = 0.0;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tvoid fillSpatialInner(\n\t\t\t\tfloat ii,\n\t\t\t\tfloat activeKey,\n\t\t\t\tvec3 corner,\n\t\t\t\tinout float sdf,\n\t\t\t\tinout float colorDivisor,\n\t\t\t\tinout vec4 trackColor\n\t\t\t) {\n\t\t\t\tfor (float i = 0.; i < 24.; i++) {\n\t\t\t\t\tif (activeKey < 1.) break; \n\t\t\t\t\tactiveKey *= 0.5;\n\t\t\t\t\tif (fract(activeKey) < 0.5) continue;\n\n\t\t\t\t\tfloat iin = (i + ii + 0.5) * ${1/96};\n\t\t\t\t\tvec4 shape = shapePos(iin);\n\t\t\t\t\tvec4 quat = shapeQuat(iin);\n\t\t\t\t\tvec4 params1 = shapeParams1(iin);\n\t\t\t\t\tvec4 params2 = shapeParams2(iin);\n\n\t\t\t\t\tvec3 p = corner - shape.xyz;\n\t\t\t\t\tapplyQuaternionToVector(quat, p);\n\t\t\t\t\tp /= params2.z; // scale\n\t\t\t\t\tfloat d; // d in -1..1 coordinates\n\t\t\t\t\tswitch (int(params1.x)) {\n\t\t\t\t\t\tcase 0: d = sdSphere(p, params1.y); break;\n\t\t\t\t\t\tcase 1: d = sdEllipsoid(p, params1.yzw); break;\n\t\t\t\t\t\tcase 2: d = sdBox(p, params1.yzw); break;\n\t\t\t\t\t\tcase 3: d = sdCappedCylinder(p, params1.y, params1.z); break;\n\t\t\t\t\t\tcase 4: d = sdCappedCone(p, params1.y, params1.z, params1.w); break;\n\t\t\t\t\t\tcase 5: d = sdTorus(p, params1.yz); break;\n\t\t\t\t\t\tcase 6: d = sdCappedTorus(p, params1.yz, params1.w, params2.w); break;\n\t\t\t\t\t\t// Mesh children (type 7) live in a WebGPU-only baked SDF\n\t\t\t\t\t\t// atlas — the GLSL evaluator skips the shape entirely\n\t\t\t\t\t\t// (also closes the latent uninitialized-d default).\n\t\t\t\t\t\tdefault: continue;\n\t\t\t\t\t}\n\t\t\t\t\td -= params2.y; // rounded edge\n\t\t\t\t\td *= params2.z; // scale\n\n\t\t\t\t\tfloat k = params2.x;\n\t\t\t\t\tfloat op = shape.w;\n\n\t\t\t\t\tsdf = smoothOperation(shape.w, sdf, d, k);\n\n\t\t\t\t\tfloat isNegativeOne = step(-1.5, op) * step(op, -0.5); // 1 when op == -1, 0 otherwise\n\t\t\t\t\tfloat colorCull = smoothstep(maxBlend, 0., -d);\n\t\t\t\t\tfloat cullFactor = mix(1.0, colorCull, isNegativeOne);\n\t\t\t\t\ttrackColor *= cullFactor;\n\t\t\t\t\tcolorDivisor *= cullFactor;\n\n\t\t\t\t\tmaxBlend = max(maxBlend, k);\n\n\t\t\t\t\tk += 2. * INV_VOXEL_RESOLUTION; // avoid division by zero, and other color artifacts with very small k\n\t\t\t\t\tfloat nearness = smoothstep(k, 0., d);\n\n\t\t\t\t\tvec4 color = shapeColor(iin);\n\t\t\t\t\tnearness *= float(color.a >= 0.);\n\n\t\t\t\t\tcolorDivisor += nearness;\n\t\t\t\t\ttrackColor += color * nearness;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvec3 div;\n\t\t\t// compute potential from all spheres; collect +ve and =ve values separately\n\t\t\t// work in blocks of A*4 (=96) spheres, using the bit flags in 4 float channel 'activeKey' values\n\t\t\t// TODO check if extra vec3 output useful, not really used at present\n\t\t\tfloat fillSpatial(vec3 corner, inout vec4 trackColor) {\n\t\t\t\tfloat sdf = 1e3; // hack: initialize to large value\n\t\t\t\tfloat colorDivisor = 0.;\n\t\t\t\t// spatialPassTexture holds x=> lowi, x faster moving and y=> z, y faster moving\n\t\t\t\tfloat divyz = (div.y + div.z * spatialDivisions + 0.5) / (spatialDivisions2);\n\t\t\t\tfor (float ii = 0.; ii < spatialn; ii++) {\n\t\t\t\t\tfloat i = ii * 96.;\n\n\t\t\t\t\tvec4 activeKey = texture(spatialPassTexture, vec2((div.x * spatialn + ii + 0.5)/(spatialn * spatialDivisions), divyz));\n\t\t\t\t\tfillSpatialInner(i, activeKey.x, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+24., activeKey.y, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+48., activeKey.z, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+72., activeKey.w, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t}\n\n\t\t\t\ttrackColor /= colorDivisor;\n\t\t\t\treturn mix(sdf, 0.0, step(1e20 - 0.1, sdf));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\t${X.getxyzi} \n\n\t\t\t\tvec3 xyzi = vec3(xi,yi,zi);\n\t\t\t\tvec3 corner = xyzi / VOXEL_RESOLUTION_SUB1 * 2. - 1.; \n\n\t\t\t\tdiv = floor(xyzi / VOXEL_RESOLUTION_SUB1 * spatialDivisionsSub1);\n\n\t\t\t\tvec4 c = vec4(0.);\n\t\t\t\tfloat t = fillSpatial(corner, c);\n\n\t\t\t\tpc_FragColor = vec4(t, packRGBAToVec3(c)); \n\t\t\t}\n\t\t`;return new L({name:"PotentialPass",fragmentShader:t,uniforms:this.potentialPassUniforms})}voxelPassMaterial(){let t=`\n\t\t\tprecision highp float;\n\t\t\tlayout(location = 0) out vec4 pc_FragColor;\n\t\t\tlayout(location = 1) out vec4 numTris;\n\n\t\t\tconst float res = float(RES);\n\t\t\tconst float VOXEL_RESOLUTION = pow(2., res);\n\t\t\tconst float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.; \n\t\t\tconst float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));\n\t\t\tconst float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;\n\t\t\tuniform sampler2D numTrisTable; \n\n\t\t\tfloat keyi(float f000, float f100, float f010, float f110, float f001, float f101, float f011, float f111) {\n\t\t\t\treturn (float(f000 < 0.) * 1.) +\n\t\t\t\t\t\t\t (float(f100 < 0.) * 2.) +\n\t\t\t\t\t\t\t (float(f010 < 0.) * 8.) +\n\t\t\t\t\t\t\t (float(f110 < 0.) * 4.) +\n\t\t\t\t\t\t\t (float(f001 < 0.) * 16.) +\n\t\t\t\t\t\t\t (float(f101 < 0.) * 32.) +\n\t\t\t\t\t\t\t (float(f011 < 0.) * 128.) +\n\t\t\t\t\t\t\t (float(f111 < 0.) * 64.);\n\t\t\t}\n\n\t\t\t${X.lookup}\n\n\t\t\tvec3 compNormi(float xi, float yi, float zi) {\n\t\t\t\tfloat dx = look(xi + 1., yi, zi, potentialPassTexture).r - look(xi - 1., yi, zi, potentialPassTexture).r;\n\t\t\t\tfloat dy = look(xi, yi + 1., zi, potentialPassTexture).r - look(xi, yi - 1., zi, potentialPassTexture).r;\n\t\t\t\tfloat dz = look(xi, yi, zi + 1., potentialPassTexture).r - look(xi, yi, zi - 1., potentialPassTexture).r;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (dx == 0.0 && dy == 0.0 && dz == 0.0) {\n\t\t\t\t\treturn vec3(0.199, 0.299, 0.399);\n\t\t\t\t}\n\t\t\t\treturn normalize(vec3(dx, dy, dz));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\t${X.getxyzi} \n\n\t\t\t\tvec3 normal = compNormi(xi, yi, zi); \n\n\t\t\t\tif (xi >= VOXEL_RESOLUTION_SUB1 || yi >= VOXEL_RESOLUTION_SUB1 || zi >= VOXEL_RESOLUTION_SUB1) {\n\t\t\t\t\tpc_FragColor = vec4(normal, 0.);\n\t\t\t\t\tnumTris = vec4(0.);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfloat\n\t\t\t\t\tf000 = look(xi, yi, zi, potentialPassTexture).r,\n\t\t\t\t\tf100 = look(xi+1., yi, zi, potentialPassTexture).r,\n\t\t\t\t\tf010 = look(xi, yi+1., zi, potentialPassTexture).r,\n\t\t\t\t\tf110 = look(xi+1., yi+1., zi, potentialPassTexture).r,\n\t\t\t\t\tf001 = look(xi, yi, zi+1., potentialPassTexture).r,\n\t\t\t\t\tf101 = look(xi+1., yi, zi+1., potentialPassTexture).r,\n\t\t\t\t\tf011 = look(xi, yi+1., zi+1., potentialPassTexture).r,\n\t\t\t\t\tf111 = look(xi+1., yi+1., zi+1., potentialPassTexture).r;\n\t\t\t\tfloat key = keyi(f000, f100, f010, f110, f001, f101, f011, f111);\n\n\t\t\t\tpc_FragColor = vec4(normal, key);\n\n\t\t\t\tnumTris = texture(numTrisTable, vec2((key + 0.5) / 256., 0.5));\n\t\t\t}\n\t\t`;return new L({name:"VoxelPass",fragmentShader:t,uniforms:this.voxelPassUniforms})}patchVertexShaderForShapeBlend(t){let e=`\n\t\t#ifdef SHAPEBLEND \n\t\t\tprecision highp sampler2D;\n\n\t\t\tuniform float isol;\n\n\t\t\tuniform sampler2D triTable; \n\t\t\tuniform sampler2D pyramidTexture1;\n\t\t\tuniform vec2 pyramidTexture1Size;\n\t\t\tuniform sampler2D pyramidTexture2;\n\t\t\tuniform vec2 pyramidTexture2Size;\n\n\t\t\tconst vec2 halfPixelOffset = vec2(0.5, 0.5);\n\n\t\t\tconst vec2 rShift = vec2(0., 1.);\n\t\t\tconst vec2 gShift = vec2(1., 1.);\n\t\t\tconst vec2 bShift = vec2(1., 0.);\n\n\t\t\tconst float res = float(RES);\n\t\t\tconst float VOXEL_RESOLUTION = pow(2., res);\n\t\t\tconst float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));\n\t\t\tconst float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;\n\n\t\t\tconst float scale_factor = 2.;\n\n\t\t\t#if SHAPEBLEND == 5\n\t\t\t\tconst float levelShiftX[7] = float[7](4., 6., 12., 24., 48., 96., 192.);\n\t\t\t\tconst float scale = 8. * scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(16.);\n\t\t\t#elif SHAPEBLEND == 7\n\t\t\t\tconst float levelShiftX[10] = float[10](4., 6., 12., 24., 48., 96., 192., 384., 768., 1536.); \n\t\t\t\tconst float scale = 2. * scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(64.);\n\t\t\t#elif SHAPEBLEND == 8\n\t\t\t\tconst float levelShiftX[11] = float[11](4., 8., 16., 32., 64., 128., 256., 512., 1024., 2048., 4096.);\n\t\t\t\tconst float scale = scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(128.);\n\t\t\t#else\n\t\t\t\tconst float levelShiftX[8] = float[8](4., 8., 16., 32., 64., 128., 256., 512.);\n\t\t\t\tconst float scale = 4. * scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(32.);\n\t\t\t#endif\n\n\t\t\t${X.lookup}\n\n\t\t\tconst vec3 offsets[24] = vec3[](\n\t\t\t\tvec3(0., 0., 0.), vec3(1., 0., 0.),\n\t\t\t\tvec3(1., 0., 0.), vec3(1., 1., 0.),\n\t\t\t\tvec3(0., 1., 0.), vec3(1., 1., 0.),\n\t\t\t\tvec3(0., 0., 0.), vec3(0., 1., 0.),\n\t\t\t\tvec3(0., 0., 1.), vec3(1., 0., 1.),\n\t\t\t\tvec3(1., 0., 1.), vec3(1., 1., 1.),\n\t\t\t\tvec3(0., 1., 1.), vec3(1., 1., 1.),\n\t\t\t\tvec3(0., 0., 1.), vec3(0., 1., 1.),\n\t\t\t\tvec3(0., 0., 0.), vec3(0., 0., 1.),\n\t\t\t\tvec3(1., 0., 0.), vec3(1., 0., 1.),\n\t\t\t\tvec3(1., 1., 0.), vec3(1., 1., 1.),\n\t\t\t\tvec3(0., 1., 0.), vec3(0., 1., 1.)\n\t\t\t);\n\n\t\t\tvec2 computeShiftedPosition1(vec2 xy, float levelOriginX) {\n\t\t\t\tvec2 xyShifted = xy;\n\t\t\t\txyShifted.x += levelOriginX;\n\t\t\t\treturn (xyShifted + halfPixelOffset) / pyramidTexture1Size;\n\t\t\t}\n\n\t\t\tvec2 computeShiftedPosition2(vec2 xy, float levelOriginX) {\n\t\t\t\tvec2 xyShifted = xy;\n\t\t\t\txyShifted.x += levelOriginX;\n\t\t\t\treturn (xyShifted + halfPixelOffset) / pyramidTexture2Size;\n\t\t\t}\n\n\t\t\tvec4 unpackVec3ToRGBA(vec3 vec) {\n\t\t\t\tuint combined = uint(vec.x * 65535.0 + 0.5); \n\t\t\t\tfloat g = float(combined & uint(0xFF)) * 0.00392156862; \n\t\t\t\tfloat r = float((combined >> 8) & uint(0xFF)) * 0.00392156862; \n\t\t\n\t\t\t\treturn vec4(r, g, vec.y, vec.z);\n\t\t\t}\n\n\t\t\tout vec4 marchColor;\n\t\t\t\n\t\t#endif\n\t\t`;t.vertexShader=e+t.vertexShader.replace("#include <project_vertex>","\n\t\t#ifdef SHAPEBLEND\n\t\t\tfloat triIndex = floor(float(gl_VertexID/3));\n\t\t\tfloat vertexIndex = float(gl_VertexID);\n\t\t\t\n\t\t\t\n\t\t\tfloat levelOriginX1 = pyramidTexture1Size.x - 2.;\n\t\t\tfloat levelOriginX2 = pyramidTexture2Size.x - 1.;\n\t\t\tvec2 xy = vec2(0.);\n\t\t\tvec4 lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));\n\t\t\t\n\t\t\t\n\t\t\tif (triIndex >= lookUp.r) return;\n\t\t\t\n\t\t\t\n\t\t\tfloat start = 0.;\n\t\t\tvec4 triIndexVec = vec4(triIndex);\n\t\t\t\n\t\t\t\n\t\t\tfor (int i = 0; i < LOOP;) {\n\t\t\t\t\n\t\t\t\tvec4 ends = lookUp + vec4(start);\n\t\t\t\tvec4 starts = vec4(ends.gba, start);\n\t\t\t\tvec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * \n\t\t\t\t\t\t\t\t\t\t\tvec4(lessThan(triIndexVec, ends));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\txy *= 2.;\n\t\t\t\txy += check.r * rShift + check.g * gShift + check.b * bShift;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tstart = dot(check, starts);\n\t\t\t\tlevelOriginX2 -= levelShiftX[i];\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tlookUp = texture(pyramidTexture1, computeShiftedPosition1(xy, levelOriginX1));\n\t\t\t\ti++;\n\n\t\t\t\tends = lookUp + vec4(start);\n\t\t\t\tstarts = vec4(ends.gba, start);\n\t\t\t\tcheck = vec4(greaterThanEqual(triIndexVec, starts)) * \n\t\t\t\t\t\t\t\t\t\t\tvec4(lessThan(triIndexVec, ends));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\txy *= 2.;\n\t\t\t\txy += check.r * rShift + check.g * gShift + check.b * bShift;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tstart = dot(check, starts);\n\t\t\t\tlevelOriginX1 -= levelShiftX[i];\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tlookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));\n\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\t#if HALF == 1\n\t\t\t\tvec4 ends = lookUp + vec4(start);\n\t\t\t\tvec4 starts = vec4(ends.gba, start);\n\t\t\t\tvec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * vec4(lessThan(triIndexVec, ends));\n\t\t\t\n\t\t\t\t\n\t\t\t\txy *= 2.;\n\t\t\t\txy += check.r * rShift + check.g * gShift + check.b * bShift;\n\t\t\t\n\t\t\t\t\n\t\t\t\tstart = dot(check, starts);\n\t\t\t#endif\n\t\t\t\n\t\t\t\n\t\t\tvec3 gridPos;\n\t\t\tgridPos.x = mod(xy.x, VOXEL_RESOLUTION);\n\t\t\tgridPos.y = mod(xy.y, VOXEL_RESOLUTION);\n\t\t\tgridPos.z = floor(xy.x * INV_VOXEL_RESOLUTION) + \n\t\t\t\t\t\t\t\t\tfloor(xy.y * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;\n\t\t\t\n\t\t\t\n\t\t\tvertexIndex -= start * 3.;\n\t\t\tfloat vk = vertexIndex * 0.0625 + 0.03125; \n\t\t\t\n\t\t\t\n\t\t\tvec4 voxel = look(gridPos.x, gridPos.y, gridPos.z, voxelPassTexture);\n\t\t\tfloat key = (voxel.w + 0.5) * 0.00390625; \n\t\t\t\n\t\t\t\n\t\t\tfloat edgeNum = texture(triTable, vec2(vk, key)).x;\n\t\t\tint edgeIndex = int(edgeNum) * 2;\n\t\t\t\n\t\t\t\n\t\t\tvec3 p1 = gridPos + offsets[edgeIndex];\n\t\t\tvec3 p2 = gridPos + offsets[edgeIndex + 1];\n\t\t\t\n\t\t\t\n\t\t\tvec4 potential1 = look(p1.x, p1.y, p1.z, potentialPassTexture);\n\t\t\tvec4 potential2 = look(p2.x, p2.y, p2.z, potentialPassTexture);\n\t\t\t\n\t\t\t\n\t\t\tfloat mu = potential1.r / (potential1.r - potential2.r);\n\n\t\t\tmarchColor = mix(\n\t\t\t\tunpackVec3ToRGBA(potential1.gba),\n\t\t\t\tunpackVec3ToRGBA(potential2.gba),\n\t\t\t\tmu\n\t\t\t);\n\n\t\t\ttransformed = p1 + (p2 - p1) * mu;\n\t\t\ttransformed -= originOffset;\n\t\t\ttransformed *= scale;\n\t\t\tvec4 data1 = look(p1.x, p1.y, p1.z, voxelPassTexture);\n\t\t\tvec4 data2 = look(p2.x, p2.y, p2.z, voxelPassTexture);\n\t\t\tobjectNormal = normalize(mix(data1.xyz, data2.xyz, mu));\n\t\t\ttransformedNormal = normalMatrix * objectNormal;\n\t\t\t#ifndef FLAT_SHADED\n\t\t\t\tvNormal = transformedNormal;\n\t\t\t#endif\n\t\t#endif\n\t\t\n#include <project_vertex>");let i=t.fragmentShader.match(/vec3 diffuseColor[^\n]*\n/);if(!i)return;let a=`\n\t\t#ifdef SHAPEBLEND_C\n\t\t\t#if SHAPEBLEND_C == 1\n\t\t\t\t${i[0].replace(/nodeU0,/g,"marchColor.rgb,").replace(/nodeU\d+(?=,g_uid\d+_calpha\))/g,"marchColor.a")}\n\t\t\t#else\n\t\t\t\t${i[0]}\n\t\t\t#endif\n\t\t#else\n\t\t\t${i[0]}\n\t\t#endif\n\t\t`;t.fragmentShader="in vec4 marchColor;\n"+t.fragmentShader.replace(i[0],a),Object.assign(t.uniforms,this.marchPassUniforms)}initDebugPass(t){console.log("fboToDebug.width",t.width,t.height),this.geometry=new y(t.width,t.height),this.geometry.userData={parameters:{width:4,height:4}};let e={inputTexture:{value:t.textures.length>1?t.textures[1]:t.texture},pyramidTextureSize:{value:void 0}},i=t=>{t.vertexShader="\n\t\t\t\tprecision highp float;\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\t\tvUv = uv;\n\t\t\t\t}\n\t\t\t",t.fragmentShader="\n\t\t\t\tlayout(location = 1) out vec4 gVelocity;\n\n\t\t\t\tprecision highp float;\n\t\t\t\t\n\t\t\t\tuniform sampler2D inputTexture;\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tuniform vec2 pyramidTextureSize;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\t\t\n\t\t\t\t\t\tgl_FragColor = texture(inputTexture, vUv);\n\t\t\t\t\t\tgVelocity = vec4(0.0);\n\t\t\t\t}\n\t\t\t",e.pyramidTextureSize.value=new l(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(t.uniforms,e)};this.material.shapeBlendhack=i,this.material.root.shapeBlendhack=i}dispose(){super.dispose(),B()?.release(this)}},G=j;G.streamCompaction=new class{constructor(){this.pyramidPassScene=new x,this.pyramidPassMaterial=new L({name:"PyramidPass"}),this.pyramidPassUniforms={inputTexture:{value:void 0},inputWidth:{value:0},inputHeight:{value:0},inputShiftX:{value:0},outputShiftX:{value:0}},this.pyramidTopLevelReadPixelBuffer=new Float32Array(4),this.pyramidPassMaterial.fragmentShader="\n\t\t\tprecision highp float;\n\t\t\tprecision highp sampler2D;\n\t\t\tlayout(location = 0) out vec4 pc_FragColor;\n\t\t\tuniform sampler2D inputTexture;\n\t\t\tuniform float inputWidth;\n\t\t\tuniform float inputHeight;\n\t\t\tuniform float inputShiftX;\n\t\t\tuniform float outputShiftX;\n\t\t\tconst vec2 half_unit_coord = vec2(0.5);\n\t\t\tconst vec4 one = vec4(1.0);\n\t\t\tvoid main() {\n\t\t\t\tvec2 inputSize = vec2(inputWidth, inputHeight);\n\t\t\t\tvec2 input_pixel_uv = 1. / inputSize;\n\t\t\t\tvec2 coord = gl_FragCoord.xy - half_unit_coord;\n\t\t\t\tcoord.x -= outputShiftX;\n\t\t\t\tcoord = coord * 2. + half_unit_coord;\n\t\t\t\tcoord.x += inputShiftX;\n\n\t\t\t\t\n\t\t\t\tvec2 input_uv = coord / inputSize;\n\t\t\t\tfloat bl = texture(inputTexture, input_uv).r;\n\n\t\t\t\t\n\t\t\t\tinput_uv.x += input_pixel_uv.x;\n\t\t\t\tfloat br = texture(inputTexture, input_uv).r;\n\n\t\t\t\t\n\t\t\t\tinput_uv.y += input_pixel_uv.y;\n\t\t\t\tfloat tr = texture(inputTexture, input_uv).r;\n\n\t\t\t\t\n\t\t\t\tinput_uv.x -= input_pixel_uv.x;\n\t\t\t\tfloat tl = texture(inputTexture, input_uv).r;\n\n\t\t\t\tpc_FragColor.a = bl;\n\t\t\t\tpc_FragColor.b = pc_FragColor.a + br;\n\t\t\t\tpc_FragColor.g = pc_FragColor.b + tr;\n\t\t\t\tpc_FragColor.r = pc_FragColor.g + tl; \n\t\t\t}\n\t\t",this.pyramidPassMaterial.uniforms=this.pyramidPassUniforms,this.pyramidPassMaterial.depthTest=!1,this.pyramidPassMaterial.depthWrite=!1;let t=new P(O,this.pyramidPassMaterial);t.frustumCulled=!1,this.pyramidPassScene.add(t)}renderPyramid(t,e,i,a,n){(new m).min.setScalar(0);let s=e.length-1,r=new c;i.getViewport(r),this.pyramidPassUniforms.inputShiftX.value=0,this.pyramidPassUniforms.outputShiftX.value=0;let o=s-1;for(let s=o;s>=0;s--){let r=s%2==o%2?n[0]:n[1],l=s===o?a:s%2==o%2?n[1]:n[0];this.pyramidPassUniforms.inputTexture.value=l.textures.length>1?l.textures[1]:l.texture,this.pyramidPassUniforms.inputWidth.value="width"in l?l.width:1,this.pyramidPassUniforms.inputHeight.value="height"in l?l.height:1,i.setRenderTarget(r);let h=e[s],p=i.getPixelRatio();i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,h/p,h/p),2===s&&t%2!=0&&i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,3/p,3/p),i.render(this.pyramidPassScene,D);let d=this.pyramidPassUniforms.inputShiftX.value;this.pyramidPassUniforms.inputShiftX.value=this.pyramidPassUniforms.outputShiftX.value,this.pyramidPassUniforms.outputShiftX.value=d,s<o&&(this.pyramidPassUniforms.outputShiftX.value+=e[s+1])}i.setViewport(r);let l=e.length%2==0?0:1;return i.readRenderTargetPixelsAsync(n[l],n[l].width-1,0,1,1,this.pyramidTopLevelReadPixelBuffer).then(()=>this.pyramidTopLevelReadPixelBuffer[0])}};var $=new v,Z=new v,Q=new h,Y=new p,J=new p,tt=new h;function et(t,e=0){let i=this.children.length;for(;i--;){let a=this.children[i];n.is(a)&&it.call(a,t,e+1)}}function it(t,e=0){if(!0!==t(this,e)){let i=this.children.length;for(;i--;){let a=this.children[i];n.is(a)&&it.call(a,t,e+1)}}}function at(){if(void 0===this.shapesDataTexture.value){let t=new w(new Float32Array(1920),96,5,d,o);this.shapesDataTexture.value=t}let n=this.shapesDataTexture.value,l=n.image.data,h=0,p=0,c=this.data.geometry.blendRange,f=$.copy(this.matrixWorld).invert(),u=this._npart,v=0;this._meshSdfWanted.clear();let m=null;if(et.call(this,n=>{if(!1===n.visible)return!0;let o;if(n instanceof t)return;if(n instanceof e||r(n))return;o=n instanceof i?n.object:n;let d=n.data?.cloner;if(s.is(n)&&d&&!d.hideBase&&"radial"!==d.type&&!0!==d.disabled||!(o instanceof a))return;let u=o.geometry.userData.parameters,x=u?.shapeBlendNode??o.dataPatched?.geometry?.shapeBlendNode;if(void 0===x)return;if(Z.multiplyMatrices(f,n.matrixWorld).decompose(J,Q,Y),"TorusGeometry"===u?.type&&360!==u.arc){let t=u.arc*Math.PI/180;t/=4,Q.multiply(tt.set(0,0,Math.sin(t),Math.cos(t)))}let y=x.overrideGlobalBlend?x.blendRange:c;y=y/this.bboxSize*2,l[4*v]=(J.x-this.bboxOffset)/this.bboxSize*2,l[4*v+1]=(J.y-this.bboxOffset)/this.bboxSize*2,l[4*v+2]=(J.z-this.bboxOffset)/this.bboxSize*2,l[4*v+3]=0===x.operation?1:2===x.operation?-1:-2,l[384+4*v]=-Q.x,l[384+4*v+1]=-Q.y,l[384+4*v+2]=-Q.z,l[384+4*v+3]=Q.w;let g=new Float32Array(4),S=0,b=y;if("SphereGeometry"===u?.type)u.width===u.height&&u.width===u.depth?g[0]=0:g[0]=1,g[1]=u.width/this.bboxSize,g[2]=u.height/this.bboxSize,g[3]=u.depth/this.bboxSize,b=Math.max(g[1],g[2],g[3])*Y.x+y;else if("CubeGeometry"===u?.type){S=u.cornerRadius;let t=u.width,e=u.height,i=u.depth;g[0]=2,g[1]=(t-2*S)/this.bboxSize,g[2]=(e-2*S)/this.bboxSize,g[3]=(i-2*S)/this.bboxSize,b=Math.sqrt(t**2+e**2+i**2)/this.bboxSize*Y.x+y}else if("CylinderGeometry"===u?.type){S=u.cornerRadius;let t=u.height,e=u.radiusBottom,i=u.radiusTop;if(i>=e){let a=Math.atan2(i-e,t),n=(Math.PI/2-a)/2;i-=S/Math.tan(n),e-=S*Math.tan(n)}else if(e>i){let a=Math.atan2(e-i,t),n=(Math.PI/2-a)/2;i-=S*Math.tan(n),e-=S/Math.tan(n)}g[1]=(u.height-2*S)/this.bboxSize,e===i?(g[0]=3,g[2]=e/this.bboxSize*2):(g[0]=4,g[2]=e/this.bboxSize*2,g[3]=i/this.bboxSize*2),b=(Math.hypot(g[1],Math.max(Math.abs(g[2]),Math.abs(g[3])))+S/this.bboxSize*2)*Y.x+y}else if("TorusGeometry"===u?.type){if(g[0]=5,g[1]=(u.width-u.depth)/this.bboxSize,g[2]=u.depth/this.bboxSize,360!==u.arc){g[0]=6,g[3]=g[1],l[1152+4*v+3]=g[2];let t=2*Math.atan2(g[2]/2,g[1]),e=u.arc*Math.PI/180/2-t;g[1]=Math.sin(e),g[2]=Math.cos(e)}b=u.width*Y.x/this.bboxSize+y}else{let t=o.geometry;(m??(m=new Set)).add(t.uuid);let e=this._meshSdfBaked.get(t.uuid),i=K(t);if((void 0===e||e.posVersion!==i)&&this._meshSdfWanted.set(t.uuid,t),void 0===e)return;g[0]=7,g[1]=e.slot,g[2]=e.boxHalf.x/this.bboxSize*2,g[3]=e.boxHalf.y/this.bboxSize*2,l[1152+4*v+3]=e.boxHalf.z/this.bboxSize*2,b=Math.hypot(e.boxHalf.x,e.boxHalf.y,e.boxHalf.z)/this.bboxSize*2*Y.x+y}l.set(g,768+4*v),h=Math.max(h,b),p=Math.max(p,y),this._reach[v]=b,l[1152+4*v]=y,l[1152+4*v+1]=S/this.bboxSize*2,l[1152+4*v+2]=Y.x;let T,P,_=Array.isArray(o.material)?o.material[0]:o.material,z=_;if(z?.getShapeBlendBaseColor){let t=z.getShapeBlendBaseColor();T=t,P=t.a}else void 0!==_?.uniforms?.nodeU0?(T=_.uniforms.nodeU0.node.value,P=_.uniforms.nodeU1?.value??1):(T={r:1,g:1,b:1},P=1);0!==x.operation&&!x.useColor&&(P=-1),l[1536+4*v]=T.r,l[1536+4*v+1]=T.g,l[1536+4*v+2]=T.b,l[1536+4*v+3]=P,P<1&&1===this.material.defines?.SHAPEBLEND_C&&(this.material.transparent=!0),v++}),this._meshSdfBaked.size>0){let t=m??new Set;for(let e of this._meshSdfBaked.keys())t.has(e)||this._meshSdfBaked.delete(e)}this.npart=v,this._maxBlendK=p;let x=1.1*h+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=x;let y=this._prevShapeData,g=u!==v,S=null===y||this._prevSpan!==x||g,b=S||H,T=this._fieldDirtyMin.set(1/0,1/0,1/0),P=this._fieldDirtyMax.set(-1/0,-1/0,-1/0);if(null!==y){let t=Math.max(v,u);for(let e=0;e<t;e++){let t=!1;for(let i=0;i<5;i++){let a=384*i+4*e;if(l[a]!==y[a]||l[a+1]!==y[a+1]||l[a+2]!==y[a+2]||l[a+3]!==y[a+3]){t=!0;break}}if(!t)continue;if(S=!0,b)break;let i=l[4*e],a=l[4*e+1],n=l[4*e+2],s=y[4*e],r=y[4*e+1],o=y[4*e+2],h=this._reach[e],p=this._prevReach[e];Number.isFinite(i+a+n+h)&&Number.isFinite(s+r+o+p)?(T.x=Math.min(T.x,i-h,s-p),T.y=Math.min(T.y,a-h,r-p),T.z=Math.min(T.z,n-h,o-p),P.x=Math.max(P.x,i+h,s+p),P.y=Math.max(P.y,a+h,r+p),P.z=Math.max(P.z,n+h,o+p)):b=!0}}return H&&(S=!0),this._fieldDirtyFull=b||T.x===1/0,S&&(null===y?this._prevShapeData=new Float32Array(l):y.set(l),this._prevReach.set(this._reach),this._prevSpan=x,n.needsUpdate=!0),S}function nt(t){return at.call(t)}export{k as a,E as b,M as c,F as d,N as e,V as f,B as g,A as h,W as i,K as j,G as k,nt as l};
1
+ import{a as t}from"./runtime-chunk-U6S2BBR7.js";import{a as e}from"./runtime-chunk-SXDO5LXF.js";import{$ as i,ea as a}from"./runtime-chunk-LALFWESO.js";import{e as n,h as s}from"./runtime-chunk-PLJ25O2X.js";import{a as r}from"./runtime-chunk-2PT2WH66.js";import{Aa as o,Dc as l,Ec as h,Fc as p,Ja as d,Jc as c,Lc as f,Ma as u,Oc as v,Qe as m,Vc as x,Vd as y,Zc as g,ce as S,dd as b,de as T,ld as P,na as _,nc as z,nd as w,we as R}from"./runtime-chunk-VGN7YHB7.js";var O=new b;O.setAttribute("position",new g(new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),3));var L=class extends T{constructor(t){super({...t,depthTest:!1,depthWrite:!1,glslVersion:z,vertexShader:"\n\t\t\t\tprecision highp float;\n\t\t\t\tin vec3 position;\n\t\t\t\tvoid main() {\n\t\t\t\t\tgl_Position = vec4(position, 1);\n\t\t\t\t}\n\t\t\t"})}customProgramCacheKey(){return""}};function k(){return{shapeInput:()=>"\n\t\t\tconst float posRowCoord = 0.1; \n\t\t\tconst float quatRowCoord = 0.3; \n\t\t\tconst float param1RowCoord = 0.5;\n\t\t\tconst float param2RowCoord = 0.7;\n\t\t\tconst float colorRowCoord = 0.9; \n\t\t\tuniform sampler2D shapesDataTexture;\n\t\t\tvec4 shapePos(float iin) { \n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, posRowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeQuat(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, quatRowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeParams1(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, param1RowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeParams2(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, param2RowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tvec4 shapeColor(float iin) {\n\t\t\t\tvec4 r = texture(shapesDataTexture, vec2(iin, colorRowCoord));\n\t\t\t\treturn r;\n\t\t\t}\n\t\t",getxyzi:"\n\t\t\t// this code must complement lookup\n\t\t\tfloat xi = mod(gl_FragCoord.x - 0.5, VOXEL_RESOLUTION);\n\t\t\tfloat yi = mod(gl_FragCoord.y - 0.5, VOXEL_RESOLUTION);\n\t\t\tfloat zi = floor((gl_FragCoord.x - 0.5) * INV_VOXEL_RESOLUTION) + floor((gl_FragCoord.y - 0.5) * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;\n\t\t",lookup:"\n\t\t\tuniform sampler2D potentialPassTexture;\n\t\t\tuniform sampler2D voxelPassTexture; \n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tvec4 look(float xi, float yi, float zi, sampler2D rt) {\n\t\t\t\tvec2 uv = vec2(\n\t\t\t\t\tmod(zi, Z_LAYERS_PER_ROW) + (xi + 0.5) / VOXEL_RESOLUTION,\n\t\t\t\t\tfloor(zi / Z_LAYERS_PER_ROW) + (yi + 0.5) / VOXEL_RESOLUTION\n\t\t\t\t); \n\t\t\t\tuv /= Z_LAYERS_PER_ROW;\n\t\t\t\treturn texture(rt, uv);\n\t\t\t}\n\t\t",getpart:"\n\t\t\tfloat getpart(inout float a, float b) {\n\t\t\t\tfloat t = floor(a/b);\n\t\t\t\tfloat r = a - t*b;\n\t\t\t\ta = t;\n\t\t\t\treturn r;\n\t\t\t}\n\t\t",triTable:new Float32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,8,1,1,8,9,-1,-1,-1,-1,-1,-1,-1,-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1,-1,-1,-1,11,2,0,11,0,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,2,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,10,8,2,9,8,10,-1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,10,8,2,8,1,0,8,10,1,-1,-1,-1,-1,2,10,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]),numTrisTable:new Float32Array([0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,2,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,2,3,4,4,3,3,4,4,3,4,5,5,2,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,4,2,3,3,4,3,4,2,3,3,4,4,5,4,5,3,2,3,4,4,3,4,5,3,2,4,5,5,4,5,2,4,1,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,3,2,3,3,4,3,4,4,5,3,2,4,3,4,3,5,2,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,4,3,4,4,3,4,5,5,4,4,3,5,2,5,4,2,1,2,3,3,4,3,4,4,5,3,4,4,5,2,3,3,2,3,4,4,5,4,5,5,2,4,3,5,4,3,2,4,1,3,4,4,5,4,5,3,4,4,5,5,2,3,4,2,1,2,3,3,2,3,4,2,1,3,2,4,1,2,1,1,0])}}var D=new R,U=null;function E(t){U=t}function M(){return U}var C=null;function F(t){C=t}function N(){return C}var I=null;function V(t){I=t}function B(){return I}var X=k(),A=24,W=96,H=!1,q=!0;try{let t=new URLSearchParams(window.location.search);H="0"===t.get("dbgsbstatic"),q="0"!==t.get("sb512")}catch{}function K(t){let e=t.getAttribute("position");return void 0===e?-1:1048576*(e.version??e.data?.version??0)+(e.count??0)%1048576}var j=class extends a{constructor(t,e,i){super(t,e,i),this.data=e,this.isShapeBlendEntity=!0,this.needsRebuild=!0,this.customDepthMaterialNeedsUpdate=!1,this._prevShapeData=null,this._prevSpan=-1,this._reach=new Float32Array(96),this._prevReach=new Float32Array(96),this._fieldDirtyFull=!0,this._fieldDirtyMin=new p,this._fieldDirtyMax=new p,this._maxBlendK=0,this._meshSdfBaked=new Map,this._meshSdfWanted=new Map,this._passesRenderer=null,this._npart=-1,this.spatialn=1,this.drawRangeNeedsForceUpdate=!0,this._resolutionLevel=-1,this._authoredResolutionLevel=-1,this.ultraFieldResolution=0,this.resolution=64,this.spatialDivisions=25,this.zLayersPerRow=8,this.basePyramidSize=512,this.pyramidTexture1Width=341,this.pyramidTexture1Height=256,this.pyramidTexture2Width=170,this.pyramidTexture2Height=128,this.numLevels=9,this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=0,this.bboxOffset=0,this.shapesDataTexture={value:void 0},this.spatialscene=new x,this.potentialPassScene=new x,this.voxelPassScene=new x,this._spatialPassRenderTargets=[],this._potentialPassRenderTargets=[],this._voxelPassRenderTargets=[],this._pyramidRenderTargets=[],this.geometry=new b,this.geometry.drawRange.count=0,this.spatialPassUniforms={span:{value:-1},shapesDataTexture:this.shapesDataTexture,npart:{value:this.npart},spatialn:{value:this.spatialn}},this.spatialMesh=new P(O,this.spatialPassMaterial()),this.spatialMesh.frustumCulled=!1,this.spatialscene.add(this.spatialMesh);let a=new w(X.triTable,16,256,u,o);a.needsUpdate=!0;let n=new w(X.numTrisTable,256,1,u,o);n.needsUpdate=!0,this.voxelPassUniforms={potentialPassTexture:{value:void 0},numTrisTable:{value:n}},this.voxelMesh=new P(O,this.voxelPassMaterial()),this.voxelMesh.frustumCulled=!1,this.voxelPassScene.add(this.voxelMesh),this.potentialPassUniforms={shapesDataTexture:this.shapesDataTexture,spatialPassTexture:{value:void 0},npart:{value:this.npart},spatialn:{value:this.spatialn}},this.potentialMesh=new P(O,this.potentialPassMaterial()),this.potentialMesh.frustumCulled=!1,this.potentialPassScene.add(this.potentialMesh),this.marchPassUniforms={triTable:{value:a},potentialPassTexture:{value:void 0},voxelPassTexture:{value:void 0},pyramidTexture1:{value:void 0},pyramidTexture1Size:{value:void 0},pyramidTexture2:{value:void 0},pyramidTexture2Size:{value:void 0}},this.frustumCulled=!1,this.onBeforeShadowPass=t=>{let e=at.call(this);if(0===this.npart)return void(this.geometry.drawRange.count=0);let i=this.material.root;if(i.shadersPatchedForShapeBlend){if(this.customDepthMaterialNeedsUpdate){this.customDepthMaterialNeedsUpdate=!1,this.customDepthMaterial=new S({vertexShader:i.vertexShader,fragmentShader:"\n\t\t\t\t\t\t#include <packing>\n\t\t\t\t\t\tvoid main()\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tgl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n\t\t\t\t\t\t}\n\t\t\t\t\t",uniforms:i.uniforms,defines:this.material.defines}),this.isMeshDepthMaterial=!0,this.customDistanceMaterial=new S({vertexShader:i.vertexShader,fragmentShader:"\n\t\t\t\t\t#include <common>\n\t\t\t\t\t#include <packing>\n\t\t\t\t\tuniform vec3 referencePosition;\n\t\t\t\t\tuniform float nearDistance;\n\t\t\t\t\tuniform float farDistance;\n\t\t\t\t\t\n\t\t\t\t\tvarying vec3 vWPosition;\n\t\t\t\t\tvoid main()\n\t\t\t\t\t{\n\t\t\t\t\t\tfloat dist = length(vWPosition - referencePosition);\n\t\t\t\t\t\tdist = (dist - nearDistance) / (farDistance - nearDistance);\n\t\t\t\t\t\tdist = saturate(dist);\n\t\t\t\t\t\t\n\t\t\t\t\t\tgl_FragColor = packDepthToRGBA( dist );\n\t\t\t\t\t}",uniforms:{nearDistance:{value:0},farDistance:{value:0},referencePosition:{value:new p},opacity:{value:0},...i.uniforms},defines:this.material.defines});let t=this.customDistanceMaterial;t.referencePosition=new p,t.nearDistance=0,t.farDistance=0,t.opacity=1,t.isMeshDistanceMaterial=!0}}else this.patchVertexShaderForShapeBlend(i),i.shadersPatchedForShapeBlend=!0,this.customDepthMaterialNeedsUpdate=!0;this.spatialPassUniforms.npart.value=this.npart,this.spatialPassUniforms.spatialn.value=this.spatialn,this.potentialPassUniforms.npart.value=this.npart,this.potentialPassUniforms.spatialn.value=this.spatialn;let a=this.needsRebuild;if(this.needsRebuild){this.needsRebuild=!1,this.spatialMesh.material.defines.RES=this.resolutionLevel,this.spatialMesh.material.needsUpdate=!0,this.potentialMesh.material.defines.RES=this.resolutionLevel,this.potentialPassUniforms.spatialPassTexture.value=this.spatialPassRenderTarget.texture,this.potentialMesh.material.needsUpdate=!0,this.voxelMesh.material.defines.RES=this.resolutionLevel,this.voxelMesh.material.needsUpdate=!0,this.voxelPassUniforms.potentialPassTexture.value=this.potentialPassRenderTarget.texture,this.marchPassUniforms.potentialPassTexture.value=this.potentialPassRenderTarget.texture,this.marchPassUniforms.voxelPassTexture.value=this.voxelPassRenderTarget.textures[0],this.material.defines.RES=this.resolutionLevel,this.material.defines.LEVELS=this.pyramidLevelSizes.length,this.material.defines.LOOP=this.pyramidLevelSizes.length%2==0?this.pyramidLevelSizes.length-3:this.pyramidLevelSizes.length-2,this.material.defines.HALF=this.pyramidLevelSizes.length%2==0?1:0,this.material.needsUpdate=!0;let t=this.pyramidLevelSizes.length%2==0?0:1,e=this.pyramidLevelSizes.length%2==0?1:0;this.marchPassUniforms.pyramidTexture2.value=this.pyramidRenderTarget[t].texture,this.marchPassUniforms.pyramidTexture2Size.value=new l(this.pyramidRenderTarget[t].width,this.pyramidRenderTarget[t].height),this.marchPassUniforms.pyramidTexture1.value=this.pyramidRenderTarget[e].texture,this.marchPassUniforms.pyramidTexture1Size.value=new l(this.pyramidRenderTarget[e].width,this.pyramidRenderTarget[e].height),Object.assign(this.material.uniforms,this.marchPassUniforms)}if(!e&&!a&&!this.drawRangeNeedsForceUpdate&&this._passesRenderer===t)return;this._passesRenderer=t;let n=t.shadowMap.enabled;t.shadowMap.enabled=!1;let s=t.getRenderTarget();t.setRenderTarget(this.spatialPassRenderTarget),t.render(this.spatialscene,D),t.setRenderTarget(this.potentialPassRenderTarget),t.render(this.potentialPassScene,D),t.setRenderTarget(this.voxelPassRenderTarget),t.render(this.voxelPassScene,D),j.streamCompaction.renderPyramid(this.resolutionLevel,this.pyramidLevelSizes,t,this.voxelPassRenderTarget,this.pyramidRenderTarget).then(t=>{this.material.wireframe&&(3*t>this.geometry.attributes.position.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.dispose(),this.geometry=new b,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]},this.geometry.attributes.position=new g(new Float32Array(3*t*2),3)),(3*t>this.geometry.drawRange.count||this.drawRangeNeedsForceUpdate)&&(this.geometry.drawRange.count=3*Math.floor(1.2*t),this.markSceneShadowsDirty()),this.drawRangeNeedsForceUpdate=!1}),t.shadowMap.enabled=n,t.setRenderTarget(s)}}markSceneShadowsDirty(){let t=this.parent;if(null!==t){for(;t.parent;)t=t.parent;t.markShadowsDirty?.()}}set npart(t){t!==this._npart&&(this.drawRangeNeedsForceUpdate=!0,this._npart=t,this.spatialn=Math.ceil(t/96))}get npart(){return this._npart}set resolutionLevel(t){let e=Math.min(q?9:8,Math.max(5,t));if(e===this._authoredResolutionLevel)return;this._authoredResolutionLevel=e,this.ultraFieldResolution=Math.pow(2,e);let i=Math.min(8,e);switch(this._resolutionLevel=i,this.resolution=Math.pow(2,i),this.resolutionLevel){case 5:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192],this.bboxSize=496,this.bboxOffset=-8;break;case 6:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512],this.bboxSize=504,this.bboxOffset=-4;break;case 7:this.pyramidLevelSizes=[1,2,4,6,12,24,48,96,192,384,768,1536],this.bboxSize=508,this.bboxOffset=-2;break;case 8:this.pyramidLevelSizes=[1,2,4,8,16,32,64,128,256,512,1024,2048,4096],this.bboxSize=510,this.bboxOffset=-1}this.pyramidTexture1Width=0,this.pyramidTexture2Width=0,this.pyramidTexture1Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-2],this.pyramidTexture2Height=this.pyramidLevelSizes[this.pyramidLevelSizes.length-3];for(let t=this.pyramidLevelSizes.length-2;t>=0;t--)(this.pyramidLevelSizes.length-2)%2==t%2?this.pyramidTexture1Width+=this.pyramidLevelSizes[t]:this.pyramidTexture2Width+=this.pyramidLevelSizes[t];this.basePyramidSize=this.pyramidLevelSizes[this.pyramidLevelSizes.length-1],this.zLayersPerRow=this.basePyramidSize/this.resolution,this.numLevels=this.pyramidLevelSizes.length-1,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]},this.needsRebuild=!0,this.customDepthMaterialNeedsUpdate=!0}get resolutionLevel(){return this._resolutionLevel}get spatialPassRenderTarget(){let t=this._spatialPassRenderTargets[this.resolutionLevel];return t||(t=new f(this.spatialDivisions*this.spatialn,this.spatialDivisions**2,{format:d,type:o,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:_,magFilter:_}),this._spatialPassRenderTargets[this.resolutionLevel]=t),t}get potentialPassRenderTarget(){let t=this._potentialPassRenderTargets[this.resolutionLevel];return t||(t=new f(this.basePyramidSize,this.basePyramidSize,{format:d,type:o,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:_,magFilter:_}),this._potentialPassRenderTargets[this.resolutionLevel]=t),t}get voxelPassRenderTarget(){let t=this._voxelPassRenderTargets[this.resolutionLevel];return t||(t=new f(this.basePyramidSize,this.basePyramidSize,{count:2,stencilBuffer:!1,depthBuffer:!1,generateMipmaps:!1,minFilter:_,magFilter:_}),t.textures[0].format=d,t.textures[0].type=o,t.textures[1].format=u,t.textures[1].type=o,this._voxelPassRenderTargets[this.resolutionLevel]=t),t}get pyramidRenderTarget(){let t=this._pyramidRenderTargets[this.resolutionLevel];return t||(t=[new f(this.pyramidTexture1Width,this.pyramidTexture1Height,{format:d,type:o,stencilBuffer:!1,depthBuffer:!1,magFilter:_,minFilter:_}),new f(this.pyramidTexture2Width,this.pyramidTexture2Height,{format:d,type:o,stencilBuffer:!1,depthBuffer:!1,magFilter:_,minFilter:_})],this._pyramidRenderTargets[this.resolutionLevel]=t),t}updateState(t,e){let i=this.material;super.updateState(t,e),i!==this.material&&(this.needsRebuild=!0),t.geometry&&(this.resolutionLevel=t.geometry.resolutionLevel,this.geometry.userData.parameters={width:this.bboxSize,height:this.bboxSize,depth:this.bboxSize,centerOffset:[this.bboxOffset,this.bboxOffset,this.bboxOffset]}),t.wireframe&&!this.geometry.getAttribute("position")?this.geometry.setAttribute("position",new g(new Float32Array(3*this.geometry.drawRange.count),3)):!t.wireframe&&this.geometry.getAttribute("position")&&this.geometry.deleteAttribute("position")}spatialPassMaterial(){let t=`\n\t\t\tprecision highp float;\n\t\t\tout vec4 pc_FragColor;\n\t\t\tconst float spatialDivisions = ${this.spatialDivisions}.;\n\t\t\tuniform float span;\n\t\t\tuniform float npart;\n\t\t\tuniform float spatialn;\n\t\t\t${X.shapeInput()}\n\n\t\t\tvec3 low, high; \n\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tfloat spatialKey(float lowi) {\n\t\t\t\tfloat t = 0.;\n\t\t\t\tfor (float ii = 23.; ii >= 0.; ii--) {\n\t\t\t\t\tfloat i = ii + lowi;\n\t\t\t\t\tfloat iin = (i + 0.5) / 96.;\n\t\t\t\t\tvec4 shape = shapePos(iin);\n\t\t\t\t\tvec3 d = shape.xyz;\n\t\t\t\t\tfloat op = shape.w;\n\t\n\t\t\t\t\tt *= 2.;\n\t\t\t\t\tt += (\n\t\t\t\t\t\tlow.x < d.x && d.x < high.x &&\n\t\t\t\t\t\tlow.y < d.y && d.y < high.y &&\n\t\t\t\t\t\tlow.z < d.z && d.z < high.z &&\n\t\t\t\t\t\ti < npart || op == -2. \n\t\t\t\t\t) ? 1. : 0.;\n\t\t\t\t}\n\t\t\t\treturn t;\n\t\t\t}\n\n\t\t\t${X.getpart}\n\n\t\t\tvoid main() { \n\t\t\t\t\n\t\t\t\tvec3 div; \n\t\t\t\t\n\t\t\t\tfloat yz = float(gl_FragCoord.y - 0.5); \n\t\t\t\tdiv.y = getpart(yz, spatialDivisions);\n\t\t\t\tdiv.z = yz; \n\n\t\t\t\tfloat lx = float(gl_FragCoord.x - 0.5); \n\t\t\t\tfloat lowi = getpart(lx, spatialn) * 96.;\n\t\t\t\tdiv.x = lx;\n\n\t\t\t\tlow = div / spatialDivisions * 2. - 1. - span;\n\t\t\t\thigh = (div+1.) / spatialDivisions * 2. - 1. + span;\n\n\t\t\t\t\n\t\t\t\tpc_FragColor.x = spatialKey(lowi);\n\t\t\t\tpc_FragColor.y = spatialKey(lowi+24.);\n\t\t\t\tpc_FragColor.z = spatialKey(lowi+48.);\n\t\t\t\tpc_FragColor.w = spatialKey(lowi+72.);\n\t\t\t}\n\t\t`;return new L({name:"Spatial Pass",fragmentShader:t,uniforms:this.spatialPassUniforms})}potentialPassMaterial(){let t=`\n\t\t\tprecision highp float;\n\t\t\tout vec4 pc_FragColor;\n\n\t\t\t${X.shapeInput()}\n\t\t\tuniform sampler2D spatialPassTexture;\n\n\t\t\tconst float res = float(RES);\n\t\t\tconst float VOXEL_RESOLUTION = pow(2., res);\n\t\t\tconst float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));\n\t\t\tconst float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.;\n\t\t\tconst float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;\n\n\t\t\tuniform float npart;\n\t\t\tuniform float spatialn;\n\t\t\tconst float spatialDivisions = ${this.spatialDivisions}.;\n\t\t\tconst float spatialDivisions2 = spatialDivisions * spatialDivisions;\n\t\t\tconst float spatialDivisionsSub1 = spatialDivisions - 1.;\n\n\t\t\t${X.getpart}\n\n\t\t\tvec3 packRGBAToVec3(vec4 color) {\n\t\t\t\tuint r = uint(color.r * 255.);\n\t\t\t\tuint g = uint(color.g * 255.);\n\t\t\t\tuint combined = (r << 8) | g; \n\t\t\t\treturn vec3(float(combined) * 0.00001525902, color.b, color.a); \n\t\t\t}\n\n\t\t\tvoid applyQuaternionToVector(in vec4 q, inout vec3 v) {\n\t\t\t\tv += 2.0 * cross(q.xyz, cross(q.xyz, v) + q.w * v);\n\t\t\t}\n\n\t\t\t\n\n\n\n\t\t\t\n\t\t\tfloat smoothOperation(float op, float sdf, float d, float k) {\n\t\t\t \n\t\t\t \n\t\t\t\t\n\n\t\t\t\tfloat signSubtract = clamp(op, -1., 1.);\n\t\t\t\tfloat signIntersection = 2. * (op - signSubtract) + 1.;\n\t\t\t\tfloat h = clamp(\n\t\t\t\t\t0.5 + signSubtract * 0.5 * (sdf - signSubtract * signIntersection * d) / k,\n\t\t\t\t\t0.0,\n\t\t\t\t\t1.0\n\t\t\t\t);\n\t\t\t\treturn mix(sdf, signSubtract * signIntersection * d, h) - \n\t\t\t\t\t\t\t signSubtract * k * h * (1.0 - h);\n\t\t\t}\n\n\t\t\tfloat sdSphere( vec3 p, float s )\n\t\t\t{\n\t\t\t\treturn length(p)-s;\n\t\t\t}\n\n\t\t\tfloat sdEllipsoid( vec3 p, vec3 r )\n\t\t\t{\n\t\t\t\tfloat k0 = length(p/r);\n\t\t\t\tfloat k1 = length(p/(r*r));\n\t\t\t\treturn k0*(k0-1.0)/k1;\n\t\t\t}\n\n\t\t\tfloat sdBox( vec3 p, vec3 b )\n\t\t\t{\n\t\t\t\tvec3 q = abs(p) - b;\n\t\t\t\treturn length(max(q,0.0)) + min(max(q.x,max(q.y,q.z)),0.0);\n\t\t\t}\n\n\t\t\tfloat sdTorus( vec3 p, vec2 t )\n\t\t\t{\n\t\t\t\tvec2 q = vec2(length(p.xy)-t.x,p.z);\n\t\t\t\treturn length(q)-t.y;\n\t\t\t}\n\n\t\t\tfloat sdCappedTorus( vec3 p, vec2 sc, float ra, float rb)\n\t\t\t{\n\t\t\t\tp.x = abs(p.x);\n\t\t\t\tfloat k = (sc.y*p.x>sc.x*p.y) ? dot(p.xy,sc) : length(p.xy);\n\t\t\t\treturn sqrt( dot(p,p) + ra*ra - 2.0*ra*k ) - rb;\n\t\t\t}\n\n\t\t\tfloat dot2( in vec2 v ) { return dot(v,v); }\n\t\t\tfloat sdCappedCone( vec3 p, float h, float r1, float r2 )\n\t\t\t{\n\t\t\t\tvec2 q = vec2( length(p.xz), p.y );\n\t\t\t\tvec2 k1 = vec2(r2,h);\n\t\t\t\tvec2 k2 = vec2(r2-r1,2.0*h);\n\t\t\t\tvec2 ca = vec2(q.x-min(q.x,(q.y<0.0)?r1:r2), abs(q.y)-h);\n\t\t\t\tvec2 cb = q - k1 + k2*clamp( dot(k1-q,k2)/dot2(k2), 0.0, 1.0 );\n\t\t\t\tfloat s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0;\n\t\t\t\treturn s*sqrt( min(dot2(ca),dot2(cb)) );\n\t\t\t}\n\n\t\t\tfloat sdCappedCylinder( vec3 p, float h, float r )\n\t\t\t{\n\t\t\t\tvec2 d = abs(vec2(length(p.xz),p.y)) - vec2(r,h);\n\t\t\t\treturn min(max(d.x,d.y),0.0) + length(max(d,0.0));\n\t\t\t}\n\n\t\t\tfloat maxBlend = 0.0;\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tvoid fillSpatialInner(\n\t\t\t\tfloat ii,\n\t\t\t\tfloat activeKey,\n\t\t\t\tvec3 corner,\n\t\t\t\tinout float sdf,\n\t\t\t\tinout float colorDivisor,\n\t\t\t\tinout vec4 trackColor\n\t\t\t) {\n\t\t\t\tfor (float i = 0.; i < 24.; i++) {\n\t\t\t\t\tif (activeKey < 1.) break; \n\t\t\t\t\tactiveKey *= 0.5;\n\t\t\t\t\tif (fract(activeKey) < 0.5) continue;\n\n\t\t\t\t\tfloat iin = (i + ii + 0.5) * ${1/96};\n\t\t\t\t\tvec4 shape = shapePos(iin);\n\t\t\t\t\tvec4 quat = shapeQuat(iin);\n\t\t\t\t\tvec4 params1 = shapeParams1(iin);\n\t\t\t\t\tvec4 params2 = shapeParams2(iin);\n\n\t\t\t\t\tvec3 p = corner - shape.xyz;\n\t\t\t\t\tapplyQuaternionToVector(quat, p);\n\t\t\t\t\tp /= params2.z; // scale\n\t\t\t\t\tfloat d; // d in -1..1 coordinates\n\t\t\t\t\tswitch (int(params1.x)) {\n\t\t\t\t\t\tcase 0: d = sdSphere(p, params1.y); break;\n\t\t\t\t\t\tcase 1: d = sdEllipsoid(p, params1.yzw); break;\n\t\t\t\t\t\tcase 2: d = sdBox(p, params1.yzw); break;\n\t\t\t\t\t\tcase 3: d = sdCappedCylinder(p, params1.y, params1.z); break;\n\t\t\t\t\t\tcase 4: d = sdCappedCone(p, params1.y, params1.z, params1.w); break;\n\t\t\t\t\t\tcase 5: d = sdTorus(p, params1.yz); break;\n\t\t\t\t\t\tcase 6: d = sdCappedTorus(p, params1.yz, params1.w, params2.w); break;\n\t\t\t\t\t\t// Mesh children (type 7) live in a WebGPU-only baked SDF\n\t\t\t\t\t\t// atlas — the GLSL evaluator skips the shape entirely\n\t\t\t\t\t\t// (also closes the latent uninitialized-d default).\n\t\t\t\t\t\tdefault: continue;\n\t\t\t\t\t}\n\t\t\t\t\td -= params2.y; // rounded edge\n\t\t\t\t\td *= params2.z; // scale\n\n\t\t\t\t\tfloat k = params2.x;\n\t\t\t\t\tfloat op = shape.w;\n\n\t\t\t\t\tsdf = smoothOperation(shape.w, sdf, d, k);\n\n\t\t\t\t\tfloat isNegativeOne = step(-1.5, op) * step(op, -0.5); // 1 when op == -1, 0 otherwise\n\t\t\t\t\tfloat colorCull = smoothstep(maxBlend, 0., -d);\n\t\t\t\t\tfloat cullFactor = mix(1.0, colorCull, isNegativeOne);\n\t\t\t\t\ttrackColor *= cullFactor;\n\t\t\t\t\tcolorDivisor *= cullFactor;\n\n\t\t\t\t\tmaxBlend = max(maxBlend, k);\n\n\t\t\t\t\tk += 2. * INV_VOXEL_RESOLUTION; // avoid division by zero, and other color artifacts with very small k\n\t\t\t\t\tfloat nearness = smoothstep(k, 0., d);\n\n\t\t\t\t\tvec4 color = shapeColor(iin);\n\t\t\t\t\tnearness *= float(color.a >= 0.);\n\n\t\t\t\t\tcolorDivisor += nearness;\n\t\t\t\t\ttrackColor += color * nearness;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvec3 div;\n\t\t\t// compute potential from all spheres; collect +ve and =ve values separately\n\t\t\t// work in blocks of A*4 (=96) spheres, using the bit flags in 4 float channel 'activeKey' values\n\t\t\t// TODO check if extra vec3 output useful, not really used at present\n\t\t\tfloat fillSpatial(vec3 corner, inout vec4 trackColor) {\n\t\t\t\tfloat sdf = 1e3; // hack: initialize to large value\n\t\t\t\tfloat colorDivisor = 0.;\n\t\t\t\t// spatialPassTexture holds x=> lowi, x faster moving and y=> z, y faster moving\n\t\t\t\tfloat divyz = (div.y + div.z * spatialDivisions + 0.5) / (spatialDivisions2);\n\t\t\t\tfor (float ii = 0.; ii < spatialn; ii++) {\n\t\t\t\t\tfloat i = ii * 96.;\n\n\t\t\t\t\tvec4 activeKey = texture(spatialPassTexture, vec2((div.x * spatialn + ii + 0.5)/(spatialn * spatialDivisions), divyz));\n\t\t\t\t\tfillSpatialInner(i, activeKey.x, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+24., activeKey.y, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+48., activeKey.z, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t\tfillSpatialInner(i+72., activeKey.w, corner, sdf, colorDivisor, trackColor);\n\t\t\t\t}\n\n\t\t\t\ttrackColor /= colorDivisor;\n\t\t\t\treturn mix(sdf, 0.0, step(1e20 - 0.1, sdf));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\t${X.getxyzi} \n\n\t\t\t\tvec3 xyzi = vec3(xi,yi,zi);\n\t\t\t\tvec3 corner = xyzi / VOXEL_RESOLUTION_SUB1 * 2. - 1.; \n\n\t\t\t\tdiv = floor(xyzi / VOXEL_RESOLUTION_SUB1 * spatialDivisionsSub1);\n\n\t\t\t\tvec4 c = vec4(0.);\n\t\t\t\tfloat t = fillSpatial(corner, c);\n\n\t\t\t\tpc_FragColor = vec4(t, packRGBAToVec3(c)); \n\t\t\t}\n\t\t`;return new L({name:"PotentialPass",fragmentShader:t,uniforms:this.potentialPassUniforms})}voxelPassMaterial(){let t=`\n\t\t\tprecision highp float;\n\t\t\tlayout(location = 0) out vec4 pc_FragColor;\n\t\t\tlayout(location = 1) out vec4 numTris;\n\n\t\t\tconst float res = float(RES);\n\t\t\tconst float VOXEL_RESOLUTION = pow(2., res);\n\t\t\tconst float VOXEL_RESOLUTION_SUB1 = VOXEL_RESOLUTION - 1.; \n\t\t\tconst float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));\n\t\t\tconst float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;\n\t\t\tuniform sampler2D numTrisTable; \n\n\t\t\tfloat keyi(float f000, float f100, float f010, float f110, float f001, float f101, float f011, float f111) {\n\t\t\t\treturn (float(f000 < 0.) * 1.) +\n\t\t\t\t\t\t\t (float(f100 < 0.) * 2.) +\n\t\t\t\t\t\t\t (float(f010 < 0.) * 8.) +\n\t\t\t\t\t\t\t (float(f110 < 0.) * 4.) +\n\t\t\t\t\t\t\t (float(f001 < 0.) * 16.) +\n\t\t\t\t\t\t\t (float(f101 < 0.) * 32.) +\n\t\t\t\t\t\t\t (float(f011 < 0.) * 128.) +\n\t\t\t\t\t\t\t (float(f111 < 0.) * 64.);\n\t\t\t}\n\n\t\t\t${X.lookup}\n\n\t\t\tvec3 compNormi(float xi, float yi, float zi) {\n\t\t\t\tfloat dx = look(xi + 1., yi, zi, potentialPassTexture).r - look(xi - 1., yi, zi, potentialPassTexture).r;\n\t\t\t\tfloat dy = look(xi, yi + 1., zi, potentialPassTexture).r - look(xi, yi - 1., zi, potentialPassTexture).r;\n\t\t\t\tfloat dz = look(xi, yi, zi + 1., potentialPassTexture).r - look(xi, yi, zi - 1., potentialPassTexture).r;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (dx == 0.0 && dy == 0.0 && dz == 0.0) {\n\t\t\t\t\treturn vec3(0.199, 0.299, 0.399);\n\t\t\t\t}\n\t\t\t\treturn normalize(vec3(dx, dy, dz));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\t${X.getxyzi} \n\n\t\t\t\tvec3 normal = compNormi(xi, yi, zi); \n\n\t\t\t\tif (xi >= VOXEL_RESOLUTION_SUB1 || yi >= VOXEL_RESOLUTION_SUB1 || zi >= VOXEL_RESOLUTION_SUB1) {\n\t\t\t\t\tpc_FragColor = vec4(normal, 0.);\n\t\t\t\t\tnumTris = vec4(0.);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfloat\n\t\t\t\t\tf000 = look(xi, yi, zi, potentialPassTexture).r,\n\t\t\t\t\tf100 = look(xi+1., yi, zi, potentialPassTexture).r,\n\t\t\t\t\tf010 = look(xi, yi+1., zi, potentialPassTexture).r,\n\t\t\t\t\tf110 = look(xi+1., yi+1., zi, potentialPassTexture).r,\n\t\t\t\t\tf001 = look(xi, yi, zi+1., potentialPassTexture).r,\n\t\t\t\t\tf101 = look(xi+1., yi, zi+1., potentialPassTexture).r,\n\t\t\t\t\tf011 = look(xi, yi+1., zi+1., potentialPassTexture).r,\n\t\t\t\t\tf111 = look(xi+1., yi+1., zi+1., potentialPassTexture).r;\n\t\t\t\tfloat key = keyi(f000, f100, f010, f110, f001, f101, f011, f111);\n\n\t\t\t\tpc_FragColor = vec4(normal, key);\n\n\t\t\t\tnumTris = texture(numTrisTable, vec2((key + 0.5) / 256., 0.5));\n\t\t\t}\n\t\t`;return new L({name:"VoxelPass",fragmentShader:t,uniforms:this.voxelPassUniforms})}patchVertexShaderForShapeBlend(t){let e=`\n\t\t#ifdef SHAPEBLEND \n\t\t\tprecision highp sampler2D;\n\n\t\t\tuniform float isol;\n\n\t\t\tuniform sampler2D triTable; \n\t\t\tuniform sampler2D pyramidTexture1;\n\t\t\tuniform vec2 pyramidTexture1Size;\n\t\t\tuniform sampler2D pyramidTexture2;\n\t\t\tuniform vec2 pyramidTexture2Size;\n\n\t\t\tconst vec2 halfPixelOffset = vec2(0.5, 0.5);\n\n\t\t\tconst vec2 rShift = vec2(0., 1.);\n\t\t\tconst vec2 gShift = vec2(1., 1.);\n\t\t\tconst vec2 bShift = vec2(1., 0.);\n\n\t\t\tconst float res = float(RES);\n\t\t\tconst float VOXEL_RESOLUTION = pow(2., res);\n\t\t\tconst float Z_LAYERS_PER_ROW = ceil(pow(2., res / 2.));\n\t\t\tconst float INV_VOXEL_RESOLUTION = 1.0 / VOXEL_RESOLUTION;\n\n\t\t\tconst float scale_factor = 2.;\n\n\t\t\t#if SHAPEBLEND == 5\n\t\t\t\tconst float levelShiftX[7] = float[7](4., 6., 12., 24., 48., 96., 192.);\n\t\t\t\tconst float scale = 8. * scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(16.);\n\t\t\t#elif SHAPEBLEND == 7\n\t\t\t\tconst float levelShiftX[10] = float[10](4., 6., 12., 24., 48., 96., 192., 384., 768., 1536.); \n\t\t\t\tconst float scale = 2. * scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(64.);\n\t\t\t#elif SHAPEBLEND == 8\n\t\t\t\tconst float levelShiftX[11] = float[11](4., 8., 16., 32., 64., 128., 256., 512., 1024., 2048., 4096.);\n\t\t\t\tconst float scale = scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(128.);\n\t\t\t#else\n\t\t\t\tconst float levelShiftX[8] = float[8](4., 8., 16., 32., 64., 128., 256., 512.);\n\t\t\t\tconst float scale = 4. * scale_factor;\n\t\t\t\tconst vec3 originOffset = vec3(32.);\n\t\t\t#endif\n\n\t\t\t${X.lookup}\n\n\t\t\tconst vec3 offsets[24] = vec3[](\n\t\t\t\tvec3(0., 0., 0.), vec3(1., 0., 0.),\n\t\t\t\tvec3(1., 0., 0.), vec3(1., 1., 0.),\n\t\t\t\tvec3(0., 1., 0.), vec3(1., 1., 0.),\n\t\t\t\tvec3(0., 0., 0.), vec3(0., 1., 0.),\n\t\t\t\tvec3(0., 0., 1.), vec3(1., 0., 1.),\n\t\t\t\tvec3(1., 0., 1.), vec3(1., 1., 1.),\n\t\t\t\tvec3(0., 1., 1.), vec3(1., 1., 1.),\n\t\t\t\tvec3(0., 0., 1.), vec3(0., 1., 1.),\n\t\t\t\tvec3(0., 0., 0.), vec3(0., 0., 1.),\n\t\t\t\tvec3(1., 0., 0.), vec3(1., 0., 1.),\n\t\t\t\tvec3(1., 1., 0.), vec3(1., 1., 1.),\n\t\t\t\tvec3(0., 1., 0.), vec3(0., 1., 1.)\n\t\t\t);\n\n\t\t\tvec2 computeShiftedPosition1(vec2 xy, float levelOriginX) {\n\t\t\t\tvec2 xyShifted = xy;\n\t\t\t\txyShifted.x += levelOriginX;\n\t\t\t\treturn (xyShifted + halfPixelOffset) / pyramidTexture1Size;\n\t\t\t}\n\n\t\t\tvec2 computeShiftedPosition2(vec2 xy, float levelOriginX) {\n\t\t\t\tvec2 xyShifted = xy;\n\t\t\t\txyShifted.x += levelOriginX;\n\t\t\t\treturn (xyShifted + halfPixelOffset) / pyramidTexture2Size;\n\t\t\t}\n\n\t\t\tvec4 unpackVec3ToRGBA(vec3 vec) {\n\t\t\t\tuint combined = uint(vec.x * 65535.0 + 0.5); \n\t\t\t\tfloat g = float(combined & uint(0xFF)) * 0.00392156862; \n\t\t\t\tfloat r = float((combined >> 8) & uint(0xFF)) * 0.00392156862; \n\t\t\n\t\t\t\treturn vec4(r, g, vec.y, vec.z);\n\t\t\t}\n\n\t\t\tout vec4 marchColor;\n\t\t\t\n\t\t#endif\n\t\t`;t.vertexShader=e+t.vertexShader.replace("#include <project_vertex>","\n\t\t#ifdef SHAPEBLEND\n\t\t\tfloat triIndex = floor(float(gl_VertexID/3));\n\t\t\tfloat vertexIndex = float(gl_VertexID);\n\t\t\t\n\t\t\t\n\t\t\tfloat levelOriginX1 = pyramidTexture1Size.x - 2.;\n\t\t\tfloat levelOriginX2 = pyramidTexture2Size.x - 1.;\n\t\t\tvec2 xy = vec2(0.);\n\t\t\tvec4 lookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));\n\t\t\t\n\t\t\t\n\t\t\tif (triIndex >= lookUp.r) return;\n\t\t\t\n\t\t\t\n\t\t\tfloat start = 0.;\n\t\t\tvec4 triIndexVec = vec4(triIndex);\n\t\t\t\n\t\t\t\n\t\t\tfor (int i = 0; i < LOOP;) {\n\t\t\t\t\n\t\t\t\tvec4 ends = lookUp + vec4(start);\n\t\t\t\tvec4 starts = vec4(ends.gba, start);\n\t\t\t\tvec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * \n\t\t\t\t\t\t\t\t\t\t\tvec4(lessThan(triIndexVec, ends));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\txy *= 2.;\n\t\t\t\txy += check.r * rShift + check.g * gShift + check.b * bShift;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tstart = dot(check, starts);\n\t\t\t\tlevelOriginX2 -= levelShiftX[i];\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tlookUp = texture(pyramidTexture1, computeShiftedPosition1(xy, levelOriginX1));\n\t\t\t\ti++;\n\n\t\t\t\tends = lookUp + vec4(start);\n\t\t\t\tstarts = vec4(ends.gba, start);\n\t\t\t\tcheck = vec4(greaterThanEqual(triIndexVec, starts)) * \n\t\t\t\t\t\t\t\t\t\t\tvec4(lessThan(triIndexVec, ends));\n\t\t\t\t\n\t\t\t\t\n\t\t\t\txy *= 2.;\n\t\t\t\txy += check.r * rShift + check.g * gShift + check.b * bShift;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tstart = dot(check, starts);\n\t\t\t\tlevelOriginX1 -= levelShiftX[i];\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tlookUp = texture(pyramidTexture2, computeShiftedPosition2(xy, levelOriginX2));\n\n\t\t\t\ti++;\n\t\t\t}\n\n\t\t\t#if HALF == 1\n\t\t\t\tvec4 ends = lookUp + vec4(start);\n\t\t\t\tvec4 starts = vec4(ends.gba, start);\n\t\t\t\tvec4 check = vec4(greaterThanEqual(triIndexVec, starts)) * vec4(lessThan(triIndexVec, ends));\n\t\t\t\n\t\t\t\t\n\t\t\t\txy *= 2.;\n\t\t\t\txy += check.r * rShift + check.g * gShift + check.b * bShift;\n\t\t\t\n\t\t\t\t\n\t\t\t\tstart = dot(check, starts);\n\t\t\t#endif\n\t\t\t\n\t\t\t\n\t\t\tvec3 gridPos;\n\t\t\tgridPos.x = mod(xy.x, VOXEL_RESOLUTION);\n\t\t\tgridPos.y = mod(xy.y, VOXEL_RESOLUTION);\n\t\t\tgridPos.z = floor(xy.x * INV_VOXEL_RESOLUTION) + \n\t\t\t\t\t\t\t\t\tfloor(xy.y * INV_VOXEL_RESOLUTION) * Z_LAYERS_PER_ROW;\n\t\t\t\n\t\t\t\n\t\t\tvertexIndex -= start * 3.;\n\t\t\tfloat vk = vertexIndex * 0.0625 + 0.03125; \n\t\t\t\n\t\t\t\n\t\t\tvec4 voxel = look(gridPos.x, gridPos.y, gridPos.z, voxelPassTexture);\n\t\t\tfloat key = (voxel.w + 0.5) * 0.00390625; \n\t\t\t\n\t\t\t\n\t\t\tfloat edgeNum = texture(triTable, vec2(vk, key)).x;\n\t\t\tint edgeIndex = int(edgeNum) * 2;\n\t\t\t\n\t\t\t\n\t\t\tvec3 p1 = gridPos + offsets[edgeIndex];\n\t\t\tvec3 p2 = gridPos + offsets[edgeIndex + 1];\n\t\t\t\n\t\t\t\n\t\t\tvec4 potential1 = look(p1.x, p1.y, p1.z, potentialPassTexture);\n\t\t\tvec4 potential2 = look(p2.x, p2.y, p2.z, potentialPassTexture);\n\t\t\t\n\t\t\t\n\t\t\tfloat mu = potential1.r / (potential1.r - potential2.r);\n\n\t\t\tmarchColor = mix(\n\t\t\t\tunpackVec3ToRGBA(potential1.gba),\n\t\t\t\tunpackVec3ToRGBA(potential2.gba),\n\t\t\t\tmu\n\t\t\t);\n\n\t\t\ttransformed = p1 + (p2 - p1) * mu;\n\t\t\ttransformed -= originOffset;\n\t\t\ttransformed *= scale;\n\t\t\tvec4 data1 = look(p1.x, p1.y, p1.z, voxelPassTexture);\n\t\t\tvec4 data2 = look(p2.x, p2.y, p2.z, voxelPassTexture);\n\t\t\tobjectNormal = normalize(mix(data1.xyz, data2.xyz, mu));\n\t\t\ttransformedNormal = normalMatrix * objectNormal;\n\t\t\t#ifndef FLAT_SHADED\n\t\t\t\tvNormal = transformedNormal;\n\t\t\t#endif\n\t\t#endif\n\t\t\n#include <project_vertex>");let i=t.fragmentShader.match(/vec3 diffuseColor[^\n]*\n/);if(!i)return;let a=`\n\t\t#ifdef SHAPEBLEND_C\n\t\t\t#if SHAPEBLEND_C == 1\n\t\t\t\t${i[0].replace(/nodeU0,/g,"marchColor.rgb,").replace(/nodeU\d+(?=,g_uid\d+_calpha\))/g,"marchColor.a")}\n\t\t\t#else\n\t\t\t\t${i[0]}\n\t\t\t#endif\n\t\t#else\n\t\t\t${i[0]}\n\t\t#endif\n\t\t`;t.fragmentShader="in vec4 marchColor;\n"+t.fragmentShader.replace(i[0],a),Object.assign(t.uniforms,this.marchPassUniforms)}initDebugPass(t){console.log("fboToDebug.width",t.width,t.height),this.geometry=new y(t.width,t.height),this.geometry.userData={parameters:{width:4,height:4}};let e={inputTexture:{value:t.textures.length>1?t.textures[1]:t.texture},pyramidTextureSize:{value:void 0}},i=t=>{t.vertexShader="\n\t\t\t\tprecision highp float;\n\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t\t\t\tvUv = uv;\n\t\t\t\t}\n\t\t\t",t.fragmentShader="\n\t\t\t\tlayout(location = 1) out vec4 gVelocity;\n\n\t\t\t\tprecision highp float;\n\t\t\t\t\n\t\t\t\tuniform sampler2D inputTexture;\n\t\t\t\tvarying vec2 vUv;\n\n\t\t\t\tuniform vec2 pyramidTextureSize;\n\n\t\t\t\tvoid main() {\n\t\t\t\t\t\t\n\t\t\t\t\t\tgl_FragColor = texture(inputTexture, vUv);\n\t\t\t\t\t\tgVelocity = vec4(0.0);\n\t\t\t\t}\n\t\t\t",e.pyramidTextureSize.value=new l(this.pyramidRenderTarget[0].width,this.pyramidRenderTarget[0].height),Object.assign(t.uniforms,e)};this.material.shapeBlendhack=i,this.material.root.shapeBlendhack=i}dispose(){super.dispose(),B()?.release(this)}},G=j;G.streamCompaction=new class{constructor(){this.pyramidPassScene=new x,this.pyramidPassMaterial=new L({name:"PyramidPass"}),this.pyramidPassUniforms={inputTexture:{value:void 0},inputWidth:{value:0},inputHeight:{value:0},inputShiftX:{value:0},outputShiftX:{value:0}},this.pyramidTopLevelReadPixelBuffer=new Float32Array(4),this.pyramidPassMaterial.fragmentShader="\n\t\t\tprecision highp float;\n\t\t\tprecision highp sampler2D;\n\t\t\tlayout(location = 0) out vec4 pc_FragColor;\n\t\t\tuniform sampler2D inputTexture;\n\t\t\tuniform float inputWidth;\n\t\t\tuniform float inputHeight;\n\t\t\tuniform float inputShiftX;\n\t\t\tuniform float outputShiftX;\n\t\t\tconst vec2 half_unit_coord = vec2(0.5);\n\t\t\tconst vec4 one = vec4(1.0);\n\t\t\tvoid main() {\n\t\t\t\tvec2 inputSize = vec2(inputWidth, inputHeight);\n\t\t\t\tvec2 input_pixel_uv = 1. / inputSize;\n\t\t\t\tvec2 coord = gl_FragCoord.xy - half_unit_coord;\n\t\t\t\tcoord.x -= outputShiftX;\n\t\t\t\tcoord = coord * 2. + half_unit_coord;\n\t\t\t\tcoord.x += inputShiftX;\n\n\t\t\t\t\n\t\t\t\tvec2 input_uv = coord / inputSize;\n\t\t\t\tfloat bl = texture(inputTexture, input_uv).r;\n\n\t\t\t\t\n\t\t\t\tinput_uv.x += input_pixel_uv.x;\n\t\t\t\tfloat br = texture(inputTexture, input_uv).r;\n\n\t\t\t\t\n\t\t\t\tinput_uv.y += input_pixel_uv.y;\n\t\t\t\tfloat tr = texture(inputTexture, input_uv).r;\n\n\t\t\t\t\n\t\t\t\tinput_uv.x -= input_pixel_uv.x;\n\t\t\t\tfloat tl = texture(inputTexture, input_uv).r;\n\n\t\t\t\tpc_FragColor.a = bl;\n\t\t\t\tpc_FragColor.b = pc_FragColor.a + br;\n\t\t\t\tpc_FragColor.g = pc_FragColor.b + tr;\n\t\t\t\tpc_FragColor.r = pc_FragColor.g + tl; \n\t\t\t}\n\t\t",this.pyramidPassMaterial.uniforms=this.pyramidPassUniforms,this.pyramidPassMaterial.depthTest=!1,this.pyramidPassMaterial.depthWrite=!1;let t=new P(O,this.pyramidPassMaterial);t.frustumCulled=!1,this.pyramidPassScene.add(t)}renderPyramid(t,e,i,a,n){(new m).min.setScalar(0);let s=e.length-1,r=new c;i.getViewport(r),this.pyramidPassUniforms.inputShiftX.value=0,this.pyramidPassUniforms.outputShiftX.value=0;let o=s-1;for(let s=o;s>=0;s--){let r=s%2==o%2?n[0]:n[1],l=s===o?a:s%2==o%2?n[1]:n[0];this.pyramidPassUniforms.inputTexture.value=l.textures.length>1?l.textures[1]:l.texture,this.pyramidPassUniforms.inputWidth.value="width"in l?l.width:1,this.pyramidPassUniforms.inputHeight.value="height"in l?l.height:1,i.setRenderTarget(r);let h=e[s],p=i.getPixelRatio();i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,h/p,h/p),2===s&&t%2!=0&&i.setViewport(this.pyramidPassUniforms.outputShiftX.value/p,0,3/p,3/p),i.render(this.pyramidPassScene,D);let d=this.pyramidPassUniforms.inputShiftX.value;this.pyramidPassUniforms.inputShiftX.value=this.pyramidPassUniforms.outputShiftX.value,this.pyramidPassUniforms.outputShiftX.value=d,s<o&&(this.pyramidPassUniforms.outputShiftX.value+=e[s+1])}i.setViewport(r);let l=e.length%2==0?0:1;return i.readRenderTargetPixelsAsync(n[l],n[l].width-1,0,1,1,this.pyramidTopLevelReadPixelBuffer).then(()=>this.pyramidTopLevelReadPixelBuffer[0])}};var $=new v,Y=new v,Z=new h,Q=new p,J=new p,tt=new h;function et(t,e=0){let i=this.children.length;for(;i--;){let a=this.children[i];n.is(a)&&it.call(a,t,e+1)}}function it(t,e=0){if(!0!==t(this,e)){let i=this.children.length;for(;i--;){let a=this.children[i];n.is(a)&&it.call(a,t,e+1)}}}function at(){if(void 0===this.shapesDataTexture.value){let t=new w(new Float32Array(1920),96,5,d,o);this.shapesDataTexture.value=t}let n=this.shapesDataTexture.value,l=n.image.data,h=0,p=0,c=this.data.geometry.blendRange,f=$.copy(this.matrixWorld).invert(),u=this._npart,v=0;this._meshSdfWanted.clear();let m=null;if(et.call(this,n=>{if(!1===n.visible)return!0;let o;if(n instanceof t)return;if(n instanceof e||r(n))return;o=n instanceof i?n.object:n;let d=n.data?.cloner;if(s.is(n)&&d&&!d.hideBase&&"radial"!==d.type&&!0!==d.disabled||!(o instanceof a))return;let u=o.geometry.userData.parameters,x=u?.shapeBlendNode??o.dataPatched?.geometry?.shapeBlendNode;if(void 0===x)return;if(Y.multiplyMatrices(f,n.matrixWorld).decompose(J,Z,Q),"TorusGeometry"===u?.type&&360!==u.arc){let t=u.arc*Math.PI/180;t/=4,Z.multiply(tt.set(0,0,Math.sin(t),Math.cos(t)))}let y=x.overrideGlobalBlend?x.blendRange:c;y=y/this.bboxSize*2,l[4*v]=(J.x-this.bboxOffset)/this.bboxSize*2,l[4*v+1]=(J.y-this.bboxOffset)/this.bboxSize*2,l[4*v+2]=(J.z-this.bboxOffset)/this.bboxSize*2,l[4*v+3]=0===x.operation?1:2===x.operation?-1:-2,l[384+4*v]=-Z.x,l[384+4*v+1]=-Z.y,l[384+4*v+2]=-Z.z,l[384+4*v+3]=Z.w;let g=new Float32Array(4),S=0,b=y;if("SphereGeometry"===u?.type)u.width===u.height&&u.width===u.depth?g[0]=0:g[0]=1,g[1]=u.width/this.bboxSize,g[2]=u.height/this.bboxSize,g[3]=u.depth/this.bboxSize,b=Math.max(g[1],g[2],g[3])*Q.x+y;else if("CubeGeometry"===u?.type){S=u.cornerRadius;let t=u.width,e=u.height,i=u.depth;g[0]=2,g[1]=(t-2*S)/this.bboxSize,g[2]=(e-2*S)/this.bboxSize,g[3]=(i-2*S)/this.bboxSize,b=Math.sqrt(t**2+e**2+i**2)/this.bboxSize*Q.x+y}else if("CylinderGeometry"===u?.type){S=u.cornerRadius;let t=u.height,e=u.radiusBottom,i=u.radiusTop;if(i>=e){let a=Math.atan2(i-e,t),n=(Math.PI/2-a)/2;i-=S/Math.tan(n),e-=S*Math.tan(n)}else if(e>i){let a=Math.atan2(e-i,t),n=(Math.PI/2-a)/2;i-=S*Math.tan(n),e-=S/Math.tan(n)}g[1]=(u.height-2*S)/this.bboxSize,e===i?(g[0]=3,g[2]=e/this.bboxSize*2):(g[0]=4,g[2]=e/this.bboxSize*2,g[3]=i/this.bboxSize*2),b=(Math.hypot(g[1],Math.max(Math.abs(g[2]),Math.abs(g[3])))+S/this.bboxSize*2)*Q.x+y}else if("TorusGeometry"===u?.type){if(g[0]=5,g[1]=(u.width-u.depth)/this.bboxSize,g[2]=u.depth/this.bboxSize,360!==u.arc){g[0]=6,g[3]=g[1],l[1152+4*v+3]=g[2];let t=2*Math.atan2(g[2]/2,g[1]),e=u.arc*Math.PI/180/2-t;g[1]=Math.sin(e),g[2]=Math.cos(e)}b=u.width*Q.x/this.bboxSize+y}else{let t=o.geometry;(m??(m=new Set)).add(t.uuid);let e=this._meshSdfBaked.get(t.uuid),i=K(t);if((void 0===e||e.posVersion!==i)&&this._meshSdfWanted.set(t.uuid,t),void 0===e)return;g[0]=7,g[1]=e.slot,g[2]=e.boxHalf.x/this.bboxSize*2,g[3]=e.boxHalf.y/this.bboxSize*2,l[1152+4*v+3]=e.boxHalf.z/this.bboxSize*2,b=Math.hypot(e.boxHalf.x,e.boxHalf.y,e.boxHalf.z)/this.bboxSize*2*Q.x+y}l.set(g,768+4*v),h=Math.max(h,b),p=Math.max(p,y),this._reach[v]=b,l[1152+4*v]=y,l[1152+4*v+1]=S/this.bboxSize*2,l[1152+4*v+2]=Q.x;let T,P,_=Array.isArray(o.material)?o.material[0]:o.material,z=_;if(z?.getShapeBlendBaseColor){let t=z.getShapeBlendBaseColor();T=t,P=t.a}else void 0!==_?.uniforms?.nodeU0?(T=_.uniforms.nodeU0.node.value,P=_.uniforms.nodeU1?.value??1):(T={r:1,g:1,b:1},P=1);0!==x.operation&&!x.useColor&&(P=-1),l[1536+4*v]=T.r,l[1536+4*v+1]=T.g,l[1536+4*v+2]=T.b,l[1536+4*v+3]=P,P<1&&1===this.material.defines?.SHAPEBLEND_C&&(this.material.transparent=!0),v++}),this._meshSdfBaked.size>0){let t=m??new Set;for(let e of this._meshSdfBaked.keys())t.has(e)||this._meshSdfBaked.delete(e)}this.npart=v,this._maxBlendK=p;let x=1.1*h+2/(this.spatialDivisions-1)+4/(this.resolution-1);this.spatialPassUniforms.span.value=x;let y=this._prevShapeData,g=u!==v,S=null===y||this._prevSpan!==x||g,b=S||H,T=this._fieldDirtyMin.set(1/0,1/0,1/0),P=this._fieldDirtyMax.set(-1/0,-1/0,-1/0);if(null!==y){let t=Math.max(v,u);for(let e=0;e<t;e++){let t=!1;for(let i=0;i<5;i++){let a=384*i+4*e;if(l[a]!==y[a]||l[a+1]!==y[a+1]||l[a+2]!==y[a+2]||l[a+3]!==y[a+3]){t=!0;break}}if(!t)continue;if(S=!0,b)break;let i=l[4*e],a=l[4*e+1],n=l[4*e+2],s=y[4*e],r=y[4*e+1],o=y[4*e+2],h=this._reach[e],p=this._prevReach[e];Number.isFinite(i+a+n+h)&&Number.isFinite(s+r+o+p)?(T.x=Math.min(T.x,i-h,s-p),T.y=Math.min(T.y,a-h,r-p),T.z=Math.min(T.z,n-h,o-p),P.x=Math.max(P.x,i+h,s+p),P.y=Math.max(P.y,a+h,r+p),P.z=Math.max(P.z,n+h,o+p)):b=!0}}return H&&(S=!0),this._fieldDirtyFull=b||T.x===1/0,S&&(null===y?this._prevShapeData=new Float32Array(l):y.set(l),this._prevReach.set(this._reach),this._prevSpan=x,n.needsUpdate=!0),S}function nt(t){return at.call(t)}export{k as a,E as b,M as c,F as d,N as e,V as f,B as g,A as h,W as i,K as j,G as k,nt as l};