@holoscript/core 7.0.0 → 8.0.1

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 (350) hide show
  1. package/README.md +4 -4
  2. package/bin/holoscript.cjs +3 -0
  3. package/dist/GLTFPipeline-N6B6PJ6G.cjs +38 -0
  4. package/dist/GLTFPipeline-P3WMNYCN.js +17 -0
  5. package/dist/HoloScriptPlusParser-7FBIFUFC.js +693 -0
  6. package/dist/HoloScriptPlusParser-A2W7OCN2.cjs +698 -0
  7. package/dist/HoloScriptPlusParser-F2Z56FJR.js +10 -0
  8. package/dist/HoloScriptPlusParser-WKHRIH6T.cjs +27 -0
  9. package/dist/HoloScriptRuntime-CBYJX3LZ.js +10 -0
  10. package/dist/HoloScriptRuntime-VJ374RER.cjs +19 -0
  11. package/dist/USDZExporter-3FWJ25JI.cjs +1037 -0
  12. package/dist/USDZExporter-D2HQLQYK.js +1035 -0
  13. package/dist/agents/index.cjs +19 -0
  14. package/dist/agents/index.d.ts +100 -0
  15. package/dist/agents/index.js +17 -0
  16. package/dist/chunk-2BSMSUCE.js +1941 -0
  17. package/dist/chunk-2IWC4FP7.cjs +1189 -0
  18. package/dist/chunk-2M2DPHKB.js +762 -0
  19. package/dist/chunk-2X7NGX3M.js +2426 -0
  20. package/dist/chunk-2YSNA2F2.cjs +1274 -0
  21. package/dist/chunk-3FOKASKO.cjs +348 -0
  22. package/dist/chunk-3WZEJHUQ.cjs +116 -0
  23. package/dist/chunk-4C57PR42.js +468 -0
  24. package/dist/chunk-4GU5GCIY.js +1384 -0
  25. package/dist/chunk-4N4SXXWF.js +769 -0
  26. package/dist/chunk-4PDEPEQW.cjs +41 -0
  27. package/dist/chunk-4R6SBXDB.js +45 -0
  28. package/dist/chunk-4SDKXQ4C.js +811 -0
  29. package/dist/chunk-4V2E7U7Q.cjs +2015 -0
  30. package/dist/chunk-5FSKKMR7.cjs +2092 -0
  31. package/dist/chunk-5GLCTO44.js +161 -0
  32. package/dist/chunk-5H2G27PK.cjs +627 -0
  33. package/dist/chunk-5JEU52DW.js +382 -0
  34. package/dist/chunk-5NWINHR5.cjs +689 -0
  35. package/dist/chunk-5S7RKFGR.cjs +446 -0
  36. package/dist/chunk-5WUNN6ZN.cjs +428 -0
  37. package/dist/chunk-6CTRH7HT.cjs +1985 -0
  38. package/dist/chunk-6EX3I5P4.cjs +130 -0
  39. package/dist/chunk-6Q7RC2MK.cjs +1418 -0
  40. package/dist/chunk-7H33U5SM.cjs +413 -0
  41. package/dist/chunk-7M3PNU2M.cjs +672 -0
  42. package/dist/chunk-7T25IEZ2.js +449 -0
  43. package/dist/chunk-7V4JI5TB.cjs +6947 -0
  44. package/dist/chunk-A6KINLZJ.js +236 -0
  45. package/dist/chunk-ADADVMXY.js +404 -0
  46. package/dist/chunk-AIA52I7T.cjs +543 -0
  47. package/dist/chunk-ALC6K7GL.cjs +4402 -0
  48. package/dist/chunk-ANXZFVY2.js +113 -0
  49. package/dist/chunk-AOVGZ25K.cjs +56583 -0
  50. package/dist/chunk-AVJHHUC5.cjs +718 -0
  51. package/dist/chunk-BGY3SDG3.js +4396 -0
  52. package/dist/chunk-BOVPWH4H.js +3857 -0
  53. package/dist/chunk-BRQJKJGT.cjs +20 -0
  54. package/dist/chunk-C37BHB7N.cjs +636 -0
  55. package/dist/chunk-CBJY23VL.js +126 -0
  56. package/dist/chunk-CCATWPXM.js +778 -0
  57. package/dist/chunk-CIWWXYHZ.cjs +50 -0
  58. package/dist/chunk-CMT5NMMS.js +669 -0
  59. package/dist/chunk-CR4FMIWL.cjs +1049 -0
  60. package/dist/chunk-CR7XRXRN.cjs +639 -0
  61. package/dist/chunk-CSD27UNQ.js +2176 -0
  62. package/dist/chunk-D3STJ56J.js +714 -0
  63. package/dist/chunk-DAJXW4KX.js +725 -0
  64. package/dist/chunk-DHO2YRIM.js +756 -0
  65. package/dist/chunk-DTGBOSEM.cjs +319 -0
  66. package/dist/chunk-E6XXE66V.js +2252 -0
  67. package/dist/chunk-E7JP3BS3.cjs +61 -0
  68. package/dist/chunk-EKBKLK7P.js +1169 -0
  69. package/dist/chunk-EKYL4PE3.cjs +404 -0
  70. package/dist/chunk-EXKSFGSX.cjs +274 -0
  71. package/dist/chunk-EXUP2BUM.cjs +1173 -0
  72. package/dist/chunk-FDSGHPAK.js +130 -0
  73. package/dist/chunk-FEWUHQNM.cjs +144 -0
  74. package/dist/chunk-FFAOS5HQ.js +70 -0
  75. package/dist/chunk-FGGJQRLZ.js +270 -0
  76. package/dist/chunk-FHP6LXJS.js +415 -0
  77. package/dist/chunk-FJPADH77.cjs +666 -0
  78. package/dist/chunk-FL33V6U7.js +421 -0
  79. package/dist/chunk-FYSPZT4V.cjs +169 -0
  80. package/dist/chunk-GIOYPNTH.js +5575 -0
  81. package/dist/chunk-GJNCFRJU.cjs +125 -0
  82. package/dist/chunk-GMP623FG.cjs +1508 -0
  83. package/dist/chunk-GQHQOPXZ.cjs +5580 -0
  84. package/dist/chunk-GTU2Z2WW.cjs +262 -0
  85. package/dist/chunk-GYZE55MO.js +2007 -0
  86. package/dist/chunk-GZG4KA4E.js +529 -0
  87. package/dist/chunk-H652NHX5.js +600 -0
  88. package/dist/chunk-HCCQLAA4.cjs +74 -0
  89. package/dist/chunk-HKEXJUWS.cjs +4007 -0
  90. package/dist/chunk-HNDK4IQU.cjs +5737 -0
  91. package/dist/chunk-HR2OSYVQ.js +56165 -0
  92. package/dist/chunk-HYNTS5CP.js +422 -0
  93. package/dist/chunk-I6XZ5DZF.cjs +488 -0
  94. package/dist/chunk-ILRBGFVD.cjs +72 -0
  95. package/dist/chunk-IUDGEUDO.cjs +1409 -0
  96. package/dist/chunk-IUTY5WQ2.cjs +424 -0
  97. package/dist/chunk-IVY74O6C.js +247 -0
  98. package/dist/chunk-IWC5DM2M.cjs +611 -0
  99. package/dist/chunk-J32ZJZJH.js +554 -0
  100. package/dist/chunk-J52VSAQ7.js +6884 -0
  101. package/dist/chunk-J6M4FPK5.js +421 -0
  102. package/dist/chunk-J7XZV333.js +844 -0
  103. package/dist/chunk-JBNDTXXV.cjs +2433 -0
  104. package/dist/chunk-JC5YBPSF.cjs +984 -0
  105. package/dist/chunk-JD7CIZ33.js +1949 -0
  106. package/dist/chunk-JIBL5LRK.js +4287 -0
  107. package/dist/chunk-JIYN45TV.cjs +2525 -0
  108. package/dist/chunk-K574J76X.cjs +457 -0
  109. package/dist/chunk-KHDZJE5D.cjs +2196 -0
  110. package/dist/chunk-KKFZ3B6J.cjs +557 -0
  111. package/dist/chunk-KKP7JKN4.cjs +6002 -0
  112. package/dist/chunk-KPJL34Y7.cjs +186 -0
  113. package/dist/chunk-KQCN6AKJ.cjs +3042 -0
  114. package/dist/chunk-L5LKKENW.cjs +424 -0
  115. package/dist/chunk-LHAXPADA.js +882 -0
  116. package/dist/chunk-LM2VU56C.cjs +37 -0
  117. package/dist/chunk-M56JSP4A.js +400 -0
  118. package/dist/chunk-MBOOR7X4.js +18 -0
  119. package/dist/chunk-MQWAT42R.cjs +4310 -0
  120. package/dist/chunk-MXFUTKCO.js +56 -0
  121. package/dist/chunk-MYY4PMWX.cjs +264 -0
  122. package/dist/chunk-N75IH2HY.js +258 -0
  123. package/dist/chunk-NCWCUZNS.cjs +72 -0
  124. package/dist/chunk-NG77ATEW.cjs +778 -0
  125. package/dist/chunk-NW5G5FBQ.js +215 -0
  126. package/dist/chunk-OBIYPYYS.cjs +1993 -0
  127. package/dist/chunk-OH2FAIVU.js +608 -0
  128. package/dist/chunk-OIQYIIO3.cjs +473 -0
  129. package/dist/chunk-OL46QLBJ.js +61 -0
  130. package/dist/chunk-OMXII44L.js +5386 -0
  131. package/dist/chunk-OSYNRVOV.cjs +243 -0
  132. package/dist/chunk-PGANYCAG.cjs +220 -0
  133. package/dist/chunk-PHENW4MQ.js +65 -0
  134. package/dist/chunk-PY37LNDP.js +686 -0
  135. package/dist/chunk-Q56TT7IL.js +483 -0
  136. package/dist/chunk-QD32ADK6.js +1046 -0
  137. package/dist/chunk-QPOQ7VPI.js +1491 -0
  138. package/dist/chunk-QPSKHBJP.js +5963 -0
  139. package/dist/chunk-QXH7QDSZ.js +1989 -0
  140. package/dist/chunk-R24NNAEG.js +1399 -0
  141. package/dist/chunk-R75BSDH7.cjs +50 -0
  142. package/dist/chunk-RARB3MBR.js +207 -0
  143. package/dist/chunk-ROHLEP2W.cjs +847 -0
  144. package/dist/chunk-S3MDHNKB.cjs +490 -0
  145. package/dist/chunk-S6YWHCKV.cjs +410 -0
  146. package/dist/chunk-SIEXCILW.js +229 -0
  147. package/dist/chunk-SLU6UPJI.cjs +410 -0
  148. package/dist/chunk-SMIWS6DE.cjs +212 -0
  149. package/dist/chunk-T5J7ZKP3.cjs +4885 -0
  150. package/dist/chunk-TDCNJHWO.js +341 -0
  151. package/dist/chunk-TG7O4WBC.js +406 -0
  152. package/dist/chunk-THCK6ECW.js +2085 -0
  153. package/dist/chunk-TJHVSBP2.js +439 -0
  154. package/dist/chunk-TVHSPJ4N.cjs +606 -0
  155. package/dist/chunk-TWUXUCEW.cjs +781 -0
  156. package/dist/chunk-U44IKGG7.cjs +5390 -0
  157. package/dist/chunk-UFZZ7TSN.cjs +886 -0
  158. package/dist/chunk-UJXISJBN.js +487 -0
  159. package/dist/chunk-UOIGFQXC.cjs +9750 -0
  160. package/dist/chunk-URG2SJLK.js +2521 -0
  161. package/dist/chunk-UWJHCOH2.js +623 -0
  162. package/dist/chunk-V6MKC2FZ.js +979 -0
  163. package/dist/chunk-VJ3L7CHT.cjs +169 -0
  164. package/dist/chunk-VMLKSV26.js +1216 -0
  165. package/dist/chunk-VVKVQZI6.js +55 -0
  166. package/dist/chunk-W6RW64BB.cjs +1219 -0
  167. package/dist/chunk-WKX5AMOY.js +309 -0
  168. package/dist/chunk-WNNE3PO3.js +34 -0
  169. package/dist/chunk-WRKUDAZJ.js +3038 -0
  170. package/dist/chunk-WRLUBRKS.cjs +1943 -0
  171. package/dist/chunk-WRNEH5MO.js +3169 -0
  172. package/dist/chunk-WRWEX5ZF.js +658 -0
  173. package/dist/chunk-X3GJPRVK.cjs +3246 -0
  174. package/dist/chunk-X3UVCWNL.cjs +2257 -0
  175. package/dist/chunk-XB274MW5.cjs +814 -0
  176. package/dist/chunk-XHIV6326.cjs +793 -0
  177. package/dist/chunk-XIVIE43A.cjs +729 -0
  178. package/dist/chunk-XJAN7CZG.cjs +432 -0
  179. package/dist/chunk-XKTPFXGA.js +164 -0
  180. package/dist/chunk-XL6INWKT.js +121 -0
  181. package/dist/chunk-XSFNHP2E.js +632 -0
  182. package/dist/chunk-XT6JY5W5.js +9684 -0
  183. package/dist/chunk-XUILI4KB.cjs +430 -0
  184. package/dist/chunk-YF2I3MV3.js +46 -0
  185. package/dist/chunk-YIMN575O.js +4847 -0
  186. package/dist/chunk-YIVFJNYV.js +176 -0
  187. package/dist/chunk-YKGPCZEE.cjs +237 -0
  188. package/dist/chunk-YN2YWTXW.js +5731 -0
  189. package/dist/chunk-YN6V7R3L.cjs +327 -0
  190. package/dist/chunk-YQELFNJV.js +39 -0
  191. package/dist/chunk-YVD3CSO3.js +1183 -0
  192. package/dist/chunk-YVOAF4ML.js +623 -0
  193. package/dist/chunk-YWOBW2PV.cjs +759 -0
  194. package/dist/chunk-YYXH45E2.js +426 -0
  195. package/dist/chunk-ZDSYWBIE.cjs +69 -0
  196. package/dist/chunk-ZU7NIRT6.js +325 -0
  197. package/dist/chunk-ZZ7RO2UQ.js +1243 -0
  198. package/dist/cli/holoscript-runner.cjs +2255 -0
  199. package/dist/cli/holoscript-runner.js +2230 -0
  200. package/dist/codebase/index.cjs +336 -0
  201. package/dist/codebase/index.js +331 -0
  202. package/dist/compiler/agent-inference.cjs +31 -0
  203. package/dist/compiler/agent-inference.js +8 -0
  204. package/dist/compiler/android-xr.cjs +24 -0
  205. package/dist/compiler/android-xr.js +14 -0
  206. package/dist/compiler/android.cjs +24 -0
  207. package/dist/compiler/android.js +14 -0
  208. package/dist/compiler/ar.cjs +23 -0
  209. package/dist/compiler/ar.js +11 -0
  210. package/dist/compiler/babylon.cjs +21 -0
  211. package/dist/compiler/babylon.js +15 -0
  212. package/dist/compiler/business-quest.cjs +43 -0
  213. package/dist/compiler/business-quest.js +4 -0
  214. package/dist/compiler/coco.cjs +27 -0
  215. package/dist/compiler/coco.js +4 -0
  216. package/dist/compiler/context.cjs +25 -0
  217. package/dist/compiler/context.d.ts +28 -0
  218. package/dist/compiler/context.js +8 -0
  219. package/dist/compiler/domain-block-utils.cjs +609 -0
  220. package/dist/compiler/domain-block-utils.js +11 -0
  221. package/dist/compiler/dtdl.cjs +27 -0
  222. package/dist/compiler/dtdl.js +11 -0
  223. package/dist/compiler/gltf-pipeline.cjs +39 -0
  224. package/dist/compiler/gltf-pipeline.js +4 -0
  225. package/dist/compiler/godot.cjs +18 -0
  226. package/dist/compiler/godot.js +12 -0
  227. package/dist/compiler/incremental.cjs +34 -0
  228. package/dist/compiler/incremental.js +9 -0
  229. package/dist/compiler/index.cjs +5408 -0
  230. package/dist/compiler/index.d.ts +334 -21
  231. package/dist/compiler/index.js +5069 -0
  232. package/dist/compiler/ios.cjs +23 -0
  233. package/dist/compiler/ios.js +13 -0
  234. package/dist/compiler/llm-provider-capabilities.cjs +25 -0
  235. package/dist/compiler/llm-provider-capabilities.d.ts +43 -0
  236. package/dist/compiler/llm-provider-capabilities.js +8 -0
  237. package/dist/compiler/multi-layer.cjs +24 -0
  238. package/dist/compiler/multi-layer.js +15 -0
  239. package/dist/compiler/nodetoy.cjs +23 -0
  240. package/dist/compiler/nodetoy.d.ts +69 -0
  241. package/dist/compiler/nodetoy.js +4 -0
  242. package/dist/compiler/openxr.cjs +19 -0
  243. package/dist/compiler/openxr.js +13 -0
  244. package/dist/compiler/playcanvas.cjs +19 -0
  245. package/dist/compiler/playcanvas.js +13 -0
  246. package/dist/compiler/r3f.cjs +39 -0
  247. package/dist/compiler/r3f.d.ts +22 -0
  248. package/dist/compiler/r3f.js +17 -0
  249. package/dist/compiler/remotion.cjs +23 -0
  250. package/dist/compiler/remotion.js +4 -0
  251. package/dist/compiler/reproducibility.cjs +39 -0
  252. package/dist/compiler/reproducibility.js +4 -0
  253. package/dist/compiler/sdf.cjs +24 -0
  254. package/dist/compiler/sdf.js +12 -0
  255. package/dist/compiler/semantic-scene.cjs +31 -0
  256. package/dist/compiler/semantic-scene.js +4 -0
  257. package/dist/compiler/state.cjs +21 -0
  258. package/dist/compiler/state.js +11 -0
  259. package/dist/compiler/trait-composition.cjs +30 -0
  260. package/dist/compiler/trait-composition.js +9 -0
  261. package/dist/compiler/unity.cjs +19 -0
  262. package/dist/compiler/unity.js +13 -0
  263. package/dist/compiler/unreal.cjs +23 -0
  264. package/dist/compiler/unreal.js +13 -0
  265. package/dist/compiler/urdf.cjs +52 -0
  266. package/dist/compiler/urdf.js +12 -0
  267. package/dist/compiler/usd-physics.cjs +26 -0
  268. package/dist/compiler/usd-physics.js +9 -0
  269. package/dist/compiler/visionos.cjs +19 -0
  270. package/dist/compiler/visionos.js +13 -0
  271. package/dist/compiler/vrchat.cjs +22 -0
  272. package/dist/compiler/vrchat.js +12 -0
  273. package/dist/compiler/vrr.cjs +24 -0
  274. package/dist/compiler/vrr.js +12 -0
  275. package/dist/compiler/wasm.cjs +36 -0
  276. package/dist/compiler/wasm.js +12 -0
  277. package/dist/compiler/webgpu.cjs +18 -0
  278. package/dist/compiler/webgpu.js +12 -0
  279. package/dist/coordinators/index.cjs +1266 -0
  280. package/dist/coordinators/index.d.ts +72 -1
  281. package/dist/coordinators/index.js +1259 -0
  282. package/dist/debugger.cjs +24 -0
  283. package/dist/debugger.js +11 -0
  284. package/dist/dist-ACXG6IH5.cjs +3113 -0
  285. package/dist/dist-VD4L6V7Q.js +3076 -0
  286. package/dist/entries/interop.cjs +64 -0
  287. package/dist/entries/interop.js +7 -0
  288. package/dist/entries/scripting.cjs +55 -0
  289. package/dist/entries/scripting.js +10 -0
  290. package/dist/hololand/index.cjs +146 -0
  291. package/dist/hololand/index.d.ts +70 -0
  292. package/dist/hololand/index.js +5 -0
  293. package/dist/index.cjs +44660 -0
  294. package/dist/index.d.ts +978 -21
  295. package/dist/index.js +41422 -0
  296. package/dist/math/tropical-spmv.cjs +45 -0
  297. package/dist/math/tropical-spmv.js +4 -0
  298. package/dist/math/vec3.cjs +57 -0
  299. package/dist/math/vec3.js +4 -0
  300. package/dist/ml-dsa-FSKBTE3W.cjs +1265 -0
  301. package/dist/ml-dsa-Z7JDKW4L.js +1265 -0
  302. package/dist/paper-0c-spike/index.cjs +150 -0
  303. package/dist/paper-0c-spike/index.js +141 -0
  304. package/dist/parser.cjs +61 -0
  305. package/dist/parser.d.ts +11 -0
  306. package/dist/parser.js +12 -0
  307. package/dist/playwright-3AT3AKTV.cjs +98673 -0
  308. package/dist/playwright-VZPDVUEQ.js +98660 -0
  309. package/dist/reconstruction/index.cjs +153 -0
  310. package/dist/reconstruction/index.d.ts +29 -2
  311. package/dist/reconstruction/index.js +8 -0
  312. package/dist/runtime.cjs +316 -0
  313. package/dist/runtime.d.ts +61 -0
  314. package/dist/runtime.js +31 -0
  315. package/dist/self-improvement/index.cjs +563 -0
  316. package/dist/self-improvement/index.js +545 -0
  317. package/dist/src-4ROC227P.cjs +2094 -0
  318. package/dist/src-HCCCSYP7.js +2073 -0
  319. package/dist/storage/index.cjs +38 -0
  320. package/dist/storage/index.js +5 -0
  321. package/dist/testing.cjs +25 -0
  322. package/dist/testing.d.ts +70 -0
  323. package/dist/testing.js +4 -0
  324. package/dist/traitDocs/traitDocs.cjs +33 -0
  325. package/dist/traitDocs/traitDocs.js +7 -0
  326. package/dist/traits/botanical-lotus.cjs +177 -0
  327. package/dist/traits/botanical-lotus.d.ts +502 -0
  328. package/dist/traits/botanical-lotus.js +7 -0
  329. package/dist/traits/engines/index.cjs +520 -0
  330. package/dist/traits/engines/index.js +380 -0
  331. package/dist/traits/index.cjs +24548 -0
  332. package/dist/traits/index.d.ts +171 -35
  333. package/dist/traits/index.js +21638 -0
  334. package/dist/traits/simulation-solver-factory.cjs +13 -0
  335. package/dist/traits/simulation-solver-factory.d.ts +23 -0
  336. package/dist/traits/simulation-solver-factory.js +4 -0
  337. package/dist/traits/webcam-gaze.cjs +35 -0
  338. package/dist/traits/webcam-gaze.d.ts +17 -0
  339. package/dist/traits/webcam-gaze.js +4 -0
  340. package/dist/type-checker.cjs +19 -0
  341. package/dist/type-checker.js +6 -0
  342. package/dist/world/index.cjs +947 -0
  343. package/dist/world/index.d.ts +147 -0
  344. package/dist/world/index.js +939 -0
  345. package/dist/world-model/index.cjs +1446 -0
  346. package/dist/world-model/index.d.ts +119 -0
  347. package/dist/world-model/index.js +1414 -0
  348. package/dist/wot/index.cjs +29 -0
  349. package/dist/wot/index.js +4 -0
  350. package/package.json +93 -49
@@ -0,0 +1,4402 @@
1
+ 'use strict';
2
+
3
+ var chunkUOIGFQXC_cjs = require('./chunk-UOIGFQXC.cjs');
4
+ var chunk6Q7RC2MK_cjs = require('./chunk-6Q7RC2MK.cjs');
5
+ var chunk5S7RKFGR_cjs = require('./chunk-5S7RKFGR.cjs');
6
+ var chunkOIQYIIO3_cjs = require('./chunk-OIQYIIO3.cjs');
7
+ var chunkAIA52I7T_cjs = require('./chunk-AIA52I7T.cjs');
8
+ var chunkHKEXJUWS_cjs = require('./chunk-HKEXJUWS.cjs');
9
+ var chunkKKP7JKN4_cjs = require('./chunk-KKP7JKN4.cjs');
10
+ var chunkHCCQLAA4_cjs = require('./chunk-HCCQLAA4.cjs');
11
+
12
+ // src/traits/visual/presets/hologram-media.visual.ts
13
+ var HOLOGRAM_MEDIA_VISUALS;
14
+ var init_hologram_media_visual = chunkHCCQLAA4_cjs.__esm({
15
+ "src/traits/visual/presets/hologram-media.visual.ts"() {
16
+ HOLOGRAM_MEDIA_VISUALS = {
17
+ depth_estimation: {
18
+ material: { roughness: 0.3 },
19
+ emissive: { color: "#6644FF", intensity: 0.2 },
20
+ tags: ["ai", "depth", "hologram"],
21
+ layer: "visual_effect"
22
+ },
23
+ displacement: {
24
+ material: { roughness: 0.4 },
25
+ emissive: { color: "#8866FF", intensity: 0.15 },
26
+ tags: ["3d", "depth", "mesh"],
27
+ layer: "visual_effect"
28
+ },
29
+ segment: {
30
+ material: { roughness: 0.3 },
31
+ emissive: { color: "#FF44AA", intensity: 0.15 },
32
+ tags: ["ai", "segmentation", "mask"],
33
+ layer: "visual_effect"
34
+ },
35
+ animated_texture: {
36
+ material: { roughness: 0.3 },
37
+ emissive: { color: "#44FFAA", intensity: 0.15 },
38
+ tags: ["animation", "texture", "gif"],
39
+ layer: "visual_effect"
40
+ },
41
+ holographic_sprite: {
42
+ material: { roughness: 0.2 },
43
+ emissive: { color: "#AA44FF", intensity: 0.3 },
44
+ tags: ["hologram", "sprite", "3d"],
45
+ layer: "visual_effect"
46
+ },
47
+ quilt: {
48
+ material: { roughness: 0.3 },
49
+ emissive: { color: "#44AAFF", intensity: 0.2 },
50
+ tags: ["hologram", "multiview", "looking-glass"],
51
+ layer: "visual_effect"
52
+ },
53
+ gaussian_splatting: {
54
+ material: { roughness: 0.2 },
55
+ emissive: { color: "#AACCFF", intensity: 0.15 },
56
+ tags: ["3d", "photorealistic", "splat"],
57
+ layer: "visual_effect"
58
+ },
59
+ spatial_video: {
60
+ material: { roughness: 0.3 },
61
+ emissive: { color: "#FF8844", intensity: 0.15 },
62
+ tags: ["video", "stereo", "spatial"],
63
+ layer: "visual_effect"
64
+ },
65
+ image: {
66
+ material: { roughness: 0.4 },
67
+ tags: ["media", "texture", "source"],
68
+ layer: "base_material"
69
+ },
70
+ depth_sequence: {
71
+ material: { roughness: 0.3 },
72
+ emissive: { color: "#6644FF", intensity: 0.1 },
73
+ tags: ["video", "depth", "temporal"],
74
+ layer: "visual_effect"
75
+ },
76
+ temporal_smoothing: {
77
+ material: { roughness: 0.3 },
78
+ tags: ["processing", "temporal"],
79
+ layer: "visual_effect"
80
+ },
81
+ depth_to_normal: {
82
+ material: { roughness: 0.3 },
83
+ emissive: { color: "#8888FF", intensity: 0.1 },
84
+ tags: ["processing", "normal-map"],
85
+ layer: "visual_effect"
86
+ }
87
+ };
88
+ }
89
+ });
90
+
91
+ // src/traits/visual/presets/gaps-physics.visual.ts
92
+ var GAPS_PHYSICS_VISUALS;
93
+ var init_gaps_physics_visual = chunkHCCQLAA4_cjs.__esm({
94
+ "src/traits/visual/presets/gaps-physics.visual.ts"() {
95
+ GAPS_PHYSICS_VISUALS = /* @__PURE__ */ new Map([
96
+ // --- Pillar A: Unified Physics ---
97
+ [
98
+ "fluid",
99
+ {
100
+ material: {
101
+ type: "physical",
102
+ color: "#1a6fc4",
103
+ metalness: 0,
104
+ roughness: 0.05,
105
+ transmission: 0.95,
106
+ ior: 1.33,
107
+ thickness: 0.5
108
+ },
109
+ layers: [
110
+ {
111
+ type: "effect",
112
+ name: "ssfr",
113
+ priority: 50,
114
+ config: {
115
+ resolutionScale: 0.5,
116
+ absorptionColor: [0.4, 0.04, 0],
117
+ absorptionStrength: 2,
118
+ fresnelPower: 0.02,
119
+ refractionStrength: 0.1
120
+ }
121
+ }
122
+ ]
123
+ }
124
+ ],
125
+ [
126
+ "soft_body_pro",
127
+ {
128
+ material: {
129
+ type: "physical",
130
+ color: "#e8a87c",
131
+ metalness: 0,
132
+ roughness: 0.6
133
+ },
134
+ layers: [
135
+ {
136
+ type: "deformation",
137
+ name: "pbd_tearing",
138
+ priority: 45,
139
+ config: { tearThreshold: 0.8, tearColor: "#8b0000" }
140
+ }
141
+ ]
142
+ }
143
+ ],
144
+ [
145
+ "crowd_sim",
146
+ {
147
+ material: {
148
+ type: "standard",
149
+ color: "#7b68ee"
150
+ },
151
+ layers: [
152
+ {
153
+ type: "instanced",
154
+ name: "crowd_instances",
155
+ priority: 30,
156
+ config: { maxInstances: 1e4, lodLevels: 3 }
157
+ }
158
+ ]
159
+ }
160
+ ],
161
+ [
162
+ "deformable_terrain",
163
+ {
164
+ material: {
165
+ type: "standard",
166
+ color: "#8b7355",
167
+ roughness: 0.9
168
+ },
169
+ layers: [
170
+ {
171
+ type: "displacement",
172
+ name: "heightmap_erosion",
173
+ priority: 40,
174
+ config: { displacementScale: 5 }
175
+ }
176
+ ]
177
+ }
178
+ ],
179
+ [
180
+ "volumetric_clouds",
181
+ {
182
+ material: {
183
+ type: "shader",
184
+ color: "#ffffff"
185
+ },
186
+ layers: [
187
+ {
188
+ type: "volumetric",
189
+ name: "cloud_raymarcher",
190
+ priority: 80,
191
+ config: {
192
+ absorptionCoeff: 0.04,
193
+ scatteringCoeff: 0.06,
194
+ phaseG: 0.3,
195
+ maxSteps: 64
196
+ }
197
+ }
198
+ ]
199
+ }
200
+ ],
201
+ [
202
+ "god_rays",
203
+ {
204
+ material: {
205
+ type: "shader",
206
+ color: "#fffde7"
207
+ },
208
+ layers: [
209
+ {
210
+ type: "post_process",
211
+ name: "volumetric_light",
212
+ priority: 85,
213
+ config: { decay: 0.96, weight: 0.5, exposure: 0.3, samples: 100 }
214
+ }
215
+ ]
216
+ }
217
+ ],
218
+ // --- Weather Hub ---
219
+ [
220
+ "weather",
221
+ {
222
+ material: {
223
+ type: "none",
224
+ color: "#87ceeb"
225
+ },
226
+ layers: [
227
+ {
228
+ type: "ambient",
229
+ name: "weather_atmosphere",
230
+ priority: 90,
231
+ config: { affectsLighting: true, affectsFog: true }
232
+ }
233
+ ]
234
+ }
235
+ ],
236
+ // --- Pillar B: Persistent World ---
237
+ [
238
+ "world_state",
239
+ {
240
+ material: {
241
+ type: "none",
242
+ color: "#4a90d9"
243
+ },
244
+ layers: []
245
+ }
246
+ ],
247
+ [
248
+ "spatial_voice",
249
+ {
250
+ material: {
251
+ type: "none",
252
+ color: "#90ee90"
253
+ },
254
+ layers: [
255
+ {
256
+ type: "indicator",
257
+ name: "voice_range",
258
+ priority: 10,
259
+ config: { showRadius: true, radiusColor: "#90ee9040" }
260
+ }
261
+ ]
262
+ }
263
+ ],
264
+ [
265
+ "lip_sync",
266
+ {
267
+ material: {
268
+ type: "none",
269
+ color: "#ffb6c1"
270
+ },
271
+ layers: [
272
+ {
273
+ type: "morph",
274
+ name: "viseme_blendshapes",
275
+ priority: 60,
276
+ config: { blendShapePrefix: "viseme_" }
277
+ }
278
+ ]
279
+ }
280
+ ],
281
+ // --- Pillar C: Living Economy ---
282
+ [
283
+ "ai_companion",
284
+ {
285
+ material: {
286
+ type: "standard",
287
+ color: "#dda0dd",
288
+ emissive: "#330033",
289
+ emissiveIntensity: 0.2
290
+ },
291
+ layers: [
292
+ {
293
+ type: "indicator",
294
+ name: "ai_thinking",
295
+ priority: 15,
296
+ config: { pulseColor: "#9b59b6", pulseSpeed: 1.5 }
297
+ }
298
+ ]
299
+ }
300
+ ],
301
+ [
302
+ "token_gated",
303
+ {
304
+ material: {
305
+ type: "standard",
306
+ color: "#ffd700",
307
+ metalness: 0.8,
308
+ roughness: 0.2
309
+ },
310
+ layers: [
311
+ {
312
+ type: "barrier",
313
+ name: "token_gate_barrier",
314
+ priority: 70,
315
+ config: { barrierColor: "#ffd70060", shimmer: true }
316
+ }
317
+ ]
318
+ }
319
+ ],
320
+ [
321
+ "moderation",
322
+ {
323
+ material: {
324
+ type: "none",
325
+ color: "#ff6347"
326
+ },
327
+ layers: []
328
+ }
329
+ ],
330
+ [
331
+ "anti_grief",
332
+ {
333
+ material: {
334
+ type: "none",
335
+ color: "#32cd32"
336
+ },
337
+ layers: [
338
+ {
339
+ type: "shield",
340
+ name: "grief_shield",
341
+ priority: 95,
342
+ config: { shieldColor: "#32cd3230" }
343
+ }
344
+ ]
345
+ }
346
+ ]
347
+ ]);
348
+ }
349
+ });
350
+
351
+ // src/traits/visual/presets/phone-sleeve-vr.visual.ts
352
+ var PHONE_SLEEVE_VR_VISUALS;
353
+ var init_phone_sleeve_vr_visual = chunkHCCQLAA4_cjs.__esm({
354
+ "src/traits/visual/presets/phone-sleeve-vr.visual.ts"() {
355
+ PHONE_SLEEVE_VR_VISUALS = {
356
+ // --- Hardware Form Factor ---
357
+ phone_sleeve: {
358
+ material: { roughness: 0.3, metalness: 0.6 },
359
+ emissive: { color: "#00CCFF", intensity: 0.2 },
360
+ tags: ["vr", "phone", "sleeve", "headset"],
361
+ layer: "visual_effect"
362
+ },
363
+ sleeve_nfc_trigger: {
364
+ material: { roughness: 0.4 },
365
+ emissive: { color: "#FFD700", intensity: 0.15 },
366
+ tags: ["nfc", "trigger", "hardware"],
367
+ layer: "visual_effect"
368
+ },
369
+ sleeve_lens_profile: {
370
+ material: { roughness: 0.1, metalness: 0 },
371
+ opacity: 0.6,
372
+ tags: ["lens", "optics"],
373
+ layer: "visual_effect"
374
+ },
375
+ phone_detection: {
376
+ material: { roughness: 0.4 },
377
+ emissive: { color: "#44FF88", intensity: 0.1 },
378
+ tags: ["detection", "calibration"],
379
+ layer: "visual_effect"
380
+ },
381
+ // --- Display ---
382
+ stereo_split: {
383
+ material: { roughness: 0.2 },
384
+ emissive: { color: "#FF44AA", intensity: 0.2 },
385
+ tags: ["stereoscopic", "display", "split"],
386
+ layer: "visual_effect"
387
+ },
388
+ barrel_distortion: {
389
+ material: { roughness: 0.3 },
390
+ emissive: { color: "#AA44FF", intensity: 0.15 },
391
+ tags: ["distortion", "shader", "lens"],
392
+ layer: "visual_effect"
393
+ },
394
+ chromatic_aberration_fix: {
395
+ material: { roughness: 0.3 },
396
+ emissive: { color: "#FF8800", intensity: 0.1 },
397
+ tags: ["color", "correction", "lens"],
398
+ layer: "visual_effect"
399
+ },
400
+ ipd_adjust: {
401
+ material: { roughness: 0.4 },
402
+ emissive: { color: "#44CCFF", intensity: 0.1 },
403
+ tags: ["calibration", "ipd", "comfort"],
404
+ layer: "visual_effect"
405
+ },
406
+ // --- Sensor / Tracking ---
407
+ gyro_head_tracking: {
408
+ material: { roughness: 0.4 },
409
+ emissive: { color: "#00FF88", intensity: 0.15 },
410
+ tags: ["tracking", "gyroscope", "3dof"],
411
+ layer: "visual_effect"
412
+ },
413
+ accel_sensor_fusion: {
414
+ material: { roughness: 0.4 },
415
+ emissive: { color: "#00CC66", intensity: 0.1 },
416
+ tags: ["sensor", "accelerometer", "fusion"],
417
+ layer: "visual_effect"
418
+ },
419
+ mag_drift_correction: {
420
+ material: { roughness: 0.4 },
421
+ emissive: { color: "#8844FF", intensity: 0.1 },
422
+ tags: ["magnetometer", "drift", "correction"],
423
+ layer: "visual_effect"
424
+ },
425
+ positional_estimation: {
426
+ material: { roughness: 0.4 },
427
+ emissive: { color: "#FFAA00", intensity: 0.15 },
428
+ tags: ["6dof", "vio", "tracking"],
429
+ layer: "visual_effect"
430
+ },
431
+ // --- Interaction ---
432
+ gaze_cursor: {
433
+ material: { roughness: 0.2 },
434
+ emissive: { color: "#FFFFFF", intensity: 0.3 },
435
+ tags: ["gaze", "cursor", "reticle"],
436
+ layer: "visual_effect"
437
+ },
438
+ gaze_dwell_select: {
439
+ material: { roughness: 0.3 },
440
+ emissive: { color: "#FFFF44", intensity: 0.2 },
441
+ tags: ["gaze", "dwell", "selection"],
442
+ layer: "visual_effect"
443
+ },
444
+ bt_controller: {
445
+ material: { roughness: 0.5, metalness: 0.3 },
446
+ tags: ["bluetooth", "controller", "input"],
447
+ layer: "visual_effect"
448
+ },
449
+ tap_select: {
450
+ material: { roughness: 0.4 },
451
+ emissive: { color: "#44FF44", intensity: 0.1 },
452
+ tags: ["tap", "capacitive", "input"],
453
+ layer: "visual_effect"
454
+ },
455
+ voice_command: {
456
+ material: { roughness: 0.4 },
457
+ emissive: { color: "#4488FF", intensity: 0.1 },
458
+ tags: ["voice", "speech", "command"],
459
+ layer: "visual_effect"
460
+ },
461
+ // --- Performance ---
462
+ thermal_throttle: {
463
+ material: { roughness: 0.6 },
464
+ emissive: { color: "#FF4400", intensity: 0.2 },
465
+ tags: ["thermal", "throttle", "performance"],
466
+ layer: "visual_effect"
467
+ },
468
+ battery_aware_lod: {
469
+ material: { roughness: 0.5 },
470
+ emissive: { color: "#44FF00", intensity: 0.1 },
471
+ tags: ["battery", "lod", "adaptive"],
472
+ layer: "visual_effect"
473
+ },
474
+ sleeve_foveated: {
475
+ material: { roughness: 0.3 },
476
+ emissive: { color: "#CC44FF", intensity: 0.15 },
477
+ tags: ["foveated", "rendering", "performance"],
478
+ layer: "visual_effect"
479
+ },
480
+ low_persistence: {
481
+ material: { roughness: 0.2 },
482
+ emissive: { color: "#88CCFF", intensity: 0.1 },
483
+ tags: ["display", "persistence", "blur"],
484
+ layer: "visual_effect"
485
+ },
486
+ // --- Comfort ---
487
+ vr_comfort_vignette: {
488
+ material: { roughness: 0.5 },
489
+ opacity: 0.7,
490
+ tags: ["comfort", "vignette", "motion"],
491
+ layer: "visual_effect"
492
+ },
493
+ reorient_snap: {
494
+ material: { roughness: 0.4 },
495
+ emissive: { color: "#44FFCC", intensity: 0.1 },
496
+ tags: ["snap", "recenter", "comfort"],
497
+ layer: "visual_effect"
498
+ },
499
+ static_horizon: {
500
+ material: { roughness: 0.4 },
501
+ emissive: { color: "#88FF88", intensity: 0.1 },
502
+ tags: ["horizon", "stability", "nausea"],
503
+ layer: "visual_effect"
504
+ },
505
+ session_timer: {
506
+ material: { roughness: 0.4 },
507
+ emissive: { color: "#FFCC00", intensity: 0.15 },
508
+ tags: ["timer", "health", "breaks"],
509
+ layer: "visual_effect"
510
+ }
511
+ };
512
+ }
513
+ });
514
+
515
+ // src/traits/visual/index.ts
516
+ function registerAllPresets() {
517
+ const registry = chunkOIQYIIO3_cjs.TraitVisualRegistry.getInstance();
518
+ for (const presetMap of ALL_PRESETS) {
519
+ registry.registerBatch(presetMap);
520
+ }
521
+ }
522
+ var ALL_PRESETS;
523
+ var init_visual = chunkHCCQLAA4_cjs.__esm({
524
+ "src/traits/visual/index.ts"() {
525
+ chunkOIQYIIO3_cjs.init_TraitVisualRegistry();
526
+ chunkOIQYIIO3_cjs.init_types();
527
+ chunkOIQYIIO3_cjs.init_TraitVisualRegistry();
528
+ chunkUOIGFQXC_cjs.init_material_properties_visual();
529
+ chunkUOIGFQXC_cjs.init_surface_texture_visual();
530
+ chunkUOIGFQXC_cjs.init_lighting_visual();
531
+ chunkUOIGFQXC_cjs.init_gems_minerals_visual();
532
+ chunkUOIGFQXC_cjs.init_fabric_cloth_visual();
533
+ chunkUOIGFQXC_cjs.init_visual_effects_visual();
534
+ chunkUOIGFQXC_cjs.init_age_condition_visual();
535
+ chunkUOIGFQXC_cjs.init_water_fluid_visual();
536
+ chunkUOIGFQXC_cjs.init_weather_phenomena_visual();
537
+ chunkUOIGFQXC_cjs.init_emotion_mood_visual();
538
+ chunkUOIGFQXC_cjs.init_size_scale_visual();
539
+ chunkUOIGFQXC_cjs.init_environmental_biome_visual();
540
+ chunkUOIGFQXC_cjs.init_magic_fantasy_visual();
541
+ chunkUOIGFQXC_cjs.init_scifi_technology_visual();
542
+ chunkUOIGFQXC_cjs.init_creatures_mythical_visual();
543
+ chunkUOIGFQXC_cjs.init_nature_life_visual();
544
+ chunkUOIGFQXC_cjs.init_furniture_decor_visual();
545
+ chunkUOIGFQXC_cjs.init_construction_building_visual();
546
+ chunkUOIGFQXC_cjs.init_containers_storage_visual();
547
+ chunkUOIGFQXC_cjs.init_shape_form_visual();
548
+ chunkUOIGFQXC_cjs.init_animals_visual();
549
+ chunkUOIGFQXC_cjs.init_maritime_naval_visual();
550
+ chunkUOIGFQXC_cjs.init_time_period_visual();
551
+ chunkUOIGFQXC_cjs.init_accessibility_visual();
552
+ chunkUOIGFQXC_cjs.init_accessibility_extended_visual();
553
+ chunkUOIGFQXC_cjs.init_architecture_realestate_visual();
554
+ chunkUOIGFQXC_cjs.init_audio_visual();
555
+ chunkUOIGFQXC_cjs.init_cooking_food_visual();
556
+ chunkUOIGFQXC_cjs.init_core_vr_interaction_visual();
557
+ chunkUOIGFQXC_cjs.init_data_visualization_visual();
558
+ chunkUOIGFQXC_cjs.init_education_learning_visual();
559
+ chunkUOIGFQXC_cjs.init_environment_input_visual();
560
+ chunkUOIGFQXC_cjs.init_game_mechanics_visual();
561
+ chunkUOIGFQXC_cjs.init_geospatial_web3_visual();
562
+ chunkUOIGFQXC_cjs.init_healthcare_medical_visual();
563
+ chunkUOIGFQXC_cjs.init_humanoid_avatar_visual();
564
+ chunkUOIGFQXC_cjs.init_intelligence_behavior_visual();
565
+ chunkUOIGFQXC_cjs.init_interop_copresence_visual();
566
+ chunkUOIGFQXC_cjs.init_iot_autonomous_agents_visual();
567
+ chunkUOIGFQXC_cjs.init_locomotion_movement_visual();
568
+ chunkUOIGFQXC_cjs.init_measurement_sensing_visual();
569
+ chunkUOIGFQXC_cjs.init_media_analytics_visual();
570
+ chunkUOIGFQXC_cjs.init_multisensory_haptic_visual();
571
+ chunkUOIGFQXC_cjs.init_musical_sound_visual();
572
+ chunkUOIGFQXC_cjs.init_music_performance_visual();
573
+ chunkUOIGFQXC_cjs.init_narrative_storytelling_visual();
574
+ chunkUOIGFQXC_cjs.init_networking_ai_visual();
575
+ chunkUOIGFQXC_cjs.init_npc_roles_visual();
576
+ chunkUOIGFQXC_cjs.init_object_interaction_visual();
577
+ chunkUOIGFQXC_cjs.init_parser_core_ui_visual();
578
+ chunkUOIGFQXC_cjs.init_physical_affordances_visual();
579
+ chunkUOIGFQXC_cjs.init_physics_expansion_visual();
580
+ chunkUOIGFQXC_cjs.init_procedural_generation_visual();
581
+ chunkUOIGFQXC_cjs.init_resource_gathering_visual();
582
+ chunkUOIGFQXC_cjs.init_safety_boundaries_visual();
583
+ chunkUOIGFQXC_cjs.init_signs_communication_visual();
584
+ chunkUOIGFQXC_cjs.init_simple_modifiers_visual();
585
+ chunkUOIGFQXC_cjs.init_social_commerce_visual();
586
+ chunkUOIGFQXC_cjs.init_social_effects_visual();
587
+ chunkUOIGFQXC_cjs.init_sports_fitness_visual();
588
+ chunkUOIGFQXC_cjs.init_state_persistence_visual();
589
+ chunkUOIGFQXC_cjs.init_transportation_vehicles_visual();
590
+ chunkUOIGFQXC_cjs.init_volumetric_webgpu_visual();
591
+ chunkUOIGFQXC_cjs.init_weather_particles_visual();
592
+ chunkUOIGFQXC_cjs.init_xr_platform_visual();
593
+ init_hologram_media_visual();
594
+ init_gaps_physics_visual();
595
+ init_phone_sleeve_vr_visual();
596
+ ALL_PRESETS = [
597
+ // Original 12
598
+ chunkUOIGFQXC_cjs.MATERIAL_PROPERTIES_VISUALS,
599
+ chunkUOIGFQXC_cjs.SURFACE_TEXTURE_VISUALS,
600
+ chunkUOIGFQXC_cjs.LIGHTING_VISUALS,
601
+ chunkUOIGFQXC_cjs.GEMS_MINERALS_VISUALS,
602
+ chunkUOIGFQXC_cjs.FABRIC_CLOTH_VISUALS,
603
+ chunkUOIGFQXC_cjs.VISUAL_EFFECTS_VISUALS,
604
+ chunkUOIGFQXC_cjs.AGE_CONDITION_VISUALS,
605
+ chunkUOIGFQXC_cjs.WATER_FLUID_VISUALS,
606
+ chunkUOIGFQXC_cjs.WEATHER_PHENOMENA_VISUALS,
607
+ chunkUOIGFQXC_cjs.EMOTION_MOOD_VISUALS,
608
+ chunkUOIGFQXC_cjs.SIZE_SCALE_VISUALS,
609
+ chunkUOIGFQXC_cjs.ENVIRONMENTAL_BIOME_VISUALS,
610
+ // Expansion wave 1
611
+ chunkUOIGFQXC_cjs.MAGIC_FANTASY_VISUALS,
612
+ chunkUOIGFQXC_cjs.SCIFI_TECHNOLOGY_VISUALS,
613
+ chunkUOIGFQXC_cjs.CREATURES_MYTHICAL_VISUALS,
614
+ chunkUOIGFQXC_cjs.NATURE_LIFE_VISUALS,
615
+ chunkUOIGFQXC_cjs.FURNITURE_DECOR_VISUALS,
616
+ chunkUOIGFQXC_cjs.CONSTRUCTION_BUILDING_VISUALS,
617
+ chunkUOIGFQXC_cjs.CONTAINERS_STORAGE_VISUALS,
618
+ chunkUOIGFQXC_cjs.SHAPE_FORM_VISUALS,
619
+ chunkUOIGFQXC_cjs.ANIMALS_VISUALS,
620
+ chunkUOIGFQXC_cjs.MARITIME_NAVAL_VISUALS,
621
+ chunkUOIGFQXC_cjs.TIME_PERIOD_VISUALS,
622
+ // Expansion wave 2 — full coverage
623
+ chunkUOIGFQXC_cjs.ACCESSIBILITY_VISUALS,
624
+ chunkUOIGFQXC_cjs.ACCESSIBILITY_EXTENDED_VISUALS,
625
+ chunkUOIGFQXC_cjs.ARCHITECTURE_REALESTATE_VISUALS,
626
+ chunkUOIGFQXC_cjs.AUDIO_VISUALS,
627
+ chunkUOIGFQXC_cjs.COOKING_FOOD_VISUALS,
628
+ chunkUOIGFQXC_cjs.CORE_VR_INTERACTION_VISUALS,
629
+ chunkUOIGFQXC_cjs.DATA_VISUALIZATION_VISUALS,
630
+ chunkUOIGFQXC_cjs.EDUCATION_LEARNING_VISUALS,
631
+ chunkUOIGFQXC_cjs.ENVIRONMENT_INPUT_VISUALS,
632
+ chunkUOIGFQXC_cjs.GAME_MECHANICS_VISUALS,
633
+ chunkUOIGFQXC_cjs.GEOSPATIAL_WEB3_VISUALS,
634
+ chunkUOIGFQXC_cjs.HEALTHCARE_MEDICAL_VISUALS,
635
+ chunkUOIGFQXC_cjs.HUMANOID_AVATAR_VISUALS,
636
+ chunkUOIGFQXC_cjs.INTELLIGENCE_BEHAVIOR_VISUALS,
637
+ chunkUOIGFQXC_cjs.INTEROP_COPRESENCE_VISUALS,
638
+ chunkUOIGFQXC_cjs.IOT_AUTONOMOUS_AGENTS_VISUALS,
639
+ chunkUOIGFQXC_cjs.LOCOMOTION_MOVEMENT_VISUALS,
640
+ chunkUOIGFQXC_cjs.MEASUREMENT_SENSING_VISUALS,
641
+ chunkUOIGFQXC_cjs.MEDIA_ANALYTICS_VISUALS,
642
+ chunkUOIGFQXC_cjs.MULTISENSORY_HAPTIC_VISUALS,
643
+ chunkUOIGFQXC_cjs.MUSICAL_SOUND_VISUALS,
644
+ chunkUOIGFQXC_cjs.MUSIC_PERFORMANCE_VISUALS,
645
+ chunkUOIGFQXC_cjs.NARRATIVE_STORYTELLING_VISUALS,
646
+ chunkUOIGFQXC_cjs.NETWORKING_AI_VISUALS,
647
+ chunkUOIGFQXC_cjs.NPC_ROLES_VISUALS,
648
+ chunkUOIGFQXC_cjs.OBJECT_INTERACTION_VISUALS,
649
+ chunkUOIGFQXC_cjs.PARSER_CORE_UI_VISUALS,
650
+ chunkUOIGFQXC_cjs.PHYSICAL_AFFORDANCES_VISUALS,
651
+ chunkUOIGFQXC_cjs.PHYSICS_EXPANSION_VISUALS,
652
+ chunkUOIGFQXC_cjs.PROCEDURAL_GENERATION_VISUALS,
653
+ chunkUOIGFQXC_cjs.RESOURCE_GATHERING_VISUALS,
654
+ chunkUOIGFQXC_cjs.SAFETY_BOUNDARIES_VISUALS,
655
+ chunkUOIGFQXC_cjs.SIGNS_COMMUNICATION_VISUALS,
656
+ chunkUOIGFQXC_cjs.SIMPLE_MODIFIERS_VISUALS,
657
+ chunkUOIGFQXC_cjs.SOCIAL_COMMERCE_VISUALS,
658
+ chunkUOIGFQXC_cjs.SOCIAL_EFFECTS_VISUALS,
659
+ chunkUOIGFQXC_cjs.SPORTS_FITNESS_VISUALS,
660
+ chunkUOIGFQXC_cjs.STATE_PERSISTENCE_VISUALS,
661
+ chunkUOIGFQXC_cjs.TRANSPORTATION_VEHICLES_VISUALS,
662
+ chunkUOIGFQXC_cjs.VOLUMETRIC_WEBGPU_VISUALS,
663
+ chunkUOIGFQXC_cjs.WEATHER_PARTICLES_VISUALS,
664
+ chunkUOIGFQXC_cjs.XR_PLATFORM_VISUALS,
665
+ // Hologram Media Pipeline
666
+ HOLOGRAM_MEDIA_VISUALS,
667
+ // GAPS Feature Roadmap — Phase 1
668
+ GAPS_PHYSICS_VISUALS,
669
+ // Phone Sleeve VR — smartphone-as-headset
670
+ PHONE_SLEEVE_VR_VISUALS
671
+ ];
672
+ registerAllPresets();
673
+ }
674
+ });
675
+
676
+ // src/compiler/ObjectPool.ts
677
+ exports.ASTNodePool = void 0;
678
+ var init_ObjectPool = chunkHCCQLAA4_cjs.__esm({
679
+ "src/compiler/ObjectPool.ts"() {
680
+ exports.ASTNodePool = class {
681
+ /**
682
+ * @param factory Creates a fresh instance of the node.
683
+ * @param resetter Resets the node state before it is handed out again.
684
+ * @param initialCapacity How many nodes to pre-allocate.
685
+ */
686
+ constructor(factory, resetter, initialCapacity = 1e4) {
687
+ this.pool = [];
688
+ this.factory = factory;
689
+ this.resetter = resetter;
690
+ for (let i = 0; i < initialCapacity; i++) {
691
+ this.pool.push(this.factory());
692
+ }
693
+ }
694
+ /**
695
+ * Acquire a node from the pool, or create a new one if the pool is empty.
696
+ */
697
+ acquire() {
698
+ if (this.pool.length > 0) {
699
+ const node = this.pool.pop();
700
+ this.resetter(node);
701
+ return node;
702
+ }
703
+ return this.factory();
704
+ }
705
+ /**
706
+ * Release a node back to the pool to be reused.
707
+ */
708
+ release(node) {
709
+ this.pool.push(node);
710
+ }
711
+ /**
712
+ * Release an array of nodes back to the pool.
713
+ */
714
+ releaseAll(nodes) {
715
+ for (const node of nodes) {
716
+ this.pool.push(node);
717
+ }
718
+ }
719
+ /**
720
+ * Clear the pool, allowing garbage collection.
721
+ */
722
+ clear() {
723
+ this.pool.length = 0;
724
+ }
725
+ };
726
+ }
727
+ });
728
+
729
+ // src/compiler/R3FCompiler.ts
730
+ var R3FCompiler_exports = {};
731
+ chunkHCCQLAA4_cjs.__export(R3FCompiler_exports, {
732
+ ENVIRONMENT_PRESETS: () => exports.ENVIRONMENT_PRESETS,
733
+ MATERIAL_PRESETS: () => exports.MATERIAL_PRESETS,
734
+ QUALITY_TIER_SCALES: () => exports.QUALITY_TIER_SCALES,
735
+ R3FCompiler: () => exports.R3FCompiler,
736
+ UI_COMPONENT_PRESETS: () => exports.UI_COMPONENT_PRESETS
737
+ });
738
+ function isVfxParticleTraitName(name) {
739
+ return name.startsWith("vfx_particle_");
740
+ }
741
+ function vfxParticleEffect(name) {
742
+ return name.replace("vfx_particle_", "");
743
+ }
744
+ function gemResonanceConfig(config) {
745
+ return {
746
+ max_distance: 0.5,
747
+ base_frequencies: "auto",
748
+ blend_mode: "harmonic",
749
+ output: "spatial_audio",
750
+ ...config || {}
751
+ };
752
+ }
753
+ var r3fNodePool; exports.MATERIAL_PRESETS = void 0; exports.ENVIRONMENT_PRESETS = void 0; var MESH_TYPES; exports.UI_COMPONENT_PRESETS = void 0; exports.QUALITY_TIER_SCALES = void 0; exports.R3FCompiler = void 0;
754
+ var init_R3FCompiler = chunkHCCQLAA4_cjs.__esm({
755
+ "src/compiler/R3FCompiler.ts"() {
756
+ chunkOIQYIIO3_cjs.init_TraitCompositor();
757
+ chunk5S7RKFGR_cjs.init_ProvenanceSemiring();
758
+ init_visual();
759
+ chunkHKEXJUWS_cjs.init_DomainBlockCompilerMixin();
760
+ chunkAIA52I7T_cjs.init_PlatformConditionalCompilerMixin();
761
+ chunkKKP7JKN4_cjs.init_AgentRBAC();
762
+ chunkKKP7JKN4_cjs.init_CompilerBase();
763
+ init_ObjectPool();
764
+ chunk6Q7RC2MK_cjs.init_BotanicalLotusTrait();
765
+ r3fNodePool = new exports.ASTNodePool(
766
+ () => ({ type: "", props: {} }),
767
+ (node) => {
768
+ node.type = "";
769
+ node.id = void 0;
770
+ node.props = {};
771
+ node.children = void 0;
772
+ node.traits = void 0;
773
+ node.directives = void 0;
774
+ node.assetMaturity = void 0;
775
+ },
776
+ 0
777
+ // Was 20000 — demand-allocate instead of pre-allocating
778
+ );
779
+ exports.MATERIAL_PRESETS = {
780
+ plastic: { roughness: 0.5, metalness: 0, clearcoat: 0.1 },
781
+ metal: { roughness: 0.2, metalness: 1 },
782
+ chrome: { roughness: 0.05, metalness: 1, envMapIntensity: 1.5 },
783
+ gold: { roughness: 0.3, metalness: 1, color: "#ffd700" },
784
+ copper: { roughness: 0.4, metalness: 1, color: "#b87333" },
785
+ glass: {
786
+ roughness: 0,
787
+ metalness: 0,
788
+ transmission: 0.95,
789
+ ior: 1.5,
790
+ thickness: 0.5,
791
+ transparent: true
792
+ },
793
+ crystal: {
794
+ roughness: 0,
795
+ metalness: 0.1,
796
+ transmission: 0.9,
797
+ ior: 2,
798
+ iridescence: 1,
799
+ iridescenceIOR: 1.3
800
+ },
801
+ wood: { roughness: 0.8, metalness: 0 },
802
+ fabric: {
803
+ roughness: 0.95,
804
+ metalness: 0,
805
+ sheen: 0.5,
806
+ sheenRoughness: 0.8,
807
+ sheenColor: "#ffffff"
808
+ },
809
+ rubber: { roughness: 0.9, metalness: 0 },
810
+ leather: {
811
+ roughness: 0.7,
812
+ metalness: 0,
813
+ sheen: 0.3,
814
+ sheenRoughness: 0.6,
815
+ sheenColor: "#3d2b1f"
816
+ },
817
+ water: {
818
+ roughness: 0,
819
+ metalness: 0,
820
+ transmission: 0.9,
821
+ ior: 1.33,
822
+ transparent: true,
823
+ color: "#006994"
824
+ },
825
+ emissive: { roughness: 0.5, metalness: 0, emissiveIntensity: 2 },
826
+ hologram: {
827
+ roughness: 0,
828
+ metalness: 0.3,
829
+ transparent: true,
830
+ opacity: 0.6,
831
+ emissiveIntensity: 1
832
+ },
833
+ stone: { roughness: 0.85, metalness: 0, color: "#808080" },
834
+ marble: { roughness: 0.15, metalness: 0, color: "#F0EDE6", envMapIntensity: 0.8 },
835
+ shiny: { roughness: 0.05, metalness: 0.3, envMapIntensity: 1.5, clearcoat: 0.8 },
836
+ neon: {
837
+ roughness: 0,
838
+ metalness: 0,
839
+ emissiveIntensity: 3,
840
+ transparent: true,
841
+ opacity: 0.9
842
+ },
843
+ toon: { roughness: 1, metalness: 0 },
844
+ wireframe: { roughness: 0.5, metalness: 0.5, wireframe: true },
845
+ velvet: {
846
+ roughness: 1,
847
+ metalness: 0,
848
+ sheen: 1,
849
+ sheenRoughness: 0.8,
850
+ sheenColor: "#ffffff",
851
+ clearcoat: 0.3
852
+ },
853
+ xray: { roughness: 0, metalness: 0, transparent: true, opacity: 0.3, emissiveIntensity: 0.5 },
854
+ gradient: { roughness: 0.5, metalness: 0 },
855
+ matte: { roughness: 1, metalness: 0 },
856
+ // ===========================================================================
857
+ // REALISTIC FABRICS — differentiated by sheen, roughness, and anisotropy
858
+ // ===========================================================================
859
+ cotton: {
860
+ roughness: 0.95,
861
+ metalness: 0,
862
+ sheen: 0.6,
863
+ sheenRoughness: 0.9,
864
+ sheenColor: "#ffffff"
865
+ },
866
+ polyester: {
867
+ roughness: 0.7,
868
+ metalness: 0,
869
+ sheen: 0.8,
870
+ sheenRoughness: 0.4,
871
+ sheenColor: "#e8e8e8"
872
+ },
873
+ silk: {
874
+ roughness: 0.3,
875
+ metalness: 0,
876
+ sheen: 1,
877
+ sheenRoughness: 0.2,
878
+ sheenColor: "#fffaf0",
879
+ anisotropy: 0.8,
880
+ anisotropyRotation: 0
881
+ },
882
+ satin: {
883
+ roughness: 0.25,
884
+ metalness: 0,
885
+ sheen: 0.9,
886
+ sheenRoughness: 0.15,
887
+ sheenColor: "#fff5ee",
888
+ anisotropy: 0.6,
889
+ anisotropyRotation: 0
890
+ },
891
+ linen: {
892
+ roughness: 0.9,
893
+ metalness: 0,
894
+ sheen: 0.4,
895
+ sheenRoughness: 0.85,
896
+ sheenColor: "#f5f0e8"
897
+ },
898
+ wool: {
899
+ roughness: 1,
900
+ metalness: 0,
901
+ sheen: 0.7,
902
+ sheenRoughness: 1,
903
+ sheenColor: "#e8dcc8"
904
+ },
905
+ denim: {
906
+ roughness: 0.85,
907
+ metalness: 0,
908
+ color: "#2b4570",
909
+ sheen: 0.5,
910
+ sheenRoughness: 0.7,
911
+ sheenColor: "#4a6fa5"
912
+ },
913
+ canvas: {
914
+ roughness: 0.95,
915
+ metalness: 0,
916
+ color: "#c8b88a",
917
+ sheen: 0.3,
918
+ sheenRoughness: 0.9,
919
+ sheenColor: "#d4c9a8"
920
+ },
921
+ burlap: {
922
+ roughness: 1,
923
+ metalness: 0,
924
+ color: "#8b7355",
925
+ sheen: 0.2,
926
+ sheenRoughness: 1,
927
+ sheenColor: "#a08060"
928
+ },
929
+ // ===========================================================================
930
+ // SKIN & ORGANIC — differentiated by subsurface scattering
931
+ // ===========================================================================
932
+ skin: {
933
+ roughness: 0.5,
934
+ metalness: 0,
935
+ color: "#e8b89d",
936
+ thickness: 0.8,
937
+ attenuationColor: "#cc4422",
938
+ attenuationDistance: 0.5
939
+ },
940
+ skin_dark: {
941
+ roughness: 0.45,
942
+ metalness: 0,
943
+ color: "#8d5524",
944
+ thickness: 1,
945
+ attenuationColor: "#661111",
946
+ attenuationDistance: 0.3
947
+ },
948
+ // Dragon / creature material presets
949
+ dragon_bone: {
950
+ roughness: 0.35,
951
+ metalness: 0.15,
952
+ color: "#e8dcc8"
953
+ },
954
+ dragon_leather: {
955
+ roughness: 0.8,
956
+ metalness: 0,
957
+ color: "#5c3a21"
958
+ },
959
+ dragon_scale: {
960
+ roughness: 0.25,
961
+ metalness: 0.4,
962
+ color: "#1a0d3d"
963
+ },
964
+ obsidian: {
965
+ roughness: 0.05,
966
+ metalness: 0.1,
967
+ color: "#0d0d0d",
968
+ clearcoat: 0.9,
969
+ clearcoatRoughness: 0.1,
970
+ envMapIntensity: 1.2
971
+ },
972
+ skin_pale: {
973
+ roughness: 0.55,
974
+ metalness: 0,
975
+ color: "#fde0c8",
976
+ thickness: 0.6,
977
+ attenuationColor: "#ee5533",
978
+ attenuationDistance: 0.6
979
+ },
980
+ candle_wax: {
981
+ roughness: 0.7,
982
+ metalness: 0,
983
+ color: "#fff8dc",
984
+ thickness: 2,
985
+ attenuationColor: "#ffaa44",
986
+ attenuationDistance: 0.3,
987
+ transmission: 0.15
988
+ },
989
+ jade: {
990
+ roughness: 0.2,
991
+ metalness: 0,
992
+ color: "#00a86b",
993
+ thickness: 1.5,
994
+ attenuationColor: "#004d32",
995
+ attenuationDistance: 1,
996
+ transmission: 0.1
997
+ },
998
+ milk: {
999
+ roughness: 0.3,
1000
+ metalness: 0,
1001
+ color: "#fdfff5",
1002
+ thickness: 1,
1003
+ attenuationColor: "#fff5d6",
1004
+ attenuationDistance: 0.2,
1005
+ transmission: 0.6,
1006
+ ior: 1.35
1007
+ },
1008
+ leaf: {
1009
+ roughness: 0.6,
1010
+ metalness: 0,
1011
+ color: "#228b22",
1012
+ thickness: 0.3,
1013
+ attenuationColor: "#44cc22",
1014
+ attenuationDistance: 0.5
1015
+ },
1016
+ honey: {
1017
+ roughness: 0.1,
1018
+ metalness: 0,
1019
+ color: "#eb9605",
1020
+ thickness: 1.5,
1021
+ attenuationColor: "#cc6600",
1022
+ attenuationDistance: 0.4,
1023
+ transmission: 0.7,
1024
+ ior: 1.5
1025
+ },
1026
+ // ===========================================================================
1027
+ // MUD & EARTH — differentiated by roughness, color, and subtle properties
1028
+ // ===========================================================================
1029
+ clay_mud: {
1030
+ roughness: 0.95,
1031
+ metalness: 0,
1032
+ color: "#8b4513",
1033
+ thickness: 0.5,
1034
+ attenuationColor: "#663311",
1035
+ attenuationDistance: 0.8
1036
+ },
1037
+ sandy_mud: {
1038
+ roughness: 0.85,
1039
+ metalness: 0.02,
1040
+ color: "#c2a66b"
1041
+ },
1042
+ wet_mud: {
1043
+ roughness: 0.4,
1044
+ metalness: 0,
1045
+ color: "#3d2b1f",
1046
+ clearcoat: 0.6,
1047
+ clearcoatRoughness: 0.2
1048
+ },
1049
+ dry_earth: {
1050
+ roughness: 1,
1051
+ metalness: 0,
1052
+ color: "#9b7653"
1053
+ },
1054
+ peat: {
1055
+ roughness: 0.9,
1056
+ metalness: 0,
1057
+ color: "#2d1f0e"
1058
+ },
1059
+ red_clay: {
1060
+ roughness: 0.95,
1061
+ metalness: 0,
1062
+ color: "#cc4b2e",
1063
+ thickness: 0.4,
1064
+ attenuationColor: "#993322",
1065
+ attenuationDistance: 0.6
1066
+ },
1067
+ volcanic_ash: {
1068
+ roughness: 0.8,
1069
+ metalness: 0.05,
1070
+ color: "#3c3c3c"
1071
+ },
1072
+ wet_sand: {
1073
+ roughness: 0.6,
1074
+ metalness: 0.02,
1075
+ color: "#c2b280",
1076
+ clearcoat: 0.3,
1077
+ clearcoatRoughness: 0.4
1078
+ },
1079
+ dry_sand: {
1080
+ roughness: 0.95,
1081
+ metalness: 0.02,
1082
+ color: "#e0cc8e"
1083
+ },
1084
+ // ===========================================================================
1085
+ // METALS (BRUSHED/ANISOTROPIC) — directional roughness
1086
+ // ===========================================================================
1087
+ brushed_steel: {
1088
+ roughness: 0.35,
1089
+ metalness: 1,
1090
+ color: "#c0c0c0",
1091
+ anisotropy: 0.7,
1092
+ anisotropyRotation: 0
1093
+ },
1094
+ brushed_aluminum: {
1095
+ roughness: 0.3,
1096
+ metalness: 1,
1097
+ color: "#d0d0d0",
1098
+ anisotropy: 0.8,
1099
+ anisotropyRotation: 0
1100
+ },
1101
+ brushed_copper: {
1102
+ roughness: 0.35,
1103
+ metalness: 1,
1104
+ color: "#b87333",
1105
+ anisotropy: 0.6,
1106
+ anisotropyRotation: 0
1107
+ },
1108
+ cast_iron: {
1109
+ roughness: 0.7,
1110
+ metalness: 0.9,
1111
+ color: "#3a3a3a"
1112
+ },
1113
+ bronze: {
1114
+ roughness: 0.45,
1115
+ metalness: 1,
1116
+ color: "#cd7f32"
1117
+ },
1118
+ silver: {
1119
+ roughness: 0.15,
1120
+ metalness: 1,
1121
+ color: "#c0c0c0",
1122
+ envMapIntensity: 1.3
1123
+ },
1124
+ platinum: {
1125
+ roughness: 0.2,
1126
+ metalness: 1,
1127
+ color: "#e5e4e2",
1128
+ envMapIntensity: 1.2
1129
+ },
1130
+ rust: {
1131
+ roughness: 0.9,
1132
+ metalness: 0.3,
1133
+ color: "#8b3a15"
1134
+ },
1135
+ // ===========================================================================
1136
+ // HAIR & FIBERS — anisotropy-driven
1137
+ // ===========================================================================
1138
+ hair_dark: {
1139
+ roughness: 0.35,
1140
+ metalness: 0,
1141
+ color: "#1a1209",
1142
+ anisotropy: 1,
1143
+ anisotropyRotation: Math.PI / 2,
1144
+ sheen: 0.3,
1145
+ sheenRoughness: 0.3,
1146
+ sheenColor: "#2a2219"
1147
+ },
1148
+ hair_blonde: {
1149
+ roughness: 0.3,
1150
+ metalness: 0,
1151
+ color: "#c8a55a",
1152
+ anisotropy: 1,
1153
+ anisotropyRotation: Math.PI / 2,
1154
+ sheen: 0.4,
1155
+ sheenRoughness: 0.25,
1156
+ sheenColor: "#d4b86a"
1157
+ },
1158
+ hair_red: {
1159
+ roughness: 0.35,
1160
+ metalness: 0,
1161
+ color: "#8b3a15",
1162
+ anisotropy: 1,
1163
+ anisotropyRotation: Math.PI / 2,
1164
+ sheen: 0.35,
1165
+ sheenRoughness: 0.3,
1166
+ sheenColor: "#a04520"
1167
+ },
1168
+ // ===========================================================================
1169
+ // WET SURFACES — clearcoat simulates water film
1170
+ // ===========================================================================
1171
+ wet_stone: {
1172
+ roughness: 0.3,
1173
+ metalness: 0,
1174
+ color: "#606060",
1175
+ clearcoat: 0.8,
1176
+ clearcoatRoughness: 0.1
1177
+ },
1178
+ wet_wood: {
1179
+ roughness: 0.4,
1180
+ metalness: 0,
1181
+ color: "#5a3a1a",
1182
+ clearcoat: 0.7,
1183
+ clearcoatRoughness: 0.15
1184
+ },
1185
+ wet_concrete: {
1186
+ roughness: 0.5,
1187
+ metalness: 0,
1188
+ color: "#707070",
1189
+ clearcoat: 0.5,
1190
+ clearcoatRoughness: 0.2
1191
+ },
1192
+ // ===========================================================================
1193
+ // FOOD & ORGANIC — SSS-heavy
1194
+ // ===========================================================================
1195
+ fruit: {
1196
+ roughness: 0.4,
1197
+ metalness: 0,
1198
+ color: "#ff4444",
1199
+ thickness: 0.8,
1200
+ attenuationColor: "#cc2200",
1201
+ attenuationDistance: 0.5,
1202
+ clearcoat: 0.3,
1203
+ clearcoatRoughness: 0.2
1204
+ },
1205
+ cheese: {
1206
+ roughness: 0.7,
1207
+ metalness: 0,
1208
+ color: "#ffc125",
1209
+ thickness: 1.2,
1210
+ attenuationColor: "#cc9900",
1211
+ attenuationDistance: 0.4
1212
+ },
1213
+ bread: {
1214
+ roughness: 0.95,
1215
+ metalness: 0,
1216
+ color: "#c4a35a",
1217
+ thickness: 0.3,
1218
+ attenuationColor: "#8b6914",
1219
+ attenuationDistance: 0.8
1220
+ },
1221
+ chocolate: {
1222
+ roughness: 0.5,
1223
+ metalness: 0,
1224
+ color: "#3b1e08",
1225
+ clearcoat: 0.2,
1226
+ clearcoatRoughness: 0.3
1227
+ },
1228
+ // ===========================================================================
1229
+ // COATED SURFACES — clearcoat-driven
1230
+ // ===========================================================================
1231
+ car_paint: {
1232
+ roughness: 0.1,
1233
+ metalness: 0,
1234
+ clearcoat: 1,
1235
+ clearcoatRoughness: 0.05
1236
+ },
1237
+ lacquer: {
1238
+ roughness: 0.05,
1239
+ metalness: 0,
1240
+ clearcoat: 1,
1241
+ clearcoatRoughness: 0.02
1242
+ },
1243
+ varnished_wood: {
1244
+ roughness: 0.3,
1245
+ metalness: 0,
1246
+ color: "#8b5e3c",
1247
+ clearcoat: 0.9,
1248
+ clearcoatRoughness: 0.1
1249
+ },
1250
+ glazed_ceramic: {
1251
+ roughness: 0.15,
1252
+ metalness: 0,
1253
+ color: "#f0ede6",
1254
+ clearcoat: 0.8,
1255
+ clearcoatRoughness: 0.05
1256
+ },
1257
+ enamel: {
1258
+ roughness: 0.1,
1259
+ metalness: 0,
1260
+ clearcoat: 0.9,
1261
+ clearcoatRoughness: 0.03
1262
+ },
1263
+ // ===========================================================================
1264
+ // IRIDESCENT — thin-film interference
1265
+ // ===========================================================================
1266
+ soap_bubble: {
1267
+ roughness: 0,
1268
+ metalness: 0,
1269
+ transmission: 0.9,
1270
+ ior: 1.33,
1271
+ transparent: true,
1272
+ opacity: 0.3,
1273
+ iridescence: 1,
1274
+ iridescenceIOR: 1.5
1275
+ },
1276
+ oil_slick: {
1277
+ roughness: 0,
1278
+ metalness: 0.1,
1279
+ color: "#1a1a2e",
1280
+ iridescence: 1,
1281
+ iridescenceIOR: 1.8
1282
+ },
1283
+ beetle_shell: {
1284
+ roughness: 0.2,
1285
+ metalness: 0.3,
1286
+ color: "#0a3d0a",
1287
+ iridescence: 0.8,
1288
+ iridescenceIOR: 1.6,
1289
+ clearcoat: 0.5,
1290
+ clearcoatRoughness: 0.1
1291
+ },
1292
+ pearl: {
1293
+ roughness: 0.15,
1294
+ metalness: 0,
1295
+ color: "#fdeef4",
1296
+ iridescence: 0.6,
1297
+ iridescenceIOR: 1.3,
1298
+ sheen: 0.3,
1299
+ sheenRoughness: 0.2,
1300
+ sheenColor: "#fff0f5"
1301
+ },
1302
+ abalone: {
1303
+ roughness: 0.1,
1304
+ metalness: 0.1,
1305
+ color: "#e0f0e8",
1306
+ iridescence: 1,
1307
+ iridescenceIOR: 1.5
1308
+ },
1309
+ // ===========================================================================
1310
+ // GEMSTONES — transmission + IOR + iridescence
1311
+ // ===========================================================================
1312
+ diamond: {
1313
+ roughness: 0,
1314
+ metalness: 0,
1315
+ color: "#ffffff",
1316
+ transmission: 0.95,
1317
+ ior: 2.417,
1318
+ thickness: 0.5,
1319
+ transparent: true
1320
+ },
1321
+ ruby: {
1322
+ roughness: 0.05,
1323
+ metalness: 0,
1324
+ color: "#e0115f",
1325
+ transmission: 0.4,
1326
+ ior: 1.76,
1327
+ thickness: 1
1328
+ },
1329
+ sapphire: {
1330
+ roughness: 0.05,
1331
+ metalness: 0,
1332
+ color: "#0f52ba",
1333
+ transmission: 0.4,
1334
+ ior: 1.77,
1335
+ thickness: 1
1336
+ },
1337
+ emerald: {
1338
+ roughness: 0.1,
1339
+ metalness: 0,
1340
+ color: "#50c878",
1341
+ transmission: 0.3,
1342
+ ior: 1.57,
1343
+ thickness: 1.2
1344
+ },
1345
+ amber: {
1346
+ roughness: 0.1,
1347
+ metalness: 0,
1348
+ color: "#ffbf00",
1349
+ transmission: 0.6,
1350
+ ior: 1.55,
1351
+ thickness: 2,
1352
+ transparent: true,
1353
+ attenuationColor: "#cc6600",
1354
+ attenuationDistance: 1
1355
+ },
1356
+ opal: {
1357
+ roughness: 0.15,
1358
+ metalness: 0,
1359
+ color: "#e8e0d0",
1360
+ iridescence: 0.9,
1361
+ iridescenceIOR: 1.45,
1362
+ transmission: 0.1,
1363
+ ior: 1.45
1364
+ },
1365
+ amethyst: {
1366
+ roughness: 0.05,
1367
+ metalness: 0,
1368
+ color: "#9966cc",
1369
+ transmission: 0.5,
1370
+ ior: 1.54,
1371
+ thickness: 1,
1372
+ transparent: true
1373
+ },
1374
+ topaz: {
1375
+ roughness: 0.02,
1376
+ metalness: 0,
1377
+ color: "#ffc87c",
1378
+ transmission: 0.7,
1379
+ ior: 1.63,
1380
+ thickness: 0.8,
1381
+ transparent: true
1382
+ },
1383
+ turquoise: {
1384
+ roughness: 0.6,
1385
+ metalness: 0,
1386
+ color: "#40e0d0"
1387
+ },
1388
+ lapis_lazuli: {
1389
+ roughness: 0.4,
1390
+ metalness: 0,
1391
+ color: "#26619c",
1392
+ clearcoat: 0.3,
1393
+ clearcoatRoughness: 0.1
1394
+ },
1395
+ // ===========================================================================
1396
+ // MORE METALS — extended metallic palette
1397
+ // ===========================================================================
1398
+ titanium: {
1399
+ roughness: 0.25,
1400
+ metalness: 1,
1401
+ color: "#878681"
1402
+ },
1403
+ tungsten: {
1404
+ roughness: 0.3,
1405
+ metalness: 1,
1406
+ color: "#696969"
1407
+ },
1408
+ tin: {
1409
+ roughness: 0.35,
1410
+ metalness: 1,
1411
+ color: "#b0b0b0",
1412
+ envMapIntensity: 0.8
1413
+ },
1414
+ lead: {
1415
+ roughness: 0.6,
1416
+ metalness: 0.9,
1417
+ color: "#595959"
1418
+ },
1419
+ brass: {
1420
+ roughness: 0.35,
1421
+ metalness: 1,
1422
+ color: "#b5a642"
1423
+ },
1424
+ wrought_iron: {
1425
+ roughness: 0.7,
1426
+ metalness: 0.85,
1427
+ color: "#2c2c2c"
1428
+ },
1429
+ mercury: {
1430
+ roughness: 0,
1431
+ metalness: 1,
1432
+ color: "#d4d4d4",
1433
+ envMapIntensity: 2
1434
+ },
1435
+ // ===========================================================================
1436
+ // NATURAL / WEATHER — environmental surfaces
1437
+ // ===========================================================================
1438
+ snow: {
1439
+ roughness: 0.8,
1440
+ metalness: 0,
1441
+ color: "#f0f8ff",
1442
+ thickness: 0.5,
1443
+ attenuationColor: "#c8e0ff",
1444
+ attenuationDistance: 2
1445
+ },
1446
+ fresh_snow: {
1447
+ roughness: 0.6,
1448
+ metalness: 0,
1449
+ color: "#ffffff",
1450
+ sheen: 0.3,
1451
+ sheenRoughness: 0.5,
1452
+ sheenColor: "#e8f0ff"
1453
+ },
1454
+ frost: {
1455
+ roughness: 0.3,
1456
+ metalness: 0,
1457
+ color: "#e8f4f8",
1458
+ transmission: 0.15,
1459
+ ior: 1.31,
1460
+ clearcoat: 0.4,
1461
+ clearcoatRoughness: 0.1
1462
+ },
1463
+ ice: {
1464
+ roughness: 0.1,
1465
+ metalness: 0,
1466
+ color: "#d6eaf8",
1467
+ transmission: 0.8,
1468
+ ior: 1.31,
1469
+ transparent: true
1470
+ },
1471
+ moss: {
1472
+ roughness: 1,
1473
+ metalness: 0,
1474
+ color: "#4a7c3f",
1475
+ sheen: 0.2,
1476
+ sheenRoughness: 1,
1477
+ sheenColor: "#5a9c4f"
1478
+ },
1479
+ lichen: {
1480
+ roughness: 0.9,
1481
+ metalness: 0,
1482
+ color: "#8fa37a"
1483
+ },
1484
+ bark: {
1485
+ roughness: 0.95,
1486
+ metalness: 0,
1487
+ color: "#5c4033"
1488
+ },
1489
+ dried_leaves: {
1490
+ roughness: 0.9,
1491
+ metalness: 0,
1492
+ color: "#8b6914",
1493
+ thickness: 0.1,
1494
+ attenuationColor: "#664400",
1495
+ attenuationDistance: 0.3
1496
+ },
1497
+ // ===========================================================================
1498
+ // AGED / WEATHERED — patina, tarnish, wear
1499
+ // ===========================================================================
1500
+ patina: {
1501
+ roughness: 0.6,
1502
+ metalness: 0.4,
1503
+ color: "#4a9c7e"
1504
+ },
1505
+ tarnished_silver: {
1506
+ roughness: 0.5,
1507
+ metalness: 0.7,
1508
+ color: "#8a8a7a"
1509
+ },
1510
+ aged_bronze: {
1511
+ roughness: 0.55,
1512
+ metalness: 0.6,
1513
+ color: "#6b8e5a"
1514
+ },
1515
+ weathered_wood: {
1516
+ roughness: 0.95,
1517
+ metalness: 0,
1518
+ color: "#8a8070"
1519
+ },
1520
+ cracked_paint: {
1521
+ roughness: 0.8,
1522
+ metalness: 0,
1523
+ color: "#c8c0b0"
1524
+ },
1525
+ oxidized_copper: {
1526
+ roughness: 0.65,
1527
+ metalness: 0.5,
1528
+ color: "#2e8b57"
1529
+ },
1530
+ // ===========================================================================
1531
+ // CONSTRUCTION — architectural materials
1532
+ // ===========================================================================
1533
+ asphalt: {
1534
+ roughness: 0.9,
1535
+ metalness: 0,
1536
+ color: "#3a3a3a"
1537
+ },
1538
+ cement: {
1539
+ roughness: 0.85,
1540
+ metalness: 0,
1541
+ color: "#a0a0a0"
1542
+ },
1543
+ tile_ceramic: {
1544
+ roughness: 0.2,
1545
+ metalness: 0,
1546
+ color: "#e8e0d0",
1547
+ clearcoat: 0.6,
1548
+ clearcoatRoughness: 0.05
1549
+ },
1550
+ tile_porcelain: {
1551
+ roughness: 0.1,
1552
+ metalness: 0,
1553
+ color: "#f5f5f5",
1554
+ clearcoat: 0.8,
1555
+ clearcoatRoughness: 0.02
1556
+ },
1557
+ linoleum: {
1558
+ roughness: 0.6,
1559
+ metalness: 0,
1560
+ color: "#c0b090",
1561
+ clearcoat: 0.2,
1562
+ clearcoatRoughness: 0.3
1563
+ },
1564
+ drywall: {
1565
+ roughness: 1,
1566
+ metalness: 0,
1567
+ color: "#f0ece0"
1568
+ },
1569
+ rebar: {
1570
+ roughness: 0.6,
1571
+ metalness: 0.9,
1572
+ color: "#5a4a3a"
1573
+ },
1574
+ stucco: {
1575
+ roughness: 0.95,
1576
+ metalness: 0,
1577
+ color: "#e8dcc8"
1578
+ },
1579
+ gravel: {
1580
+ roughness: 1,
1581
+ metalness: 0.02,
1582
+ color: "#8a8070"
1583
+ },
1584
+ // ===========================================================================
1585
+ // LEATHER VARIANTS — sheen + clearcoat differentiation
1586
+ // ===========================================================================
1587
+ suede: {
1588
+ roughness: 1,
1589
+ metalness: 0,
1590
+ color: "#8b6914",
1591
+ sheen: 0.6,
1592
+ sheenRoughness: 1,
1593
+ sheenColor: "#a07828"
1594
+ },
1595
+ patent_leather: {
1596
+ roughness: 0.05,
1597
+ metalness: 0,
1598
+ color: "#1a1a1a",
1599
+ clearcoat: 1,
1600
+ clearcoatRoughness: 0.02
1601
+ },
1602
+ distressed_leather: {
1603
+ roughness: 0.8,
1604
+ metalness: 0,
1605
+ color: "#5a3a1a",
1606
+ sheen: 0.15,
1607
+ sheenRoughness: 0.8,
1608
+ sheenColor: "#4a3010"
1609
+ },
1610
+ nubuck: {
1611
+ roughness: 0.95,
1612
+ metalness: 0,
1613
+ color: "#c8a882",
1614
+ sheen: 0.5,
1615
+ sheenRoughness: 0.9,
1616
+ sheenColor: "#d4b892"
1617
+ },
1618
+ // ===========================================================================
1619
+ // RUBBER VARIANTS
1620
+ // ===========================================================================
1621
+ tire_rubber: {
1622
+ roughness: 0.85,
1623
+ metalness: 0,
1624
+ color: "#1a1a1a"
1625
+ },
1626
+ silicone: {
1627
+ roughness: 0.6,
1628
+ metalness: 0,
1629
+ color: "#e0e0e0",
1630
+ thickness: 0.5,
1631
+ attenuationColor: "#cccccc",
1632
+ attenuationDistance: 1,
1633
+ transmission: 0.05
1634
+ },
1635
+ latex: {
1636
+ roughness: 0.3,
1637
+ metalness: 0,
1638
+ color: "#ffefd5",
1639
+ clearcoat: 0.5,
1640
+ clearcoatRoughness: 0.1,
1641
+ thickness: 0.3,
1642
+ attenuationColor: "#ffcc88",
1643
+ attenuationDistance: 0.5
1644
+ },
1645
+ eraser: {
1646
+ roughness: 0.95,
1647
+ metalness: 0,
1648
+ color: "#ff6b81"
1649
+ },
1650
+ // ===========================================================================
1651
+ // LIQUIDS — transmission + animated surface hints
1652
+ // ===========================================================================
1653
+ lava: {
1654
+ roughness: 0.8,
1655
+ metalness: 0,
1656
+ color: "#ff4400",
1657
+ emissive: "#ff2200",
1658
+ emissiveIntensity: 3
1659
+ },
1660
+ blood: {
1661
+ roughness: 0.2,
1662
+ metalness: 0,
1663
+ color: "#8b0000",
1664
+ clearcoat: 0.7,
1665
+ clearcoatRoughness: 0.05,
1666
+ thickness: 1,
1667
+ attenuationColor: "#440000",
1668
+ attenuationDistance: 0.3
1669
+ },
1670
+ oil_liquid: {
1671
+ roughness: 0.05,
1672
+ metalness: 0,
1673
+ color: "#1a1a0a",
1674
+ clearcoat: 0.9,
1675
+ clearcoatRoughness: 0.02
1676
+ },
1677
+ molten_metal: {
1678
+ roughness: 0.15,
1679
+ metalness: 0.8,
1680
+ color: "#ff8c00",
1681
+ emissive: "#ff6600",
1682
+ emissiveIntensity: 5
1683
+ },
1684
+ syrup: {
1685
+ roughness: 0.1,
1686
+ metalness: 0,
1687
+ color: "#8b4513",
1688
+ transmission: 0.4,
1689
+ ior: 1.49,
1690
+ thickness: 2,
1691
+ attenuationColor: "#663300",
1692
+ attenuationDistance: 0.5
1693
+ },
1694
+ // ===========================================================================
1695
+ // BLACKBODY / THERMAL — temperature-driven emission
1696
+ // ===========================================================================
1697
+ heated_metal_low: {
1698
+ roughness: 0.5,
1699
+ metalness: 0.9,
1700
+ color: "#4a4a4a",
1701
+ emissive: "#ff1a00",
1702
+ emissiveIntensity: 1.5
1703
+ },
1704
+ heated_metal_mid: {
1705
+ roughness: 0.4,
1706
+ metalness: 0.8,
1707
+ color: "#5a5a5a",
1708
+ emissive: "#ff6600",
1709
+ emissiveIntensity: 3
1710
+ },
1711
+ heated_metal_hot: {
1712
+ roughness: 0.3,
1713
+ metalness: 0.7,
1714
+ color: "#6a6a6a",
1715
+ emissive: "#ffcc00",
1716
+ emissiveIntensity: 5
1717
+ },
1718
+ heated_metal_white: {
1719
+ roughness: 0.2,
1720
+ metalness: 0.6,
1721
+ color: "#8a8a8a",
1722
+ emissive: "#ffffff",
1723
+ emissiveIntensity: 8
1724
+ },
1725
+ ember: {
1726
+ roughness: 0.9,
1727
+ metalness: 0,
1728
+ color: "#2a0a00",
1729
+ emissive: "#ff4400",
1730
+ emissiveIntensity: 2
1731
+ },
1732
+ coal: {
1733
+ roughness: 0.85,
1734
+ metalness: 0,
1735
+ color: "#1a1a1a",
1736
+ emissive: "#cc2200",
1737
+ emissiveIntensity: 0.5
1738
+ },
1739
+ // ===========================================================================
1740
+ // SPECIAL EFFECTS — sparkle, glow, energy
1741
+ // ===========================================================================
1742
+ glitter: {
1743
+ roughness: 0.2,
1744
+ metalness: 0.8,
1745
+ color: "#ffd700",
1746
+ envMapIntensity: 2
1747
+ },
1748
+ sequin: {
1749
+ roughness: 0.05,
1750
+ metalness: 1,
1751
+ envMapIntensity: 2.5,
1752
+ iridescence: 0.3
1753
+ },
1754
+ mica: {
1755
+ roughness: 0.3,
1756
+ metalness: 0.2,
1757
+ color: "#c8b888",
1758
+ iridescence: 0.4,
1759
+ iridescenceIOR: 1.58,
1760
+ sheen: 0.2,
1761
+ sheenRoughness: 0.3,
1762
+ sheenColor: "#d4c498"
1763
+ },
1764
+ fluorescent_green: {
1765
+ roughness: 0.5,
1766
+ metalness: 0,
1767
+ color: "#39ff14",
1768
+ emissive: "#39ff14",
1769
+ emissiveIntensity: 1.5
1770
+ },
1771
+ fluorescent_orange: {
1772
+ roughness: 0.5,
1773
+ metalness: 0,
1774
+ color: "#ff6700",
1775
+ emissive: "#ff6700",
1776
+ emissiveIntensity: 1.5
1777
+ },
1778
+ fluorescent_pink: {
1779
+ roughness: 0.5,
1780
+ metalness: 0,
1781
+ color: "#ff1493",
1782
+ emissive: "#ff1493",
1783
+ emissiveIntensity: 1.5
1784
+ },
1785
+ glow_in_dark: {
1786
+ roughness: 0.7,
1787
+ metalness: 0,
1788
+ color: "#2a3a2a",
1789
+ emissive: "#44ff44",
1790
+ emissiveIntensity: 0.8
1791
+ },
1792
+ plasma: {
1793
+ roughness: 0,
1794
+ metalness: 0,
1795
+ color: "#4400ff",
1796
+ emissive: "#8844ff",
1797
+ emissiveIntensity: 4,
1798
+ transparent: true,
1799
+ opacity: 0.7
1800
+ },
1801
+ energy_field: {
1802
+ roughness: 0,
1803
+ metalness: 0,
1804
+ emissive: "#00ccff",
1805
+ emissiveIntensity: 3,
1806
+ transparent: true,
1807
+ opacity: 0.4,
1808
+ transmission: 0.6
1809
+ },
1810
+ force_field: {
1811
+ roughness: 0,
1812
+ metalness: 0,
1813
+ emissive: "#00ff88",
1814
+ emissiveIntensity: 2,
1815
+ transparent: true,
1816
+ opacity: 0.2,
1817
+ iridescence: 0.8,
1818
+ iridescenceIOR: 1.5
1819
+ },
1820
+ // ===========================================================================
1821
+ // RETROREFLECTIVE — safety, signage
1822
+ // ===========================================================================
1823
+ safety_vest: {
1824
+ roughness: 0.6,
1825
+ metalness: 0,
1826
+ color: "#ccff00",
1827
+ emissive: "#ccff00",
1828
+ emissiveIntensity: 0.3
1829
+ },
1830
+ road_sign: {
1831
+ roughness: 0.4,
1832
+ metalness: 0.1,
1833
+ color: "#ffffff",
1834
+ envMapIntensity: 1.8,
1835
+ emissive: "#ffffff",
1836
+ emissiveIntensity: 0.2
1837
+ },
1838
+ reflective_tape: {
1839
+ roughness: 0.2,
1840
+ metalness: 0.3,
1841
+ color: "#e0e0e0",
1842
+ envMapIntensity: 2.5
1843
+ },
1844
+ // ===========================================================================
1845
+ // MISC — everything else in the real world
1846
+ // ===========================================================================
1847
+ chalkboard: {
1848
+ roughness: 0.9,
1849
+ metalness: 0,
1850
+ color: "#2a3a2a"
1851
+ },
1852
+ chalk: {
1853
+ roughness: 1,
1854
+ metalness: 0,
1855
+ color: "#ffffff"
1856
+ },
1857
+ charcoal: {
1858
+ roughness: 0.9,
1859
+ metalness: 0,
1860
+ color: "#1a1a1a"
1861
+ },
1862
+ cork: {
1863
+ roughness: 0.95,
1864
+ metalness: 0,
1865
+ color: "#b88a50"
1866
+ },
1867
+ felt: {
1868
+ roughness: 1,
1869
+ metalness: 0,
1870
+ color: "#5a8a5a",
1871
+ sheen: 0.4,
1872
+ sheenRoughness: 1,
1873
+ sheenColor: "#6a9a6a"
1874
+ },
1875
+ sponge: {
1876
+ roughness: 1,
1877
+ metalness: 0,
1878
+ color: "#e8c840"
1879
+ },
1880
+ porcelain: {
1881
+ roughness: 0.1,
1882
+ metalness: 0,
1883
+ color: "#f8f4f0",
1884
+ clearcoat: 0.7,
1885
+ clearcoatRoughness: 0.02
1886
+ },
1887
+ terracotta: {
1888
+ roughness: 0.85,
1889
+ metalness: 0,
1890
+ color: "#cc6644"
1891
+ },
1892
+ concrete_polished: {
1893
+ roughness: 0.3,
1894
+ metalness: 0,
1895
+ color: "#a0a0a0",
1896
+ clearcoat: 0.3,
1897
+ clearcoatRoughness: 0.15
1898
+ },
1899
+ rope: {
1900
+ roughness: 1,
1901
+ metalness: 0,
1902
+ color: "#c4a35a",
1903
+ sheen: 0.2,
1904
+ sheenRoughness: 1,
1905
+ sheenColor: "#b89848"
1906
+ },
1907
+ wicker: {
1908
+ roughness: 0.9,
1909
+ metalness: 0,
1910
+ color: "#a08050"
1911
+ },
1912
+ parchment: {
1913
+ roughness: 0.8,
1914
+ metalness: 0,
1915
+ color: "#f0e6c8",
1916
+ thickness: 0.1,
1917
+ attenuationColor: "#d4c0a0",
1918
+ attenuationDistance: 0.2
1919
+ },
1920
+ // ===========================================================================
1921
+ // ANIMATED MATERIALS — time-driven surface effects (wired to scene.time)
1922
+ // These set metadata flags that the runtime uses to drive animated shaders.
1923
+ // ===========================================================================
1924
+ flowing_water: {
1925
+ roughness: 0,
1926
+ metalness: 0,
1927
+ color: "#006994",
1928
+ transmission: 0.85,
1929
+ ior: 1.33,
1930
+ transparent: true,
1931
+ _animated: { pattern: "flow", speed: 0.8, amplitude: 0.3 }
1932
+ },
1933
+ rippling_water: {
1934
+ roughness: 0.05,
1935
+ metalness: 0,
1936
+ color: "#005577",
1937
+ transmission: 0.8,
1938
+ ior: 1.33,
1939
+ transparent: true,
1940
+ _animated: { pattern: "ripple", speed: 1, amplitude: 0.4 }
1941
+ },
1942
+ flickering_fire: {
1943
+ roughness: 0.8,
1944
+ metalness: 0,
1945
+ color: "#ff4400",
1946
+ emissive: "#ff2200",
1947
+ emissiveIntensity: 3,
1948
+ _animated: { pattern: "flicker", speed: 3, amplitude: 0.6 }
1949
+ },
1950
+ pulsing_glow: {
1951
+ roughness: 0.5,
1952
+ metalness: 0,
1953
+ emissive: "#00ff88",
1954
+ emissiveIntensity: 2,
1955
+ _animated: { pattern: "pulse", speed: 1.5, amplitude: 0.5 }
1956
+ },
1957
+ breathing_light: {
1958
+ roughness: 0.3,
1959
+ metalness: 0,
1960
+ emissive: "#4488ff",
1961
+ emissiveIntensity: 1.5,
1962
+ _animated: { pattern: "breathe", speed: 0.5, amplitude: 0.8 }
1963
+ },
1964
+ scrolling_lava: {
1965
+ roughness: 0.8,
1966
+ metalness: 0,
1967
+ color: "#ff4400",
1968
+ emissive: "#ff2200",
1969
+ emissiveIntensity: 4,
1970
+ _animated: { pattern: "scroll", speed: 0.3, amplitude: 1 }
1971
+ },
1972
+ waving_grass: {
1973
+ roughness: 0.9,
1974
+ metalness: 0,
1975
+ color: "#228b22",
1976
+ sheen: 0.2,
1977
+ sheenRoughness: 0.8,
1978
+ sheenColor: "#44cc22",
1979
+ _animated: { pattern: "wave", speed: 0.8, amplitude: 0.2 }
1980
+ },
1981
+ flickering_neon: {
1982
+ roughness: 0,
1983
+ metalness: 0,
1984
+ emissive: "#ff00ff",
1985
+ emissiveIntensity: 3.5,
1986
+ transparent: true,
1987
+ opacity: 0.9,
1988
+ _animated: { pattern: "flicker", speed: 5, amplitude: 0.4 }
1989
+ },
1990
+ pulsing_crystal: {
1991
+ roughness: 0,
1992
+ metalness: 0.1,
1993
+ transmission: 0.8,
1994
+ ior: 2,
1995
+ iridescence: 0.8,
1996
+ iridescenceIOR: 1.3,
1997
+ emissive: "#8844ff",
1998
+ emissiveIntensity: 1,
1999
+ _animated: { pattern: "pulse", speed: 0.8, amplitude: 0.6 }
2000
+ },
2001
+ animated_hologram: {
2002
+ roughness: 0,
2003
+ metalness: 0.3,
2004
+ transparent: true,
2005
+ opacity: 0.5,
2006
+ emissive: "#00ccff",
2007
+ emissiveIntensity: 1.5,
2008
+ _animated: { pattern: "scroll", speed: 1.5, amplitude: 0.3 }
2009
+ },
2010
+ boiling_surface: {
2011
+ roughness: 0.7,
2012
+ metalness: 0,
2013
+ color: "#cc4400",
2014
+ emissive: "#ff6600",
2015
+ emissiveIntensity: 2,
2016
+ _animated: { pattern: "noise", speed: 2, amplitude: 0.5 }
2017
+ },
2018
+ shimmer_heat: {
2019
+ roughness: 0,
2020
+ metalness: 0,
2021
+ transparent: true,
2022
+ opacity: 0.15,
2023
+ _animated: { pattern: "wave", speed: 2, amplitude: 0.1 }
2024
+ },
2025
+ // ===========================================================================
2026
+ // VOLUMETRIC MATERIALS — metadata for ray-marched volume rendering
2027
+ // These presets describe volumetric phenomena; the runtime renders them via
2028
+ // a ray marching pass on a bounding box/sphere geometry.
2029
+ // ===========================================================================
2030
+ fog: {
2031
+ roughness: 0,
2032
+ metalness: 0,
2033
+ color: "#c0c0c0",
2034
+ transparent: true,
2035
+ opacity: 0.3,
2036
+ _volumetric: { type: "fog", density: 0.3, scattering: 0.8, absorption: 0.05 }
2037
+ },
2038
+ dense_fog: {
2039
+ roughness: 0,
2040
+ metalness: 0,
2041
+ color: "#a0a0a0",
2042
+ transparent: true,
2043
+ opacity: 0.5,
2044
+ _volumetric: { type: "fog", density: 0.7, scattering: 0.9, absorption: 0.1 }
2045
+ },
2046
+ smoke: {
2047
+ roughness: 0,
2048
+ metalness: 0,
2049
+ color: "#404040",
2050
+ transparent: true,
2051
+ opacity: 0.4,
2052
+ _volumetric: {
2053
+ type: "smoke",
2054
+ density: 0.5,
2055
+ scattering: 0.3,
2056
+ absorption: 0.4,
2057
+ riseSpeed: 0.5,
2058
+ turbulence: 0.6
2059
+ }
2060
+ },
2061
+ campfire_smoke: {
2062
+ roughness: 0,
2063
+ metalness: 0,
2064
+ color: "#505050",
2065
+ transparent: true,
2066
+ opacity: 0.35,
2067
+ _volumetric: {
2068
+ type: "smoke",
2069
+ density: 0.4,
2070
+ scattering: 0.25,
2071
+ absorption: 0.5,
2072
+ riseSpeed: 0.8,
2073
+ turbulence: 0.4
2074
+ }
2075
+ },
2076
+ fire_volume: {
2077
+ roughness: 0,
2078
+ metalness: 0,
2079
+ color: "#ff4400",
2080
+ emissive: "#ff2200",
2081
+ emissiveIntensity: 4,
2082
+ transparent: true,
2083
+ opacity: 0.7,
2084
+ _volumetric: {
2085
+ type: "fire",
2086
+ density: 0.6,
2087
+ scattering: 0.1,
2088
+ absorption: 0.2,
2089
+ riseSpeed: 1.2,
2090
+ turbulence: 0.7,
2091
+ temperature: 2500
2092
+ }
2093
+ },
2094
+ candle_flame: {
2095
+ roughness: 0,
2096
+ metalness: 0,
2097
+ color: "#ffaa33",
2098
+ emissive: "#ff8800",
2099
+ emissiveIntensity: 3,
2100
+ transparent: true,
2101
+ opacity: 0.6,
2102
+ _volumetric: {
2103
+ type: "fire",
2104
+ density: 0.4,
2105
+ scattering: 0.05,
2106
+ absorption: 0.1,
2107
+ riseSpeed: 0.3,
2108
+ turbulence: 0.2,
2109
+ temperature: 1800
2110
+ }
2111
+ },
2112
+ clouds: {
2113
+ roughness: 0,
2114
+ metalness: 0,
2115
+ color: "#ffffff",
2116
+ transparent: true,
2117
+ opacity: 0.6,
2118
+ _volumetric: {
2119
+ type: "clouds",
2120
+ density: 0.4,
2121
+ scattering: 0.95,
2122
+ absorption: 0.02,
2123
+ noiseScale: 2,
2124
+ octaves: 6
2125
+ }
2126
+ },
2127
+ storm_clouds: {
2128
+ roughness: 0,
2129
+ metalness: 0,
2130
+ color: "#3a3a4a",
2131
+ transparent: true,
2132
+ opacity: 0.8,
2133
+ _volumetric: {
2134
+ type: "clouds",
2135
+ density: 0.7,
2136
+ scattering: 0.6,
2137
+ absorption: 0.15,
2138
+ noiseScale: 1.5,
2139
+ octaves: 6
2140
+ }
2141
+ },
2142
+ dust_motes: {
2143
+ roughness: 0,
2144
+ metalness: 0,
2145
+ color: "#c8b888",
2146
+ transparent: true,
2147
+ opacity: 0.15,
2148
+ _volumetric: { type: "dust", density: 0.1, scattering: 0.5, absorption: 0.02 }
2149
+ },
2150
+ mist: {
2151
+ roughness: 0,
2152
+ metalness: 0,
2153
+ color: "#e0e8f0",
2154
+ transparent: true,
2155
+ opacity: 0.25,
2156
+ _volumetric: {
2157
+ type: "mist",
2158
+ density: 0.2,
2159
+ scattering: 0.85,
2160
+ absorption: 0.03,
2161
+ heightFalloff: 1.5
2162
+ }
2163
+ },
2164
+ steam: {
2165
+ roughness: 0,
2166
+ metalness: 0,
2167
+ color: "#e8e8e8",
2168
+ transparent: true,
2169
+ opacity: 0.3,
2170
+ _volumetric: {
2171
+ type: "steam",
2172
+ density: 0.35,
2173
+ scattering: 0.7,
2174
+ absorption: 0.05,
2175
+ riseSpeed: 1,
2176
+ turbulence: 0.3
2177
+ }
2178
+ },
2179
+ aurora_borealis: {
2180
+ roughness: 0,
2181
+ metalness: 0,
2182
+ emissive: "#00ff88",
2183
+ emissiveIntensity: 2,
2184
+ transparent: true,
2185
+ opacity: 0.3,
2186
+ _volumetric: {
2187
+ type: "aurora",
2188
+ density: 0.15,
2189
+ scattering: 0.1,
2190
+ absorption: 0.01,
2191
+ emissionIntensity: 2
2192
+ }
2193
+ },
2194
+ nebula: {
2195
+ roughness: 0,
2196
+ metalness: 0,
2197
+ emissive: "#ff44aa",
2198
+ emissiveIntensity: 1.5,
2199
+ transparent: true,
2200
+ opacity: 0.4,
2201
+ _volumetric: {
2202
+ type: "nebula",
2203
+ density: 0.25,
2204
+ scattering: 0.3,
2205
+ absorption: 0.05,
2206
+ emissionIntensity: 1.5,
2207
+ noiseScale: 1
2208
+ }
2209
+ },
2210
+ underwater_caustics: {
2211
+ roughness: 0,
2212
+ metalness: 0,
2213
+ color: "#003366",
2214
+ transparent: true,
2215
+ opacity: 0.2,
2216
+ _volumetric: { type: "underwater", density: 0.15, scattering: 0.6, absorption: 0.1 }
2217
+ },
2218
+ god_rays: {
2219
+ roughness: 0,
2220
+ metalness: 0,
2221
+ color: "#ffffd0",
2222
+ transparent: true,
2223
+ opacity: 0.15,
2224
+ emissive: "#ffff88",
2225
+ emissiveIntensity: 0.5,
2226
+ _volumetric: { type: "god_rays", density: 0.1, scattering: 0.9, absorption: 0.01 }
2227
+ },
2228
+ neon_gas: {
2229
+ roughness: 0,
2230
+ metalness: 0,
2231
+ emissive: "#ff4400",
2232
+ emissiveIntensity: 3,
2233
+ transparent: true,
2234
+ opacity: 0.5,
2235
+ _volumetric: {
2236
+ type: "neon_gas",
2237
+ density: 0.3,
2238
+ scattering: 0.2,
2239
+ absorption: 0.05,
2240
+ emissionIntensity: 3
2241
+ }
2242
+ },
2243
+ explosion: {
2244
+ roughness: 0,
2245
+ metalness: 0,
2246
+ color: "#ff6600",
2247
+ emissive: "#ff4400",
2248
+ emissiveIntensity: 6,
2249
+ transparent: true,
2250
+ opacity: 0.8,
2251
+ _volumetric: {
2252
+ type: "fire",
2253
+ density: 0.8,
2254
+ scattering: 0.15,
2255
+ absorption: 0.3,
2256
+ riseSpeed: 2,
2257
+ turbulence: 1,
2258
+ temperature: 4e3
2259
+ }
2260
+ },
2261
+ toxic_gas: {
2262
+ roughness: 0,
2263
+ metalness: 0,
2264
+ color: "#44cc00",
2265
+ emissive: "#33aa00",
2266
+ emissiveIntensity: 1,
2267
+ transparent: true,
2268
+ opacity: 0.35,
2269
+ _volumetric: {
2270
+ type: "smoke",
2271
+ density: 0.3,
2272
+ scattering: 0.4,
2273
+ absorption: 0.2,
2274
+ riseSpeed: 0.2,
2275
+ turbulence: 0.3
2276
+ }
2277
+ },
2278
+ magical_mist: {
2279
+ roughness: 0,
2280
+ metalness: 0,
2281
+ emissive: "#8844ff",
2282
+ emissiveIntensity: 1.5,
2283
+ transparent: true,
2284
+ opacity: 0.3,
2285
+ iridescence: 0.6,
2286
+ iridescenceIOR: 1.5,
2287
+ _volumetric: {
2288
+ type: "mist",
2289
+ density: 0.2,
2290
+ scattering: 0.5,
2291
+ absorption: 0.03,
2292
+ emissionIntensity: 1.5
2293
+ }
2294
+ },
2295
+ // --- Architectural & Natural Stone ---
2296
+ brick: { roughness: 0.9, metalness: 0, color: "#a6523c" },
2297
+ concrete: { roughness: 0.88, metalness: 0, color: "#8a8a8a" },
2298
+ granite: { roughness: 0.6, metalness: 0, color: "#666670" },
2299
+ sandstone: { roughness: 0.85, metalness: 0, color: "#cca66e" },
2300
+ slate: { roughness: 0.7, metalness: 0, color: "#3f4450" },
2301
+ adobe: { roughness: 0.95, metalness: 0, color: "#bf9160" },
2302
+ plaster: { roughness: 0.82, metalness: 0, color: "#ebe8de" },
2303
+ // --- Plant & Cellulose ---
2304
+ bamboo: { roughness: 0.65, metalness: 0, color: "#b3a84d" },
2305
+ paper: { roughness: 0.9, metalness: 0, color: "#f3f0e5" },
2306
+ cardboard: { roughness: 0.88, metalness: 0, color: "#b88c58" },
2307
+ // --- Organic & Animal ---
2308
+ bone: { roughness: 0.7, metalness: 0, color: "#e0d4b5" },
2309
+ ivory: { roughness: 0.35, metalness: 0, color: "#f0e8c5", envMapIntensity: 0.4 },
2310
+ coral: { roughness: 0.75, metalness: 0, color: "#f2614d" },
2311
+ shell: {
2312
+ roughness: 0.25,
2313
+ metalness: 0.05,
2314
+ color: "#f5ede0",
2315
+ iridescence: 0.8,
2316
+ iridescenceIOR: 1.5,
2317
+ envMapIntensity: 0.6
2318
+ },
2319
+ thatch: { roughness: 0.95, metalness: 0, color: "#c0a84a" },
2320
+ // --- Synthetic & Engineered ---
2321
+ resin: {
2322
+ roughness: 0.08,
2323
+ metalness: 0,
2324
+ transmission: 0.75,
2325
+ ior: 1.5,
2326
+ color: "#e8c46a",
2327
+ transparent: true,
2328
+ opacity: 0.88
2329
+ },
2330
+ foam: { roughness: 0.95, metalness: 0, color: "#f0f0f0" },
2331
+ composite: { roughness: 0.5, metalness: 0.25, color: "#333338" },
2332
+ carbon_fiber: {
2333
+ roughness: 0.28,
2334
+ metalness: 0.6,
2335
+ color: "#111114",
2336
+ envMapIntensity: 1.2,
2337
+ clearcoat: 0.6,
2338
+ clearcoatRoughness: 0.1
2339
+ },
2340
+ kevlar: { roughness: 0.82, metalness: 0, color: "#ccbb66" },
2341
+ fiberglass: {
2342
+ roughness: 0.3,
2343
+ metalness: 0.05,
2344
+ transmission: 0.4,
2345
+ ior: 1.45,
2346
+ color: "#e0ede0",
2347
+ transparent: true,
2348
+ opacity: 0.92
2349
+ },
2350
+ stained_glass: {
2351
+ roughness: 0.05,
2352
+ metalness: 0,
2353
+ transmission: 0.85,
2354
+ ior: 1.52,
2355
+ color: "#cc44ff",
2356
+ transparent: true,
2357
+ opacity: 0.75,
2358
+ thickness: 0.3
2359
+ }
2360
+ };
2361
+ exports.ENVIRONMENT_PRESETS = {
2362
+ forest_sunset: {
2363
+ background: true,
2364
+ envPreset: "sunset",
2365
+ fog: { color: "#ff9966", near: 10, far: 100 },
2366
+ ground: { color: "#2d5a27" },
2367
+ lighting: {
2368
+ ambient: { color: "#ffa366", intensity: 0.3 },
2369
+ directional: { color: "#ff7700", intensity: 1.5, position: [10, 20, 5], shadows: true }
2370
+ }
2371
+ },
2372
+ cyberpunk_city: {
2373
+ background: true,
2374
+ envPreset: "night",
2375
+ fog: { color: "#0a0020", near: 5, far: 60 },
2376
+ ground: { color: "#1a1a2e" },
2377
+ lighting: {
2378
+ ambient: { color: "#220044", intensity: 0.2 },
2379
+ directional: { color: "#ff00ff", intensity: 0.5, position: [5, 15, 5], shadows: true },
2380
+ points: [
2381
+ { color: "#00ffff", intensity: 3, position: [-5, 3, -5], distance: 15 },
2382
+ { color: "#ff00ff", intensity: 3, position: [5, 3, 5], distance: 15 }
2383
+ ]
2384
+ },
2385
+ postprocessing: { bloom: { intensity: 1.5, luminanceThreshold: 0.1 } }
2386
+ },
2387
+ space_void: {
2388
+ background: true,
2389
+ envPreset: "night",
2390
+ lighting: {
2391
+ ambient: { color: "#111133", intensity: 0.1 },
2392
+ directional: { color: "#ffffff", intensity: 0.5, position: [0, 10, 0], shadows: false }
2393
+ }
2394
+ },
2395
+ studio: {
2396
+ background: true,
2397
+ envPreset: "studio",
2398
+ ground: { color: "#cccccc" },
2399
+ lighting: {
2400
+ ambient: { color: "#ffffff", intensity: 0.4 },
2401
+ directional: { color: "#ffffff", intensity: 1, position: [5, 10, 5], shadows: true }
2402
+ }
2403
+ },
2404
+ underwater: {
2405
+ background: true,
2406
+ envPreset: "dawn",
2407
+ fog: { color: "#003366", near: 2, far: 40 },
2408
+ ground: { color: "#1a3a4a" },
2409
+ lighting: {
2410
+ ambient: { color: "#004488", intensity: 0.3 },
2411
+ directional: { color: "#66aacc", intensity: 0.8, position: [0, 20, 0], shadows: true }
2412
+ }
2413
+ },
2414
+ desert: {
2415
+ background: true,
2416
+ envPreset: "sunset",
2417
+ fog: { color: "#d4a574", near: 20, far: 150 },
2418
+ ground: { color: "#c4a35a" },
2419
+ lighting: {
2420
+ ambient: { color: "#f5deb3", intensity: 0.4 },
2421
+ directional: { color: "#ffffcc", intensity: 2, position: [15, 30, 10], shadows: true }
2422
+ }
2423
+ }
2424
+ };
2425
+ MESH_TYPES = /* @__PURE__ */ new Set([
2426
+ "orb",
2427
+ "sphere",
2428
+ "cube",
2429
+ "box",
2430
+ "cylinder",
2431
+ "pyramid",
2432
+ "cone",
2433
+ "plane",
2434
+ "torus",
2435
+ "ring",
2436
+ "capsule",
2437
+ "object",
2438
+ "avatar",
2439
+ "dna",
2440
+ "gaussian_splat",
2441
+ "splat",
2442
+ "nerf",
2443
+ "volumetric_video",
2444
+ // Procedural geometry types (hull/spline/membrane/blob/metaball)
2445
+ "hull",
2446
+ "spline",
2447
+ "membrane",
2448
+ "blob",
2449
+ "metaball"
2450
+ ]);
2451
+ exports.UI_COMPONENT_PRESETS = {
2452
+ UIPanel: {
2453
+ component: "Container",
2454
+ // @react-three/uikit Container
2455
+ defaultProps: {
2456
+ flexDirection: "column",
2457
+ padding: 16,
2458
+ backgroundColor: "rgba(0, 0, 0, 0.8)",
2459
+ borderRadius: 8
2460
+ }
2461
+ },
2462
+ UIText: {
2463
+ component: "Text",
2464
+ // @react-three/uikit Text
2465
+ defaultProps: {
2466
+ fontSize: 16,
2467
+ color: "white"
2468
+ }
2469
+ },
2470
+ UIButton: {
2471
+ component: "Button",
2472
+ // Custom button using Container with hover
2473
+ defaultProps: {
2474
+ padding: 12,
2475
+ paddingX: 24,
2476
+ backgroundColor: "#4a90d9",
2477
+ borderRadius: 4,
2478
+ cursor: "pointer"
2479
+ }
2480
+ },
2481
+ UISlider: {
2482
+ component: "Slider",
2483
+ // Custom slider implementation
2484
+ defaultProps: {
2485
+ width: 200,
2486
+ height: 20,
2487
+ trackColor: "#333",
2488
+ fillColor: "#4a90d9",
2489
+ thumbSize: 16
2490
+ }
2491
+ },
2492
+ UIInput: {
2493
+ component: "Input",
2494
+ // @react-three/uikit Input
2495
+ defaultProps: {
2496
+ width: 200,
2497
+ padding: 8,
2498
+ backgroundColor: "#222",
2499
+ borderColor: "#444",
2500
+ borderWidth: 1,
2501
+ borderRadius: 4,
2502
+ color: "white"
2503
+ }
2504
+ },
2505
+ UIImage: {
2506
+ component: "Image",
2507
+ // @react-three/uikit Image
2508
+ defaultProps: {
2509
+ objectFit: "contain"
2510
+ }
2511
+ },
2512
+ UIChart: {
2513
+ component: "Chart",
2514
+ // Custom chart component
2515
+ defaultProps: {
2516
+ width: 300,
2517
+ height: 200,
2518
+ backgroundColor: "#1a1a2e"
2519
+ }
2520
+ },
2521
+ UIGauge: {
2522
+ component: "Gauge",
2523
+ // Custom gauge component
2524
+ defaultProps: {
2525
+ size: 100,
2526
+ strokeWidth: 8,
2527
+ trackColor: "#333",
2528
+ fillColor: "#4a90d9"
2529
+ }
2530
+ }
2531
+ };
2532
+ exports.QUALITY_TIER_SCALES = {
2533
+ low: {
2534
+ particleScale: 0.25,
2535
+ lodLevel: "draft",
2536
+ maxLights: 2,
2537
+ shadowMapSize: 512,
2538
+ shaderComplexity: "basic"
2539
+ },
2540
+ med: {
2541
+ particleScale: 0.6,
2542
+ lodLevel: "mesh",
2543
+ maxLights: 4,
2544
+ shadowMapSize: 1024,
2545
+ shaderComplexity: "standard"
2546
+ },
2547
+ high: {
2548
+ particleScale: 1,
2549
+ lodLevel: "final",
2550
+ maxLights: 8,
2551
+ shadowMapSize: 2048,
2552
+ shaderComplexity: "physical"
2553
+ },
2554
+ ultra: {
2555
+ particleScale: 1.5,
2556
+ lodLevel: "final",
2557
+ maxLights: 16,
2558
+ shadowMapSize: 4096,
2559
+ shaderComplexity: "physical"
2560
+ }
2561
+ };
2562
+ exports.R3FCompiler = class {
2563
+ constructor(options = {}) {
2564
+ // ─── RBAC Enforcement ─────────────────────────────────────────────────
2565
+ this.compilerName = "R3FCompiler";
2566
+ this.rbac = chunkKKP7JKN4_cjs.getRBAC();
2567
+ this.qualityTier = options.qualityTier ?? "high";
2568
+ this.tierScales = exports.QUALITY_TIER_SCALES[this.qualityTier];
2569
+ this._defaultLighting = options.defaultLighting ?? true;
2570
+ this._holomapPointCloud = options.holomapPointCloud;
2571
+ if (options.platformTarget) {
2572
+ this._platformTarget = typeof options.platformTarget === "string" ? chunkAIA52I7T_cjs.createPlatformTarget(options.platformTarget) : options.platformTarget;
2573
+ }
2574
+ }
2575
+ /**
2576
+ * Validate agent permissions before compilation.
2577
+ * Skips validation when no token is provided (backwards compatibility).
2578
+ *
2579
+ * Checks:
2580
+ * 1. AST read access (can the agent read AST?)
2581
+ * 2. Code generation access (can the agent generate code?)
2582
+ * 3. Output path scope (if outputPath provided)
2583
+ *
2584
+ * @param agentToken - Agent JWT token (optional for backwards compat)
2585
+ * @param outputPath - Optional output file path for scope validation
2586
+ * @throws UnauthorizedCompilerAccessError if token is provided but invalid/unauthorized
2587
+ */
2588
+ validateCompilerAccess(agentToken, outputPath) {
2589
+ if (!agentToken) return;
2590
+ const astDecision = this.rbac.checkAccess({
2591
+ token: agentToken,
2592
+ resourceType: "ast" /* AST */,
2593
+ operation: "read",
2594
+ expectedWorkflowStep: "generate_assembly" /* GENERATE_ASSEMBLY */
2595
+ });
2596
+ if (!astDecision.allowed) {
2597
+ throw new chunkKKP7JKN4_cjs.UnauthorizedCompilerAccessError(astDecision, "AST access", this.compilerName);
2598
+ }
2599
+ const codeDecision = this.rbac.checkAccess({
2600
+ token: agentToken,
2601
+ resourceType: "code" /* CODE */,
2602
+ operation: "write",
2603
+ expectedWorkflowStep: "generate_assembly" /* GENERATE_ASSEMBLY */
2604
+ });
2605
+ if (!codeDecision.allowed) {
2606
+ throw new chunkKKP7JKN4_cjs.UnauthorizedCompilerAccessError(codeDecision, "code generation", this.compilerName);
2607
+ }
2608
+ if (outputPath) {
2609
+ const outputDecision = this.rbac.checkAccess({
2610
+ token: agentToken,
2611
+ resourceType: "output" /* OUTPUT */,
2612
+ operation: "write",
2613
+ resourcePath: outputPath,
2614
+ expectedWorkflowStep: "serialize" /* SERIALIZE */
2615
+ });
2616
+ if (!outputDecision.allowed) {
2617
+ throw new chunkKKP7JKN4_cjs.UnauthorizedCompilerAccessError(
2618
+ outputDecision,
2619
+ `output write to '${outputPath}'`,
2620
+ this.compilerName
2621
+ );
2622
+ }
2623
+ }
2624
+ }
2625
+ // ─── Spread Expansion Utility ─────────────────────────────────────────
2626
+ /**
2627
+ * Expands spread expressions in a properties object.
2628
+ * Spreads are stored with keys like `__spread_0`, `__spread_1` and have
2629
+ * the structure: { type: 'spread', argument: <value> }
2630
+ *
2631
+ * @param props - The properties object potentially containing spreads
2632
+ * @param context - Optional context for resolving references (templates, state)
2633
+ * @returns A new object with spreads expanded and merged
2634
+ */
2635
+ expandSpreads(props, context) {
2636
+ const result = {};
2637
+ const spreadKeys = [];
2638
+ for (const [key, value] of Object.entries(props)) {
2639
+ if (key.startsWith("__spread_")) {
2640
+ spreadKeys.push(key);
2641
+ } else if (value && typeof value === "object" && value.type === "spread") {
2642
+ spreadKeys.push(key);
2643
+ } else {
2644
+ if (value && typeof value === "object" && !Array.isArray(value) && !("__ref" in value) && !("__expr" in value)) {
2645
+ result[key] = this.expandSpreads(value, context);
2646
+ } else if (Array.isArray(value)) {
2647
+ result[key] = this.expandArraySpreads(value, context);
2648
+ } else {
2649
+ result[key] = value;
2650
+ }
2651
+ }
2652
+ }
2653
+ for (const spreadKey of spreadKeys) {
2654
+ const spreadValue = props[spreadKey];
2655
+ if (spreadValue && typeof spreadValue === "object" && spreadValue.type === "spread") {
2656
+ const resolved = this.resolveSpreadArgument(
2657
+ spreadValue.argument,
2658
+ context
2659
+ );
2660
+ if (resolved && typeof resolved === "object" && !Array.isArray(resolved)) {
2661
+ Object.assign(result, this.expandSpreads(resolved, context));
2662
+ }
2663
+ }
2664
+ }
2665
+ for (const [key, value] of Object.entries(props)) {
2666
+ if (!key.startsWith("__spread_") && !(value && typeof value === "object" && value.type === "spread")) {
2667
+ if (value && typeof value === "object" && !Array.isArray(value) && !("__ref" in value) && !("__expr" in value)) {
2668
+ result[key] = this.expandSpreads(value, context);
2669
+ } else if (Array.isArray(value)) {
2670
+ result[key] = this.expandArraySpreads(value, context);
2671
+ } else {
2672
+ result[key] = value;
2673
+ }
2674
+ }
2675
+ }
2676
+ return result;
2677
+ }
2678
+ /**
2679
+ * Expands spread expressions within an array.
2680
+ * Spread elements have { type: 'spread', argument: <value> }
2681
+ */
2682
+ expandArraySpreads(arr, context) {
2683
+ const result = [];
2684
+ for (const item of arr) {
2685
+ if (item && typeof item === "object" && item.type === "spread") {
2686
+ const resolved = this.resolveSpreadArgument(
2687
+ item.argument,
2688
+ context
2689
+ );
2690
+ if (Array.isArray(resolved)) {
2691
+ result.push(...resolved);
2692
+ } else if (resolved !== void 0 && resolved !== null) {
2693
+ result.push(resolved);
2694
+ }
2695
+ } else if (item && typeof item === "object" && !Array.isArray(item)) {
2696
+ result.push(this.expandSpreads(item, context));
2697
+ } else {
2698
+ result.push(item);
2699
+ }
2700
+ }
2701
+ return result;
2702
+ }
2703
+ /**
2704
+ * Resolves a spread argument to its value.
2705
+ * Handles: direct values, __ref references, template references
2706
+ */
2707
+ resolveSpreadArgument(argument, context) {
2708
+ if (argument === null || argument === void 0) {
2709
+ return void 0;
2710
+ }
2711
+ if (typeof argument === "object" && !("__ref" in argument)) {
2712
+ return argument;
2713
+ }
2714
+ if (typeof argument === "object" && "__ref" in argument) {
2715
+ const ref = argument.__ref;
2716
+ if (context?.templates) {
2717
+ const template = context.templates.get(ref);
2718
+ if (template) {
2719
+ return template.properties || template;
2720
+ }
2721
+ }
2722
+ if (context?.state && ref in context.state) {
2723
+ return context.state[ref];
2724
+ }
2725
+ if (context?.state && ref.includes(".")) {
2726
+ const parts = ref.split(".");
2727
+ let value = context.state;
2728
+ for (const part of parts) {
2729
+ if (value && typeof value === "object" && part in value) {
2730
+ value = value[part];
2731
+ } else {
2732
+ value = void 0;
2733
+ break;
2734
+ }
2735
+ }
2736
+ if (value !== void 0) {
2737
+ return value;
2738
+ }
2739
+ }
2740
+ return argument;
2741
+ }
2742
+ if (typeof argument === "string") {
2743
+ if (context?.templates) {
2744
+ const template = context.templates.get(argument);
2745
+ if (template) {
2746
+ return template.properties || template;
2747
+ }
2748
+ }
2749
+ return { __ref: argument };
2750
+ }
2751
+ return argument;
2752
+ }
2753
+ // ─── HSPlusAST Compilation ────────────────────────────────────────────
2754
+ compile(ast, agentToken, outputPath) {
2755
+ this.validateCompilerAccess(agentToken, outputPath);
2756
+ const root = this.compileNode(ast.root);
2757
+ if (this.hasPostProcessing(root)) {
2758
+ root.children?.unshift({
2759
+ type: "EffectComposer",
2760
+ props: {},
2761
+ children: this.extractPostProcessingNodes(root)
2762
+ });
2763
+ }
2764
+ this.injectDefaultLighting(root);
2765
+ const domainBlocks = ast.domainBlocks ?? [];
2766
+ if (domainBlocks.length > 0) {
2767
+ const compiled = chunkHKEXJUWS_cjs.compileDomainBlocks(
2768
+ domainBlocks,
2769
+ {
2770
+ material: (block) => {
2771
+ const mat = chunkHKEXJUWS_cjs.compileMaterialBlock(block);
2772
+ return {
2773
+ type: "DomainBlockOutput",
2774
+ props: {
2775
+ __raw: chunkHKEXJUWS_cjs.materialToR3F(mat, this.tierScales),
2776
+ __domain: "material",
2777
+ __name: mat.name
2778
+ },
2779
+ children: []
2780
+ };
2781
+ },
2782
+ physics: (block) => {
2783
+ const phys = chunkHKEXJUWS_cjs.compilePhysicsBlock(block);
2784
+ return {
2785
+ type: "DomainBlockOutput",
2786
+ props: {
2787
+ __raw: chunkHKEXJUWS_cjs.physicsToR3F(phys),
2788
+ __domain: "physics",
2789
+ __name: phys.name || phys.keyword
2790
+ },
2791
+ children: []
2792
+ };
2793
+ },
2794
+ vfx: (block) => {
2795
+ const ps = chunkHKEXJUWS_cjs.compileParticleBlock(block);
2796
+ return {
2797
+ type: "DomainBlockOutput",
2798
+ props: {
2799
+ __raw: chunkHKEXJUWS_cjs.particlesToR3F(ps, this.tierScales),
2800
+ __domain: "vfx",
2801
+ __name: ps.name
2802
+ },
2803
+ children: []
2804
+ };
2805
+ },
2806
+ postfx: (block) => {
2807
+ const pp = chunkHKEXJUWS_cjs.compilePostProcessingBlock(block);
2808
+ return {
2809
+ type: "DomainBlockOutput",
2810
+ props: {
2811
+ __raw: chunkHKEXJUWS_cjs.postProcessingToR3F(pp),
2812
+ __domain: "postfx",
2813
+ __name: pp.name || "PostProcessing"
2814
+ },
2815
+ children: []
2816
+ };
2817
+ },
2818
+ audio: (block) => {
2819
+ const audio = chunkHKEXJUWS_cjs.compileAudioSourceBlock(block);
2820
+ return {
2821
+ type: "DomainBlockOutput",
2822
+ props: { __raw: chunkHKEXJUWS_cjs.audioSourceToR3F(audio), __domain: "audio", __name: audio.name },
2823
+ children: []
2824
+ };
2825
+ },
2826
+ weather: (block) => {
2827
+ const weather = chunkHKEXJUWS_cjs.compileWeatherBlock(block);
2828
+ return {
2829
+ type: "DomainBlockOutput",
2830
+ props: {
2831
+ __raw: chunkHKEXJUWS_cjs.weatherToR3F(weather),
2832
+ __domain: "weather",
2833
+ __name: weather.name || "Weather"
2834
+ },
2835
+ children: []
2836
+ };
2837
+ },
2838
+ simulation: (block) => {
2839
+ const sim = chunkHKEXJUWS_cjs.compileSimulationBlock(block);
2840
+ return {
2841
+ type: "DomainBlockOutput",
2842
+ props: {
2843
+ __raw: chunkHKEXJUWS_cjs.simulationToR3F(sim),
2844
+ __domain: "simulation",
2845
+ __name: sim.name || "Simulation"
2846
+ },
2847
+ children: []
2848
+ };
2849
+ }
2850
+ }
2851
+ );
2852
+ if (!root.children) root.children = [];
2853
+ for (const c of compiled) {
2854
+ if (typeof c === "object") root.children.push(c);
2855
+ }
2856
+ }
2857
+ return root;
2858
+ }
2859
+ /**
2860
+ * Compiles a declarative 'world' node into R3F scene nodes.
2861
+ * Nested `world.children` (objects) are compiled via the same path as top-level objects.
2862
+ */
2863
+ compileWorldNode(world, templateMap) {
2864
+ const nodes = [];
2865
+ const props = {};
2866
+ if (world.properties) {
2867
+ for (const prop of world.properties) {
2868
+ props[prop.key] = prop.value;
2869
+ }
2870
+ }
2871
+ if (props.ambient_light !== void 0) {
2872
+ nodes.push(
2873
+ this.createNode("ambientLight", {
2874
+ intensity: Number(props.ambient_light)
2875
+ })
2876
+ );
2877
+ }
2878
+ if (props.skybox_color !== void 0) {
2879
+ nodes.push(
2880
+ this.createNode("Environment", {
2881
+ background: true,
2882
+ preset: "sunset"
2883
+ // Default preset if just color is given
2884
+ })
2885
+ );
2886
+ nodes.push(
2887
+ this.createNode("color", {
2888
+ attach: "background",
2889
+ args: [props.skybox_color]
2890
+ })
2891
+ );
2892
+ }
2893
+ if (props.gravity !== void 0) {
2894
+ nodes.push(
2895
+ this.createNode("Physics", {
2896
+ gravity: [0, -Number(props.gravity), 0]
2897
+ })
2898
+ );
2899
+ }
2900
+ const childNodes = [];
2901
+ if (world.children && world.children.length > 0) {
2902
+ for (const child of world.children) {
2903
+ childNodes.push(this.compileObjectDecl(child, templateMap));
2904
+ }
2905
+ }
2906
+ if (childNodes.length === 0) {
2907
+ return nodes;
2908
+ }
2909
+ const group = this.createNode(
2910
+ "group",
2911
+ {},
2912
+ world.name ? chunkKKP7JKN4_cjs.escapeStringValue(world.name, "JSX") : void 0
2913
+ );
2914
+ group.children = [...nodes, ...childNodes];
2915
+ return [group];
2916
+ }
2917
+ createNode(type, props = {}, id) {
2918
+ const node = r3fNodePool.acquire();
2919
+ node.type = type;
2920
+ node.id = id;
2921
+ node.props = props;
2922
+ node.children = [];
2923
+ node.traits = /* @__PURE__ */ new Map();
2924
+ node.directives = [];
2925
+ return node;
2926
+ }
2927
+ /**
2928
+ * I.007 closure: emit a node's compiled petal material spec into its props.
2929
+ * Shared by every trait-bearing compile path (compileNode directives + the
2930
+ * .holo compileObjectDecl obj.traits path) so the emission can't silently miss
2931
+ * the real parser route. The spec is the locked CompiledMaterialSpec shape that
2932
+ * the renderer's buildCompiledMaterial consumes — building the petal material
2933
+ * from `.holo` data instead of hand-authoring it.
2934
+ */
2935
+ emitCompiledLotusMaterial(props, config) {
2936
+ const profile = chunk6Q7RC2MK_cjs.createBotanicalLotusRenderProfile(config);
2937
+ props.__compiledMaterial = chunk6Q7RC2MK_cjs.buildLotusPetalMaterialSpec(profile);
2938
+ props.__uniformBindings = chunk6Q7RC2MK_cjs.LOTUS_PETAL_UNIFORM_BINDINGS;
2939
+ }
2940
+ compileNode(node) {
2941
+ if (node.type === "system") {
2942
+ return this.compileSystemNode(node);
2943
+ }
2944
+ if (node.type === "component") {
2945
+ return this.compileComponentNode(node);
2946
+ }
2947
+ const rawProps = node.properties || {};
2948
+ const type = this.mapType(node.type, rawProps);
2949
+ const r3fNode = r3fNodePool.acquire();
2950
+ r3fNode.type = type;
2951
+ const rawId = node.id || node.name;
2952
+ r3fNode.id = rawId ? chunkKKP7JKN4_cjs.escapeStringValue(rawId, "JSX") : void 0;
2953
+ r3fNode.props = this.compileProperties(node, rawProps);
2954
+ r3fNode.children = [];
2955
+ r3fNode.traits = /* @__PURE__ */ new Map();
2956
+ r3fNode.directives = node.directives || [];
2957
+ if (node.directives) {
2958
+ for (const directive of node.directives) {
2959
+ if (directive.type === "trait") {
2960
+ r3fNode.traits?.set(
2961
+ directive.name,
2962
+ directive.config
2963
+ );
2964
+ }
2965
+ }
2966
+ }
2967
+ const lotusConfig = r3fNode.traits?.get("botanical_lotus");
2968
+ if (lotusConfig) {
2969
+ this.emitCompiledLotusMaterial(r3fNode.props, lotusConfig);
2970
+ }
2971
+ const enhanced = node;
2972
+ if (enhanced.graphics) {
2973
+ this.applyGraphicsConfig(r3fNode, enhanced.graphics);
2974
+ }
2975
+ if (enhanced.children && Array.isArray(enhanced.children)) {
2976
+ r3fNode.children = enhanced.children.map(
2977
+ (child) => this.compileNode(child)
2978
+ );
2979
+ }
2980
+ return r3fNode;
2981
+ }
2982
+ // ─── HoloComposition Compilation (.holo files) ────────────────────────
2983
+ compileComposition(composition, agentToken, outputPath) {
2984
+ this.validateCompilerAccess(agentToken, outputPath);
2985
+ if (this._platformTarget) {
2986
+ const platformMixin = new chunkAIA52I7T_cjs.PlatformConditionalCompilerMixin();
2987
+ composition = platformMixin.filterForPlatform(composition, this._platformTarget);
2988
+ }
2989
+ const root = r3fNodePool.acquire();
2990
+ root.type = "group";
2991
+ root.id = composition.name ? chunkKKP7JKN4_cjs.escapeStringValue(composition.name, "JSX") : void 0;
2992
+ root.props = {};
2993
+ root.children = [];
2994
+ root.traits = /* @__PURE__ */ new Map();
2995
+ root.directives = [];
2996
+ const templateMap = /* @__PURE__ */ new Map();
2997
+ if (Array.isArray(composition.templates)) {
2998
+ for (const tmpl of composition.templates) {
2999
+ templateMap.set(tmpl.name, tmpl);
3000
+ }
3001
+ }
3002
+ if (composition.children && Array.isArray(composition.children)) {
3003
+ for (const child of composition.children) {
3004
+ if (child.type === "template" && child.name) {
3005
+ templateMap.set(child.name, child);
3006
+ }
3007
+ }
3008
+ for (const child of composition.children) {
3009
+ root.children.push(this.compileChildNode(child, templateMap));
3010
+ }
3011
+ }
3012
+ if (composition.environment) {
3013
+ root.children.push(
3014
+ ...this.compileEnvironmentBlock(composition.environment)
3015
+ );
3016
+ }
3017
+ if (Array.isArray(composition.lights)) {
3018
+ for (const light of composition.lights) {
3019
+ root.children.push(this.compileLightBlock(light));
3020
+ }
3021
+ }
3022
+ if (Array.isArray(composition.objects)) {
3023
+ for (const obj of composition.objects) {
3024
+ root.children.push(this.compileObjectDecl(obj, templateMap));
3025
+ }
3026
+ }
3027
+ if (Array.isArray(composition.spatialGroups)) {
3028
+ for (const group of composition.spatialGroups) {
3029
+ root.children.push(this.compileSpatialGroup(group, templateMap));
3030
+ }
3031
+ }
3032
+ if (Array.isArray(composition.timelines)) {
3033
+ for (const timeline of composition.timelines) {
3034
+ root.children.push(this.compileTimelineBlock(timeline));
3035
+ }
3036
+ }
3037
+ if (Array.isArray(composition.audio)) {
3038
+ for (const audio of composition.audio) {
3039
+ root.children.push(this.compileAudioBlock(audio));
3040
+ }
3041
+ }
3042
+ if (Array.isArray(composition.zones)) {
3043
+ for (const zone of composition.zones) {
3044
+ root.children.push(this.compileZoneBlock(zone));
3045
+ }
3046
+ }
3047
+ if (Array.isArray(composition.worlds)) {
3048
+ for (const world of composition.worlds) {
3049
+ root.children.push(
3050
+ ...this.compileWorldNode(
3051
+ world,
3052
+ templateMap
3053
+ )
3054
+ );
3055
+ }
3056
+ }
3057
+ if (composition.ui) {
3058
+ root.children.push(this.compileUIBlock(composition.ui));
3059
+ }
3060
+ if (Array.isArray(composition.transitions)) {
3061
+ for (const transition of composition.transitions) {
3062
+ root.children.push(this.compileTransitionBlock(transition));
3063
+ }
3064
+ }
3065
+ if (Array.isArray(composition.conditionals)) {
3066
+ for (const cond of composition.conditionals) {
3067
+ root.children.push(this.compileConditionalBlock(cond, templateMap));
3068
+ }
3069
+ }
3070
+ if (Array.isArray(composition.iterators)) {
3071
+ for (const iter of composition.iterators) {
3072
+ root.children.push(this.compileForEachBlock(iter, templateMap));
3073
+ }
3074
+ }
3075
+ if (composition.camera) {
3076
+ root.children.push(this.compileCameraBlock(composition.camera));
3077
+ }
3078
+ if (composition.effects) {
3079
+ root.children.unshift(
3080
+ this.compileEffectsBlock(composition.effects)
3081
+ );
3082
+ } else if (this.hasPostProcessing(root)) {
3083
+ root.children.unshift({
3084
+ type: "EffectComposer",
3085
+ props: {},
3086
+ children: this.extractPostProcessingNodes(root)
3087
+ });
3088
+ }
3089
+ this.injectHolomapPointCloud(root);
3090
+ this.injectDefaultLighting(root);
3091
+ return root;
3092
+ }
3093
+ /** R3F host apps can map this node to BufferGeometry + pointsMaterial from base64 buffers. */
3094
+ injectHolomapPointCloud(root) {
3095
+ const h = this._holomapPointCloud;
3096
+ if (!h || h.pointCount < 1 || !h.positionsB64 || !h.colorsB64) return;
3097
+ if (!root.children) root.children = [];
3098
+ root.children.push({
3099
+ type: "holomapPointCloud",
3100
+ props: {
3101
+ positionsB64: h.positionsB64,
3102
+ colorsB64: h.colorsB64,
3103
+ pointCount: h.pointCount
3104
+ }
3105
+ });
3106
+ }
3107
+ compileLightBlock(light) {
3108
+ const lightMapping = {
3109
+ directional: "directionalLight",
3110
+ point: "pointLight",
3111
+ spot: "spotLight",
3112
+ hemisphere: "hemisphereLight",
3113
+ ambient: "ambientLight",
3114
+ area: "rectAreaLight"
3115
+ };
3116
+ const type = lightMapping[light.lightType] || "directionalLight";
3117
+ const props = {};
3118
+ if (Array.isArray(light.properties)) {
3119
+ for (const prop of light.properties) {
3120
+ const key = prop.key;
3121
+ const value = prop.value;
3122
+ if (key === "cast_shadow" || key === "castShadow") {
3123
+ props.castShadow = value;
3124
+ } else if (key === "ground_color" || key === "groundColor") {
3125
+ props.groundColor = value;
3126
+ } else if (key === "shadow_map_size") {
3127
+ props["shadow-mapSize"] = Array.isArray(value) ? value : [value, value];
3128
+ } else {
3129
+ props[key] = value;
3130
+ }
3131
+ }
3132
+ }
3133
+ if ((light.lightType === "directional" || light.lightType === "spot") && props.castShadow === void 0) {
3134
+ props.castShadow = true;
3135
+ }
3136
+ const r3fNode = r3fNodePool.acquire();
3137
+ r3fNode.type = type;
3138
+ r3fNode.id = light.name ? chunkKKP7JKN4_cjs.escapeStringValue(light.name, "JSX") : void 0;
3139
+ r3fNode.props = props;
3140
+ r3fNode.children = [];
3141
+ r3fNode.traits = /* @__PURE__ */ new Map();
3142
+ r3fNode.directives = [];
3143
+ return r3fNode;
3144
+ }
3145
+ compileEffectsBlock(effects) {
3146
+ const children = [];
3147
+ if (Array.isArray(effects.effects)) {
3148
+ for (const effect of effects.effects) {
3149
+ const effectMapping = {
3150
+ bloom: "Bloom",
3151
+ ssao: "SSAO",
3152
+ vignette: "Vignette",
3153
+ dof: "DepthOfField",
3154
+ chromatic_aberration: "ChromaticAberration",
3155
+ tone_mapping: "ToneMapping",
3156
+ noise: "Noise"
3157
+ };
3158
+ const effectType = effect.effectType;
3159
+ const type = effectMapping[effectType] || effectType;
3160
+ children.push(
3161
+ this.createNode(type, { ...effect.properties || {} })
3162
+ );
3163
+ }
3164
+ }
3165
+ const composer = this.createNode("EffectComposer", {});
3166
+ composer.children = children;
3167
+ return composer;
3168
+ }
3169
+ compileCameraBlock(camera) {
3170
+ const props = {};
3171
+ if (Array.isArray(camera.properties)) {
3172
+ for (const prop of camera.properties) {
3173
+ if (prop.key === "field_of_view" || prop.key === "fov") {
3174
+ props.fov = prop.value;
3175
+ } else if (prop.key === "look_at" || prop.key === "lookAt") {
3176
+ props.lookAt = prop.value;
3177
+ } else {
3178
+ props[prop.key] = prop.value;
3179
+ }
3180
+ }
3181
+ }
3182
+ props.cameraType = camera.cameraType;
3183
+ return this.createNode("Camera", props, "__camera");
3184
+ }
3185
+ compileEnvironmentBlock(env) {
3186
+ const nodes = [];
3187
+ const envProps = {};
3188
+ if (env.properties) {
3189
+ for (const prop of env.properties) {
3190
+ envProps[prop.key] = prop.value;
3191
+ }
3192
+ }
3193
+ const presetName = envProps.skybox || envProps.preset;
3194
+ if (presetName) {
3195
+ const preset = exports.ENVIRONMENT_PRESETS[presetName];
3196
+ if (preset) {
3197
+ nodes.push(
3198
+ this.createNode("Environment", {
3199
+ background: true,
3200
+ preset: preset.envPreset || presetName
3201
+ })
3202
+ );
3203
+ const lighting = preset.lighting;
3204
+ if (lighting?.ambient) {
3205
+ nodes.push(
3206
+ this.createNode("ambientLight", {
3207
+ color: lighting.ambient.color,
3208
+ intensity: lighting.ambient.intensity
3209
+ })
3210
+ );
3211
+ }
3212
+ if (lighting?.directional) {
3213
+ const dl = lighting.directional;
3214
+ nodes.push(
3215
+ this.createNode("directionalLight", {
3216
+ color: dl.color,
3217
+ intensity: dl.intensity,
3218
+ position: dl.position,
3219
+ castShadow: dl.shadows !== false,
3220
+ "shadow-mapSize": [2048, 2048]
3221
+ })
3222
+ );
3223
+ }
3224
+ if (Array.isArray(lighting?.points)) {
3225
+ for (const pl of lighting.points) {
3226
+ nodes.push(
3227
+ this.createNode("pointLight", {
3228
+ color: pl.color,
3229
+ intensity: pl.intensity,
3230
+ position: pl.position,
3231
+ distance: pl.distance
3232
+ })
3233
+ );
3234
+ }
3235
+ }
3236
+ const presetMap = preset;
3237
+ if (presetMap.fog) {
3238
+ const fogMap = presetMap.fog;
3239
+ nodes.push(
3240
+ this.createNode("fog", {
3241
+ attach: "fog",
3242
+ color: fogMap.color,
3243
+ near: fogMap.near,
3244
+ far: fogMap.far
3245
+ })
3246
+ );
3247
+ }
3248
+ if (presetMap.ground) {
3249
+ const groundMap = presetMap.ground;
3250
+ nodes.push(
3251
+ this.createNode(
3252
+ "mesh",
3253
+ {
3254
+ hsType: "plane",
3255
+ rotation: [-Math.PI / 2, 0, 0],
3256
+ position: [0, -0.01, 0],
3257
+ receiveShadow: true,
3258
+ args: [200, 200],
3259
+ color: groundMap.color,
3260
+ materialProps: { roughness: 0.8, metalness: 0 }
3261
+ },
3262
+ "__ground"
3263
+ )
3264
+ );
3265
+ }
3266
+ } else {
3267
+ nodes.push(this.createNode("Environment", { background: true, preset: presetName }));
3268
+ }
3269
+ }
3270
+ if (envProps.ambient_light !== void 0) {
3271
+ nodes.push(
3272
+ this.createNode("ambientLight", {
3273
+ intensity: typeof envProps.ambient_light === "number" ? envProps.ambient_light : 0.5
3274
+ })
3275
+ );
3276
+ }
3277
+ const explicitFog = envProps.fog;
3278
+ if (explicitFog && typeof explicitFog === "object") {
3279
+ nodes.push(
3280
+ this.createNode("fog", {
3281
+ attach: "fog",
3282
+ color: explicitFog.color || "#cccccc",
3283
+ near: explicitFog.near || 10,
3284
+ far: explicitFog.far || 100
3285
+ })
3286
+ );
3287
+ }
3288
+ return nodes;
3289
+ }
3290
+ compileObjectDecl(obj, templateMap) {
3291
+ const props = {};
3292
+ let geometryType = "cube";
3293
+ if (obj.template && templateMap) {
3294
+ const tmpl = templateMap.get(obj.template);
3295
+ if (tmpl) {
3296
+ const tmplTraits = tmpl.traits;
3297
+ if (tmplTraits && Array.isArray(tmplTraits)) {
3298
+ const existingTraitNames = new Set(
3299
+ (obj.traits || []).map(
3300
+ (t) => t.name
3301
+ )
3302
+ );
3303
+ obj.traits = [
3304
+ ...tmplTraits.filter(
3305
+ (t) => !existingTraitNames.has(t.name)
3306
+ ),
3307
+ ...obj.traits || []
3308
+ ];
3309
+ }
3310
+ const tmplProps = tmpl.properties;
3311
+ if (tmplProps && Array.isArray(tmplProps)) {
3312
+ const existingKeys = new Set(
3313
+ (obj.properties || []).map(
3314
+ (p) => p.key
3315
+ )
3316
+ );
3317
+ const mergedProps = tmplProps.filter((p) => !existingKeys.has(p.key)).map((p) => ({
3318
+ type: "ObjectProperty",
3319
+ key: p.key,
3320
+ value: p.value
3321
+ }));
3322
+ obj.properties = [...mergedProps, ...obj.properties || []];
3323
+ }
3324
+ }
3325
+ }
3326
+ if (obj.properties && Array.isArray(obj.properties)) {
3327
+ const expandedProperties = [];
3328
+ for (const p of obj.properties) {
3329
+ const prop = p;
3330
+ if (prop && prop.type === "spread") {
3331
+ const resolved = this.resolveSpreadArgument(
3332
+ prop.target || prop.argument,
3333
+ {
3334
+ templates: templateMap
3335
+ }
3336
+ );
3337
+ if (resolved && typeof resolved === "object" && !Array.isArray(resolved)) {
3338
+ for (const [key, value] of Object.entries(resolved)) {
3339
+ expandedProperties.push({ key, value });
3340
+ }
3341
+ } else if (Array.isArray(resolved)) {
3342
+ expandedProperties.push(...resolved);
3343
+ }
3344
+ } else {
3345
+ expandedProperties.push(prop);
3346
+ }
3347
+ }
3348
+ obj.properties = expandedProperties;
3349
+ }
3350
+ if (obj.properties) {
3351
+ for (const p of obj.properties) {
3352
+ const key = p.key;
3353
+ const value = p.value;
3354
+ if (key === "geometry" || key === "mesh") {
3355
+ geometryType = value;
3356
+ } else if (key === "type") {
3357
+ const valStr = value;
3358
+ if (["text", "sparkles", "portal", "audio"].includes(valStr)) {
3359
+ geometryType = valStr;
3360
+ } else if (["directional", "point", "spot", "hemisphere", "ambient", "area"].includes(valStr)) {
3361
+ geometryType = "light";
3362
+ props.lightType = valStr;
3363
+ } else {
3364
+ props[key] = value;
3365
+ }
3366
+ } else if (key === "light_type") {
3367
+ props.lightType = value;
3368
+ } else if (key === "position" && Array.isArray(value)) {
3369
+ props.position = value;
3370
+ } else if (key === "rotation" && Array.isArray(value)) {
3371
+ props.rotation = value;
3372
+ } else if (key === "scale") {
3373
+ props.scale = Array.isArray(value) ? value : [value, value, value];
3374
+ } else if (key === "color") {
3375
+ props.color = value;
3376
+ } else if (key === "src" || key === "model" || key === "source") {
3377
+ props.src = value;
3378
+ geometryType = "model";
3379
+ } else if (key === "text") {
3380
+ props.children = this.resolveValue(value);
3381
+ props.text = this.resolveValue(value);
3382
+ } else if (key === "font_size") {
3383
+ props.fontSize = value;
3384
+ } else if (key === "material") {
3385
+ const currentMaterialProps = props.materialProps || {};
3386
+ if (typeof value === "string" && exports.MATERIAL_PRESETS[value]) {
3387
+ props.materialProps = { ...exports.MATERIAL_PRESETS[value], ...currentMaterialProps };
3388
+ } else if (typeof value === "object" && value !== null) {
3389
+ const valObj = value;
3390
+ if (valObj.preset && typeof valObj.preset === "string" && exports.MATERIAL_PRESETS[valObj.preset]) {
3391
+ const { preset: _, ...rest } = valObj;
3392
+ props.materialProps = {
3393
+ ...exports.MATERIAL_PRESETS[valObj.preset],
3394
+ ...rest,
3395
+ ...currentMaterialProps
3396
+ };
3397
+ } else {
3398
+ props.materialProps = { ...currentMaterialProps, ...valObj };
3399
+ }
3400
+ }
3401
+ } else if (key === "roughness" || key === "metalness" || key === "metallic") {
3402
+ const mProps = props.materialProps || {};
3403
+ mProps[key === "metallic" ? "metalness" : key] = value;
3404
+ props.materialProps = mProps;
3405
+ } else if (key === "opacity") {
3406
+ const mProps = props.materialProps || {};
3407
+ mProps.opacity = value;
3408
+ mProps.transparent = value < 1;
3409
+ props.materialProps = mProps;
3410
+ } else if (key === "emissive") {
3411
+ props.materialProps = {
3412
+ ...props.materialProps || {},
3413
+ emissive: value
3414
+ };
3415
+ } else if (key === "emissiveIntensity" || key === "emissive_intensity") {
3416
+ props.materialProps = {
3417
+ ...props.materialProps || {},
3418
+ emissiveIntensity: value
3419
+ };
3420
+ } else if (key === "size") {
3421
+ if (Array.isArray(value)) {
3422
+ props.args = value;
3423
+ }
3424
+ props.size = value;
3425
+ } else if (key === "radius") {
3426
+ props.size = value * 2;
3427
+ } else if (key === "intensity") {
3428
+ props.intensity = value;
3429
+ } else if (key === "cast_shadow" || key === "castShadow") {
3430
+ props.castShadow = value;
3431
+ } else if (key === "receiveShadow" || key === "receive_shadow") {
3432
+ props.receiveShadow = value;
3433
+ } else if (key === "visible") {
3434
+ props[key] = value;
3435
+ } else if (key === "maturity") {
3436
+ props.maturityOverride = value;
3437
+ } else if (key === "promoteUrl" || key === "promote_url") {
3438
+ props.promoteUrl = value;
3439
+ } else if (key === "collisionShape" || key === "collision_shape") {
3440
+ props.collisionShape = value;
3441
+ } else {
3442
+ props[key] = this.resolveValue(value);
3443
+ }
3444
+ }
3445
+ }
3446
+ if (obj.traits && Array.isArray(obj.traits)) {
3447
+ const semiring = new chunk5S7RKFGR_cjs.ProvenanceSemiring();
3448
+ const physicsApplications = obj.traits.filter((t) => t.name === "physics" || t.name === "collidable").map((t) => {
3449
+ let baseConfig = t.config || {};
3450
+ if (t.name === "collidable" && !baseConfig.type)
3451
+ baseConfig = { ...baseConfig, type: "fixed" };
3452
+ if (t.name === "physics" && !baseConfig.type)
3453
+ baseConfig = { ...baseConfig, type: "dynamic" };
3454
+ return {
3455
+ name: t.name,
3456
+ config: baseConfig,
3457
+ context: obj.provenance?.context
3458
+ };
3459
+ });
3460
+ if (physicsApplications.length > 0) {
3461
+ const { config: mergedPhysics } = semiring.add(physicsApplications);
3462
+ props.rigidBody = { ...mergedPhysics };
3463
+ props.collider = { type: "auto" };
3464
+ if (props.rigidBody?.type === "fixed") {
3465
+ props.castShadow = true;
3466
+ props.receiveShadow = true;
3467
+ }
3468
+ }
3469
+ for (const trait of obj.traits) {
3470
+ const name = trait.name;
3471
+ if (name === "physics" || name === "collidable") {
3472
+ continue;
3473
+ } else if (name === "grabbable") {
3474
+ props.castShadow = true;
3475
+ props.grabbable = trait.config || true;
3476
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3477
+ if (!props.collider) props.collider = { type: "auto" };
3478
+ } else if (name === "hoverable") {
3479
+ props.hoverable = trait.config || true;
3480
+ } else if (name === "animated") {
3481
+ props.animated = trait.config || true;
3482
+ } else if (name === "positional" || name === "spatial_audio") {
3483
+ props.spatial = true;
3484
+ } else if (name === "gem_resonance") {
3485
+ props.gemResonance = gemResonanceConfig(trait.config);
3486
+ props.spatial = true;
3487
+ } else if (name === "shadow") {
3488
+ props.castShadow = true;
3489
+ if (trait.config?.mapSize)
3490
+ props["shadow-mapSize"] = [trait.config.mapSize, trait.config.mapSize];
3491
+ } else if (name === "material") {
3492
+ const presetName = trait.config?.preset;
3493
+ if (presetName && typeof presetName === "string" && exports.MATERIAL_PRESETS[presetName]) {
3494
+ const { preset: _, ...rest } = trait.config;
3495
+ props.materialProps = {
3496
+ ...exports.MATERIAL_PRESETS[presetName],
3497
+ ...rest,
3498
+ ...props.materialProps
3499
+ };
3500
+ } else {
3501
+ props.materialProps = {
3502
+ ...props.materialProps,
3503
+ ...trait.config
3504
+ };
3505
+ }
3506
+ } else if (name === "networked") {
3507
+ props.networked = trait.config || true;
3508
+ } else if (name === "moldable") {
3509
+ props.moldable = trait.config || true;
3510
+ } else if (name === "stretchable") {
3511
+ props.stretchable = trait.config || true;
3512
+ } else if (name === "bloom") {
3513
+ props.bloom = trait.config || { intensity: 1 };
3514
+ } else if (name === "portal") {
3515
+ props.portal = trait.config || true;
3516
+ } else if (name === "attach") {
3517
+ props.attach = trait.config || true;
3518
+ } else if (name === "orbit") {
3519
+ props.orbit = trait.config || true;
3520
+ } else if (name === "look_at") {
3521
+ props.lookAtTarget = trait.config || true;
3522
+ } else if (name === "follow") {
3523
+ props.follow = trait.config || true;
3524
+ } else if (name === "plane_detection") {
3525
+ props.planeDetection = trait.config || { mode: "all" };
3526
+ } else if (name === "mesh_detection") {
3527
+ props.meshDetection = trait.config || { classification: true };
3528
+ } else if (name === "anchor") {
3529
+ props.anchor = trait.config || { type: "spatial" };
3530
+ } else if (name === "persistent_anchor") {
3531
+ props.persistentAnchor = trait.config || { storage: "local" };
3532
+ } else if (name === "shared_anchor") {
3533
+ props.sharedAnchor = trait.config || { authority: "creator" };
3534
+ } else if (name === "occlusion") {
3535
+ props.occlusionMode = trait.config?.mode || "environment";
3536
+ props.occlusion = trait.config || true;
3537
+ } else if (name === "light_estimation") {
3538
+ props.lightEstimation = trait.config || { auto_apply: true };
3539
+ } else if (name === "geospatial") {
3540
+ props.geospatial = trait.config || true;
3541
+ } else if (name === "gaussian_splat") {
3542
+ props.gaussianSplat = trait.config || true;
3543
+ } else if (name === "nerf") {
3544
+ props.nerf = trait.config || true;
3545
+ } else if (name === "volumetric_video") {
3546
+ props.volumetricVideo = trait.config || true;
3547
+ } else if (name === "point_cloud") {
3548
+ props.pointCloud = trait.config || true;
3549
+ } else if (name === "photogrammetry") {
3550
+ props.photogrammetry = trait.config || true;
3551
+ } else if (name === "web_surface") {
3552
+ props.webSurface = trait.config || true;
3553
+ } else if (name === "cloth") {
3554
+ props.cloth = trait.config || { stiffness: 0.8 };
3555
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3556
+ } else if (name === "fluid") {
3557
+ props.fluid = trait.config || { viscosity: 0.01 };
3558
+ props.__gapsComponents = props.__gapsComponents || [];
3559
+ props.__gapsComponents.push("FluidRenderer");
3560
+ } else if (name === "soft_body") {
3561
+ props.softBody = trait.config || { elasticity: 0.5 };
3562
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3563
+ } else if (name === "rope") {
3564
+ props.rope = trait.config || { segments: 20 };
3565
+ } else if (name === "chain") {
3566
+ props.chain = trait.config || { link_count: 20 };
3567
+ } else if (name === "wind") {
3568
+ props.wind = trait.config || { strength: 5 };
3569
+ } else if (name === "buoyancy") {
3570
+ props.buoyancy = trait.config || { water_level: 0 };
3571
+ } else if (name === "destruction") {
3572
+ props.destruction = trait.config || { health: 100 };
3573
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3574
+ if (!props.collider) props.collider = { type: "auto" };
3575
+ } else if (name === "soft_body_pro") {
3576
+ props.softBodyPro = trait.config || { tear_threshold: 0.5 };
3577
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
3578
+ } else if (name === "crowd_sim") {
3579
+ props.crowdSim = trait.config || { max_agents: 1e3 };
3580
+ } else if (name === "deformable_terrain") {
3581
+ props.deformableTerrain = trait.config || { resolution: 256 };
3582
+ } else if (name === "volumetric_clouds") {
3583
+ props.volumetricClouds = trait.config || { coverage: 0.5 };
3584
+ props.__gapsComponents = props.__gapsComponents || [];
3585
+ props.__gapsComponents.push("CloudRenderer");
3586
+ } else if (name === "god_rays") {
3587
+ props.godRays = trait.config || { intensity: 1 };
3588
+ props.__gapsComponents = props.__gapsComponents || [];
3589
+ props.__gapsComponents.push("GodRaysEffect");
3590
+ } else if (name === "spatial_voice") {
3591
+ props.spatialVoice = trait.config || { max_distance: 30 };
3592
+ props.spatial = true;
3593
+ } else if (name === "ai_companion") {
3594
+ props.aiCompanion = trait.config || { personality: "friendly" };
3595
+ } else if (name === "moderation") {
3596
+ props.moderation = trait.config || { sensitivity: "medium" };
3597
+ } else if (name === "anti_grief") {
3598
+ props.antiGrief = trait.config || { detection_window: 30 };
3599
+ } else if (name === "world_state") {
3600
+ props.worldState = trait.config || { sync_rate: 10 };
3601
+ } else if (name === "token_gated") {
3602
+ props.tokenGated = trait.config || { token_contract: "", min_balance: 1 };
3603
+ } else if (name === "ambisonics") {
3604
+ props.ambisonics = trait.config || { order: 1 };
3605
+ props.spatial = true;
3606
+ } else if (name === "hrtf") {
3607
+ props.hrtf = trait.config || true;
3608
+ props.spatial = true;
3609
+ } else if (name === "reverb_zone") {
3610
+ props.reverbZone = trait.config || { preset: "room" };
3611
+ } else if (name === "audio_occlusion") {
3612
+ props.audioOcclusion = trait.config || true;
3613
+ } else if (name === "audio_portal") {
3614
+ props.audioPortal = trait.config || true;
3615
+ } else if (name === "head_tracked_audio") {
3616
+ props.headTrackedAudio = trait.config || true;
3617
+ props.spatial = true;
3618
+ } else if (name === "accessible") {
3619
+ props.accessible = trait.config || { role: "generic" };
3620
+ } else if (name === "alt_text") {
3621
+ props.altText = trait.config?.text || "";
3622
+ } else if (name === "magnifiable") {
3623
+ props.magnifiable = trait.config || { max_scale: 3 };
3624
+ } else if (name === "high_contrast") {
3625
+ props.highContrast = trait.config || { mode: "outline" };
3626
+ } else if (name === "motion_reduced") {
3627
+ props.motionReduced = trait.config || true;
3628
+ if (props.animated) props.animated = false;
3629
+ } else if (name === "compute") {
3630
+ props.compute = trait.config || true;
3631
+ } else if (name === "gpu_particle") {
3632
+ props.gpuParticle = trait.config || { count: 1e4 };
3633
+ } else if (isVfxParticleTraitName(name)) {
3634
+ const particleConfig = {
3635
+ effect: vfxParticleEffect(name),
3636
+ ...trait.config || {}
3637
+ };
3638
+ const gpuParticles = props.gpuParticles ?? [];
3639
+ props.gpuParticles = [...gpuParticles, particleConfig];
3640
+ if (!props.gpuParticle) props.gpuParticle = particleConfig;
3641
+ } else if (name === "gpu_physics") {
3642
+ props.gpuPhysics = trait.config || true;
3643
+ } else if (name === "digital_twin") {
3644
+ props.digitalTwin = trait.config || true;
3645
+ } else if (name === "sensor") {
3646
+ props.sensor = trait.config || true;
3647
+ } else if (name === "data_binding") {
3648
+ props.dataBinding = trait.config || true;
3649
+ } else if (name === "behavior_tree") {
3650
+ props.behaviorTree = trait.config || true;
3651
+ } else if (name === "llm_agent") {
3652
+ props.llmAgent = trait.config || true;
3653
+ } else if (name === "neural_link") {
3654
+ props.neuralLink = trait.config || { model: "brittney-v4.gguf", temperature: 0.7 };
3655
+ } else if (name === "perception") {
3656
+ props.perception = trait.config || { sight_range: 20 };
3657
+ } else if (name === "patrol") {
3658
+ props.patrol = trait.config || true;
3659
+ } else if (name === "co_located") {
3660
+ props.coLocated = trait.config || true;
3661
+ } else if (name === "shared_world") {
3662
+ props.sharedWorld = trait.config || true;
3663
+ } else if (name === "voice_proximity") {
3664
+ props.voiceProximity = trait.config || { max_distance: 20 };
3665
+ props.spatial = true;
3666
+ } else if (name === "spatial_persona") {
3667
+ props.spatialPersona = trait.config || { style: "realistic" };
3668
+ } else if (name === "shareplay") {
3669
+ props.sharePlay = trait.config || { activity_type: "custom" };
3670
+ } else if (name === "object_tracking") {
3671
+ props.objectTracking = trait.config || true;
3672
+ } else if (name === "scene_reconstruction") {
3673
+ props.sceneReconstruction = trait.config || { mode: "mesh" };
3674
+ } else if (name === "eye_tracked") {
3675
+ props.eyeTracked = true;
3676
+ } else if (name === "eye_hand_fusion") {
3677
+ props.eyeHandFusion = true;
3678
+ } else if (name === "controlnet") {
3679
+ props.controlNet = trait.config || { model: "canny" };
3680
+ } else if (name === "ai_texture_gen") {
3681
+ props.aiTextureGen = trait.config || { style: "photorealistic" };
3682
+ } else if (name === "diffusion_realtime") {
3683
+ props.diffusionRealtime = trait.config || { backend: "cuda" };
3684
+ } else if (name === "ai_upscaling") {
3685
+ props.aiUpscaling = trait.config || { factor: 2 };
3686
+ } else if (name === "ai_inpainting") {
3687
+ props.aiInpainting = trait.config || true;
3688
+ } else if (name === "neural_forge") {
3689
+ props.neuralForge = trait.config || true;
3690
+ } else if (name === "embedding_search") {
3691
+ props.embeddingSearch = trait.config || { dimensions: 1536 };
3692
+ } else if (name === "ai_npc_brain") {
3693
+ props.aiNpcBrain = trait.config || { model: "llm" };
3694
+ } else if (name === "vector_db") {
3695
+ props.vectorDb = trait.config || true;
3696
+ } else if (name === "vision" || name === "ai_vision") {
3697
+ props.vision = trait.config || { task: "detection" };
3698
+ } else if (name === "spatial_awareness") {
3699
+ props.spatialAwareness = trait.config || true;
3700
+ } else if (name === "neural_animation") {
3701
+ props.neuralAnimation = trait.config || { style: "motion_matching" };
3702
+ } else if (name === "draft") {
3703
+ props.draftMode = true;
3704
+ props.draftShape = trait.config?.shape || "box";
3705
+ props.draftColor = trait.config?.color || "#88aaff";
3706
+ props.draftOpacity = trait.config?.opacity ?? 1;
3707
+ props.draftWireframe = trait.config?.wireframe || false;
3708
+ if (trait.config?.collision !== false) {
3709
+ if (!props.rigidBody) props.rigidBody = { type: "fixed" };
3710
+ if (!props.collider) props.collider = { type: "auto" };
3711
+ }
3712
+ } else if (name === "botanical_lotus") {
3713
+ this.emitCompiledLotusMaterial(props, trait.config || {});
3714
+ } else {
3715
+ props[name] = trait.config || true;
3716
+ if (!props.__unrecognizedTraits) {
3717
+ props.__unrecognizedTraits = [];
3718
+ }
3719
+ props.__unrecognizedTraits.push(name);
3720
+ }
3721
+ }
3722
+ }
3723
+ if (obj.traits && Array.isArray(obj.traits)) {
3724
+ const traitNames = obj.traits.map(
3725
+ (t) => t.name
3726
+ );
3727
+ const compositor = new chunkOIQYIIO3_cjs.TraitCompositor();
3728
+ const composedMaterial = compositor.compose(traitNames);
3729
+ if (Object.keys(composedMaterial).length > 0) {
3730
+ props.materialProps = {
3731
+ ...props.materialProps,
3732
+ ...composedMaterial
3733
+ };
3734
+ }
3735
+ }
3736
+ let type;
3737
+ if (geometryType === "model" && props.src) {
3738
+ type = "gltfModel";
3739
+ } else if (geometryType === "light") {
3740
+ const lightType = props.lightType || props.type || "directional";
3741
+ const lightMapping = {
3742
+ directional: "directionalLight",
3743
+ point: "pointLight",
3744
+ spot: "spotLight",
3745
+ hemisphere: "hemisphereLight",
3746
+ ambient: "ambientLight",
3747
+ area: "rectAreaLight"
3748
+ };
3749
+ type = lightMapping[lightType] || "directionalLight";
3750
+ delete props.lightType;
3751
+ } else if (geometryType === "text") {
3752
+ type = "Text";
3753
+ } else if (geometryType === "sparkles") {
3754
+ type = "Sparkles";
3755
+ } else if (geometryType === "portal") {
3756
+ type = "Portal";
3757
+ } else {
3758
+ type = "mesh";
3759
+ props.hsType = geometryType;
3760
+ if (!props.args) {
3761
+ const size = typeof props.size === "number" ? props.size : 1;
3762
+ props.args = this.getGeometryArgs(geometryType, { size });
3763
+ }
3764
+ }
3765
+ const r3fNode = this.createNode(type, props, obj.name);
3766
+ if (props.draftMode) {
3767
+ r3fNode.assetMaturity = "draft";
3768
+ } else if (props.maturityOverride) {
3769
+ const m = props.maturityOverride;
3770
+ if (m === "draft" || m === "mesh" || m === "final") {
3771
+ r3fNode.assetMaturity = m;
3772
+ }
3773
+ }
3774
+ delete props.maturityOverride;
3775
+ if (obj.children && Array.isArray(obj.children)) {
3776
+ for (const child of obj.children) {
3777
+ r3fNode.children.push(this.compileObjectDecl(child));
3778
+ }
3779
+ }
3780
+ if (props.__gapsComponents && Array.isArray(props.__gapsComponents)) {
3781
+ for (const componentType of props.__gapsComponents) {
3782
+ const componentProps = {};
3783
+ if (componentType === "CloudRenderer" && props.volumetricClouds) {
3784
+ const vc = props.volumetricClouds;
3785
+ componentProps.coverage = vc.coverage ?? 0.5;
3786
+ componentProps.altitude = vc.altitude ?? 500;
3787
+ componentProps.windOffset = vc.wind ?? [0, 0, 0];
3788
+ componentProps.layers = vc.layers ?? 3;
3789
+ } else if (componentType === "GodRaysEffect" && props.godRays) {
3790
+ const gr = props.godRays;
3791
+ componentProps.intensity = gr.intensity ?? 1;
3792
+ componentProps.decay = gr.decay ?? 0.96;
3793
+ componentProps.lightColor = gr.color ?? "#fffde7";
3794
+ } else if (componentType === "FluidRenderer" && props.fluid) {
3795
+ const fl = props.fluid;
3796
+ componentProps.color = fl.color ?? "#1a6fc4";
3797
+ componentProps.particleSize = fl.particle_radius ?? 0.02;
3798
+ componentProps.renderMode = fl.render_mode ?? "points";
3799
+ }
3800
+ r3fNode.children.push(
3801
+ this.createNode(componentType, componentProps, `${obj.name}-${componentType}`)
3802
+ );
3803
+ }
3804
+ delete props.__gapsComponents;
3805
+ }
3806
+ return r3fNode;
3807
+ }
3808
+ /**
3809
+ * Compile a SystemNode into an R3FNode.
3810
+ *
3811
+ * Systems are logical containers with state, actions, lifecycle hooks,
3812
+ * and optionally child objects/UI. In the R3F tree, a system compiles
3813
+ * to a group node annotated with its rich metadata (state, actions,
3814
+ * hooks) so the runtime/renderer can wire up behavior.
3815
+ */
3816
+ compileSystemNode(node, templateMap) {
3817
+ const props = {};
3818
+ if (node.state) {
3819
+ props.systemState = node.state;
3820
+ }
3821
+ if (node.actions) {
3822
+ props.systemActions = node.actions;
3823
+ }
3824
+ if (node.hooks) {
3825
+ props.systemHooks = node.hooks;
3826
+ }
3827
+ if (node.properties && typeof node.properties === "object") {
3828
+ for (const [key, value] of Object.entries(node.properties)) {
3829
+ props[key] = value;
3830
+ }
3831
+ }
3832
+ const r3fNode = this.createNode("System", props, node.id || node.name);
3833
+ if (node.directives) {
3834
+ r3fNode.directives = node.directives;
3835
+ }
3836
+ if (node.directives) {
3837
+ for (const d of node.directives) {
3838
+ if (d.type === "trait") {
3839
+ r3fNode.traits?.set(d.name, d.config || {});
3840
+ }
3841
+ }
3842
+ }
3843
+ if (node.children && Array.isArray(node.children)) {
3844
+ for (const child of node.children) {
3845
+ r3fNode.children.push(this.compileChildNode(child, templateMap));
3846
+ }
3847
+ }
3848
+ if (node.ui && Array.isArray(node.ui)) {
3849
+ for (const uiNode of node.ui) {
3850
+ r3fNode.children.push(this.compileNode(uiNode));
3851
+ }
3852
+ }
3853
+ return r3fNode;
3854
+ }
3855
+ /**
3856
+ * Compile a ComponentNode into an R3FNode.
3857
+ *
3858
+ * Components are UI-focused containers with props, state, actions,
3859
+ * and render/UI blocks. They compile to a group node annotated with
3860
+ * component metadata for the runtime.
3861
+ */
3862
+ compileComponentNode(node, templateMap) {
3863
+ const props = {};
3864
+ if (node.props) {
3865
+ props.componentProps = node.props;
3866
+ }
3867
+ if (node.state) {
3868
+ props.componentState = node.state;
3869
+ }
3870
+ if (node.actions) {
3871
+ props.componentActions = node.actions;
3872
+ }
3873
+ if (node.hooks) {
3874
+ props.componentHooks = node.hooks;
3875
+ }
3876
+ if (node.properties && typeof node.properties === "object") {
3877
+ for (const [key, value] of Object.entries(node.properties)) {
3878
+ props[key] = value;
3879
+ }
3880
+ }
3881
+ const r3fNode = this.createNode(
3882
+ "Component",
3883
+ props,
3884
+ node.id || node.name
3885
+ );
3886
+ if (node.directives) {
3887
+ r3fNode.directives = node.directives;
3888
+ }
3889
+ if (node.directives) {
3890
+ for (const d of node.directives) {
3891
+ if (d.type === "trait") {
3892
+ r3fNode.traits?.set(d.name, d.config || {});
3893
+ }
3894
+ }
3895
+ }
3896
+ if (node.children && Array.isArray(node.children)) {
3897
+ for (const child of node.children) {
3898
+ r3fNode.children.push(this.compileChildNode(child, templateMap));
3899
+ }
3900
+ }
3901
+ if (node.ui && Array.isArray(node.ui)) {
3902
+ for (const uiNode of node.ui) {
3903
+ r3fNode.children.push(this.compileNode(uiNode));
3904
+ }
3905
+ }
3906
+ return r3fNode;
3907
+ }
3908
+ /**
3909
+ * Dispatch a child node to the appropriate compile method based on its type.
3910
+ * Used by compileSystemNode, compileComponentNode, and compileComposition
3911
+ * when processing the parser's children array.
3912
+ */
3913
+ compileChildNode(child, templateMap) {
3914
+ switch (child.type) {
3915
+ case "system":
3916
+ return this.compileSystemNode(child, templateMap);
3917
+ case "component":
3918
+ return this.compileComponentNode(child, templateMap);
3919
+ case "object":
3920
+ return this.compileObjectDecl(child, templateMap);
3921
+ case "template":
3922
+ if (templateMap && typeof child.name === "string") {
3923
+ templateMap.set(child.name, child);
3924
+ }
3925
+ return this.compileTemplateNode(child, templateMap);
3926
+ case "spatial_group":
3927
+ return this.compileSpatialGroup(child, templateMap);
3928
+ default:
3929
+ return this.compileNode(child);
3930
+ }
3931
+ }
3932
+ /**
3933
+ * Compile a template node. Templates define reusable types.
3934
+ * In the R3F tree, they compile to an empty group (they're not
3935
+ * rendered directly — objects "using" them inherit their properties).
3936
+ */
3937
+ compileTemplateNode(node, _templateMap) {
3938
+ const props = {};
3939
+ if (node.state || node.properties?.state) {
3940
+ props.templateState = node.state || node.properties?.state;
3941
+ }
3942
+ if (node.properties) {
3943
+ for (const [key, value] of Object.entries(node.properties)) {
3944
+ if (key !== "state") {
3945
+ props[key] = value;
3946
+ }
3947
+ }
3948
+ }
3949
+ return this.createNode("Template", props, node.name);
3950
+ }
3951
+ compileSpatialGroup(group, templateMap) {
3952
+ const props = {};
3953
+ if (group.properties) {
3954
+ for (const prop of group.properties) {
3955
+ if (prop.key === "position") props.position = prop.value;
3956
+ else if (prop.key === "rotation") props.rotation = prop.value;
3957
+ else if (prop.key === "scale")
3958
+ props.scale = Array.isArray(prop.value) ? prop.value : [prop.value, prop.value, prop.value];
3959
+ }
3960
+ }
3961
+ const node = this.createNode("group", props, group.name);
3962
+ if (group.objects) {
3963
+ for (const obj of group.objects)
3964
+ node.children.push(this.compileObjectDecl(obj, templateMap));
3965
+ }
3966
+ if (group.groups) {
3967
+ for (const sub of group.groups)
3968
+ node.children.push(this.compileSpatialGroup(sub, templateMap));
3969
+ }
3970
+ return node;
3971
+ }
3972
+ compileTimelineBlock(timeline) {
3973
+ const entries = [];
3974
+ if (timeline.entries) {
3975
+ for (const entry of timeline.entries) {
3976
+ const action = entry.action;
3977
+ const entryProps = { time: entry.time, actionKind: action.kind };
3978
+ if (action.kind === "animate") {
3979
+ entryProps.target = action.target;
3980
+ entryProps.properties = action.properties;
3981
+ } else if (action.kind === "emit") {
3982
+ entryProps.event = action.event;
3983
+ if (action.data !== void 0) entryProps.data = action.data;
3984
+ } else if (action.kind === "call") {
3985
+ entryProps.method = action.method;
3986
+ if (action.args) entryProps.args = action.args;
3987
+ }
3988
+ entries.push(this.createNode("TimelineEntry", entryProps));
3989
+ }
3990
+ }
3991
+ const safeName = timeline.name ? chunkKKP7JKN4_cjs.escapeStringValue(timeline.name, "JSX") : void 0;
3992
+ const timelineNode = this.createNode(
3993
+ "Timeline",
3994
+ { autoplay: timeline.autoplay, loop: timeline.loop },
3995
+ safeName
3996
+ );
3997
+ timelineNode.children = entries;
3998
+ return timelineNode;
3999
+ }
4000
+ compileAudioBlock(audio) {
4001
+ const props = {};
4002
+ if (audio.properties) {
4003
+ for (const prop of audio.properties) {
4004
+ if (prop.key === "src" || prop.key === "source") {
4005
+ props.src = prop.value;
4006
+ } else if (prop.key === "rolloff") {
4007
+ props.rolloffFactor = prop.value;
4008
+ } else {
4009
+ props[prop.key] = prop.value;
4010
+ }
4011
+ }
4012
+ }
4013
+ const safeName = audio.name ? chunkKKP7JKN4_cjs.escapeStringValue(audio.name, "JSX") : void 0;
4014
+ return this.createNode("Audio", props, safeName);
4015
+ }
4016
+ compileZoneBlock(zone) {
4017
+ const props = {};
4018
+ if (zone.properties) {
4019
+ for (const prop of zone.properties) {
4020
+ props[prop.key] = prop.value;
4021
+ }
4022
+ }
4023
+ if (zone.handlers && zone.handlers.length > 0) {
4024
+ props.handlers = zone.handlers.map(
4025
+ (h) => ({
4026
+ event: h.event,
4027
+ parameters: h.parameters,
4028
+ body: h.body
4029
+ })
4030
+ );
4031
+ }
4032
+ const safeName = zone.name ? chunkKKP7JKN4_cjs.escapeStringValue(zone.name, "JSX") : void 0;
4033
+ return this.createNode("Zone", props, safeName);
4034
+ }
4035
+ compileUIBlock(ui) {
4036
+ const children = [];
4037
+ if (ui.elements) {
4038
+ for (const el of ui.elements) {
4039
+ const elProps = {};
4040
+ if (el.properties) {
4041
+ for (const prop of el.properties) {
4042
+ if (prop.key === "font_size") {
4043
+ elProps.fontSize = prop.value;
4044
+ } else {
4045
+ elProps[prop.key] = this.resolveValue(prop.value);
4046
+ }
4047
+ }
4048
+ }
4049
+ const safeElName = el.name ? chunkKKP7JKN4_cjs.escapeStringValue(el.name, "JSX") : void 0;
4050
+ children.push(this.createNode("UIElement", elProps, safeElName));
4051
+ }
4052
+ }
4053
+ const uiNode = this.createNode("UI", {}, "__ui");
4054
+ uiNode.children = children;
4055
+ return uiNode;
4056
+ }
4057
+ compileTransitionBlock(transition) {
4058
+ const props = {};
4059
+ if (transition.properties) {
4060
+ for (const prop of transition.properties) {
4061
+ props[prop.key] = prop.value;
4062
+ }
4063
+ }
4064
+ const safeName = transition.name ? chunkKKP7JKN4_cjs.escapeStringValue(transition.name, "JSX") : void 0;
4065
+ return this.createNode("Transition", props, safeName);
4066
+ }
4067
+ compileConditionalBlock(cond, templateMap) {
4068
+ const children = [];
4069
+ if (cond.objects) {
4070
+ for (const obj of cond.objects)
4071
+ children.push(this.compileObjectDecl(obj, templateMap));
4072
+ }
4073
+ if (cond.spatialGroups) {
4074
+ for (const g of cond.spatialGroups)
4075
+ children.push(this.compileSpatialGroup(g, templateMap));
4076
+ }
4077
+ const elseChildren = [];
4078
+ if (cond.elseObjects) {
4079
+ for (const obj of cond.elseObjects)
4080
+ elseChildren.push(this.compileObjectDecl(obj, templateMap));
4081
+ }
4082
+ if (cond.elseSpatialGroups) {
4083
+ for (const g of cond.elseSpatialGroups)
4084
+ elseChildren.push(this.compileSpatialGroup(g, templateMap));
4085
+ }
4086
+ const conditionalNode = this.createNode("ConditionalGroup", {
4087
+ condition: cond.condition,
4088
+ elseChildren: elseChildren.length > 0 ? elseChildren : void 0
4089
+ });
4090
+ conditionalNode.children = children;
4091
+ return conditionalNode;
4092
+ }
4093
+ compileForEachBlock(iter, templateMap) {
4094
+ const templateChildren = [];
4095
+ if (iter.objects) {
4096
+ for (const obj of iter.objects)
4097
+ templateChildren.push(this.compileObjectDecl(obj, templateMap));
4098
+ }
4099
+ if (iter.spatialGroups) {
4100
+ for (const g of iter.spatialGroups)
4101
+ templateChildren.push(this.compileSpatialGroup(g, templateMap));
4102
+ }
4103
+ const forEachNode = this.createNode("ForEachGroup", {
4104
+ variable: iter.variable,
4105
+ iterable: iter.iterable
4106
+ });
4107
+ forEachNode.children = templateChildren;
4108
+ return forEachNode;
4109
+ }
4110
+ /**
4111
+ * Resolve a property value, converting bind expressions into runtime-reactive markers.
4112
+ */
4113
+ resolveValue(value) {
4114
+ if (value && typeof value === "object" && value.__bind) {
4115
+ return {
4116
+ __bind: true,
4117
+ source: value.source,
4118
+ transform: value.transform
4119
+ };
4120
+ }
4121
+ return value;
4122
+ }
4123
+ // ─── Shared Helpers ───────────────────────────────────────────────────
4124
+ injectDefaultLighting(root) {
4125
+ if (!this._defaultLighting) return;
4126
+ if (!this.treeHasLights(root)) {
4127
+ const shadowSize = this.tierScales.shadowMapSize;
4128
+ root.children?.unshift(
4129
+ this.createNode("ambientLight", { intensity: 0.4, color: "#ffffff" }),
4130
+ this.createNode("directionalLight", {
4131
+ intensity: 1,
4132
+ position: [5, 10, 5],
4133
+ castShadow: true,
4134
+ "shadow-mapSize": [shadowSize, shadowSize],
4135
+ color: "#ffffff"
4136
+ })
4137
+ );
4138
+ }
4139
+ }
4140
+ treeHasLights(node) {
4141
+ if (node.type.toLowerCase().includes("light")) return true;
4142
+ return node.children?.some((c) => this.treeHasLights(c)) || false;
4143
+ }
4144
+ hasPostProcessing(node) {
4145
+ if (node.traits?.has("bloom") || node.traits?.has("postprocessing"))
4146
+ return true;
4147
+ if (node.props.bloom) return true;
4148
+ return node.children?.some((c) => this.hasPostProcessing(c)) || false;
4149
+ }
4150
+ extractPostProcessingNodes(node) {
4151
+ const effects = [];
4152
+ const ppTrait = node.traits?.get(
4153
+ "postprocessing"
4154
+ );
4155
+ if (ppTrait) {
4156
+ if (ppTrait.bloom)
4157
+ effects.push(this.createNode("Bloom", ppTrait.bloom));
4158
+ if (ppTrait.ssao)
4159
+ effects.push(this.createNode("SSAO", ppTrait.ssao));
4160
+ if (ppTrait.vignette)
4161
+ effects.push(this.createNode("Vignette", ppTrait.vignette));
4162
+ }
4163
+ if (node.props.bloom) {
4164
+ const bloom = node.props.bloom;
4165
+ const bloomProps = typeof bloom === "object" && bloom !== null ? bloom : { intensity: 1 };
4166
+ effects.push(this.createNode("Bloom", bloomProps));
4167
+ }
4168
+ node.children?.forEach((child) => effects.push(...this.extractPostProcessingNodes(child)));
4169
+ return effects;
4170
+ }
4171
+ mapType(type, props) {
4172
+ if (type === "environment") {
4173
+ if (props.name && typeof props.name === "string" && exports.ENVIRONMENT_PRESETS[props.name]) {
4174
+ Object.assign(props, exports.ENVIRONMENT_PRESETS[props.name]);
4175
+ }
4176
+ return "Environment";
4177
+ }
4178
+ if (type === "light") {
4179
+ const lightType = props.type || "directional";
4180
+ const lightMapping = {
4181
+ directional: "directionalLight",
4182
+ point: "pointLight",
4183
+ spot: "spotLight",
4184
+ hemisphere: "hemisphereLight",
4185
+ ambient: "ambientLight",
4186
+ area: "rectAreaLight"
4187
+ };
4188
+ return lightMapping[lightType] || "directionalLight";
4189
+ }
4190
+ if (type === "portal") return "Portal";
4191
+ if (type === "sparkles") return "Sparkles";
4192
+ if (MESH_TYPES.has(type)) {
4193
+ props.hsType = type;
4194
+ return "mesh";
4195
+ }
4196
+ const mapping = {
4197
+ ambient_light: "ambientLight",
4198
+ model: "gltfModel",
4199
+ audio: "positionalAudio",
4200
+ composition: "group",
4201
+ scale: "group",
4202
+ focus: "group",
4203
+ spatial_agent: "SpatialAgent",
4204
+ spatial_container: "group",
4205
+ ui_panel: "UIPanel",
4206
+ ui_text: "UIText",
4207
+ ui_button: "UIButton",
4208
+ ui_slider: "UISlider",
4209
+ ui_input: "UIInput",
4210
+ ui_image: "UIImage",
4211
+ ui_chart: "UIChart",
4212
+ ui_gauge: "UIGauge",
4213
+ ui_value: "UIValue",
4214
+ ui_status_indicator: "UIStatusIndicator",
4215
+ tool_slot: "ToolSlot",
4216
+ behavior: "group",
4217
+ system: "System",
4218
+ component: "Component",
4219
+ dna: "DNA",
4220
+ gaussian_splat: "GaussianSplat",
4221
+ splat: "GaussianSplat",
4222
+ nerf: "NeRF",
4223
+ volumetric_video: "VolumetricVideo",
4224
+ world: "group"
4225
+ };
4226
+ return mapping[type] || type;
4227
+ }
4228
+ compileProperties(node, rawProps) {
4229
+ const expandedProps = this.expandSpreads(rawProps);
4230
+ const props = { ...expandedProps };
4231
+ if (node.position) {
4232
+ props.position = node.position;
4233
+ }
4234
+ if (rawProps.position && Array.isArray(rawProps.position)) {
4235
+ props.position = rawProps.position;
4236
+ }
4237
+ if (node.hologram) {
4238
+ const h = node.hologram;
4239
+ if (h.color) props.color = h.color;
4240
+ if (MESH_TYPES.has(node.type)) {
4241
+ props.args = this.getGeometryArgs(node.type, h);
4242
+ props.hsType = node.type;
4243
+ }
4244
+ }
4245
+ if (rawProps.scale !== void 0 && !props.scale) {
4246
+ props.scale = Array.isArray(rawProps.scale) ? rawProps.scale : [rawProps.scale, rawProps.scale, rawProps.scale];
4247
+ }
4248
+ if (rawProps.geometry && !props.hsType) {
4249
+ props.hsType = rawProps.geometry;
4250
+ props.args = this.getGeometryArgs(rawProps.geometry, { size: rawProps.size || 1 });
4251
+ }
4252
+ if (rawProps.material && typeof rawProps.material === "string" && exports.MATERIAL_PRESETS[rawProps.material]) {
4253
+ props.materialProps = {
4254
+ ...exports.MATERIAL_PRESETS[rawProps.material],
4255
+ ...props.materialProps
4256
+ };
4257
+ }
4258
+ if (node.directives) {
4259
+ for (const d of node.directives) {
4260
+ if (d.type === "trait") {
4261
+ if (d.name === "grabbable") {
4262
+ props.castShadow = true;
4263
+ props.grabbable = d.config || true;
4264
+ if (!props.rigidBody) props.rigidBody = { type: "dynamic" };
4265
+ if (!props.collider) props.collider = { type: "auto" };
4266
+ } else if (d.name === "animated") {
4267
+ props.animated = d.config || true;
4268
+ } else if (d.name === "spatial_audio" || d.name === "voice") {
4269
+ props.spatial = true;
4270
+ } else if (d.name === "gem_resonance") {
4271
+ props.gemResonance = gemResonanceConfig(d.config);
4272
+ props.spatial = true;
4273
+ } else if (d.name === "networked") {
4274
+ props.networked = d.config || true;
4275
+ } else if (d.name === "moldable") {
4276
+ props.moldable = d.config || true;
4277
+ } else if (d.name === "stretchable") {
4278
+ props.stretchable = d.config || true;
4279
+ } else if (d.name === "ai_driven") {
4280
+ props.ai_driven = d.config || true;
4281
+ } else if (d.name === "dialogue") {
4282
+ props.dialogue = d.config || true;
4283
+ } else if (d.name === "gesture") {
4284
+ props.gesture = d.config || true;
4285
+ } else if (d.name === "haptic") {
4286
+ props.haptic = d.config || true;
4287
+ } else if (d.name === "avatar_embodiment") {
4288
+ props.avatarEmbodiment = d.config || true;
4289
+ } else if (d.name === "lip_sync") {
4290
+ props.lipSync = d.config || true;
4291
+ } else if (d.name === "emotion_directive") {
4292
+ props.emotionDirective = d.config || true;
4293
+ } else if (d.name === "stt") {
4294
+ props.stt = d.config || true;
4295
+ } else if (d.name === "tts") {
4296
+ props.tts = d.config || true;
4297
+ } else if (d.name === "generate") {
4298
+ props.generate = d.config;
4299
+ } else if (d.name === "skeleton") {
4300
+ props.skeleton = d.config || true;
4301
+ } else if (d.name === "body") {
4302
+ props.body = d.config || true;
4303
+ } else if (d.name === "gaussian_splat") {
4304
+ props.gaussianSplat = d.config || true;
4305
+ } else if (d.name === "nerf") {
4306
+ props.nerf = d.config || true;
4307
+ } else if (d.name === "volumetric_video") {
4308
+ props.volumetricVideo = d.config || true;
4309
+ } else if (d.name === "web_surface") {
4310
+ props.webSurface = d.config || true;
4311
+ }
4312
+ }
4313
+ }
4314
+ }
4315
+ delete props.type;
4316
+ delete props.geometry;
4317
+ return props;
4318
+ }
4319
+ applyGraphicsConfig(r3fNode, graphics) {
4320
+ if (graphics.material) {
4321
+ const m = graphics.material;
4322
+ const materialProps = {};
4323
+ if (m.preset && exports.MATERIAL_PRESETS[m.preset]) {
4324
+ Object.assign(materialProps, exports.MATERIAL_PRESETS[m.preset]);
4325
+ }
4326
+ if (m.type === "pbr" && m.pbr) {
4327
+ if (m.pbr.baseColor) materialProps["color"] = this.mapColor(m.pbr.baseColor);
4328
+ if (m.pbr.metallic !== void 0) materialProps["metalness"] = m.pbr.metallic;
4329
+ if (m.pbr.roughness !== void 0) materialProps["roughness"] = m.pbr.roughness;
4330
+ if (m.pbr.emission) materialProps["emissive"] = this.mapColor(m.pbr.emission);
4331
+ if (m.pbr.emissionStrength) materialProps["emissiveIntensity"] = m.pbr.emissionStrength;
4332
+ if (m.pbr.clearcoat !== void 0) materialProps["clearcoat"] = m.pbr.clearcoat;
4333
+ if (m.pbr.transmission !== void 0) materialProps["transmission"] = m.pbr.transmission;
4334
+ if (m.pbr.ior !== void 0) materialProps["ior"] = m.pbr.ior;
4335
+ if (m.pbr.iridescence !== void 0) materialProps["iridescence"] = m.pbr.iridescence;
4336
+ }
4337
+ const prior = r3fNode.props.materialProps ?? {};
4338
+ r3fNode.props.materialProps = { ...prior, ...materialProps };
4339
+ }
4340
+ if (graphics.lighting) {
4341
+ const l = graphics.lighting;
4342
+ if (r3fNode.type.toLowerCase().includes("light")) {
4343
+ if (l.shadows) r3fNode.props.castShadow = true;
4344
+ if (l.intensity !== void 0) r3fNode.props.intensity = l.intensity;
4345
+ if (l.color) r3fNode.props.color = this.mapColor(l.color);
4346
+ }
4347
+ if (r3fNode.type === "Environment" && l.preset) {
4348
+ r3fNode.props.preset = l.preset;
4349
+ }
4350
+ }
4351
+ if (graphics.networked) {
4352
+ r3fNode.props.networked = graphics.networked;
4353
+ }
4354
+ }
4355
+ mapColor(c) {
4356
+ if (typeof c === "string") return c;
4357
+ if (typeof c === "number") return `#${c.toString(16).padStart(6, "0")}`;
4358
+ if (c.r !== void 0) {
4359
+ const r = c.r > 1 ? c.r : Math.floor(c.r * 255);
4360
+ const g = c.g > 1 ? c.g : Math.floor(c.g * 255);
4361
+ const b = c.b > 1 ? c.b : Math.floor(c.b * 255);
4362
+ return `rgb(${r}, ${g}, ${b})`;
4363
+ }
4364
+ return "#ffffff";
4365
+ }
4366
+ getGeometryArgs(type, hologram) {
4367
+ const size = hologram.size || 1;
4368
+ switch (type) {
4369
+ case "sphere":
4370
+ case "orb":
4371
+ return [size * 0.5, 32, 32];
4372
+ case "cube":
4373
+ case "box":
4374
+ return [size, size, size];
4375
+ case "cylinder":
4376
+ return [size * 0.5, size * 0.5, size, 32];
4377
+ case "pyramid":
4378
+ case "cone":
4379
+ return [size * 0.5, 0, size, 4];
4380
+ case "plane":
4381
+ return [size, size];
4382
+ case "torus":
4383
+ return [size * 0.5, size * 0.15, 16, 32];
4384
+ case "ring":
4385
+ return [size * 0.3, size * 0.5, 32];
4386
+ case "capsule":
4387
+ return [size * 0.3, size * 0.5, 4, 16];
4388
+ default:
4389
+ return [size, size, size];
4390
+ }
4391
+ }
4392
+ };
4393
+ }
4394
+ });
4395
+
4396
+ exports.R3FCompiler_exports = R3FCompiler_exports;
4397
+ exports.init_ObjectPool = init_ObjectPool;
4398
+ exports.init_R3FCompiler = init_R3FCompiler;
4399
+ exports.init_visual = init_visual;
4400
+ exports.registerAllPresets = registerAllPresets;
4401
+ //# sourceMappingURL=chunk-ALC6K7GL.cjs.map
4402
+ //# sourceMappingURL=chunk-ALC6K7GL.cjs.map