@cimplify/sdk 0.108.0 → 0.110.2

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 (608) hide show
  1. package/LICENSE +21 -0
  2. package/dist/advanced.d.mts +4 -3
  3. package/dist/advanced.d.ts +4 -3
  4. package/dist/advanced.js +24 -24
  5. package/dist/advanced.mjs +5 -5
  6. package/dist/animation-4EXBXRVX.js +27 -0
  7. package/dist/animation-6DICNWUP.mjs +6 -0
  8. package/dist/audio-DhvyjqdA.d.mts +249 -0
  9. package/dist/audio-m0w8cnxq.d.ts +249 -0
  10. package/dist/avatars.d.mts +110 -0
  11. package/dist/avatars.d.ts +110 -0
  12. package/dist/avatars.js +82 -0
  13. package/dist/avatars.mjs +5 -0
  14. package/dist/backend-gUCzs5Kg.d.mts +3866 -0
  15. package/dist/backend-gUCzs5Kg.d.ts +3866 -0
  16. package/dist/{catalogue-B4eLL8Mi.d.ts → catalogue-CPTMyBUz.d.mts} +109 -221
  17. package/dist/catalogue-DzrTXP3v.d.mts +541 -0
  18. package/dist/catalogue-DzrTXP3v.d.ts +541 -0
  19. package/dist/{catalogue-OT89_Ifs.d.mts → catalogue-OTuS5zp-.d.ts} +109 -221
  20. package/dist/chunk-22BD3RHN.mjs +1809 -0
  21. package/dist/chunk-25T4JHEA.mjs +21 -0
  22. package/dist/chunk-2AQ237Y4.js +508 -0
  23. package/dist/chunk-2IC4H6OV.mjs +48 -0
  24. package/dist/chunk-2LHLG4OB.mjs +71 -0
  25. package/dist/chunk-2O2CG465.js +1709 -0
  26. package/dist/chunk-2Q4DTHXK.js +316 -0
  27. package/dist/chunk-2QTQ6BUH.mjs +46 -0
  28. package/dist/chunk-2UN4SFLR.mjs +100 -0
  29. package/dist/chunk-2V75I7K3.js +454 -0
  30. package/dist/chunk-2V7IL4HC.js +10 -0
  31. package/dist/chunk-34XBXUMW.js +296 -0
  32. package/dist/chunk-3C4C654I.js +71 -0
  33. package/dist/chunk-3DAD2LDF.mjs +72 -0
  34. package/dist/chunk-3GXH2NFD.mjs +4 -0
  35. package/dist/chunk-3O47ZFW3.js +961 -0
  36. package/dist/chunk-3OY3VYNF.mjs +11 -0
  37. package/dist/chunk-3S6WPBZL.js +2936 -0
  38. package/dist/chunk-3TUOUP5T.js +399 -0
  39. package/dist/chunk-3VEH23I5.mjs +1380 -0
  40. package/dist/chunk-3ZYSAW2T.mjs +263 -0
  41. package/dist/chunk-4ANVF274.js +103 -0
  42. package/dist/chunk-4C7I3ELN.js +388 -0
  43. package/dist/chunk-4DYKAYFO.mjs +8 -0
  44. package/dist/chunk-4ZDR72SG.js +329 -0
  45. package/dist/chunk-52YS45RR.js +1066 -0
  46. package/dist/chunk-5325XSCH.js +107 -0
  47. package/dist/chunk-5AD5X6AV.js +13 -0
  48. package/dist/chunk-5BYDGGWO.mjs +197 -0
  49. package/dist/chunk-5C3C7VDM.mjs +55 -0
  50. package/dist/chunk-5HFMY3D7.js +660 -0
  51. package/dist/chunk-5LH2QN3T.js +1862 -0
  52. package/dist/chunk-5PJEXSOW.js +44 -0
  53. package/dist/chunk-5SXDH3Y7.js +90 -0
  54. package/dist/chunk-5YFBGGCK.mjs +502 -0
  55. package/dist/chunk-5YWN6H5Q.mjs +133 -0
  56. package/dist/chunk-66QP3SMN.js +402 -0
  57. package/dist/chunk-6DAEZKIG.mjs +385 -0
  58. package/dist/chunk-6DATW7TB.mjs +420 -0
  59. package/dist/{chunk-JRGK3NXR.mjs → chunk-6ETDAU62.mjs} +72 -212
  60. package/dist/chunk-6H254EVP.mjs +178 -0
  61. package/dist/chunk-6PFNJPBJ.mjs +820 -0
  62. package/dist/chunk-6PJWXIFX.mjs +357 -0
  63. package/dist/chunk-6SWKWCMS.js +80 -0
  64. package/dist/chunk-6VVXXX7S.js +808 -0
  65. package/dist/chunk-6WUBSMTX.js +1403 -0
  66. package/dist/chunk-73SGZLAQ.mjs +35 -0
  67. package/dist/chunk-76L2V6KD.mjs +4 -0
  68. package/dist/chunk-7AAIAVAA.js +1531 -0
  69. package/dist/chunk-7ARSJPV3.mjs +93 -0
  70. package/dist/chunk-7BHW5GTC.mjs +1234 -0
  71. package/dist/chunk-7DQSDKDU.js +6 -0
  72. package/dist/chunk-7IQQQENP.mjs +401 -0
  73. package/dist/chunk-7KFTYENS.js +11357 -0
  74. package/dist/chunk-7SM6XSPZ.js +3171 -0
  75. package/dist/chunk-7SXOHAIR.mjs +28 -0
  76. package/dist/chunk-A2MAX6S4.js +90 -0
  77. package/dist/chunk-A33OORT7.mjs +1530 -0
  78. package/dist/{chunk-U6ACF76H.mjs → chunk-A36JRXXH.mjs} +1075 -1845
  79. package/dist/chunk-A7BU3BK4.js +52 -0
  80. package/dist/chunk-A7MQSN2V.mjs +77 -0
  81. package/dist/chunk-A7V4L2IT.mjs +416 -0
  82. package/dist/chunk-AABEK6XU.js +226 -0
  83. package/dist/chunk-AGV33FWC.mjs +5005 -0
  84. package/dist/chunk-AHNR3BXI.js +108 -0
  85. package/dist/chunk-AQ5RLBU2.mjs +286 -0
  86. package/dist/chunk-AQOE6WCG.js +1270 -0
  87. package/dist/chunk-ATAWRACV.mjs +62 -0
  88. package/dist/chunk-ATCURNUV.js +14 -0
  89. package/dist/chunk-AWPV33OO.js +6 -0
  90. package/dist/chunk-AYJPHKYV.js +337 -0
  91. package/dist/chunk-AZ5BGWHB.js +162 -0
  92. package/dist/chunk-AZAXD44P.js +1373 -0
  93. package/dist/chunk-BBGKQIJJ.mjs +406 -0
  94. package/dist/chunk-BP4JLSUA.js +1453 -0
  95. package/dist/{chunk-SUCE7FWA.mjs → chunk-BTUSVHIE.mjs} +539 -978
  96. package/dist/chunk-BU6OK542.mjs +818 -0
  97. package/dist/chunk-CVSRWM6W.js +418 -0
  98. package/dist/chunk-CYBMFMJD.mjs +247 -0
  99. package/dist/chunk-DDJLDOUX.mjs +217 -0
  100. package/dist/{chunk-V32BCG7M.js → chunk-DFZWHNRG.js} +75 -215
  101. package/dist/chunk-DJ2C7AVG.js +644 -0
  102. package/dist/chunk-DS2VU4WW.mjs +102 -0
  103. package/dist/chunk-DSAG7T5P.js +7290 -0
  104. package/dist/chunk-E2QPPH7I.js +327 -0
  105. package/dist/chunk-E65WCTIG.mjs +1187 -0
  106. package/dist/{chunk-33VCYWVL.mjs → chunk-E6QQKDNE.mjs} +30 -42
  107. package/dist/chunk-ECDK6QBF.mjs +981 -0
  108. package/dist/chunk-EIB4OWVQ.mjs +620 -0
  109. package/dist/chunk-EQUZYCGO.js +250 -0
  110. package/dist/chunk-F3UJ6ZRM.mjs +313 -0
  111. package/dist/chunk-F63N2ZTQ.js +7023 -0
  112. package/dist/chunk-F6XRYEM3.mjs +26 -0
  113. package/dist/chunk-FE6VCE4K.js +5030 -0
  114. package/dist/chunk-FLWD6GRR.js +1372 -0
  115. package/dist/chunk-FQBFWJBS.mjs +110 -0
  116. package/dist/chunk-FXVJ2HFU.js +26 -0
  117. package/dist/chunk-FZMQMQBW.js +312 -0
  118. package/dist/chunk-G3EEC44R.js +53 -0
  119. package/dist/{chunk-KG3WT4PR.mjs → chunk-GCKWKLZF.mjs} +73 -104
  120. package/dist/chunk-GCX7TY4D.mjs +6826 -0
  121. package/dist/chunk-GDB6TCSD.js +450 -0
  122. package/dist/chunk-GDCV4IWO.mjs +21 -0
  123. package/dist/chunk-GDZT5LZ5.js +170 -0
  124. package/dist/chunk-GHPUYD4I.mjs +213 -0
  125. package/dist/chunk-GHS6MIL6.mjs +1432 -0
  126. package/dist/chunk-GPS2THCL.mjs +11 -0
  127. package/dist/{chunk-EV2EVOYS.js → chunk-GTJWQAGU.js} +31 -42
  128. package/dist/chunk-GVTI6UJQ.mjs +130 -0
  129. package/dist/chunk-GXKI64OT.mjs +1138 -0
  130. package/dist/chunk-GYDYF2WX.js +275 -0
  131. package/dist/chunk-GYLP6UG4.mjs +705 -0
  132. package/dist/chunk-H3OQKK6X.js +1158 -0
  133. package/dist/chunk-H5DFSCJ6.js +40 -0
  134. package/dist/chunk-HAGEIC2L.mjs +186 -0
  135. package/dist/chunk-HAJ4JRFO.js +293 -0
  136. package/dist/chunk-HDR72GB6.js +188 -0
  137. package/dist/chunk-HF5HPS4T.mjs +40 -0
  138. package/dist/chunk-HK6LOFDS.js +218 -0
  139. package/dist/chunk-HMWYTXCY.mjs +143 -0
  140. package/dist/chunk-HPCSRCMA.js +89 -0
  141. package/dist/chunk-HSEO6TPU.js +247 -0
  142. package/dist/chunk-I5FOHCLH.js +132 -0
  143. package/dist/chunk-IDLW4NWA.mjs +85 -0
  144. package/dist/chunk-IIDZ5WUX.js +61 -0
  145. package/dist/chunk-IR74FJHU.js +2332 -0
  146. package/dist/chunk-IRVFYAKP.mjs +100 -0
  147. package/dist/{chunk-XBL3TMPC.mjs → chunk-IZDWAL53.mjs} +1795 -3287
  148. package/dist/chunk-J2KZXIU3.js +51 -0
  149. package/dist/chunk-J2U6PJSO.js +91 -0
  150. package/dist/chunk-J5AJNY2N.js +283 -0
  151. package/dist/chunk-J6KQZ4FO.mjs +821 -0
  152. package/dist/{chunk-OWW5GUSB.js → chunk-JGBCIKJV.js} +7 -6
  153. package/dist/chunk-JKGTBMU7.mjs +25 -0
  154. package/dist/chunk-JR3TNEQC.js +422 -0
  155. package/dist/chunk-JURRXY2J.mjs +29 -0
  156. package/dist/chunk-K3HW5I2A.mjs +317 -0
  157. package/dist/chunk-K46SMZ66.mjs +103 -0
  158. package/dist/chunk-K4UDGE3Z.mjs +6 -0
  159. package/dist/chunk-KDQOR4QQ.mjs +350 -0
  160. package/dist/chunk-KDTVOLHI.mjs +288 -0
  161. package/dist/chunk-KGHJH5KJ.mjs +35 -0
  162. package/dist/chunk-KIZOA5LX.mjs +140 -0
  163. package/dist/chunk-KK6HYVBI.mjs +242 -0
  164. package/dist/chunk-KMKWGXMK.js +856 -0
  165. package/dist/chunk-KPA6K5IB.js +80 -0
  166. package/dist/chunk-KU7O4IXU.mjs +260 -0
  167. package/dist/chunk-KVFNRJOR.mjs +11142 -0
  168. package/dist/chunk-KZJRSXHK.js +2432 -0
  169. package/dist/chunk-LHWPRUJL.js +79 -0
  170. package/dist/chunk-LIV3KXJG.mjs +369 -0
  171. package/dist/chunk-LKV4LACG.js +21 -0
  172. package/dist/chunk-LUY45X3U.mjs +263 -0
  173. package/dist/chunk-LYEZZEEF.mjs +17 -0
  174. package/dist/chunk-M5EXQZYY.mjs +1519 -0
  175. package/dist/chunk-ME6HGG4I.mjs +1338 -0
  176. package/dist/chunk-MEXP6DA6.js +31 -0
  177. package/dist/chunk-MG52AW3H.js +902 -0
  178. package/dist/chunk-MIPO6F72.js +334 -0
  179. package/dist/{chunk-5QW7CQBA.js → chunk-MKIJQL5Q.js} +211 -321
  180. package/dist/chunk-MN3YETVN.mjs +17 -0
  181. package/dist/chunk-MOBSBXVE.mjs +2391 -0
  182. package/dist/chunk-MOMOZEUM.mjs +88 -0
  183. package/dist/chunk-MRFUNRAP.js +62 -0
  184. package/dist/chunk-MTIHEW2M.js +433 -0
  185. package/dist/chunk-N4RGGDEL.mjs +73 -0
  186. package/dist/chunk-NH654HAT.js +10 -0
  187. package/dist/chunk-NHJUGZUR.mjs +253 -0
  188. package/dist/chunk-NMQT4HG3.mjs +757 -0
  189. package/dist/chunk-NPSYB6DC.mjs +906 -0
  190. package/dist/chunk-NW2GPMSO.js +857 -0
  191. package/dist/chunk-NXKQOQ6L.js +76 -0
  192. package/dist/chunk-NXLAZIJZ.js +309 -0
  193. package/dist/chunk-NYWNA5CF.js +148 -0
  194. package/dist/chunk-NZTKLY2W.js +1442 -0
  195. package/dist/chunk-O2ICABUD.js +36 -0
  196. package/dist/chunk-OIVVQQ22.js +862 -0
  197. package/dist/chunk-OKC2B4O3.mjs +312 -0
  198. package/dist/chunk-OLWFPDBK.js +2220 -0
  199. package/dist/chunk-OMTVH334.js +3779 -0
  200. package/dist/chunk-OQRVEM56.mjs +362 -0
  201. package/dist/chunk-OXMIBOD4.js +337 -0
  202. package/dist/chunk-PBL6YL5L.mjs +288 -0
  203. package/dist/chunk-PDOELNNQ.js +97 -0
  204. package/dist/chunk-PDQJY2GZ.js +136 -0
  205. package/dist/chunk-PKOZXD2Q.js +1274 -0
  206. package/dist/chunk-PPF2BYFL.mjs +2191 -0
  207. package/dist/chunk-PQTQKNKD.js +539 -0
  208. package/dist/chunk-PRSR4FAV.mjs +81 -0
  209. package/dist/chunk-PTRNO5UD.js +95 -0
  210. package/dist/chunk-Q2Y3VMKH.js +2000 -0
  211. package/dist/chunk-QCZOE65N.js +96 -0
  212. package/dist/chunk-QDYFLATW.mjs +52 -0
  213. package/dist/chunk-QQABGCMM.js +22 -0
  214. package/dist/chunk-QS6TRHMR.js +345 -0
  215. package/dist/chunk-R56P64LB.mjs +208 -0
  216. package/dist/chunk-RCQ2MPBV.js +428 -0
  217. package/dist/chunk-RFVRPYR2.mjs +856 -0
  218. package/dist/chunk-RKBLPGPV.js +11521 -0
  219. package/dist/chunk-RM2V4IND.mjs +327 -0
  220. package/dist/chunk-RQXN5A34.mjs +613 -0
  221. package/dist/chunk-RUVGVNOF.mjs +2687 -0
  222. package/dist/chunk-SAFJIGYB.mjs +165 -0
  223. package/dist/chunk-SKQFLBDD.js +263 -0
  224. package/dist/chunk-SMK6JU2F.mjs +2092 -0
  225. package/dist/{chunk-UVRPC2P7.js → chunk-SNNEOS5Z.js} +1984 -3476
  226. package/dist/chunk-SPCRQ6NO.mjs +1246 -0
  227. package/dist/chunk-SWX4SALA.mjs +19 -0
  228. package/dist/{chunk-JVODCGFP.mjs → chunk-SYEO2WV4.mjs} +128 -238
  229. package/dist/chunk-T2QQMX2N.js +10 -0
  230. package/dist/chunk-T3AFF3L7.mjs +57 -0
  231. package/dist/chunk-T6Z2EXYL.js +712 -0
  232. package/dist/chunk-T7LOXGYX.js +118 -0
  233. package/dist/chunk-TJCAE7RC.mjs +1315 -0
  234. package/dist/chunk-TJI3K6RP.js +137 -0
  235. package/dist/chunk-TL2SVO4P.mjs +55 -0
  236. package/dist/chunk-TM63CYGN.mjs +399 -0
  237. package/dist/chunk-TU5RYTYU.mjs +13 -0
  238. package/dist/chunk-TVJZ4GPS.js +1553 -0
  239. package/dist/chunk-TWM6DLYF.js +371 -0
  240. package/dist/chunk-U63OC4TQ.js +30 -0
  241. package/dist/{chunk-L5GKVQVJ.js → chunk-U6BVSJZ6.js} +25 -57
  242. package/dist/chunk-U6UVWEAK.mjs +792 -0
  243. package/dist/chunk-UCEPNO6N.mjs +11048 -0
  244. package/dist/{chunk-ANT574FD.js → chunk-UCR5HRYM.js} +74 -105
  245. package/dist/chunk-UG5BTOTF.mjs +334 -0
  246. package/dist/chunk-UGH37BQW.mjs +157 -0
  247. package/dist/chunk-V7ZRH3PY.mjs +271 -0
  248. package/dist/chunk-VBGHBL3E.mjs +1394 -0
  249. package/dist/chunk-VRBDAS5I.js +920 -0
  250. package/dist/chunk-VVE3Y76O.js +230 -0
  251. package/dist/chunk-W65JIRI4.mjs +1182 -0
  252. package/dist/chunk-WHYKAT7G.js +62 -0
  253. package/dist/{chunk-YOIVZ6OA.mjs → chunk-WIZRUIZB.mjs} +25 -57
  254. package/dist/chunk-WKWTDZS7.js +385 -0
  255. package/dist/chunk-WLMINRC4.mjs +78 -0
  256. package/dist/chunk-WOF3AD3J.js +22 -0
  257. package/dist/chunk-WWKMOA76.js +1262 -0
  258. package/dist/chunk-X5A5FOWW.js +615 -0
  259. package/dist/chunk-X6CN6KQF.mjs +192 -0
  260. package/dist/chunk-XD2PMH46.mjs +517 -0
  261. package/dist/chunk-XJA2NGTI.mjs +88 -0
  262. package/dist/chunk-XJIHN3BY.mjs +8 -0
  263. package/dist/chunk-XK6UDWJS.js +203 -0
  264. package/dist/chunk-XPG3N5CF.mjs +415 -0
  265. package/dist/chunk-XVZ2NKSU.mjs +74 -0
  266. package/dist/chunk-XYP45OLE.js +117 -0
  267. package/dist/chunk-XZSDGZX6.mjs +301 -0
  268. package/dist/chunk-Y2EMGN4T.mjs +120 -0
  269. package/dist/chunk-Y3XWP5XW.mjs +298 -0
  270. package/dist/chunk-Y4K22JL6.js +228 -0
  271. package/dist/chunk-Y65LXQGA.mjs +3164 -0
  272. package/dist/chunk-Y66WVMO5.mjs +87 -0
  273. package/dist/chunk-Y7JWLB25.mjs +7280 -0
  274. package/dist/chunk-YCDXAJKU.js +175 -0
  275. package/dist/chunk-YRDQCCIS.js +152 -0
  276. package/dist/chunk-YV52DGSA.js +111 -0
  277. package/dist/chunk-YXGZQPUD.js +94 -0
  278. package/dist/chunk-Z3A3AFVU.mjs +102 -0
  279. package/dist/chunk-ZCY6YKKP.mjs +475 -0
  280. package/dist/chunk-ZEQHXVU5.js +215 -0
  281. package/dist/chunk-ZF7JCXCI.js +284 -0
  282. package/dist/chunk-ZJBRUH6V.js +29 -0
  283. package/dist/chunk-ZMIL4ZOA.js +365 -0
  284. package/dist/chunk-ZR5ULMN2.mjs +337 -0
  285. package/dist/chunk-ZXREOYOW.js +87 -0
  286. package/dist/{client-BSP9U1O1.d.mts → client-CX_WR0-J.d.mts} +2 -2
  287. package/dist/client-Dytx_ZTC.d.ts +230 -0
  288. package/dist/{client-B878xeAP.d.ts → client-dqOhP9Nc.d.ts} +2 -2
  289. package/dist/client-hTKbCuhG.d.mts +230 -0
  290. package/dist/clock-B-UAjkKa.d.mts +5 -0
  291. package/dist/clock-B-UAjkKa.d.ts +5 -0
  292. package/dist/config-BlXQluJR.d.mts +36 -0
  293. package/dist/config-BlXQluJR.d.ts +36 -0
  294. package/dist/courier-Cnn-edJ4.d.ts +95 -0
  295. package/dist/courier-FmGfkvIN.d.mts +95 -0
  296. package/dist/crowd-DdHFbqKK.d.ts +186 -0
  297. package/dist/crowd-hOVSAmA3.d.mts +186 -0
  298. package/dist/danfo-BEBapFlX.d.mts +146 -0
  299. package/dist/danfo-UQ_PTIIx.d.ts +146 -0
  300. package/dist/{elements-Bty6Qs_N.d.mts → elements-DdsRig-2.d.mts} +1548 -257
  301. package/dist/{elements-Bty6Qs_N.d.ts → elements-DdsRig-2.d.ts} +1548 -257
  302. package/dist/engines/godot.d.mts +56 -0
  303. package/dist/engines/godot.d.ts +56 -0
  304. package/dist/engines/godot.js +28 -0
  305. package/dist/engines/godot.mjs +3 -0
  306. package/dist/engines/wasm.d.mts +11 -0
  307. package/dist/engines/wasm.d.ts +11 -0
  308. package/dist/engines/wasm.js +178 -0
  309. package/dist/engines/wasm.mjs +176 -0
  310. package/dist/fallback-CrG_lTFk.d.mts +270 -0
  311. package/dist/fallback-CrG_lTFk.d.ts +270 -0
  312. package/dist/fallback-KDB4Y2CE.mjs +6 -0
  313. package/dist/fallback-Y26TQENE.js +19 -0
  314. package/dist/features-CZB4rmcD.d.mts +118 -0
  315. package/dist/features-CZB4rmcD.d.ts +118 -0
  316. package/dist/fit-BWiE7rgA.d.mts +44 -0
  317. package/dist/fit-DK0oT7zO.d.ts +44 -0
  318. package/dist/five-a-side-Bv1AOUy3.d.mts +115 -0
  319. package/dist/five-a-side-EC51SJY1.d.ts +115 -0
  320. package/dist/fluid-ARr0qUIL.d.ts +939 -0
  321. package/dist/fluid-DLlEj2cs.d.mts +939 -0
  322. package/dist/game/conformance.d.mts +84 -0
  323. package/dist/game/conformance.d.ts +84 -0
  324. package/dist/game/conformance.js +1025 -0
  325. package/dist/game/conformance.mjs +994 -0
  326. package/dist/game/heap.d.mts +40 -0
  327. package/dist/game/heap.d.ts +40 -0
  328. package/dist/game/heap.js +48 -0
  329. package/dist/game/heap.mjs +7 -0
  330. package/dist/game/kit/canvas.d.mts +240 -0
  331. package/dist/game/kit/canvas.d.ts +240 -0
  332. package/dist/game/kit/canvas.js +3566 -0
  333. package/dist/game/kit/canvas.mjs +1039 -0
  334. package/dist/game/kit/courier.d.mts +17 -0
  335. package/dist/game/kit/courier.d.ts +17 -0
  336. package/dist/game/kit/courier.js +66 -0
  337. package/dist/game/kit/courier.mjs +49 -0
  338. package/dist/game/kit/danfo.d.mts +11 -0
  339. package/dist/game/kit/danfo.d.ts +11 -0
  340. package/dist/game/kit/danfo.js +109 -0
  341. package/dist/game/kit/danfo.mjs +44 -0
  342. package/dist/game/kit/engine.d.mts +29 -0
  343. package/dist/game/kit/engine.d.ts +29 -0
  344. package/dist/game/kit/engine.js +183 -0
  345. package/dist/game/kit/engine.mjs +30 -0
  346. package/dist/game/kit/five-a-side.d.mts +11 -0
  347. package/dist/game/kit/five-a-side.d.ts +11 -0
  348. package/dist/game/kit/five-a-side.js +86 -0
  349. package/dist/game/kit/five-a-side.mjs +41 -0
  350. package/dist/game/kit/frontier.d.mts +344 -0
  351. package/dist/game/kit/frontier.d.ts +344 -0
  352. package/dist/game/kit/frontier.js +435 -0
  353. package/dist/game/kit/frontier.mjs +14 -0
  354. package/dist/game/kit/genesis.d.mts +752 -0
  355. package/dist/game/kit/genesis.d.ts +752 -0
  356. package/dist/game/kit/genesis.js +380 -0
  357. package/dist/game/kit/genesis.mjs +15 -0
  358. package/dist/game/kit/ludo.d.mts +15 -0
  359. package/dist/game/kit/ludo.d.ts +15 -0
  360. package/dist/game/kit/ludo.js +87 -0
  361. package/dist/game/kit/ludo.mjs +42 -0
  362. package/dist/game/kit/runner.d.mts +12 -0
  363. package/dist/game/kit/runner.d.ts +12 -0
  364. package/dist/game/kit/runner.js +83 -0
  365. package/dist/game/kit/runner.mjs +46 -0
  366. package/dist/game/kit/shootout.d.mts +13 -0
  367. package/dist/game/kit/shootout.d.ts +13 -0
  368. package/dist/game/kit/shootout.js +122 -0
  369. package/dist/game/kit/shootout.mjs +57 -0
  370. package/dist/game/kit/slots.d.mts +392 -0
  371. package/dist/game/kit/slots.d.ts +392 -0
  372. package/dist/game/kit/slots.js +215 -0
  373. package/dist/game/kit/slots.mjs +6 -0
  374. package/dist/game/kit/tycoon.d.mts +16 -0
  375. package/dist/game/kit/tycoon.d.ts +16 -0
  376. package/dist/game/kit/tycoon.js +145 -0
  377. package/dist/game/kit/tycoon.mjs +44 -0
  378. package/dist/game/kit/word.d.mts +11 -0
  379. package/dist/game/kit/word.d.ts +11 -0
  380. package/dist/game/kit/word.js +78 -0
  381. package/dist/game/kit/word.mjs +41 -0
  382. package/dist/game/kit/worlds.d.mts +18 -0
  383. package/dist/game/kit/worlds.d.ts +18 -0
  384. package/dist/game/kit/worlds.js +74 -0
  385. package/dist/game/kit/worlds.mjs +49 -0
  386. package/dist/game/kit.d.mts +53 -0
  387. package/dist/game/kit.d.ts +53 -0
  388. package/dist/game/kit.js +2610 -0
  389. package/dist/game/kit.mjs +101 -0
  390. package/dist/game/prepared.d.mts +14 -0
  391. package/dist/game/prepared.d.ts +14 -0
  392. package/dist/game/prepared.js +81 -0
  393. package/dist/game/prepared.mjs +32 -0
  394. package/dist/game-Bx8onkhX.d.mts +1451 -0
  395. package/dist/game-fgQy2YIm.d.ts +1451 -0
  396. package/dist/game-theme-CBTw1b_d.d.mts +35 -0
  397. package/dist/game-theme-Dg-ict5A.d.ts +35 -0
  398. package/dist/game.d.mts +3546 -0
  399. package/dist/game.d.ts +3546 -0
  400. package/dist/game.js +4455 -0
  401. package/dist/game.mjs +50 -0
  402. package/dist/graphics-C6YjWYvP.d.ts +5 -0
  403. package/dist/graphics-Dk2yQnYN.d.mts +5 -0
  404. package/dist/guest-DrsA00XD.d.mts +732 -0
  405. package/dist/guest-wIdfoT05.d.ts +732 -0
  406. package/dist/hit-stop-BKkVwTq7.d.mts +43 -0
  407. package/dist/hit-stop-D-8pPYnM.d.ts +43 -0
  408. package/dist/hot-Crn9XpHJ.d.ts +29 -0
  409. package/dist/hot-DH3nOhQD.d.mts +29 -0
  410. package/dist/{index-CQStGb3B.d.mts → index-6gkHMGAq.d.mts} +2 -2
  411. package/dist/index-B8ybCKJI.d.ts +41 -0
  412. package/dist/{index-DJwXmoaP.d.ts → index-B98Xac8e.d.ts} +2 -2
  413. package/dist/{index-B7oA_1XI.d.ts → index-B_ByTtIT.d.ts} +2 -2
  414. package/dist/index-DHjNHb1c.d.mts +41 -0
  415. package/dist/{index-DhUSTAhT.d.mts → index-DbAN_VQE.d.mts} +2 -2
  416. package/dist/index.d.mts +134 -24
  417. package/dist/index.d.ts +134 -24
  418. package/dist/index.js +407 -248
  419. package/dist/index.mjs +184 -58
  420. package/dist/interactives-authoring.d.mts +231 -0
  421. package/dist/interactives-authoring.d.ts +231 -0
  422. package/dist/interactives-authoring.js +1743 -0
  423. package/dist/interactives-authoring.mjs +1704 -0
  424. package/dist/interactives-canvas.global.js +148 -0
  425. package/dist/interactives-guest.d.mts +20 -0
  426. package/dist/interactives-guest.d.ts +20 -0
  427. package/dist/interactives-guest.js +63 -0
  428. package/dist/interactives-guest.json +1 -0
  429. package/dist/interactives-guest.mjs +61 -0
  430. package/dist/interactives-jsc.global.js +9357 -0
  431. package/dist/interactives-meters.d.mts +93 -0
  432. package/dist/interactives-meters.d.ts +93 -0
  433. package/dist/interactives-meters.js +252 -0
  434. package/dist/interactives-meters.mjs +68 -0
  435. package/dist/interactives-production.d.mts +430 -0
  436. package/dist/interactives-production.d.ts +430 -0
  437. package/dist/interactives-production.js +1231 -0
  438. package/dist/interactives-production.mjs +1170 -0
  439. package/dist/interactives-record.d.mts +112 -0
  440. package/dist/interactives-record.d.ts +112 -0
  441. package/dist/interactives-record.js +302 -0
  442. package/dist/interactives-record.mjs +295 -0
  443. package/dist/interactives-runtime.d.mts +61 -0
  444. package/dist/interactives-runtime.d.ts +61 -0
  445. package/dist/interactives-runtime.js +442 -0
  446. package/dist/interactives-runtime.mjs +25 -0
  447. package/dist/interactives-studio-kernel.global.js +1 -0
  448. package/dist/interactives-studio.d.mts +806 -0
  449. package/dist/interactives-studio.d.ts +806 -0
  450. package/dist/interactives-studio.js +5741 -0
  451. package/dist/interactives-studio.mjs +5651 -0
  452. package/dist/interactives-tick.d.mts +90 -0
  453. package/dist/interactives-tick.d.ts +90 -0
  454. package/dist/interactives-tick.js +203 -0
  455. package/dist/interactives-tick.mjs +6 -0
  456. package/dist/interactives-web.d.mts +762 -0
  457. package/dist/interactives-web.d.ts +762 -0
  458. package/dist/interactives-web.js +5000 -0
  459. package/dist/interactives-web.mjs +4628 -0
  460. package/dist/interactives.d.mts +2430 -0
  461. package/dist/interactives.d.ts +2430 -0
  462. package/dist/interactives.js +5723 -0
  463. package/dist/interactives.mjs +4333 -0
  464. package/dist/juice-CoHxlpKA.d.ts +42 -0
  465. package/dist/juice-DQztFS43.d.mts +42 -0
  466. package/dist/launch-T2f4_Di4.d.mts +151 -0
  467. package/dist/launch-d6oreMzR.d.ts +151 -0
  468. package/dist/library-DXYaMFhi.d.mts +69 -0
  469. package/dist/library-DXYaMFhi.d.ts +69 -0
  470. package/dist/link-BUTqGmyi.d.mts +38 -0
  471. package/dist/link-BUTqGmyi.d.ts +38 -0
  472. package/dist/lint.js +104 -204
  473. package/dist/lint.mjs +103 -203
  474. package/dist/local-D8_I6UeL.d.mts +6967 -0
  475. package/dist/local-VZkqsCzR.d.ts +6967 -0
  476. package/dist/lockstep-BLf6dglI.d.mts +321 -0
  477. package/dist/lockstep-D50Ia0JW.d.ts +321 -0
  478. package/dist/ludo-B8ClkDqr.d.ts +205 -0
  479. package/dist/ludo-BOuohQ-M.d.mts +205 -0
  480. package/dist/mock/cli.mjs +200 -56
  481. package/dist/mock/library.js +200 -56
  482. package/dist/mock/library.mjs +200 -56
  483. package/dist/mock/msw.js +200 -56
  484. package/dist/mock/msw.mjs +200 -56
  485. package/dist/native-BodxSh03.d.mts +16 -0
  486. package/dist/native-DUHMT8gA.d.ts +16 -0
  487. package/dist/network-ZXLD7l1b.d.mts +19 -0
  488. package/dist/network-ZXLD7l1b.d.ts +19 -0
  489. package/dist/online-XeymeM9s.d.ts +381 -0
  490. package/dist/online-d7W_Al9a.d.mts +381 -0
  491. package/dist/params-DxFb5G_U.d.mts +155 -0
  492. package/dist/params-DxFb5G_U.d.ts +155 -0
  493. package/dist/play-BRRlfLhX.d.ts +940 -0
  494. package/dist/play-ClrMd_e8.d.mts +940 -0
  495. package/dist/policy-CCw8tXLm.d.mts +3078 -0
  496. package/dist/policy-CMqOSQIu.d.ts +3078 -0
  497. package/dist/ports-B_0v_P3A.d.mts +13 -0
  498. package/dist/ports-CGU_3e_0.d.ts +13 -0
  499. package/dist/prefetch-BHnicOQj.d.ts +117 -0
  500. package/dist/prefetch-CBXgYacv.d.mts +117 -0
  501. package/dist/{price-CSztR02F.d.mts → price-BOzexBww.d.mts} +1 -1
  502. package/dist/{price-C_vasx9A.d.ts → price-C1h9sPxE.d.ts} +1 -1
  503. package/dist/protocol-C8qbpUbT.d.mts +242 -0
  504. package/dist/protocol-C8qbpUbT.d.ts +242 -0
  505. package/dist/rapier-AZHT4YI7.js +7886 -0
  506. package/dist/rapier-ODEPCQA6.mjs +7792 -0
  507. package/dist/react.d.mts +157 -15
  508. package/dist/react.d.ts +157 -15
  509. package/dist/react.js +5564 -5904
  510. package/dist/react.mjs +5451 -5808
  511. package/dist/runner-CQcLL7By.d.ts +189 -0
  512. package/dist/runner-D46Yj-wE.d.mts +189 -0
  513. package/dist/runtime-BRWfkf_q.d.mts +51 -0
  514. package/dist/runtime-DyuBMkKM.d.ts +51 -0
  515. package/dist/scheduling-D2ajXpMC.d.ts +224 -0
  516. package/dist/scheduling-DSRbbaZb.d.mts +224 -0
  517. package/dist/schema-BrWxzKp6.d.mts +63 -0
  518. package/dist/schema-BrWxzKp6.d.ts +63 -0
  519. package/dist/server/evict.js +34 -37
  520. package/dist/server/evict.mjs +34 -37
  521. package/dist/server/tanstack.d.mts +49 -3
  522. package/dist/server/tanstack.d.ts +49 -3
  523. package/dist/server/tanstack.js +169 -117
  524. package/dist/server/tanstack.mjs +166 -118
  525. package/dist/{server-Dckg4Vdr.d.ts → server-D29IIuDV.d.ts} +136 -130
  526. package/dist/{server-B6dW7-Lj.d.mts → server-DQMWPnc8.d.mts} +136 -130
  527. package/dist/server.d.mts +45 -5
  528. package/dist/server.d.ts +45 -5
  529. package/dist/server.js +171 -227
  530. package/dist/server.mjs +165 -225
  531. package/dist/session-grant-CJ27DwrT.d.mts +19 -0
  532. package/dist/session-grant-CJ27DwrT.d.ts +19 -0
  533. package/dist/shootout-BJZeX6FG.d.ts +140 -0
  534. package/dist/shootout-tcZd1Rxt.d.mts +140 -0
  535. package/dist/state-replica-stMtdkVD.d.mts +42 -0
  536. package/dist/state-replica-stMtdkVD.d.ts +42 -0
  537. package/dist/studio-CowqWqez.d.mts +14 -0
  538. package/dist/studio-CowqWqez.d.ts +14 -0
  539. package/dist/styles.css +1 -1
  540. package/dist/template-AhCdB1kW.d.mts +190 -0
  541. package/dist/template-BkEGVTQj.d.ts +190 -0
  542. package/dist/terrain-BMxEc6Oc.d.ts +429 -0
  543. package/dist/terrain-C-XC1Oui.d.mts +429 -0
  544. package/dist/testing/msw.d.mts +28 -4
  545. package/dist/testing/msw.d.ts +28 -4
  546. package/dist/testing/msw.js +15 -21
  547. package/dist/testing/msw.mjs +15 -21
  548. package/dist/testing/suite.d.mts +6 -5
  549. package/dist/testing/suite.d.ts +6 -5
  550. package/dist/testing/suite.js +89 -124
  551. package/dist/testing/suite.mjs +81 -116
  552. package/dist/testing.d.mts +27 -1227
  553. package/dist/testing.d.ts +27 -1227
  554. package/dist/testing.js +127 -131
  555. package/dist/testing.mjs +19 -23
  556. package/dist/tick-transport-C8QEh8Uw.d.mts +50 -0
  557. package/dist/tick-transport-UjHY3xK1.d.ts +50 -0
  558. package/dist/timeline-protocol-hp6e8zFB.d.mts +47 -0
  559. package/dist/timeline-protocol-hp6e8zFB.d.ts +47 -0
  560. package/dist/tokens-DhanQRQS.d.mts +21 -0
  561. package/dist/tokens-K8yxwd6G.d.ts +21 -0
  562. package/dist/tree-C-Io2Hbx.d.mts +35 -0
  563. package/dist/tree-CP_qSW4H.d.ts +35 -0
  564. package/dist/tycoon-B5KHk2Xx.d.mts +255 -0
  565. package/dist/tycoon-hmHo-3HX.d.ts +255 -0
  566. package/dist/types-BQkxPwZP.d.mts +219 -0
  567. package/dist/types-D_f6UUxM.d.ts +219 -0
  568. package/dist/ui-DwHicuFv.d.mts +563 -0
  569. package/dist/ui-hi7S2YcH.d.ts +563 -0
  570. package/dist/{sign-in-DQlIdqsi.d.mts → url-52ndUruG.d.mts} +15 -1
  571. package/dist/{sign-in-DQlIdqsi.d.ts → url-52ndUruG.d.ts} +15 -1
  572. package/dist/utils.d.mts +3 -3
  573. package/dist/utils.d.ts +3 -3
  574. package/dist/utils.js +37 -37
  575. package/dist/utils.mjs +4 -4
  576. package/dist/vars-Dc_PrhBK.d.mts +511 -0
  577. package/dist/vars-Dc_PrhBK.d.ts +511 -0
  578. package/dist/vm-IUARFFAI.mjs +63 -0
  579. package/dist/vm-N7L6MGGH.js +65 -0
  580. package/dist/weave-delivery-CW-Kstut.d.mts +360 -0
  581. package/dist/weave-delivery-CW-Kstut.d.ts +360 -0
  582. package/dist/web-Dss74a7v.d.ts +883 -0
  583. package/dist/web-f9ZQPoyw.d.mts +883 -0
  584. package/dist/web-transport-C7MkBL0a.d.ts +19 -0
  585. package/dist/web-transport-aYEqXMd9.d.mts +19 -0
  586. package/dist/weight-CPGjsgjV.d.ts +92 -0
  587. package/dist/weight-tF1ODR1p.d.mts +92 -0
  588. package/dist/word-BcX9Jcmv.d.mts +70 -0
  589. package/dist/word-C7sVPLHm.d.ts +70 -0
  590. package/dist/world-PvILHDR1.d.ts +2285 -0
  591. package/dist/world-qekkXjJv.d.mts +2285 -0
  592. package/dist/worlds-Br2Pb0Cs.d.ts +109 -0
  593. package/dist/worlds-D5ydYr7d.d.mts +109 -0
  594. package/engines/c/cimplify.h +108 -0
  595. package/engines/c/cimplify.lib.js +11 -0
  596. package/engines/godot/addons/cimplify/cimplify.gd +97 -0
  597. package/engines/rust/interactives-ctx/Cargo.toml +9 -0
  598. package/engines/rust/interactives-ctx/src/lib.rs +189 -0
  599. package/package.json +189 -3
  600. package/vendor/rapier3d-compat/LICENSE +201 -0
  601. package/vendor/rapier3d-compat/PATCHES.md +61 -0
  602. package/dist/chunk-2P4KXFB6.js +0 -274
  603. package/dist/chunk-3G6RQLXK.mjs +0 -21
  604. package/dist/chunk-3V4DVXV3.mjs +0 -254
  605. package/dist/chunk-EDK3LNM6.js +0 -2436
  606. package/dist/chunk-F7J3HK27.js +0 -4549
  607. package/dist/chunk-U4MW6PYU.mjs +0 -23
  608. package/dist/chunk-XREIZ56K.js +0 -26
@@ -0,0 +1,1274 @@
1
+ 'use strict';
2
+
3
+ var chunkAZ5BGWHB_js = require('./chunk-AZ5BGWHB.js');
4
+ var chunkIIDZ5WUX_js = require('./chunk-IIDZ5WUX.js');
5
+ var chunk7AAIAVAA_js = require('./chunk-7AAIAVAA.js');
6
+ var chunkX5A5FOWW_js = require('./chunk-X5A5FOWW.js');
7
+ var chunk2O2CG465_js = require('./chunk-2O2CG465.js');
8
+ var chunk2V7IL4HC_js = require('./chunk-2V7IL4HC.js');
9
+
10
+ // src/game/render/character.ts
11
+ var HUMAN_SCATTER_MM = [3.67, 1.37, 0.68], DEFAULT_THICKNESS_MM = 1.5, DEFAULT_IRIS_RADIUS = 0.18, DEFAULT_IRIS_DEPTH = 0.04, DEFAULT_LIMBUS = 0.02, DEFAULT_PUPIL = 0.35, DEFAULT_MELANIN = 0.5, DEFAULT_REDNESS = 0.2, DEFAULT_AZIMUTHAL = 0.3, DEFAULT_DENSITY = 1, MAX_SCATTER_MM = 50, MAX_IRIS = 0.5, MAX_DENSITY = 8, MATERIAL_SKIN_SHEEN = 60, MATERIAL_SKIN_SHEEN_ROUGHNESS = 61, MATERIAL_SKIN_WARMTH = 62, MATERIAL_SKIN_RIM = 49, CHARACTER_KINDS = {
12
+ skin: 12,
13
+ eye: 13,
14
+ hair: 14
15
+ };
16
+ function clamp(value, low, high) {
17
+ return Math.min(Math.max(value, low), high);
18
+ }
19
+ function characterParams(desc) {
20
+ switch (desc.kind) {
21
+ case "skin": {
22
+ let s = desc.scatter ?? HUMAN_SCATTER_MM;
23
+ return [
24
+ clamp(s[0], 0, (50)),
25
+ clamp(s[1], 0, (50)),
26
+ clamp(s[2], 0, (50)),
27
+ Math.max(desc.thickness ?? (1.5), 0)
28
+ ];
29
+ }
30
+ case "eye":
31
+ return [
32
+ clamp(desc.irisRadius ?? (0.18), 0, (0.5)),
33
+ clamp(desc.irisDepth ?? (0.04), 0, (0.5)),
34
+ clamp(desc.limbus ?? (0.02), 0, (0.5)),
35
+ clamp(desc.pupil ?? (0.35), 0, 1)
36
+ ];
37
+ case "hair":
38
+ return [
39
+ clamp(desc.melanin ?? (0.5), 0, 1),
40
+ clamp(desc.redness ?? (0.2), 0, 1),
41
+ clamp(desc.azimuthalRoughness ?? (0.3), 0, 1),
42
+ clamp(desc.density ?? (1), 0, (8))
43
+ ];
44
+ }
45
+ }
46
+ var FLOAT = new Float32Array(1), WORD = new Uint32Array(FLOAT.buffer);
47
+ function bits(value) {
48
+ return FLOAT[0] = value === 0 ? -0 : value, WORD[0];
49
+ }
50
+ function writeCharacterWords(desc, write) {
51
+ if (characterParams(desc).forEach((value, i) => write(40 + i, bits(value))), desc.kind !== "skin") return;
52
+ let tuned = [
53
+ [(60), desc.sheen],
54
+ [(61), desc.sheenRoughness],
55
+ [(62), desc.warmth],
56
+ [(49), desc.rim]
57
+ ];
58
+ for (let [at, value] of tuned) value !== void 0 && write(at, bits(clamp(value, 0, 1)));
59
+ }
60
+
61
+ // src/game/backends/engine/material-state.ts
62
+ var FLOAT2 = new Float32Array(1), WORD2 = new Uint32Array(FLOAT2.buffer), STENCIL_FULL_MASK = 255, RGB = 3, BYTE_BITS = 8, BYTE_MAX = 255, SRGB_KNEE = 0.04045, SRGB_SLOPE = 12.92, SRGB_OFFSET = 0.055, SRGB_GAMMA = 2.4;
63
+ function floatBits(value) {
64
+ return FLOAT2[0] = value, WORD2[0];
65
+ }
66
+ function compare(func) {
67
+ return func === void 0 ? 0 : 1 + chunk7AAIAVAA_js.COMPARE_FUNCTIONS.indexOf(func);
68
+ }
69
+ function renderState(state) {
70
+ let equation = state.blend?.equation ?? "add", word = compare(state.depthFunc) << 0;
71
+ return word |= chunk7AAIAVAA_js.BLEND_EQUATIONS.indexOf(equation) << 4, word |= chunk7AAIAVAA_js.BLEND_EQUATIONS.indexOf(state.blend?.alphaEquation ?? equation) << 7, state.alphaToCoverage && (word |= 1024), state.transparency === "oit" && (word |= 2048), state.stencil && (word |= 8192), word >>> 0;
72
+ }
73
+ function blendFactors(blend) {
74
+ if (!blend) return 0;
75
+ let src = blend.src ?? "srcAlpha", dst = blend.dst ?? "oneMinusSrcAlpha";
76
+ return (chunk7AAIAVAA_js.BLEND_FACTORS.indexOf(src) << 0 | chunk7AAIAVAA_js.BLEND_FACTORS.indexOf(dst) << 5 | chunk7AAIAVAA_js.BLEND_FACTORS.indexOf(blend.srcAlpha ?? src) << 10 | chunk7AAIAVAA_js.BLEND_FACTORS.indexOf(blend.dstAlpha ?? dst) << 15) >>> 0;
77
+ }
78
+ function stencil(desc) {
79
+ return desc ? (compare(desc.func ?? "always") << 0 | ((desc.ref ?? 0) & 255) << 4 | ((desc.readMask ?? (255)) & 255) << 12 | ((desc.writeMask ?? (255)) & 255) << 20) >>> 0 : 0;
80
+ }
81
+ function stencilOps(desc) {
82
+ return desc ? chunk7AAIAVAA_js.STENCIL_OPERATIONS.indexOf(desc.fail ?? "keep") << 0 | chunk7AAIAVAA_js.STENCIL_OPERATIONS.indexOf(desc.depthFail ?? "keep") << 3 | chunk7AAIAVAA_js.STENCIL_OPERATIONS.indexOf(desc.pass ?? "keep") << 6 : 0;
83
+ }
84
+ function writeMaterialState(state, write) {
85
+ let planes = state.clippingPlanes?.length ?? 0;
86
+ if (planes > 4) throw new RangeError(`materials clip against at most ${4} planes`);
87
+ write(32, renderState(state)), write(33, blendFactors(state.blend)), write(34, stencil(state.stencil)), write(35, stencilOps(state.stencil)), write(36, floatBits(state.polygonOffset?.factor ?? 0)), write(37, floatBits(state.polygonOffset?.units ?? 0)), write(38, planes), write(39, explicit(state.envMapIntensity));
88
+ }
89
+ function explicit(value) {
90
+ return value === void 0 ? 0 : floatBits(value === 0 ? -0 : value);
91
+ }
92
+ function linear(channel) {
93
+ return channel <= (0.04045) ? channel / (12.92) : ((channel + (0.055)) / (1 + (0.055))) ** (2.4);
94
+ }
95
+ function writeColor(write, at, hex, scale) {
96
+ if (hex !== void 0)
97
+ for (let i = 0; i < (3); i++) {
98
+ let channel = (hex >> ((3) - 1 - i) * (8) & (255)) / (255);
99
+ write(at + i, explicit(linear(channel) * scale));
100
+ }
101
+ }
102
+ function writeMaterialExtension(desc, write) {
103
+ if (writeMaterialState(desc, write), desc.kind !== "physical") return;
104
+ writeColor(write, 40, desc.sheenColor, desc.sheen ?? 0), write(43, explicit(desc.sheenRoughness)), writeColor(write, 44, desc.specularColor, 1), write(47, explicit(desc.specularIntensity)), write(48, explicit(desc.thickness)), write(49, explicit(desc.iridescence)), write(59, explicit(desc.clearcoatNormalScale)), writeColor(write, 28, desc.attenuationColor, 1), write(31, explicit(desc.attenuationDistance)), write(60, explicit(desc.iridescenceIOR));
105
+ let thickness = desc.iridescenceThicknessRange;
106
+ thickness !== void 0 && (write(61, explicit(thickness[0])), write(62, explicit(thickness[1])));
107
+ }
108
+ var UNDRAWN_PHYSICAL_MAPS = ["iridescenceMap", "iridescenceThicknessMap", "anisotropyMap"];
109
+ function refuseUndrawnPhysicalFields(desc) {
110
+ if (desc.kind === "physical") {
111
+ for (let field of UNDRAWN_PHYSICAL_MAPS)
112
+ if (desc[field] !== void 0)
113
+ throw new chunk2V7IL4HC_js.GameError(
114
+ "unsupported_feature",
115
+ `the engine renderer does not draw ${field} on physical materials; remove it, or bake it into the base maps`
116
+ );
117
+ if ((desc.dispersion ?? 0) > 0)
118
+ throw new chunk2V7IL4HC_js.GameError(
119
+ "unsupported_feature",
120
+ "the engine renderer does not draw dispersion on physical materials; remove it or set it to 0"
121
+ );
122
+ }
123
+ }
124
+ function extraTextures(desc) {
125
+ return desc.kind !== "physical" ? [] : [
126
+ desc.clearcoatMap,
127
+ desc.clearcoatRoughnessMap,
128
+ desc.clearcoatNormalMap,
129
+ desc.sheenColorMap,
130
+ desc.sheenRoughnessMap,
131
+ desc.specularIntensityMap,
132
+ desc.specularColorMap,
133
+ desc.transmissionMap
134
+ ];
135
+ }
136
+ function writePlanes(state, out) {
137
+ let planes = state.clippingPlanes;
138
+ return !planes || planes.length === 0 ? false : (planes.forEach((plane, i) => out.set(plane, i * 4)), true);
139
+ }
140
+ function writeTextureTransforms(desc, out, write) {
141
+ if (!desc.textureTransforms) return false;
142
+ let mask = 0;
143
+ for (let [slot, transform] of Object.entries(desc.textureTransforms)) {
144
+ if (!transform) continue;
145
+ let index = materialSlotIndex(slot), at = index * 8;
146
+ out[at + 0] = transform.offset?.[0] ?? 0, out[at + 0 + 1] = transform.offset?.[1] ?? 0, out[at + 2] = transform.repeat?.[0] ?? 1, out[at + 2 + 1] = transform.repeat?.[1] ?? 1, out[at + 4] = transform.rotation ?? 0, out[at + 5] = transform.center?.[0] ?? 0, out[at + 5 + 1] = transform.center?.[1] ?? 0, out[at + 7] = transform.channel ?? 0, mask |= 1 << index;
147
+ }
148
+ return write(50, mask), mask !== 0;
149
+ }
150
+
151
+ // src/game/backends/engine/features.ts
152
+ var MATERIAL_TOON = 7, MATERIAL_MATCAP = 8, SLOT_AUX = 13, NODE_BUFFER_PROBE_SH = 4, NODE_FLAG_PROBE_ENVIRONMENT = 16, SHADOW_PCF = 0, SHADOW_PCSS = 1, OP_MARK_PROBE = 49, OP_SET_SPRITE = 58, OP_SET_PROJECTION = 59, CREATE_POINT_SHADOWS = 22, PROBE_SH_FLOATS = 27, NODE_SPRITE_CENTER = 61, NODE_SPRITE_ROTATION = 63, OWNER_STAGING = 15;
153
+ var CAP_SPRITE_TRANSFORM = 1 << 27, CAP_CUSTOM_PROJECTION = 1 << 28, CAP_POINT_SHADOWS = 1 << 30, MAT4 = 16, UNORM16 = 65535, TAU = Math.PI * 2, DEGREES_TO_RADIANS = Math.PI / 180, DEFAULT_SPRITE_CENTER = 0.5, DEFAULT_LINE_WIDTH = 1, DEFAULT_PROBE_INTENSITY = 1, SKY_DEFAULTS = { turbidity: 10, rayleigh: 2, mie: 5e-3, mieDirectionalG: 0.8 }, CLOUD_DEFAULTS = { coverage: 0.4, density: 0.6, scale: 1, speed: 1, elevation: 0.5 }, WORD_BYTES = 4, CREATE_ALIGN = 16, LIGHT_KINDS = {
154
+ directional: 0,
155
+ point: 1,
156
+ spot: 2,
157
+ ambient: 3,
158
+ hemisphere: 4,
159
+ probe: 5,
160
+ rectArea: 6,
161
+ reflectionProbe: 7
162
+ }, MATERIAL_KINDS = {
163
+ standard: 0,
164
+ physical: 1,
165
+ toon: (7),
166
+ matcap: (8),
167
+ unlit: 2,
168
+ sprite: 3,
169
+ points: 4,
170
+ lines: 5,
171
+ shader: 6,
172
+ ...CHARACTER_KINDS
173
+ }, RGB_MASK = 16777215;
174
+ function tintChannel(words, at, color, bit) {
175
+ return words[at] = color === void 0 ? 0 : (color & (16777215)) >>> 0, color === void 0 ? 0 : bit;
176
+ }
177
+ function writeTintWords(tint, words, at) {
178
+ let enabled = tintChannel(words, at, tint?.primary, 1) | tintChannel(words, at + 1, tint?.secondary, 2) | tintChannel(words, at + 2, tint?.tertiary, 4);
179
+ words[at + 3] = enabled;
180
+ }
181
+ function writeMaterialTint(desc, d) {
182
+ let tint = chunkIIDZ5WUX_js.materialTint(desc);
183
+ return tint.tintable ? (tint.mask !== void 0 && (d[51 + (13 - chunk7AAIAVAA_js.CORE_MATERIAL_SLOTS)] = tint.mask), 512) : 0;
184
+ }
185
+ var SHADOW_TYPES = { pcf: (0), pcss: (1) };
186
+ function materialSlotIndex(slot) {
187
+ return slot === "gradientMap" || slot === "matcap" ? (13) : chunk7AAIAVAA_js.MATERIAL_SLOTS.indexOf(slot);
188
+ }
189
+ function explicitFloat(value) {
190
+ return floatBits(value === 0 ? -0 : value);
191
+ }
192
+ function anisotropyWord(strength, rotation) {
193
+ let s = Math.round(Math.min(Math.max(strength, 0), 1) * (65535)), turns = (rotation % TAU + TAU) % TAU;
194
+ return ((Math.round(turns / TAU * (65535)) & (65535)) << 16 | s) >>> 0;
195
+ }
196
+ function materialFeatureFlags(desc) {
197
+ switch (desc.kind) {
198
+ case "toon":
199
+ return 64;
200
+ case "matcap":
201
+ return desc.flatShading ? 32 : 0;
202
+ case "lines":
203
+ return desc.worldUnits ? 256 : 0;
204
+ case "sprite":
205
+ return desc.sizeAttenuation === false ? 0 : 128;
206
+ default:
207
+ return 0;
208
+ }
209
+ }
210
+ function linearChannel(channel) {
211
+ return channel <= 0.04045 ? channel / 12.92 : ((channel + 0.055) / 1.055) ** 2.4;
212
+ }
213
+ function writeLinearHex(f, at, hex) {
214
+ f[at] = linearChannel((hex >> 16 & 255) / 255), f[at + 1] = linearChannel((hex >> 8 & 255) / 255), f[at + 2] = linearChannel((hex & 255) / 255);
215
+ }
216
+ function writeMaterialFeatures(desc, d, f) {
217
+ let aux = 51 + ((13) - chunk7AAIAVAA_js.CORE_MATERIAL_SLOTS);
218
+ switch (desc.kind) {
219
+ case "toon":
220
+ d[15] = desc.map ?? 0, d[16] = desc.normalMap ?? 0, d[19] = desc.emissiveMap ?? 0, d[20] = desc.aoMap ?? 0, writeLinearHex(f, 7, desc.emissive ?? 0), f[10] = desc.emissiveIntensity ?? 1, d[aux] = desc.gradientMap ?? 0;
221
+ break;
222
+ case "matcap":
223
+ d[15] = desc.map ?? 0, d[16] = desc.normalMap ?? 0, d[aux] = desc.matcap ?? 0;
224
+ break;
225
+ case "lines":
226
+ f[21] = desc.width ?? (1), desc.dashSize !== void 0 && (d[60] = explicitFloat(desc.dashSize)), desc.gapSize !== void 0 && (d[61] = explicitFloat(desc.gapSize)), desc.dashScale !== void 0 && (d[62] = explicitFloat(desc.dashScale));
227
+ break;
228
+ case "physical":
229
+ desc.anisotropy !== void 0 && desc.anisotropy > 0 && (d[63] = anisotropyWord(desc.anisotropy, desc.anisotropyRotation ?? 0));
230
+ break;
231
+ }
232
+ }
233
+ function writeSky(desc, d, f) {
234
+ let sky = desc.sky;
235
+ if (desc.background !== void 0 && "sky" in desc.background && (d[0] = 3), !sky) {
236
+ d[19] = 0;
237
+ return;
238
+ }
239
+ d[19] = 1, f[20] = sky.turbidity ?? SKY_DEFAULTS.turbidity, f[21] = sky.rayleigh ?? SKY_DEFAULTS.rayleigh, f[22] = sky.mie ?? SKY_DEFAULTS.mie, f[23] = sky.mieDirectionalG ?? SKY_DEFAULTS.mieDirectionalG;
240
+ let clouds = sky.clouds;
241
+ if (!clouds) {
242
+ f[24] = 0;
243
+ return;
244
+ }
245
+ f[24] = clouds.coverage ?? CLOUD_DEFAULTS.coverage, f[25] = clouds.density ?? CLOUD_DEFAULTS.density, f[26] = clouds.scale ?? CLOUD_DEFAULTS.scale, f[27] = clouds.speed ?? CLOUD_DEFAULTS.speed, f[28] = clouds.elevation ?? CLOUD_DEFAULTS.elevation;
246
+ }
247
+ function writeNodeFeatures(desc, d, f, spriteRotation) {
248
+ let lod = desc.lod;
249
+ switch (lod && (f[34] = lod.near ?? 0, f[35] = lod.far ?? 0, f[36] = lod.hysteresis ?? 0), desc.kind) {
250
+ case "sprite":
251
+ d[(61)] = explicitFloat(desc.center?.[0] ?? (0.5)), d[(61) + 1] = explicitFloat(desc.center?.[1] ?? (0.5)), d[(63)] = explicitFloat(spriteRotation);
252
+ break;
253
+ case "decal":
254
+ d[0] = 10, d[2] = desc.material, desc.angleFade !== void 0 && (f[32] = desc.angleFade), desc.fade !== void 0 && (f[33] = desc.fade);
255
+ break;
256
+ case "light":
257
+ if (d[5] = LIGHT_KINDS[desc.light], desc.shadow?.type !== void 0 && (d[50] = SHADOW_TYPES[desc.shadow.type]), desc.light === "rectArea")
258
+ f[51] = desc.width ?? 1, f[52] = desc.height ?? 1;
259
+ else if (desc.light === "probe")
260
+ desc.fromEnvironment && (d[3] |= (16));
261
+ else if (desc.light === "reflectionProbe") {
262
+ if (desc.texture === void 0) throw new chunk2V7IL4HC_js.GameError("invalid_argument", "reflection probes need a cube or equirect texture");
263
+ d[53] = desc.texture;
264
+ let min = desc.boxMin ?? [-1, -1, -1], max = desc.boxMax ?? [1, 1, 1];
265
+ for (let i = 0; i < 3; i++)
266
+ f[54 + i] = min[i], f[57 + i] = max[i];
267
+ d[60] = explicitFloat(desc.intensity ?? (1));
268
+ }
269
+ break;
270
+ }
271
+ }
272
+ function glToEngineProjection(gl, out, offset = 0) {
273
+ for (let c = 0; c < 4; c++) {
274
+ let o = c * 4;
275
+ out[offset + o] = gl[o], out[offset + o + 1] = gl[o + 1], out[offset + o + 2] = 0.5 * gl[o + 3] - 0.5 * gl[o + 2], out[offset + o + 3] = gl[o + 3];
276
+ }
277
+ }
278
+ function viewOffsetProjection(camera, aspect, view, out) {
279
+ if (camera.perspective) {
280
+ let top2 = camera.near * Math.tan(DEGREES_TO_RADIANS * 0.5 * camera.fov), height = 2 * top2, width = aspect * height, left2 = -0.5 * width;
281
+ left2 += view.x * width / view.fullWidth, top2 -= view.y * height / view.fullHeight, width *= view.width / view.fullWidth, height *= view.height / view.fullHeight, chunkAZ5BGWHB_js.mat4Frustum(out, 0, left2, left2 + width, top2 - height, top2, camera.near, camera.far);
282
+ return;
283
+ }
284
+ let halfHeight = camera.height / 2, halfWidth = halfHeight * aspect, scaleW = 2 * halfWidth / view.fullWidth, scaleH = 2 * halfHeight / view.fullHeight, left = -halfWidth + scaleW * view.x, right = left + scaleW * view.width, top = halfHeight - scaleH * view.y, bottom = top - scaleH * view.height;
285
+ chunkAZ5BGWHB_js.mat4Orthographic(out, 0, left, right, bottom, top, camera.near, camera.far);
286
+ }
287
+ var EngineFeatures = class {
288
+ constructor(host) {
289
+ this.spriteRotations = /* @__PURE__ */ new Map();
290
+ this.cameras = /* @__PURE__ */ new Map();
291
+ this.glScratch = new Float64Array((16));
292
+ this.staging = null;
293
+ this.aspect = 1;
294
+ this.host = host;
295
+ }
296
+ has(cap) {
297
+ return (this.host.caps() & cap) !== 0;
298
+ }
299
+ require(cap, feature) {
300
+ if (!this.has(cap)) throw new chunk2V7IL4HC_js.GameError("unsupported_feature", `this engine build has no ${feature}; update the app to use it`);
301
+ }
302
+ material(id, desc) {
303
+ desc.kind === "sprite" && this.spriteRotations.set(id, desc.rotation ?? 0);
304
+ }
305
+ spriteRotation(material) {
306
+ return this.spriteRotations.get(material) ?? 0;
307
+ }
308
+ forgetMaterial(id) {
309
+ this.spriteRotations.delete(id);
310
+ }
311
+ node(id, desc) {
312
+ if (desc.kind === "camera") {
313
+ let perspective = desc.projection !== "orthographic";
314
+ this.cameras.set(id, {
315
+ perspective,
316
+ fov: desc.projection === "perspective" ? desc.fov ?? 0 : 0,
317
+ height: desc.projection === "orthographic" ? desc.height : 0,
318
+ near: desc.near ?? 0,
319
+ far: desc.far ?? 0,
320
+ offset: null,
321
+ custom: false
322
+ }), desc.projection === "custom" && this.setProjectionMatrix(id, desc.matrix, desc.near, desc.far);
323
+ return;
324
+ }
325
+ desc.kind === "light" && desc.light === "probe" && desc.sh && this.setProbeCoefficients(id, desc.sh);
326
+ }
327
+ forgetNode(id) {
328
+ this.cameras.delete(id);
329
+ }
330
+ perspective(id, fov, near, far) {
331
+ let camera = this.cameras.get(id);
332
+ camera && (camera.perspective = true, camera.fov = fov, camera.near = near, camera.far = far, camera.custom = false, camera.offset && this.sendOffset(id, camera));
333
+ }
334
+ perspectiveFrom(id, values, offset) {
335
+ let camera = this.cameras.get(id);
336
+ camera && (camera.perspective = true, camera.fov = values[offset], camera.near = values[offset + 1], camera.far = values[offset + 2], camera.custom = false, camera.offset && this.sendOffset(id, camera));
337
+ }
338
+ orthographic(id, height, near, far) {
339
+ let camera = this.cameras.get(id);
340
+ camera && (camera.perspective = false, camera.height = height, camera.near = near, camera.far = far, camera.custom = false, camera.offset && this.sendOffset(id, camera));
341
+ }
342
+ resize(width, height) {
343
+ this.aspect = width / Math.max(1, height);
344
+ for (let [id, camera] of this.cameras) camera.offset && this.sendOffset(id, camera);
345
+ }
346
+ setLod(node, near, far, hysteresis) {
347
+ let a = this.host.command(chunk7AAIAVAA_js.OP_SET_LOD, node);
348
+ this.host.floats[a] = near, this.host.floats[a + 1] = far, this.host.floats[a + 2] = hysteresis;
349
+ }
350
+ setSprite(node, rotation, centerX, centerY) {
351
+ this.require(CAP_SPRITE_TRANSFORM, "sprite rotation and center");
352
+ let a = this.host.command((58), node);
353
+ this.host.floats[a] = rotation, this.host.floats[a + 1] = centerX, this.host.floats[a + 2] = centerY;
354
+ }
355
+ setProbeCoefficients(node, sh) {
356
+ if (sh.length < (27)) throw new chunk2V7IL4HC_js.GameError("invalid_argument", `light probes take ${(27)} coefficients (9 RGB)`);
357
+ this.host.buffer(4, node, (4)).set(sh.subarray(0, (27))), this.host.command((49), node);
358
+ }
359
+ setProjectionMatrix(camera, matrix, near, far) {
360
+ this.require(CAP_CUSTOM_PROJECTION, "custom camera projections");
361
+ let state = this.cameras.get(camera);
362
+ state && (state.custom = matrix !== null, matrix !== null && (state.offset = null)), this.sendProjection(camera, matrix, near, far);
363
+ }
364
+ setViewOffset(camera, offset) {
365
+ this.require(CAP_CUSTOM_PROJECTION, "camera view offsets");
366
+ let state = this.cameras.get(camera);
367
+ if (!state) throw new chunk2V7IL4HC_js.GameError("unknown_resource", `node ${camera} is not a camera`);
368
+ if (state.offset = offset, offset === null) {
369
+ this.sendProjection(camera, null, state.near, state.far);
370
+ return;
371
+ }
372
+ this.sendOffset(camera, state);
373
+ }
374
+ readGpuStats(out) {
375
+ let r = this.host.registers;
376
+ out.gpuLastNs = r[chunk7AAIAVAA_js.STAT_GPU_LAST_NS], out.gpuP50Ns = r[chunk7AAIAVAA_js.STAT_GPU_P50_NS], out.gpuP95Ns = r[chunk7AAIAVAA_js.STAT_GPU_P95_NS], out.gpuBytes = r[chunk7AAIAVAA_js.STAT_GPU_BYTES_LOW] + r[chunk7AAIAVAA_js.STAT_GPU_BYTES_HIGH] * 4294967296, out.thermalTier = r[chunk7AAIAVAA_js.STAT_THERMAL_TIER], out.particlesAlive = r[chunk7AAIAVAA_js.STAT_PARTICLES_ALIVE], out.rawDispatches = r[chunk7AAIAVAA_js.STAT_RAW_DISPATCHES], out.rawGpuNs = r[chunk7AAIAVAA_js.STAT_RAW_GPU_NS], out.rawDisabled = r[chunk7AAIAVAA_js.STAT_RAW_DISABLED], out.transparentSorted = r[chunk7AAIAVAA_js.STAT_TRANSPARENT_SORTED], out.textGlyphs = r[chunk7AAIAVAA_js.STAT_TEXT_GLYPHS], out.drawCalls = r[chunk7AAIAVAA_js.STAT_DRAW_CALLS], out.triangles = r[chunk7AAIAVAA_js.STAT_TRIANGLES];
377
+ }
378
+ sendOffset(camera, state) {
379
+ let offset = state.offset;
380
+ offset && (viewOffsetProjection(state, this.aspect, offset, this.glScratch), this.sendProjection(camera, this.glScratch, state.near, state.far));
381
+ }
382
+ sendProjection(camera, matrix, near, far) {
383
+ if (matrix === null) {
384
+ this.sendBase(camera);
385
+ return;
386
+ }
387
+ this.host.flush(), glToEngineProjection(matrix, this.stagingView());
388
+ let a = this.host.command((59), camera);
389
+ this.host.floats[a] = near, this.host.floats[a + 1] = far, this.host.flush();
390
+ }
391
+ sendBase(camera) {
392
+ let state = this.cameras.get(camera), perspective = state?.perspective ?? true, a = this.host.command(perspective ? 9 : 10, camera);
393
+ this.host.floats[a] = perspective ? state?.fov || 60 : state?.height ?? 1, this.host.floats[a + 1] = state?.near || 0.1, this.host.floats[a + 2] = state?.far || 1e3;
394
+ }
395
+ stagingView() {
396
+ return (this.staging === null || this.staging.length === 0) && (this.staging = this.host.buffer((15), 0, 0)), this.staging;
397
+ }
398
+ };
399
+ function createWithDescriptor(runtime, options, create) {
400
+ let bytes = 64 * (4);
401
+ if (typeof runtime.exports.engine_alloc != "function") return create(0);
402
+ let pointer = runtime.exports.engine_alloc(bytes, (16));
403
+ if (pointer === 0) return create(0);
404
+ try {
405
+ let words = new Uint32Array(runtime.memory.buffer, pointer, 64);
406
+ return words.fill(0), words[(22)] = options.pointShadows === !1 ? 0 : 1, create(pointer);
407
+ } finally {
408
+ runtime.exports.engine_free(pointer, bytes, (16));
409
+ }
410
+ }
411
+
412
+ // src/game/audio/worklet-processor.ts
413
+ var WORKLET_PROCESSOR_NAME = "cimplify-audio";
414
+ var WORKLET_PROCESSOR_SOURCE = `
415
+ const RING_HEADER_WORDS = 2;
416
+ const RING_WRITE = 0;
417
+ const RING_READ = 1;
418
+
419
+ class CimplifyAudioProcessor extends AudioWorkletProcessor {
420
+ constructor(options) {
421
+ super();
422
+ const o = options.processorOptions;
423
+ const instance = new WebAssembly.Instance(o.module, {});
424
+ this.x = instance.exports;
425
+ const sizes = new Uint32Array(this.x.memory.buffer, this.x.worklet_sizes(), o.sizes.length);
426
+ for (let k = 0; k < o.sizes.length; k++) sizes[k] = o.sizes[k];
427
+ this.host = this.x.worklet_create(sampleRate, o.voices, o.inputWords);
428
+ this.capacity = this.x.worklet_input_words(this.host);
429
+ this.pending = 0;
430
+ this.queue = [];
431
+ this.queued = 0;
432
+ this.reportQuanta = o.reportQuanta;
433
+ this.quanta = 0;
434
+ this.buffer = null;
435
+ this.inbound = o.inbound === null ? null : new Int32Array(o.inbound);
436
+ this.outbound = o.outbound === null ? null : new Int32Array(o.outbound);
437
+ if (this.inbound === null) {
438
+ this.port.onmessage = (event) => {
439
+ this.queue.push(event.data);
440
+ };
441
+ }
442
+ }
443
+
444
+ views() {
445
+ const buffer = this.x.memory.buffer;
446
+ if (this.buffer === buffer) return;
447
+ this.buffer = buffer;
448
+ this.input = new Uint32Array(buffer, this.x.worklet_input(this.host), this.capacity);
449
+ this.left = new Float32Array(buffer, this.x.worklet_output(this.host, 0), 4096);
450
+ this.right = new Float32Array(buffer, this.x.worklet_output(this.host, 1), 4096);
451
+ }
452
+
453
+ fromRing() {
454
+ const ring = this.inbound;
455
+ const capacity = ring.length - RING_HEADER_WORDS;
456
+ const write = Atomics.load(ring, RING_WRITE);
457
+ let read = Atomics.load(ring, RING_READ);
458
+ let available = (write - read) | 0;
459
+ const room = this.capacity - this.pending;
460
+ if (available > room) available = room;
461
+ for (let k = 0; k < available; k++) {
462
+ this.input[this.pending + k] = ring[RING_HEADER_WORDS + ((read + k) & (capacity - 1))];
463
+ }
464
+ this.pending += available;
465
+ Atomics.store(ring, RING_READ, (read + available) | 0);
466
+ }
467
+
468
+ fromQueue() {
469
+ while (this.queue.length > 0 && this.pending < this.capacity) {
470
+ const head = this.queue[0];
471
+ const take = Math.min(head.length - this.queued, this.capacity - this.pending);
472
+ this.input.set(head.subarray(this.queued, this.queued + take), this.pending);
473
+ this.pending += take;
474
+ this.queued += take;
475
+ if (this.queued === head.length) {
476
+ this.queue.shift();
477
+ this.queued = 0;
478
+ }
479
+ }
480
+ }
481
+
482
+ ingest() {
483
+ this.views();
484
+ if (this.inbound !== null) this.fromRing();
485
+ else this.fromQueue();
486
+ if (this.pending === 0) return;
487
+ const used = this.x.worklet_ingest(this.host, this.pending);
488
+ if (used > 0) {
489
+ this.input.copyWithin(0, used, this.pending);
490
+ this.pending -= used;
491
+ }
492
+ }
493
+
494
+ report() {
495
+ const words = this.x.worklet_report(this.host);
496
+ this.views();
497
+ const report = new Uint32Array(this.x.memory.buffer, this.x.worklet_report_buffer(this.host), words);
498
+ if (this.outbound === null) {
499
+ this.port.postMessage(report.slice());
500
+ return;
501
+ }
502
+ const ring = this.outbound;
503
+ const capacity = ring.length - RING_HEADER_WORDS;
504
+ const write = Atomics.load(ring, RING_WRITE);
505
+ const read = Atomics.load(ring, RING_READ);
506
+ if (capacity - ((write - read) | 0) < words) return;
507
+ for (let k = 0; k < words; k++) ring[RING_HEADER_WORDS + ((write + k) & (capacity - 1))] = report[k];
508
+ Atomics.store(ring, RING_WRITE, (write + words) | 0);
509
+ }
510
+
511
+ process(inputs, outputs) {
512
+ this.ingest();
513
+ const out = outputs[0];
514
+ const frames = out[0].length;
515
+ this.x.worklet_render(this.host, frames);
516
+ this.views();
517
+ out[0].set(this.left.subarray(0, frames));
518
+ if (out.length > 1) out[1].set(this.right.subarray(0, frames));
519
+ this.ingest();
520
+ this.quanta += 1;
521
+ if (this.quanta >= this.reportQuanta) {
522
+ this.quanta = 0;
523
+ this.report();
524
+ }
525
+ return true;
526
+ }
527
+ }
528
+
529
+ registerProcessor("${WORKLET_PROCESSOR_NAME}", CimplifyAudioProcessor);
530
+ `;
531
+
532
+ // src/game/audio/output.ts
533
+ var outputs = /* @__PURE__ */ new WeakMap();
534
+ function audioOutput(context) {
535
+ let output = outputs.get(context);
536
+ return output === void 0 ? context.destination : output;
537
+ }
538
+
539
+ // src/game/audio/worklet.ts
540
+ var ENGINE_MIX_RATE = 48e3, DEFAULT_PUMP_WORDS = 65536, DEFAULT_RING_WORDS = 1 << 20, DEFAULT_IDLE_PUMPS = 120, WORD_BYTES2 = 4, OUTPUT_CHANNELS = 2, MASTER_BUS = 0, METER_FLOATS = 2, METER_PEAK2 = 0, RUNNING = "running", DEFAULT_WORKLET_SIZES = {
541
+ arenaFloats: 1 << 23,
542
+ streamFrames: 65536,
543
+ reverbs: 2,
544
+ reverbPartitions: 1024,
545
+ banks: 4,
546
+ emitters: 2048
547
+ };
548
+ function sizeWords(sizes) {
549
+ return [sizes.arenaFloats, sizes.streamFrames, sizes.reverbs, sizes.reverbPartitions, sizes.banks, sizes.emitters];
550
+ }
551
+ function ring(words) {
552
+ return new SharedArrayBuffer((2 + words) * (4));
553
+ }
554
+ function blobUrl(source) {
555
+ return URL.createObjectURL(new Blob([source], { type: "application/javascript" }));
556
+ }
557
+ function defaultNode(context, name, options) {
558
+ let Node = globalThis.AudioWorkletNode;
559
+ return new Node(context, name, {
560
+ numberOfInputs: 0,
561
+ numberOfOutputs: 1,
562
+ outputChannelCount: [(2)],
563
+ processorOptions: options
564
+ });
565
+ }
566
+ function sharedMemoryAvailable() {
567
+ return typeof SharedArrayBuffer == "function" && globalThis.crossOriginIsolated === true;
568
+ }
569
+ var WorkletAudio = class _WorkletAudio {
570
+ constructor(engine, handle, shared, pumpWords, ringWords, context, idlePumps) {
571
+ this.backlog = [];
572
+ this.reports = [];
573
+ this.node = null;
574
+ this.failed = null;
575
+ this.meterView = null;
576
+ this.quiet = 0;
577
+ this.idled = false;
578
+ this.hidden = false;
579
+ this.engine = engine, this.handle = handle, this.shared = shared, this.stagingWords = pumpWords, this.staging = engine.allocate(pumpWords * (4)), this.inbound = shared ? new Int32Array(ring(ringWords)) : null, this.outbound = shared ? new Int32Array(ring(ringWords)) : null, this.context = context, this.idlePumps = idlePumps;
580
+ }
581
+ static create(engine, options) {
582
+ let create = engine.exports.engine_audio_relay_create;
583
+ if (!create) throw new chunk2V7IL4HC_js.GameError("unsupported_feature", "this engine build has no web audio relay");
584
+ let sizes = options.sizes ?? DEFAULT_WORKLET_SIZES, words = sizeWords(sizes), pointer = engine.allocate(6 * (4));
585
+ new Uint32Array(engine.memory.buffer, pointer, 6).set(words);
586
+ let voices = options.voices ?? 64, handle = create((48e3), voices, pointer);
587
+ if (engine.release(pointer, 6 * (4)), handle === 0) throw new chunk2V7IL4HC_js.GameError("invalid_argument", "the engine refused the web audio relay sizes");
588
+ let shared = options.shared ?? sharedMemoryAvailable(), pumpWords = options.pumpWords ?? (65536), ringWords = options.ringWords ?? DEFAULT_RING_WORDS;
589
+ if (ringWords & ringWords - 1 || ringWords < pumpWords) throw new chunk2V7IL4HC_js.GameError("invalid_argument", "the ring holds a power of two words, at least one pump");
590
+ let idlePumps = options.idlePumps ?? (120), audio = new _WorkletAudio(engine, handle, shared, pumpWords, ringWords, options.context, idlePumps), url = (options.moduleUrl ?? blobUrl)(WORKLET_PROCESSOR_SOURCE);
591
+ return Promise.all([options.context.audioWorklet.addModule(url), options.module]).then(([, module]) => {
592
+ let processor = {
593
+ module,
594
+ voices,
595
+ sizes: words,
596
+ inputWords: pumpWords * 2,
597
+ reportQuanta: options.reportQuanta ?? 8,
598
+ inbound: audio.inbound === null ? null : audio.inbound.buffer,
599
+ outbound: audio.outbound === null ? null : audio.outbound.buffer
600
+ };
601
+ audio.attach((options.createNode ?? defaultNode)(options.context, WORKLET_PROCESSOR_NAME, processor), options.context);
602
+ }).catch((cause) => {
603
+ audio.failed = cause;
604
+ }), audio;
605
+ }
606
+ get idle() {
607
+ return this.idled;
608
+ }
609
+ suspend() {
610
+ this.hidden = true, this.context.suspend?.();
611
+ }
612
+ resume() {
613
+ this.hidden = false, this.idled = false, this.quiet = 0, this.context.resume?.();
614
+ }
615
+ silent() {
616
+ let buffer = this.engine.memory.buffer, view = this.meterView;
617
+ return (view === null || view.buffer !== buffer) && (view = new Float32Array(buffer, this.staging, (2)), this.meterView = view), this.engine.exports.engine_audio_meter(this.handle, (0), this.staging), view[(0)] === 0;
618
+ }
619
+ settle(sent) {
620
+ if (sent > 0 || !this.silent()) {
621
+ this.quiet = 0, this.idled && !this.hidden && (this.idled = false, this.context.resume?.());
622
+ return;
623
+ }
624
+ this.idled || this.hidden || this.node === null || this.context.state !== RUNNING || (this.quiet += 1, !(this.quiet < this.idlePumps) && (this.idled = true, this.context.suspend?.()));
625
+ }
626
+ get ready() {
627
+ return this.node !== null;
628
+ }
629
+ get error() {
630
+ return this.failed;
631
+ }
632
+ attach(node, context) {
633
+ this.node = node, this.shared || (node.port.onmessage = (event) => {
634
+ this.reports.push(event.data);
635
+ }), node.connect(audioOutput(context)), this.drainBacklog();
636
+ }
637
+ send(words) {
638
+ let node = this.node;
639
+ if (node === null) return false;
640
+ let ring2 = this.inbound;
641
+ if (ring2 === null)
642
+ return node.port.postMessage(words, [words.buffer]), true;
643
+ let capacity = ring2.length - 2, write = Atomics.load(ring2, 0), read = Atomics.load(ring2, 1);
644
+ if (capacity - (write - read | 0) < words.length) return false;
645
+ for (let k = 0; k < words.length; k++) ring2[2 + (write + k & capacity - 1)] = words[k];
646
+ return Atomics.store(ring2, 0, write + words.length | 0), true;
647
+ }
648
+ drainBacklog() {
649
+ for (; this.backlog.length > 0 && this.send(this.backlog[0]); ) this.backlog.shift();
650
+ }
651
+ receive(words) {
652
+ let receive = this.engine.exports.engine_audio_relay_receive;
653
+ if (!receive || words.length === 0) return;
654
+ let bytes = words.length * (4), pointer = words.length <= this.stagingWords ? this.staging : this.engine.allocate(bytes);
655
+ new Uint32Array(this.engine.memory.buffer, pointer, words.length).set(words), receive(this.handle, pointer, words.length), pointer !== this.staging && this.engine.release(pointer, bytes);
656
+ }
657
+ collect() {
658
+ if (this.outbound === null) {
659
+ for (let report of this.reports) this.receive(report);
660
+ this.reports.length = 0;
661
+ return;
662
+ }
663
+ let ring2 = this.outbound, capacity = ring2.length - 2, write = Atomics.load(ring2, 0), read = Atomics.load(ring2, 1), available = write - read | 0;
664
+ if (available <= 0) return;
665
+ let words = new Uint32Array(available);
666
+ for (let k = 0; k < available; k++) words[k] = ring2[2 + (read + k & capacity - 1)];
667
+ Atomics.store(ring2, 1, read + available | 0), this.receive(words);
668
+ }
669
+ pump() {
670
+ let pump = this.engine.exports.engine_audio_relay_pump;
671
+ if (!pump) return;
672
+ this.collect(), this.drainBacklog();
673
+ let sent = this.backlog.length;
674
+ for (; ; ) {
675
+ let words = pump(this.handle, this.staging, this.stagingWords);
676
+ if (words <= 0) break;
677
+ sent += words;
678
+ let batch = new Uint32Array(this.engine.memory.buffer, this.staging, words).slice();
679
+ (this.backlog.length > 0 || !this.send(batch)) && this.backlog.push(batch);
680
+ }
681
+ this.settle(sent);
682
+ }
683
+ };
684
+
685
+ // src/game/audio/headless.ts
686
+ var NO_SOUND = -1, NO_BUS = -1, MATRIX_TRANSLATION = 12, FILTER_WORDS = 4, LOOP_WORDS = 3, RATE_WORDS = 2, HEADLESS_SAMPLE_RATE = 48e3, DEFAULT_STREAM_SECONDS = 180, SEND_KEY = 1024, HeadlessAudio = class {
687
+ constructor(maxVoices = 64) {
688
+ this.name = "headless";
689
+ this.capabilities = chunkX5A5FOWW_js.FULL_AUDIO_CAPABILITIES;
690
+ this.sampleRate = (48e3);
691
+ this.unlockedValue = false;
692
+ this.soundCount = 0;
693
+ this.busCount = 0;
694
+ this.busGains = [];
695
+ this.busFilters = [];
696
+ this.busMeters = [];
697
+ this.sends = /* @__PURE__ */ new Map();
698
+ this.reverbs = /* @__PURE__ */ new Map();
699
+ this.analysers = [];
700
+ this.analyserBus = [];
701
+ this.streams = [];
702
+ this.listener = new Float32Array(16);
703
+ this.nextVoice = 0;
704
+ this.voiceSound = new Int32Array(maxVoices).fill((-1)), this.voiceLoop = new Uint8Array(maxVoices), this.voicePosition = new Float32Array(maxVoices * 3), this.voiceGain = new Float32Array(maxVoices), this.voiceRate = new Float32Array(maxVoices * (2)), this.voiceLoopPoints = new Float32Array(maxVoices * (3)), this.voiceSpatial = new Float32Array(maxVoices * chunkX5A5FOWW_js.SPATIAL_WORDS);
705
+ }
706
+ get unlocked() {
707
+ return this.unlockedValue;
708
+ }
709
+ unlock() {
710
+ this.unlockedValue = true;
711
+ }
712
+ decode(_source) {
713
+ return Promise.resolve(this.soundCount++);
714
+ }
715
+ createSound(samples, channels, sampleRate) {
716
+ if (channels < 1 || sampleRate <= 0 || samples.length % channels !== 0) throw new chunk2V7IL4HC_js.GameError("invalid_argument", "sound PCM must be interleaved whole frames");
717
+ return this.soundCount++;
718
+ }
719
+ createBus(_name, _parent) {
720
+ this.busGains.push(1);
721
+ for (let i = 0; i < (4); i++) this.busFilters.push(i === 0 ? chunkX5A5FOWW_js.FILTER_OFF : 0);
722
+ return this.busMeters.push(0, 0), this.busCount++;
723
+ }
724
+ setBusGain(bus, gain, _rampSeconds) {
725
+ this.busGains[bus] = gain;
726
+ }
727
+ busGain(bus) {
728
+ return this.busGains[bus];
729
+ }
730
+ setBusFilter(bus, kind, frequency, q, gainDb) {
731
+ let o = bus * (4);
732
+ this.busFilters[o] = kind, this.busFilters[o + 1] = frequency, this.busFilters[o + 2] = q, this.busFilters[o + 3] = gainDb;
733
+ }
734
+ busFilter(bus, out) {
735
+ for (let i = 0; i < (4); i++) out[i] = this.busFilters[bus * (4) + i];
736
+ }
737
+ meter(bus, out) {
738
+ out[chunkX5A5FOWW_js.METER_PEAK] = this.busMeters[bus * 2] ?? 0, out[chunkX5A5FOWW_js.METER_RMS] = this.busMeters[bus * 2 + 1] ?? 0;
739
+ }
740
+ inject(bus, samples) {
741
+ let peak = 0, energy = 0;
742
+ for (let i = 0; i < samples.length; i++) {
743
+ let v = samples[i], a = v < 0 ? -v : v;
744
+ a > peak && (peak = a), energy += v * v;
745
+ }
746
+ this.busMeters[bus * 2] = peak, this.busMeters[bus * 2 + 1] = samples.length > 0 ? Math.sqrt(energy / samples.length) : 0;
747
+ for (let a = 0; a < this.analysers.length; a++)
748
+ this.analyserBus[a] === bus && this.analysers[a].push(samples, 0, samples.length);
749
+ }
750
+ createAnalyser(bus, settings) {
751
+ return this.analysers.push(new chunk7AAIAVAA_js.FftAnalyser(settings)), this.analyserBus.push(bus), this.analysers.length - 1;
752
+ }
753
+ readAnalyser(analyser, mode, out) {
754
+ let found = this.analysers[analyser];
755
+ if (!found) throw new chunk2V7IL4HC_js.GameError("unknown_resource", `analyser ${analyser} does not exist`);
756
+ mode === chunkX5A5FOWW_js.ANALYSER_FREQUENCY ? found.frequency(out) : found.timeDomain(out);
757
+ }
758
+ createReverb(parent, impulse) {
759
+ let bus = this.createBus("reverb", parent);
760
+ return this.reverbs.set(bus, impulse), bus;
761
+ }
762
+ reverbImpulse(bus) {
763
+ return this.reverbs.get(bus) ?? (-1);
764
+ }
765
+ setBusSend(bus, target, gain) {
766
+ this.sends.set(bus * (1024) + target, gain);
767
+ }
768
+ busSend(bus, target) {
769
+ return this.sends.get(bus * (1024) + target) ?? 0;
770
+ }
771
+ play(sound, _bus, gain, rate, loop, _spatial) {
772
+ let voice = this.nextVoice;
773
+ return this.nextVoice = (this.nextVoice + 1) % this.voiceSound.length, this.voiceSound[voice] = sound, this.voiceLoop[voice] = loop ? 1 : 0, this.voiceGain[voice] = gain, this.voiceRate[voice * (2)] = rate, this.voiceRate[voice * (2) + 1] = 0, this.voiceLoopPoints[voice * (3)] = loop ? 1 : 0, this.voiceLoopPoints[voice * (3) + 1] = 0, this.voiceLoopPoints[voice * (3) + 2] = 0, voice;
774
+ }
775
+ stop(voice, _fadeSeconds) {
776
+ this.voiceSound[voice] = (-1);
777
+ }
778
+ isPlaying(voice) {
779
+ return this.voiceSound[voice] !== (-1);
780
+ }
781
+ setVoiceGain(voice, gain, _rampSeconds) {
782
+ this.voiceGain[voice] = gain;
783
+ }
784
+ voiceGainOf(voice) {
785
+ return this.voiceGain[voice];
786
+ }
787
+ setVoiceRate(voice, rate, detuneCents) {
788
+ this.voiceRate[voice * (2)] = rate, this.voiceRate[voice * (2) + 1] = detuneCents;
789
+ }
790
+ voiceRateOf(voice, out) {
791
+ out[0] = this.voiceRate[voice * (2)], out[1] = this.voiceRate[voice * (2) + 1];
792
+ }
793
+ setVoiceSpatial(voice, params) {
794
+ this.voiceSpatial.set(params.subarray(0, chunkX5A5FOWW_js.SPATIAL_WORDS), voice * chunkX5A5FOWW_js.SPATIAL_WORDS);
795
+ }
796
+ voiceSpatialOf(voice, out) {
797
+ for (let i = 0; i < chunkX5A5FOWW_js.SPATIAL_WORDS; i++) out[i] = this.voiceSpatial[voice * chunkX5A5FOWW_js.SPATIAL_WORDS + i];
798
+ }
799
+ setVoiceLoop(voice, loop, startSeconds, endSeconds) {
800
+ let o = voice * (3);
801
+ this.voiceLoop[voice] = loop ? 1 : 0, this.voiceLoopPoints[o] = loop ? 1 : 0, this.voiceLoopPoints[o + 1] = startSeconds, this.voiceLoopPoints[o + 2] = endSeconds;
802
+ }
803
+ voiceLoopOf(voice, out) {
804
+ for (let i = 0; i < (3); i++) out[i] = this.voiceLoopPoints[voice * (3) + i];
805
+ }
806
+ setVoicePosition(voice, matrix, offset) {
807
+ let o = voice * 3;
808
+ this.voicePosition[o] = matrix[offset + (12)], this.voicePosition[o + 1] = matrix[offset + (12) + 1], this.voicePosition[o + 2] = matrix[offset + (12) + 2];
809
+ }
810
+ voiceX(voice) {
811
+ return this.voicePosition[voice * 3];
812
+ }
813
+ setListener(matrix, offset) {
814
+ for (let i = 0; i < 16; i++) this.listener[i] = matrix[offset + i];
815
+ }
816
+ async openStream(_source, bus) {
817
+ return this.streams.push({ bus, state: chunkX5A5FOWW_js.STREAM_STOPPED, loop: false, gain: 1, time: 0, duration: (180) }), this.streams.length - 1;
818
+ }
819
+ stream(stream) {
820
+ let found = this.streams[stream];
821
+ if (!found) throw new chunk2V7IL4HC_js.GameError("unknown_resource", `stream ${stream} is not open`);
822
+ return found;
823
+ }
824
+ playStream(stream, gain, loop) {
825
+ let s = this.stream(stream);
826
+ s.state = chunkX5A5FOWW_js.STREAM_PLAYING, s.gain = gain, s.loop = loop;
827
+ }
828
+ pauseStream(stream) {
829
+ this.stream(stream).state = chunkX5A5FOWW_js.STREAM_PAUSED;
830
+ }
831
+ seekStream(stream, seconds) {
832
+ let s = this.stream(stream);
833
+ s.time = Math.max(0, Math.min(s.duration, seconds));
834
+ }
835
+ streamTime(stream) {
836
+ return this.stream(stream).time;
837
+ }
838
+ streamDuration(stream) {
839
+ return this.stream(stream).duration;
840
+ }
841
+ streamState(stream) {
842
+ return this.stream(stream).state;
843
+ }
844
+ closeStream(stream) {
845
+ this.streams[stream] = null;
846
+ }
847
+ commit(frame, at) {
848
+ let seconds = frame[at];
849
+ for (let i = 0; i < this.streams.length; i++) {
850
+ let s = this.streams[i];
851
+ s === null || s.state !== chunkX5A5FOWW_js.STREAM_PLAYING || (s.time += seconds, s.time >= s.duration && (s.loop ? s.time -= s.duration : (s.time = s.duration, s.state = chunkX5A5FOWW_js.STREAM_STOPPED)));
852
+ }
853
+ }
854
+ suspend() {
855
+ }
856
+ resume() {
857
+ }
858
+ dispose() {
859
+ this.voiceSound.fill((-1)), this.streams.length = 0, this.analyserBus.fill((-1));
860
+ }
861
+ };
862
+
863
+ // src/game/audio/web-audio.ts
864
+ var MASTER_PARENT = -1, MATRIX_TRANSLATION2 = 12, PANNER_REF_DISTANCE = 1, PANNER_MAX_DISTANCE = 100, RAMP_TIME_CONSTANT_DIVISOR = 3, METER_FFT_SIZE = 1024, SEND_KEY2 = 1024, WebAudioPort = class {
865
+ constructor(context, maxVoices = 64, options = {}) {
866
+ this.name = "web-audio";
867
+ this.buffers = [];
868
+ this.buses = [];
869
+ this.analysers = [];
870
+ this.sends = /* @__PURE__ */ new Map();
871
+ this.streams = [];
872
+ this.meterScratch = new Float32Array((1024));
873
+ this.nextVoice = 0;
874
+ this.context = context, this.voices = Array.from({ length: maxVoices }, () => ({ source: null, gain: null, panner: null })), this.onEnded = Array.from({ length: maxVoices }, (_, voice) => () => this.release(voice)), this.createMediaElement = options.createMediaElement ?? (typeof document > "u" ? null : () => document.createElement("audio"));
875
+ let streaming = this.createMediaElement !== null && typeof context.createMediaElementSource == "function";
876
+ this.capabilities = {
877
+ spatial: true,
878
+ filters: true,
879
+ meters: true,
880
+ analyser: true,
881
+ reverb: true,
882
+ sends: true,
883
+ loopPoints: true,
884
+ streaming,
885
+ detune: true,
886
+ procedural: true
887
+ };
888
+ }
889
+ get sampleRate() {
890
+ return this.context.sampleRate;
891
+ }
892
+ get unlocked() {
893
+ return this.context.state === "running";
894
+ }
895
+ unlock() {
896
+ this.context.state !== "running" && this.context.resume();
897
+ }
898
+ async decode(source) {
899
+ let bytes;
900
+ if ("bytes" in source) bytes = source.bytes.slice(0);
901
+ else if ("url" in source) bytes = await (await fetch(source.url)).arrayBuffer();
902
+ else throw new chunk2V7IL4HC_js.GameError("invalid_argument", "audio sources are bytes or a url");
903
+ return this.buffers.push(await this.context.decodeAudioData(bytes)), this.buffers.length - 1;
904
+ }
905
+ createSound(samples, channels, sampleRate) {
906
+ if (channels < 1 || sampleRate <= 0 || samples.length % channels !== 0) throw new chunk2V7IL4HC_js.GameError("invalid_argument", "sound PCM must be interleaved whole frames");
907
+ let frames = samples.length / channels, buffer = this.context.createBuffer(channels, frames, sampleRate);
908
+ for (let c = 0; c < channels; c++) {
909
+ let data = buffer.getChannelData(c);
910
+ for (let i = 0; i < frames; i++) data[i] = samples[i * channels + c];
911
+ }
912
+ return this.buffers.push(buffer), this.buffers.length - 1;
913
+ }
914
+ createBus(_name, parent) {
915
+ let input = this.context.createGain(), target = parent === (-1) ? audioOutput(this.context) : this.buses[parent].input;
916
+ return input.connect(target), this.buses.push({ input, parent: target, tail: input, body: input, filter: null, meter: null }), this.buses.length - 1;
917
+ }
918
+ createReverb(parent, impulse) {
919
+ let buffer = this.buffers[impulse];
920
+ if (!buffer) throw new chunk2V7IL4HC_js.GameError("unknown_resource", `impulse sound ${impulse} is not loaded`);
921
+ let input = this.context.createGain(), convolver = this.context.createConvolver();
922
+ convolver.normalize = true, convolver.buffer = buffer;
923
+ let target = parent === (-1) ? audioOutput(this.context) : this.buses[parent].input;
924
+ return input.connect(convolver), convolver.connect(target), this.buses.push({ input, parent: target, tail: convolver, body: convolver, filter: null, meter: null }), this.buses.length - 1;
925
+ }
926
+ setBusGain(bus, gain, rampSeconds) {
927
+ this.ramp(this.buses[bus].input.gain, gain, rampSeconds);
928
+ }
929
+ setBusFilter(bus, kind, frequency, q, gainDb) {
930
+ let b = this.buses[bus];
931
+ if (kind < 0) {
932
+ if (b.filter === null) return;
933
+ b.body.disconnect(b.filter), b.filter.disconnect(), b.body.connect(b.parent), b.meter && b.body.connect(b.meter), b.filter = null, b.tail = b.body;
934
+ return;
935
+ }
936
+ let type = chunkX5A5FOWW_js.FILTER_KINDS[kind];
937
+ if (type === void 0) throw new chunk2V7IL4HC_js.GameError("invalid_argument", `filter kind ${kind} is unknown`);
938
+ let filter = b.filter;
939
+ filter === null && (filter = this.context.createBiquadFilter(), b.body.disconnect(b.parent), b.meter && b.body.disconnect(b.meter), b.body.connect(filter), filter.connect(b.parent), b.meter && filter.connect(b.meter), b.filter = filter, b.tail = filter), filter.type = type, filter.frequency.setValueAtTime(frequency, this.context.currentTime), filter.Q.setValueAtTime(q, this.context.currentTime), filter.gain.setValueAtTime(gainDb, this.context.currentTime);
940
+ }
941
+ meter(bus, out) {
942
+ let b = this.buses[bus];
943
+ b.meter === null && (b.meter = this.context.createAnalyser(), b.meter.fftSize = (1024), b.tail.connect(b.meter));
944
+ let data = this.meterScratch;
945
+ b.meter.getFloatTimeDomainData(data);
946
+ let peak = 0, energy = 0;
947
+ for (let i = 0; i < data.length; i++) {
948
+ let v = data[i], a = v < 0 ? -v : v;
949
+ a > peak && (peak = a), energy += v * v;
950
+ }
951
+ out[chunkX5A5FOWW_js.METER_PEAK] = peak, out[chunkX5A5FOWW_js.METER_RMS] = Math.sqrt(energy / data.length);
952
+ }
953
+ createAnalyser(bus, settings) {
954
+ let node = this.context.createAnalyser();
955
+ return node.fftSize = settings.fftSize, node.smoothingTimeConstant = settings.smoothing, node.minDecibels = settings.minDecibels, node.maxDecibels = settings.maxDecibels, this.buses[bus].tail.connect(node), this.analysers.push(node), this.analysers.length - 1;
956
+ }
957
+ readAnalyser(analyser, mode, out) {
958
+ let node = this.analysers[analyser];
959
+ if (!node) throw new chunk2V7IL4HC_js.GameError("unknown_resource", `analyser ${analyser} does not exist`);
960
+ out instanceof Uint8Array ? mode === chunkX5A5FOWW_js.ANALYSER_FREQUENCY ? node.getByteFrequencyData(out) : node.getByteTimeDomainData(out) : mode === chunkX5A5FOWW_js.ANALYSER_FREQUENCY ? node.getFloatFrequencyData(out) : node.getFloatTimeDomainData(out);
961
+ }
962
+ setBusSend(bus, target, gain) {
963
+ let key = bus * (1024) + target, send = this.sends.get(key);
964
+ send === void 0 && (send = this.context.createGain(), this.buses[bus].input.connect(send), send.connect(this.buses[target].input), this.sends.set(key, send)), send.gain.setValueAtTime(gain, this.context.currentTime);
965
+ }
966
+ play(sound, bus, gain, rate, loop, spatial) {
967
+ let id = this.nextVoice;
968
+ this.nextVoice = (this.nextVoice + 1) % this.voices.length, this.release(id);
969
+ let voice = this.voices[id], source = this.context.createBufferSource();
970
+ source.buffer = this.buffers[sound], source.loop = loop, source.playbackRate.value = rate;
971
+ let gainNode = this.context.createGain();
972
+ if (gainNode.gain.value = gain, source.connect(gainNode), spatial) {
973
+ let panner = this.context.createPanner();
974
+ panner.panningModel = "HRTF", panner.refDistance = (1), panner.maxDistance = (100), gainNode.connect(panner), panner.connect(this.buses[bus].input), voice.panner = panner;
975
+ } else
976
+ gainNode.connect(this.buses[bus].input);
977
+ return source.addEventListener("ended", this.onEnded[id]), source.start(), voice.source = source, voice.gain = gainNode, id;
978
+ }
979
+ stop(voice, fadeSeconds) {
980
+ let v = this.voices[voice];
981
+ if (!v.source || !v.gain) return;
982
+ if (fadeSeconds <= 0) {
983
+ v.source.stop();
984
+ return;
985
+ }
986
+ let now = this.context.currentTime;
987
+ v.gain.gain.setTargetAtTime(0, now, fadeSeconds / (3)), v.source.stop(now + fadeSeconds);
988
+ }
989
+ isPlaying(voice) {
990
+ return this.voices[voice].source !== null;
991
+ }
992
+ setVoiceGain(voice, gain, rampSeconds) {
993
+ let node = this.voices[voice]?.gain;
994
+ node && this.ramp(node.gain, gain, rampSeconds);
995
+ }
996
+ setVoiceRate(voice, rate, detuneCents) {
997
+ let source = this.voices[voice]?.source;
998
+ if (!source) return;
999
+ let now = this.context.currentTime;
1000
+ source.playbackRate.setValueAtTime(rate, now), source.detune.setValueAtTime(detuneCents, now);
1001
+ }
1002
+ setVoiceSpatial(voice, params) {
1003
+ let panner = this.voices[voice]?.panner;
1004
+ panner && (panner.distanceModel = chunkX5A5FOWW_js.DISTANCE_MODELS[params[chunkX5A5FOWW_js.SPATIAL_MODEL]] ?? "inverse", panner.refDistance = params[chunkX5A5FOWW_js.SPATIAL_REF_DISTANCE], panner.maxDistance = params[chunkX5A5FOWW_js.SPATIAL_MAX_DISTANCE], panner.rolloffFactor = params[chunkX5A5FOWW_js.SPATIAL_ROLLOFF], panner.coneInnerAngle = params[chunkX5A5FOWW_js.SPATIAL_CONE_INNER], panner.coneOuterAngle = params[chunkX5A5FOWW_js.SPATIAL_CONE_OUTER], panner.coneOuterGain = params[chunkX5A5FOWW_js.SPATIAL_CONE_OUTER_GAIN]);
1005
+ }
1006
+ setVoiceLoop(voice, loop, startSeconds, endSeconds) {
1007
+ let source = this.voices[voice]?.source;
1008
+ source && (source.loop = loop, source.loopStart = startSeconds, source.loopEnd = endSeconds);
1009
+ }
1010
+ setVoicePosition(voice, matrix, offset) {
1011
+ let panner = this.voices[voice].panner;
1012
+ panner && (panner.positionX.value = matrix[offset + (12)], panner.positionY.value = matrix[offset + (12) + 1], panner.positionZ.value = matrix[offset + (12) + 2], panner.orientationX.value = -matrix[offset + 8], panner.orientationY.value = -matrix[offset + 9], panner.orientationZ.value = -matrix[offset + 10]);
1013
+ }
1014
+ setListener(matrix, offset) {
1015
+ let l = this.context.listener;
1016
+ l.positionX.value = matrix[offset + 12], l.positionY.value = matrix[offset + 13], l.positionZ.value = matrix[offset + 14], l.forwardX.value = -matrix[offset + 8], l.forwardY.value = -matrix[offset + 9], l.forwardZ.value = -matrix[offset + 10], l.upX.value = matrix[offset + 4], l.upY.value = matrix[offset + 5], l.upZ.value = matrix[offset + 6];
1017
+ }
1018
+ async openStream(source, bus) {
1019
+ let make = this.createMediaElement;
1020
+ if (make === null || !this.capabilities.streaming) throw new chunk2V7IL4HC_js.GameError("unsupported_feature", "this audio context cannot stream media");
1021
+ let element = make(), objectUrl = null;
1022
+ if ("url" in source) element.src = source.url;
1023
+ else if ("bytes" in source)
1024
+ objectUrl = URL.createObjectURL(new Blob([source.bytes])), element.src = objectUrl;
1025
+ else throw new chunk2V7IL4HC_js.GameError("invalid_argument", "streams play from bytes or a url");
1026
+ element.crossOrigin = "anonymous", element.preload = "auto";
1027
+ let node = this.context.createMediaElementSource(element), gain = this.context.createGain();
1028
+ return node.connect(gain), gain.connect(this.buses[bus].input), this.streams.push({ element, source: node, gain, objectUrl }), this.streams.length - 1;
1029
+ }
1030
+ stream(stream) {
1031
+ let found = this.streams[stream];
1032
+ if (!found) throw new chunk2V7IL4HC_js.GameError("unknown_resource", `stream ${stream} is not open`);
1033
+ return found;
1034
+ }
1035
+ playStream(stream, gain, loop) {
1036
+ let s = this.stream(stream);
1037
+ s.gain.gain.setValueAtTime(gain, this.context.currentTime), s.element.loop = loop;
1038
+ let started = s.element.play();
1039
+ started && started.catch(() => {
1040
+ });
1041
+ }
1042
+ pauseStream(stream) {
1043
+ this.stream(stream).element.pause();
1044
+ }
1045
+ seekStream(stream, seconds) {
1046
+ this.stream(stream).element.currentTime = Math.max(0, seconds);
1047
+ }
1048
+ streamTime(stream) {
1049
+ return this.stream(stream).element.currentTime;
1050
+ }
1051
+ streamDuration(stream) {
1052
+ let duration = this.stream(stream).element.duration;
1053
+ return Number.isFinite(duration) ? duration : 0;
1054
+ }
1055
+ closeStream(stream) {
1056
+ let s = this.streams[stream];
1057
+ s && (s.element.pause(), s.source.disconnect(), s.gain.disconnect(), s.objectUrl !== null && URL.revokeObjectURL(s.objectUrl), this.streams[stream] = null);
1058
+ }
1059
+ suspend() {
1060
+ this.context.suspend();
1061
+ }
1062
+ resume() {
1063
+ this.context.resume();
1064
+ }
1065
+ dispose() {
1066
+ for (let i = 0; i < this.voices.length; i++) this.release(i);
1067
+ for (let i = 0; i < this.streams.length; i++) this.closeStream(i);
1068
+ this.context.close();
1069
+ }
1070
+ ramp(param, value, rampSeconds) {
1071
+ rampSeconds <= 0 ? param.setValueAtTime(value, this.context.currentTime) : param.setTargetAtTime(value, this.context.currentTime, rampSeconds / (3));
1072
+ }
1073
+ release(id) {
1074
+ let voice = this.voices[id], source = voice.source;
1075
+ source && (source.removeEventListener("ended", this.onEnded[id]), source.stop(), source.disconnect()), voice.gain?.disconnect(), voice.panner?.disconnect(), voice.source = null, voice.gain = null, voice.panner = null;
1076
+ }
1077
+ };
1078
+
1079
+ // src/game/terrain/port.ts
1080
+ var TERRAIN_SOURCE = { recipe: 0, pack: 1, planet: 2 }, TERRAIN_REGISTER = {
1081
+ requested: 0,
1082
+ installed: 1,
1083
+ inflight: 2,
1084
+ resident: 3,
1085
+ nodes: 4,
1086
+ touched: 5,
1087
+ deferred: 6,
1088
+ totalInstalls: 7
1089
+ }, BRUSH = {
1090
+ raise: 0,
1091
+ lower: 1,
1092
+ smooth: 2,
1093
+ flatten: 3,
1094
+ paint: 4,
1095
+ hole: 5,
1096
+ fill: 6
1097
+ }, NOISE = { perlin: 0, simplex2: 1, simplex3: 2, worley: 3 };
1098
+
1099
+ // src/game/terrain/engine.ts
1100
+ var ENGINE_TERRAIN_EXPORT_NAMES = [
1101
+ "engine_terrain_open",
1102
+ "engine_terrain_close",
1103
+ "engine_terrain_update",
1104
+ "engine_terrain_registers",
1105
+ "engine_terrain_height",
1106
+ "engine_terrain_normal",
1107
+ "engine_terrain_sculpt",
1108
+ "engine_terrain_colliders",
1109
+ "engine_physics_radial_gravity",
1110
+ "engine_terrain_grass",
1111
+ "engine_terrain_wind",
1112
+ "engine_terrain_interactors",
1113
+ "engine_terrain_look",
1114
+ "engine_terrain_scatter",
1115
+ "engine_noise",
1116
+ "engine_noise_fbm"
1117
+ ], NULL = 0, F32_BYTES = 4, NORMAL_FLOATS = 3, GRAVITY_SURFACE = 3, GRAVITY_RADIUS = 4, SCRATCH_FLOATS = Math.max(
1118
+ 8,
1119
+ 12,
1120
+ 7,
1121
+ 6,
1122
+ 14,
1123
+ 16,
1124
+ 32,
1125
+ 64
1126
+ ) * 2;
1127
+ function engineTerrainExports(runtime) {
1128
+ let symbols = runtime.symbols;
1129
+ return ENGINE_TERRAIN_EXPORT_NAMES.every((name) => typeof symbols[name] == "function") ? symbols : null;
1130
+ }
1131
+ var EngineTerrain = class {
1132
+ constructor(runtime, exports, render, world) {
1133
+ this.runtime = runtime;
1134
+ this.exports = exports;
1135
+ this.render = render;
1136
+ this.world = world;
1137
+ this.scratch = { pointer: (0), bytes: 0 };
1138
+ this.second = { pointer: (0), bytes: 0 };
1139
+ this.columns = { pointer: (0), bytes: 0 };
1140
+ this.buffer = null;
1141
+ this.floats = new Float32Array(0);
1142
+ this.words = new Uint32Array(0);
1143
+ this.bytes = new Uint8Array(0);
1144
+ }
1145
+ views() {
1146
+ let buffer = this.runtime.memory.buffer;
1147
+ buffer !== this.buffer && (this.buffer = buffer, this.floats = new Float32Array(buffer), this.words = new Uint32Array(buffer), this.bytes = new Uint8Array(buffer));
1148
+ }
1149
+ ensure(block, bytes) {
1150
+ if (block.bytes >= bytes) return block.pointer;
1151
+ if (block.pointer !== (0) && this.runtime.exports.engine_free(block.pointer, block.bytes, chunk2O2CG465_js.COLUMN_ALIGN), block.bytes = Math.max(bytes, chunk2O2CG465_js.COLUMN_ALIGN), block.pointer = this.runtime.exports.engine_alloc(block.bytes, chunk2O2CG465_js.COLUMN_ALIGN), block.pointer === (0))
1152
+ throw block.bytes = 0, new chunk2V7IL4HC_js.GameError("capacity_exceeded", "engine memory cannot hold terrain buffers");
1153
+ return block.pointer;
1154
+ }
1155
+ put(block, values, count = values.length) {
1156
+ let pointer = this.ensure(block, Math.max(SCRATCH_FLOATS, count) * (4));
1157
+ this.views();
1158
+ let at = pointer >>> 2;
1159
+ for (let i = 0; i < count; i++) this.floats[at + i] = values[i];
1160
+ return pointer;
1161
+ }
1162
+ open(desc, source, recipe, pack) {
1163
+ let descPointer = this.put(this.scratch, desc), recipePointer = this.put(this.second, recipe), packPointer = (0);
1164
+ if (pack !== null) {
1165
+ if (packPointer = this.runtime.exports.engine_alloc(Math.max(pack.byteLength, 1), chunk2O2CG465_js.COLUMN_ALIGN), packPointer === (0)) throw new chunk2V7IL4HC_js.GameError("capacity_exceeded", "engine memory cannot hold the terrain pack");
1166
+ this.views(), this.bytes.set(pack, packPointer);
1167
+ }
1168
+ let handle = this.exports.engine_terrain_open(this.render(), descPointer, source, recipePointer, packPointer, pack?.byteLength ?? 0);
1169
+ if (handle === (0)) throw new chunk2V7IL4HC_js.GameError("invalid_argument", "the engine refused the terrain description");
1170
+ return handle;
1171
+ }
1172
+ close(terrain) {
1173
+ this.exports.engine_terrain_close(terrain, this.render());
1174
+ }
1175
+ update(terrain, eye) {
1176
+ return this.exports.engine_terrain_update(terrain, this.render(), this.put(this.scratch, eye, 6));
1177
+ }
1178
+ registers(terrain) {
1179
+ let pointer = this.exports.engine_terrain_registers(terrain);
1180
+ if (pointer === (0)) throw new chunk2V7IL4HC_js.GameError("unknown_resource", "terrain is closed");
1181
+ return this.views(), this.words.subarray(pointer >>> 2, (pointer >>> 2) + 8);
1182
+ }
1183
+ height(x, z) {
1184
+ return this.exports.engine_terrain_height(this.render(), x, z);
1185
+ }
1186
+ normal(x, z, out) {
1187
+ let pointer = this.ensure(this.second, SCRATCH_FLOATS * (4));
1188
+ if (this.exports.engine_terrain_normal(this.render(), x, z, pointer) < 0) return false;
1189
+ this.views();
1190
+ let at = pointer >>> 2;
1191
+ for (let i = 0; i < (3); i++) out[i] = this.floats[at + i];
1192
+ return true;
1193
+ }
1194
+ sculpt(terrain, brush) {
1195
+ return this.exports.engine_terrain_sculpt(terrain, this.render(), this.put(this.scratch, brush, 7));
1196
+ }
1197
+ colliders(terrain, x, y, z) {
1198
+ let pointer = this.ensure(this.second, SCRATCH_FLOATS * (4));
1199
+ this.views();
1200
+ let f = this.floats, at = pointer >>> 2;
1201
+ return f[at] = x, f[at + 1] = y, f[at + 2] = z, this.exports.engine_terrain_colliders(terrain, this.render(), this.world(), pointer);
1202
+ }
1203
+ gravity(x, y, z, surface, radius) {
1204
+ let pointer = this.ensure(this.second, SCRATCH_FLOATS * (4));
1205
+ this.views();
1206
+ let f = this.floats, at = pointer >>> 2;
1207
+ return f[at] = x, f[at + 1] = y, f[at + 2] = z, f[at + (3)] = surface, f[at + (4)] = radius, this.exports.engine_physics_radial_gravity(this.world(), pointer);
1208
+ }
1209
+ grass(params) {
1210
+ return this.exports.engine_terrain_grass(this.render(), this.put(this.scratch, params, 14));
1211
+ }
1212
+ wind(x, z, strength, gust) {
1213
+ this.exports.engine_terrain_wind(this.render(), x, z, strength, gust);
1214
+ }
1215
+ interactors(data, count) {
1216
+ let n = Math.min(count, 8);
1217
+ this.exports.engine_terrain_interactors(this.render(), this.put(this.scratch, data, n * 4), n);
1218
+ }
1219
+ look(layers, count) {
1220
+ let n = Math.min(count, 8);
1221
+ this.exports.engine_terrain_look(this.render(), this.put(this.scratch, layers, n * 8), n);
1222
+ }
1223
+ scatter(rules, out, capacity) {
1224
+ let rulesPointer = this.put(this.scratch, rules, 16), columns = this.ensure(this.columns, capacity * 6 * (4)), written = this.exports.engine_terrain_scatter(this.render(), rulesPointer, columns, capacity);
1225
+ if (written < 0) throw new chunk2V7IL4HC_js.GameError("invalid_argument", `the engine refused the scatter rules (${written})`);
1226
+ return this.views(), out.set(this.floats.subarray(columns >>> 2, (columns >>> 2) + capacity * 6)), written;
1227
+ }
1228
+ noise(kind, x, y, z, seed) {
1229
+ return this.exports.engine_noise(kind, x, y, z, seed);
1230
+ }
1231
+ fbm(x, z, octaves, frequency, seed) {
1232
+ return this.exports.engine_noise_fbm(x, z, octaves, frequency, seed);
1233
+ }
1234
+ };
1235
+
1236
+ exports.BRUSH = BRUSH;
1237
+ exports.CAP_CUSTOM_PROJECTION = CAP_CUSTOM_PROJECTION;
1238
+ exports.CAP_POINT_SHADOWS = CAP_POINT_SHADOWS;
1239
+ exports.DEFAULT_WORKLET_SIZES = DEFAULT_WORKLET_SIZES;
1240
+ exports.ENGINE_MIX_RATE = (48e3);
1241
+ exports.ENGINE_TERRAIN_EXPORT_NAMES = ENGINE_TERRAIN_EXPORT_NAMES;
1242
+ exports.EngineFeatures = EngineFeatures;
1243
+ exports.EngineTerrain = EngineTerrain;
1244
+ exports.HeadlessAudio = HeadlessAudio;
1245
+ exports.LIGHT_KINDS = LIGHT_KINDS;
1246
+ exports.MATERIAL_KINDS = MATERIAL_KINDS;
1247
+ exports.NOISE = NOISE;
1248
+ exports.OWNER_STAGING = (15);
1249
+ exports.SHADOW_TYPES = SHADOW_TYPES;
1250
+ exports.TERRAIN_REGISTER = TERRAIN_REGISTER;
1251
+ exports.TERRAIN_SOURCE = TERRAIN_SOURCE;
1252
+ exports.WORKLET_PROCESSOR_NAME = WORKLET_PROCESSOR_NAME;
1253
+ exports.WORKLET_PROCESSOR_SOURCE = WORKLET_PROCESSOR_SOURCE;
1254
+ exports.WebAudioPort = WebAudioPort;
1255
+ exports.WorkletAudio = WorkletAudio;
1256
+ exports.characterParams = characterParams;
1257
+ exports.createWithDescriptor = createWithDescriptor;
1258
+ exports.engineTerrainExports = engineTerrainExports;
1259
+ exports.extraTextures = extraTextures;
1260
+ exports.floatBits = floatBits;
1261
+ exports.materialFeatureFlags = materialFeatureFlags;
1262
+ exports.materialSlotIndex = materialSlotIndex;
1263
+ exports.refuseUndrawnPhysicalFields = refuseUndrawnPhysicalFields;
1264
+ exports.sharedMemoryAvailable = sharedMemoryAvailable;
1265
+ exports.writeCharacterWords = writeCharacterWords;
1266
+ exports.writeMaterialExtension = writeMaterialExtension;
1267
+ exports.writeMaterialFeatures = writeMaterialFeatures;
1268
+ exports.writeMaterialState = writeMaterialState;
1269
+ exports.writeMaterialTint = writeMaterialTint;
1270
+ exports.writeNodeFeatures = writeNodeFeatures;
1271
+ exports.writePlanes = writePlanes;
1272
+ exports.writeSky = writeSky;
1273
+ exports.writeTextureTransforms = writeTextureTransforms;
1274
+ exports.writeTintWords = writeTintWords;