@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,1403 @@
1
+ 'use strict';
2
+
3
+ var chunkZXREOYOW_js = require('./chunk-ZXREOYOW.js');
4
+ var chunkGDZT5LZ5_js = require('./chunk-GDZT5LZ5.js');
5
+ var chunkZMIL4ZOA_js = require('./chunk-ZMIL4ZOA.js');
6
+ var chunkQQABGCMM_js = require('./chunk-QQABGCMM.js');
7
+ var chunkXK6UDWJS_js = require('./chunk-XK6UDWJS.js');
8
+ var chunkT7LOXGYX_js = require('./chunk-T7LOXGYX.js');
9
+ var chunkE2QPPH7I_js = require('./chunk-E2QPPH7I.js');
10
+ var chunkOLWFPDBK_js = require('./chunk-OLWFPDBK.js');
11
+ var chunkI5FOHCLH_js = require('./chunk-I5FOHCLH.js');
12
+ var chunkTJI3K6RP_js = require('./chunk-TJI3K6RP.js');
13
+ var chunk66QP3SMN_js = require('./chunk-66QP3SMN.js');
14
+ var chunkWWKMOA76_js = require('./chunk-WWKMOA76.js');
15
+ var chunk4ZDR72SG_js = require('./chunk-4ZDR72SG.js');
16
+ var chunkT6Z2EXYL_js = require('./chunk-T6Z2EXYL.js');
17
+ var chunkJ2KZXIU3_js = require('./chunk-J2KZXIU3.js');
18
+ var chunkPTRNO5UD_js = require('./chunk-PTRNO5UD.js');
19
+ var chunk6SWKWCMS_js = require('./chunk-6SWKWCMS.js');
20
+
21
+ // src/interactives/runtime/lanes.ts
22
+ var PRESENCE_ROUTE = 0, FRAME_CODE_SLOTS = 16;
23
+ function subscribe(route, slot, listener) {
24
+ return route.set(slot, [...route.get(slot) ?? [], listener]), () => {
25
+ let remaining = (route.get(slot) ?? []).filter((l) => l !== listener);
26
+ remaining.length === 0 ? route.delete(slot) : route.set(slot, remaining);
27
+ };
28
+ }
29
+ function copyInto(source, target, at, length) {
30
+ for (let i = 0; i < length; i++) target[at + i] = source[i];
31
+ }
32
+ function deliver(route, slot, message, view) {
33
+ let listeners = route.get(slot);
34
+ if (listeners !== void 0)
35
+ for (let i = 0; i < listeners.length; i++) listeners[i](message, view);
36
+ }
37
+ var FrameLane = class {
38
+ constructor(bridge) {
39
+ this.bridge = bridge;
40
+ this.length = chunk4ZDR72SG_js.TAG_BYTES;
41
+ this.scheduled = false;
42
+ this.channel = { flags: 0, slot: 0, sequence: 0, sender: 0, payload_offset: 0, payload_length: 0 };
43
+ this.roomInput = {
44
+ flags: 0,
45
+ action: 0,
46
+ sequence: 0,
47
+ client_tick: 0,
48
+ sender: 0,
49
+ payload_offset: 0,
50
+ payload_length: 0
51
+ };
52
+ this.fastValue = {
53
+ status: 0,
54
+ slot: 0,
55
+ correlation: 0,
56
+ stamp_low: 0,
57
+ stamp_high: 0,
58
+ value_offset: 0,
59
+ value_length: 0
60
+ };
61
+ this.counterValue = { status: 0, slot: 0, correlation: 0, value: 0 };
62
+ this.presence = {
63
+ flags: 0,
64
+ server_tick: 0,
65
+ cell_index: 0,
66
+ acked_input: 0,
67
+ layer: 0,
68
+ baseline_age: 0,
69
+ count: 0,
70
+ entries_offset: 0
71
+ };
72
+ this.channels = /* @__PURE__ */ new Map();
73
+ this.roomInputs = /* @__PURE__ */ new Map();
74
+ this.fastValues = /* @__PURE__ */ new Map();
75
+ this.counterValues = /* @__PURE__ */ new Map();
76
+ this.presenceTicks = /* @__PURE__ */ new Map();
77
+ this.faults = new Uint32Array((16));
78
+ this.flush = () => {
79
+ this.scheduled = false, this.length !== chunk4ZDR72SG_js.TAG_BYTES && (this.bridge.send(this.out, this.length), this.length = chunk4ZDR72SG_js.TAG_BYTES);
80
+ };
81
+ this.out = new Uint8Array(chunk4ZDR72SG_js.BRIDGE_LIMITS.frame_outbox_bytes), this.out[0] = chunk4ZDR72SG_js.MessageTag.frames, this.view = new DataView(this.out.buffer);
82
+ }
83
+ reserve(bytes) {
84
+ return this.length + bytes > this.out.length && this.flush(), this.scheduled || (this.scheduled = true, queueMicrotask(this.flush)), this.length;
85
+ }
86
+ commit(written) {
87
+ return written > 0 && (this.length += written), written;
88
+ }
89
+ receive(bytes) {
90
+ let view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength), end = bytes.byteLength, offset = chunk4ZDR72SG_js.TAG_BYTES;
91
+ for (; offset < end; ) {
92
+ let code = chunk66QP3SMN_js.peekFrameCode(view, offset, end), total = chunk66QP3SMN_js.frameLength(view, offset, end);
93
+ if (code < 0 || total < 0) {
94
+ this.faults[0] += 1;
95
+ return;
96
+ }
97
+ switch (code) {
98
+ case chunk66QP3SMN_js.FrameCode.channel:
99
+ chunk66QP3SMN_js.decodeChannelFrame(view, offset, end, this.channel) > 0 && deliver(this.channels, this.channel.slot, this.channel, view);
100
+ break;
101
+ case chunk66QP3SMN_js.FrameCode.room_input:
102
+ chunk66QP3SMN_js.decodeRoomInputFrame(view, offset, end, this.roomInput) > 0 && deliver(this.roomInputs, this.roomInput.sender, this.roomInput, view);
103
+ break;
104
+ case chunk66QP3SMN_js.FrameCode.fast_value:
105
+ chunk66QP3SMN_js.decodeFastValue(view, offset, end, this.fastValue) > 0 && deliver(this.fastValues, this.fastValue.slot, this.fastValue, view);
106
+ break;
107
+ case chunk66QP3SMN_js.FrameCode.counter_value:
108
+ chunk66QP3SMN_js.decodeCounterValue(view, offset, end, this.counterValue) > 0 && deliver(this.counterValues, this.counterValue.slot, this.counterValue, view);
109
+ break;
110
+ case chunk66QP3SMN_js.FrameCode.presence_tick:
111
+ chunk66QP3SMN_js.decodePresenceTick(view, offset, end, this.presence) > 0 && deliver(this.presenceTicks, (0), this.presence, view);
112
+ break;
113
+ default:
114
+ this.faults[code] += 1;
115
+ }
116
+ offset += total;
117
+ }
118
+ }
119
+ };
120
+ function onSlot(route, slot, listener) {
121
+ return subscribe(route, slot, listener);
122
+ }
123
+ function onPresence(lane, listener) {
124
+ return subscribe(lane.presenceTicks, (0), listener);
125
+ }
126
+ var PayloadPublisher = class {
127
+ constructor(lane, slot, maxPayload, headerBytes) {
128
+ this.lane = lane;
129
+ this.slot = slot;
130
+ this.headerBytes = headerBytes;
131
+ this.sequence = 0;
132
+ this.max_payload_bytes = maxPayload, this.scratch = new Uint8Array(maxPayload), this.scratchView = new DataView(this.scratch.buffer);
133
+ }
134
+ payload() {
135
+ return this.scratchView;
136
+ }
137
+ send(length, flags = 0) {
138
+ if (length < 0 || length > this.max_payload_bytes) return -1;
139
+ let offset = this.lane.reserve(this.headerBytes + length), written = this.header(offset, length, flags);
140
+ if (written < 0) return written;
141
+ copyInto(this.scratch, this.lane.out, offset + this.headerBytes, length), this.lane.commit(written);
142
+ let sent = this.sequence;
143
+ return this.sequence = this.sequence + 1 >>> 0, sent;
144
+ }
145
+ }, ChannelPublisher = class extends PayloadPublisher {
146
+ constructor(lane, slot, maxPayload) {
147
+ super(lane, slot, Math.min(maxPayload, chunkWWKMOA76_js.FRAME_LIMITS.max_channel_payload_bytes), chunkWWKMOA76_js.FRAME_LAYOUT.channel.header_bytes);
148
+ this.frame = { flags: 0, slot: 0, sequence: 0, sender: 0 };
149
+ this.frame.slot = slot;
150
+ }
151
+ header(offset, length, flags) {
152
+ return this.frame.flags = flags, this.frame.sequence = this.sequence, chunk66QP3SMN_js.writeChannelHeader(this.lane.view, offset, this.frame, length);
153
+ }
154
+ }, RoomInputPublisher = class extends PayloadPublisher {
155
+ constructor(lane, slot) {
156
+ super(lane, slot, chunkWWKMOA76_js.FRAME_LIMITS.max_room_input_payload_bytes, chunkWWKMOA76_js.FRAME_LAYOUT.room_input.header_bytes);
157
+ this.frame = { flags: 0, action: 0, sequence: 0, client_tick: 0, sender: 0 };
158
+ this.frame.sender = slot;
159
+ }
160
+ header(offset, length, flags) {
161
+ return this.frame.flags = flags, this.frame.sequence = this.sequence, chunk66QP3SMN_js.writeRoomInputHeader(this.lane.view, offset, this.frame, length);
162
+ }
163
+ }, LaneFastReader = class {
164
+ constructor(lane, slot, target) {
165
+ this.lane = lane;
166
+ this.slot = slot;
167
+ this.keyBytes = new Uint8Array(chunkWWKMOA76_js.FRAME_LIMITS.max_fast_key_bytes);
168
+ this.frame = { target: chunkWWKMOA76_js.FRAME_CODES.fast_target[target], slot, correlation: 0 };
169
+ }
170
+ key() {
171
+ return this.keyBytes;
172
+ }
173
+ read(key_length, correlation) {
174
+ if (key_length < 0 || key_length > this.keyBytes.length) return -1;
175
+ let offset = this.lane.reserve(chunkWWKMOA76_js.FRAME_LAYOUT.fast_read.header_bytes + key_length);
176
+ this.frame.correlation = correlation >>> 0;
177
+ let written = chunk66QP3SMN_js.writeFastReadHeader(this.lane.view, offset, this.frame, key_length);
178
+ return written < 0 ? written : (copyInto(this.keyBytes, this.lane.out, offset + chunkWWKMOA76_js.FRAME_LAYOUT.fast_read.header_bytes, key_length), this.lane.commit(written));
179
+ }
180
+ on_value(listener) {
181
+ return subscribe(this.lane.fastValues, this.slot, listener);
182
+ }
183
+ }, LaneCounter = class {
184
+ constructor(lane, slot) {
185
+ this.lane = lane;
186
+ this.slot = slot;
187
+ this.frame = { status: 0, slot: 0, correlation: 0, value: 0 };
188
+ this.frame.slot = slot;
189
+ }
190
+ add(delta, correlation) {
191
+ let offset = this.lane.reserve(chunkWWKMOA76_js.FRAME_LAYOUT.counter_add.header_bytes);
192
+ return this.frame.correlation = correlation >>> 0, this.frame.value = delta, this.lane.commit(chunk66QP3SMN_js.encodeCounterAdd(this.lane.view, offset, this.frame));
193
+ }
194
+ on_value(listener) {
195
+ return subscribe(this.lane.counterValues, this.slot, (frame) => listener(frame));
196
+ }
197
+ };
198
+ function sendMove(lane, input) {
199
+ let offset = lane.reserve(chunkWWKMOA76_js.FRAME_LAYOUT.move_input.header_bytes);
200
+ return lane.commit(chunk66QP3SMN_js.encodeMoveInput(lane.view, offset, input));
201
+ }
202
+
203
+ // src/interactives/runtime/local-families.ts
204
+ var UINT32 = 4294967296, SEED_WORDS = 4, CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ", SHORT_ALPHABET = "abcdefghijkmnopqrstuvwxyz23456789", HEX = "0123456789abcdef", UUID_BYTES = 16, ULID_TIME_CHARS = 10, ULID_RANDOM_CHARS = 16, UUID_V7 = 112, UUID_VARIANT = 128, RANDOM_POOL_BYTES = 256, RandomPool = class {
205
+ constructor(services) {
206
+ this.services = services;
207
+ this.bytes = new Uint8Array((256));
208
+ this.words = new Uint32Array(this.bytes.buffer);
209
+ this.cursor = (256);
210
+ }
211
+ u32() {
212
+ this.cursor + 4 > (256) && (this.services.random_fill(this.bytes), this.cursor = 0);
213
+ let word = this.words[this.cursor >> 2];
214
+ return this.cursor += 4, word;
215
+ }
216
+ byte() {
217
+ return this.u32() & 255;
218
+ }
219
+ }, Xoshiro128 = class {
220
+ constructor(words) {
221
+ this.a = words[0] >>> 0, this.b = words[1] >>> 0, this.c = words[2] >>> 0, this.d = words[3] >>> 0 || 1;
222
+ }
223
+ next_u32() {
224
+ let result = Math.imul(rotl(Math.imul(this.b, 5), 7), 9) >>> 0, t = this.b << 9;
225
+ return this.c ^= this.a, this.d ^= this.b, this.b ^= this.c, this.a ^= this.d, this.c ^= t, this.d = rotl(this.d, 11), result;
226
+ }
227
+ next_float() {
228
+ return this.next_u32() / (4294967296);
229
+ }
230
+ };
231
+ function rotl(x, k) {
232
+ return (x << k | x >>> 32 - k) >>> 0;
233
+ }
234
+ function localRandom(services) {
235
+ let pool = new RandomPool(services);
236
+ return {
237
+ cosmetic: () => pool.u32() / (4294967296),
238
+ async seed(request) {
239
+ let words = [0, 0, 0, 0];
240
+ for (let i = 0; i < (4); i++) words[i] = pool.u32();
241
+ return { label: request.label, recorded: false, scope: request.scope, words };
242
+ },
243
+ stream: (grant) => new Xoshiro128(grant.words)
244
+ };
245
+ }
246
+ function localCrypto(services) {
247
+ return {
248
+ sha256: (input, out) => chunkTJI3K6RP_js.sha256Into(input, out),
249
+ random_bytes: (out) => services.random_fill(out),
250
+ verify: (key, message, signature) => services.verify_ed25519(key, message, signature)
251
+ };
252
+ }
253
+ function localIds(services) {
254
+ let pool = new RandomPool(services), uuid = new Uint8Array((16));
255
+ return {
256
+ uuid_v7() {
257
+ let ms = services.now_ms(), high = Math.floor(ms / (4294967296)), low = ms >>> 0;
258
+ uuid[0] = high >>> 8 & 255, uuid[1] = high & 255, uuid[2] = low >>> 24, uuid[3] = low >>> 16 & 255, uuid[4] = low >>> 8 & 255, uuid[5] = low & 255;
259
+ for (let i = 6; i < (16); i++) uuid[i] = pool.byte();
260
+ uuid[6] = (112) | uuid[6] & 15, uuid[8] = (128) | uuid[8] & 63;
261
+ let out = "";
262
+ for (let i = 0; i < (16); i++)
263
+ (i === 4 || i === 6 || i === 8 || i === 10) && (out += "-"), out += HEX[uuid[i] >>> 4] + HEX[uuid[i] & 15];
264
+ return out;
265
+ },
266
+ ulid() {
267
+ let ms = services.now_ms(), time = "";
268
+ for (let i = 0; i < (10); i++)
269
+ time = CROCKFORD[ms % 32] + time, ms = Math.floor(ms / 32);
270
+ let random = "";
271
+ for (let i = 0; i < (16); i++) random += CROCKFORD[pool.byte() & 31];
272
+ return time + random;
273
+ },
274
+ short(length) {
275
+ let out = "";
276
+ for (let i = 0; i < length; i++) out += SHORT_ALPHABET[pool.u32() % SHORT_ALPHABET.length];
277
+ return out;
278
+ },
279
+ fill: (out) => services.random_fill(out)
280
+ };
281
+ }
282
+ function localClock(services, offsetMs) {
283
+ let now = () => services.now_ms() + offsetMs;
284
+ return {
285
+ now,
286
+ async sync() {
287
+ return { now: now(), source: "app_clock", display_offset_ms: offsetMs, room_tick: null };
288
+ }
289
+ };
290
+ }
291
+ function localLocale(info) {
292
+ let numbers = /* @__PURE__ */ new Map(), money = /* @__PURE__ */ new Map(), time = new Intl.DateTimeFormat(info.language, { timeStyle: "short", timeZone: info.time_zone });
293
+ return {
294
+ ...info,
295
+ format_number(value, fraction_digits) {
296
+ let digits = fraction_digits ?? -1, format = numbers.get(digits);
297
+ return format === void 0 && (format = new Intl.NumberFormat(
298
+ info.language,
299
+ digits < 0 ? {} : { minimumFractionDigits: digits, maximumFractionDigits: digits }
300
+ ), numbers.set(digits, format)), format.format(value);
301
+ },
302
+ format_money(amount, currency) {
303
+ let code = currency ?? info.currency, format = money.get(code);
304
+ return format === void 0 && (format = new Intl.NumberFormat(info.language, { style: "currency", currency: code }), money.set(code, format)), format.format(Number(amount));
305
+ },
306
+ format_time: (unix_ms) => time.format(unix_ms)
307
+ };
308
+ }
309
+
310
+ // src/interactives/runtime/guest-ctx.ts
311
+ var GuestUnavailableError = class extends Error {
312
+ constructor(member) {
313
+ super(`ctx.${member} is not available in the native profile`), this.name = "GuestUnavailableError", this.member = member;
314
+ }
315
+ }, CLIP_FAILURES = /* @__PURE__ */ new Set(["unavailable", "nothing_recorded", "unknown_clip", "camera_consent", "failed"]), ClipError = class extends Error {
316
+ constructor(code) {
317
+ super(`the clip was not saved (${code})`);
318
+ this.code = code;
319
+ this.name = "ClipError";
320
+ }
321
+ };
322
+ function mediaRef(value) {
323
+ if (value === null || typeof value != "object") throw new ClipError("unavailable");
324
+ let reply = value;
325
+ if (typeof reply.media_id == "string") return typeof reply.url == "string" ? { media_id: reply.media_id, url: reply.url } : { media_id: reply.media_id };
326
+ let code = reply.error?.code;
327
+ throw new ClipError(typeof code == "string" && CLIP_FAILURES.has(code) ? code : "failed");
328
+ }
329
+ function clipMedia(core) {
330
+ return {
331
+ open: () => Promise.reject(new GuestUnavailableError("media.open")),
332
+ async record_clip(_surface, max_duration_ms) {
333
+ let started = await core.command({ kind: "clip_start", max_ms: max_duration_ms }, true);
334
+ if (started === null || typeof started != "object" || typeof started.clip != "number") throw new ClipError("unavailable");
335
+ let clip = started.clip;
336
+ return {
337
+ stop: async () => mediaRef(await core.command({ kind: "clip_stop", clip }, true)),
338
+ cancel: () => {
339
+ core.command({ kind: "clip_cancel", clip }, false);
340
+ }
341
+ };
342
+ },
343
+ keep_clip: async (ms) => mediaRef(await core.command({ kind: "clip_keep", ms }, true)),
344
+ save_replay: async (replay) => mediaRef(await core.command({ kind: "replay_save", replay: chunkJ2KZXIU3_js.encodeBase64(replay) }, true)),
345
+ on_replay: (listener) => core.on_replay === void 0 ? () => {
346
+ } : core.on_replay(listener)
347
+ };
348
+ }
349
+ var EMPTY = {};
350
+ function unavailable(member) {
351
+ throw new GuestUnavailableError(member);
352
+ }
353
+ function missing(prefix, members) {
354
+ let out = {};
355
+ for (let member of members)
356
+ Object.defineProperty(out, member, { get: () => unavailable(`${prefix}.${member}`), enumerable: true });
357
+ return out;
358
+ }
359
+ function realtimeOf(handle, profile) {
360
+ let tick = handle.tick;
361
+ if (profile === null || tick === null || tick === void 0) return null;
362
+ let dialers = profile.dialers(tick.endpoints);
363
+ return { ticket: chunkJ2KZXIU3_js.decodeBase64(tick.ticket), expires_at: tick.expires_at, primary: dialers.primary, fallback: dialers.fallback };
364
+ }
365
+ function createGuestCtx(core, profile = null) {
366
+ let call = (operation) => (request) => core.call(operation, request), call0 = (operation) => () => core.call(operation, EMPTY), bound = (operation, field, value) => (request) => core.call(operation, { ...request, [field]: value }), fixed = (operation, request) => () => core.call(operation, request), events = (grant) => ({
367
+ on_event(listener) {
368
+ return core.subscribe(grant, (event) => listener(event.event));
369
+ }
370
+ }), familyEvents = (family) => ({
371
+ on_event(listener) {
372
+ return core.family(family, (event) => listener(event.event));
373
+ }
374
+ }), program = { ...core.program, set_status: call("program.set_status"), ready: () => core.mark("ready_for_input") }, openStore = async (request) => {
375
+ let handle = await core.call("store.open", request), store_id = handle.store_id, grant = null;
376
+ return {
377
+ handle,
378
+ get: bound("store.get", "store_id", store_id),
379
+ list: bound("store.list", "store_id", store_id),
380
+ commit: bound("store.commit", "store_id", store_id),
381
+ checkpoint: bound("store.checkpoint", "store_id", store_id),
382
+ restore: bound("store.restore", "store_id", store_id),
383
+ migrate: bound("store.migrate", "store_id", store_id),
384
+ on_event(listener) {
385
+ grant ?? (grant = core.call("store.subscribe", { store_id }).then((subscription) => subscription.grant));
386
+ let stop = null, stopped = false;
387
+ return grant.then((g) => {
388
+ stopped || (stop = core.subscribe(g, (event) => listener(event.event)));
389
+ }), () => {
390
+ stopped = true, stop?.();
391
+ };
392
+ }
393
+ };
394
+ }, roomApi = (handle) => {
395
+ let room_id = handle.state.room_id;
396
+ return {
397
+ handle,
398
+ realtime: realtimeOf(handle, profile),
399
+ inputs: new RoomInputPublisher(core.lane, handle.slot),
400
+ leave: fixed("room.leave", { room_id }),
401
+ state: fixed("room.state", { room_id }),
402
+ move: bound("room.move", "room_id", room_id),
403
+ view: fixed("room.view", { room_id }),
404
+ history: bound("room.history", "room_id", room_id),
405
+ control: bound("room.control", "room_id", room_id),
406
+ commit_result: bound("room.commit_result", "room_id", room_id),
407
+ on_input: (listener) => onSlot(core.lane.roomInputs, handle.slot, listener),
408
+ ...events(handle.grant)
409
+ };
410
+ }, channelApi = (handle) => {
411
+ let publisher = new ChannelPublisher(core.lane, handle.slot, handle.max_payload_bytes);
412
+ return {
413
+ handle,
414
+ slot: handle.slot,
415
+ max_payload_bytes: publisher.max_payload_bytes,
416
+ payload: () => publisher.payload(),
417
+ send: (length, flags) => publisher.send(length, flags),
418
+ on_message: (listener) => onSlot(core.lane.channels, handle.slot, listener),
419
+ close: fixed("channel.close", { channel_id: handle.channel_id }),
420
+ on_event: (listener) => core.family("channel", (event) => listener(event.event))
421
+ };
422
+ }, worldAdmin = (world_id) => ({
423
+ invite: bound("world.invite", "world_id", world_id),
424
+ set_role: bound("world.set_role", "world_id", world_id),
425
+ moderate: bound("world.moderate", "world_id", world_id)
426
+ }), worldSessionApi = (session) => {
427
+ let world_id = session.world_id;
428
+ return {
429
+ session,
430
+ realtime: realtimeOf(session, profile),
431
+ ...worldAdmin(world_id),
432
+ move: (input) => sendMove(core.lane, input),
433
+ on_presence: (listener) => onPresence(core.lane, listener),
434
+ emote: bound("world.emote", "world_id", world_id),
435
+ set_visibility: bound("world.set_visibility", "world_id", world_id),
436
+ enter_venue: bound("world.enter_venue", "world_id", world_id),
437
+ exit_venue: call("world.exit_venue"),
438
+ nearby: bound("world.nearby", "world_id", world_id),
439
+ leave: fixed("world.leave", { world_id }),
440
+ ...events(session.grant)
441
+ };
442
+ }, gameUi = null, ui = {
443
+ game: (options) => {
444
+ if (gameUi !== null) return gameUi;
445
+ let assets = profile?.assets, packaged = assets?.has?.(chunkI5FOHCLH_js.TEXT_DICTIONARIES_ASSET) === true, created = new chunkOLWFPDBK_js.GameUi(
446
+ { submit: (bytes, length) => core.game_ui(bytes, length) },
447
+ { ...options, reserve: chunk4ZDR72SG_js.TAG_BYTES, dictionaries: options?.dictionaries ?? packaged }
448
+ );
449
+ return packaged && assets !== void 0 && chunkT6Z2EXYL_js.breakDictionaries() === null && assets.take(chunkI5FOHCLH_js.TEXT_DICTIONARIES_ASSET).then(
450
+ (bytes) => {
451
+ chunkT6Z2EXYL_js.registerBreakDictionaries(bytes.slice().buffer);
452
+ },
453
+ () => {
454
+ }
455
+ ), core.on_game_ui((bytes) => created.dispatch(bytes, chunk4ZDR72SG_js.TAG_BYTES)), gameUi = created, created;
456
+ },
457
+ render: (tree) => core.render(tree),
458
+ present: (mode) => core.command({ kind: "present", mode }, true).then(() => {
459
+ }),
460
+ open_sheet: (request) => core.command({ kind: "open_sheet", request }, true),
461
+ open_handoff: (handoff_id) => core.command({ kind: "open_handoff", handoff_id }, true),
462
+ toast: (text) => {
463
+ core.command({ kind: "toast", text }, false);
464
+ },
465
+ haptic: (haptic) => {
466
+ core.command({ kind: "haptic", haptic }, false);
467
+ },
468
+ announce: (text) => {
469
+ core.command({ kind: "announce", text }, false);
470
+ },
471
+ on_event: (listener) => core.on_ui(listener)
472
+ }, loop = profile?.loop, camera = profile?.camera, gameBase = missing("game", loop === void 0 ? ["kit_version", "loop", "scenes", "camera", "feel"] : ["kit_version", "scenes", "camera", "feel"]);
473
+ loop !== void 0 && Object.defineProperty(gameBase, "loop", { value: loop, enumerable: true });
474
+ let game = Object.assign(gameBase, {
475
+ create_physics: () => unavailable("game.create_physics"),
476
+ saves: () => unavailable("game.saves"),
477
+ turns: () => unavailable("game.turns"),
478
+ leaderboards: {
479
+ async submit(request) {
480
+ let receipt = await core.call("game.leaderboards.submit", request);
481
+ return receipt.status !== "rejected" && core.complete({ outcome: "finished", score: receipt.score }), receipt;
482
+ },
483
+ page: call("game.leaderboards.page")
484
+ },
485
+ achievements: { list: call0("game.achievements.list"), progress: call("game.achievements.progress") },
486
+ economy: {
487
+ catalogue: call0("game.economy.catalogue"),
488
+ balances: call("game.economy.balances"),
489
+ grant: call("game.economy.grant"),
490
+ spend: call("game.economy.spend"),
491
+ propose_trade: call("game.economy.trade.propose"),
492
+ accept_trade: call("game.economy.trade.accept"),
493
+ cancel_trade: call("game.economy.trade.cancel"),
494
+ exchange: call("game.economy.exchange")
495
+ }
496
+ });
497
+ return {
498
+ program,
499
+ session: {
500
+ complete(request) {
501
+ return core.complete({ outcome: request.outcome, score: request.score ?? null }), core.call("program.complete", request);
502
+ }
503
+ },
504
+ clock: localClock(core.services, core.clock_offset_ms),
505
+ random: localRandom(core.services),
506
+ locale: localLocale(core.locale),
507
+ identity: {
508
+ current: call0("identity.current"),
509
+ personas: call("identity.personas"),
510
+ profile: call0("identity.profile")
511
+ },
512
+ social: {
513
+ friends: call("social.friends"),
514
+ challenge: call("social.challenge"),
515
+ invite: call("social.invite"),
516
+ post: call("social.post"),
517
+ remix_lineage: call0("social.remix_lineage"),
518
+ avatars: call("social.avatars"),
519
+ avatar_consent: call("social.avatar_consent")
520
+ },
521
+ open_store: openStore,
522
+ async schedule(request) {
523
+ let task = await core.call("schedule.create", request), ref = { task_id: task.task_id };
524
+ return {
525
+ task,
526
+ status: fixed("schedule.status", ref),
527
+ cancel: fixed("schedule.cancel", ref),
528
+ ...familyEvents("schedule")
529
+ };
530
+ },
531
+ compute: call("compute.invoke"),
532
+ async create_worker(request) {
533
+ let handle = await core.call("worker.create", request);
534
+ return {
535
+ handle,
536
+ post: bound("worker.post", "worker_id", handle.worker_id),
537
+ terminate: fixed("worker.terminate", { worker_id: handle.worker_id }),
538
+ ...events(handle.grant)
539
+ };
540
+ },
541
+ create_local_worker: () => unavailable("create_local_worker"),
542
+ create_room: async (request) => roomApi(await core.call("room.create", request)),
543
+ join_room: async (request) => roomApi(await core.call("room.join", request)),
544
+ create_channel: async (request) => channelApi(await core.call("channel.open", request)),
545
+ create_world: async (request) => {
546
+ let handle = await core.call("world.create", request);
547
+ return { handle, ...worldAdmin(handle.world_id) };
548
+ },
549
+ join_world: async (request) => worldSessionApi(await core.call("world.join", request)),
550
+ list_worlds: call("world.list"),
551
+ game,
552
+ services: {
553
+ catalogue: { search: call("services.catalogue.search"), product: call("services.catalogue.product") },
554
+ cart: { get: call("services.cart.get"), add: call("services.cart.add"), update: call("services.cart.update") },
555
+ delivery: { quote: call("services.delivery.quote") },
556
+ purchase_intents: {
557
+ create: call("services.purchase_intents.create"),
558
+ status: call("services.purchase_intents.status")
559
+ },
560
+ orders: { list: call("services.orders.list"), get: call("services.orders.get") },
561
+ scheduling: {
562
+ availability: call("services.scheduling.availability"),
563
+ book: call("services.scheduling.book")
564
+ },
565
+ places: {
566
+ search: call("services.places.search"),
567
+ get: call("services.places.get"),
568
+ contribute: call("services.places.contribute")
569
+ },
570
+ arcs: {
571
+ progress: call("services.arcs.progress"),
572
+ record: call("services.arcs.record"),
573
+ challenges: call("services.arcs.challenges")
574
+ }
575
+ },
576
+ gifts: { kinds: call("gifts.kinds"), send: call("gifts.send"), prizes: call("gifts.prizes"), ...familyEvents("gifts") },
577
+ wallet: {
578
+ offers: call0("wallet.offers"),
579
+ spend: call("wallet.spend"),
580
+ entitlements: call0("wallet.entitlements"),
581
+ allowance: call0("wallet.allowance"),
582
+ consume: call("wallet.consume")
583
+ },
584
+ ads: { placement: call("ads.placement"), sponsored_items: call("ads.sponsored_items") },
585
+ notify: { status: call0("notify.status"), request_opt_in: call("notify.request_opt_in"), send: call("notify.send") },
586
+ moderate: { submit: call("moderate.submit"), status: call("moderate.status") },
587
+ report: { submit: call("report.submit"), block: call("report.block") },
588
+ actions: { prepare: call("actions.prepare"), execute: call("actions.execute"), receipt: call("actions.receipt") },
589
+ provider: { call: call("provider.call"), subscribe: call("provider.subscribe"), ...familyEvents("provider") },
590
+ flow: {
591
+ status: call("flow.status"),
592
+ checkpoint: call("flow.checkpoint"),
593
+ resume: call("flow.resume"),
594
+ report_result: call("flow.report_result")
595
+ },
596
+ agent: {
597
+ ask: call("agent.ask"),
598
+ cancel: call("agent.cancel"),
599
+ request_edit: call("agent.request_edit"),
600
+ ...familyEvents("agent")
601
+ },
602
+ share: call("share.open"),
603
+ db: { describe: call0("db.describe"), migrate: call("db.migrate"), query: call("db.query") },
604
+ tx: { begin: call("tx.begin"), stage: call("tx.stage"), commit: call("tx.commit"), abort: call("tx.abort") },
605
+ async open_kv(request) {
606
+ let handle = await core.call("kv.open", request), namespace_id = handle.namespace_id;
607
+ return {
608
+ handle,
609
+ fast: new LaneFastReader(core.lane, handle.slot, "kv"),
610
+ get: bound("kv.get", "namespace_id", namespace_id),
611
+ set: bound("kv.set", "namespace_id", namespace_id),
612
+ compare_and_set: bound("kv.compare_and_set", "namespace_id", namespace_id),
613
+ delete: bound("kv.delete", "namespace_id", namespace_id),
614
+ list: bound("kv.list", "namespace_id", namespace_id)
615
+ };
616
+ },
617
+ async open_cache(request) {
618
+ let handle = await core.call("cache.open", request), namespace_id = handle.namespace_id;
619
+ return {
620
+ handle,
621
+ fast: new LaneFastReader(core.lane, handle.slot, "cache"),
622
+ get: bound("cache.get", "namespace_id", namespace_id),
623
+ set: bound("cache.set", "namespace_id", namespace_id),
624
+ delete: bound("cache.delete", "namespace_id", namespace_id)
625
+ };
626
+ },
627
+ async open_counter(request) {
628
+ let handle = await core.call("counter.open", request), counter_id = handle.counter_id, fast = new LaneCounter(core.lane, handle.slot);
629
+ return {
630
+ handle,
631
+ add_fast: (delta, correlation) => fast.add(delta, correlation),
632
+ on_value: (listener) => fast.on_value(listener),
633
+ add: bound("counter.add", "counter_id", counter_id),
634
+ read: bound("counter.read", "counter_id", counter_id),
635
+ rate_limit: bound("counter.rate_limit", "counter_id", counter_id),
636
+ rank: bound("counter.rank", "counter_id", counter_id),
637
+ rank_range: bound("counter.rank_range", "counter_id", counter_id),
638
+ rank_of: bound("counter.rank_of", "counter_id", counter_id)
639
+ };
640
+ },
641
+ blob: {
642
+ put: call("blob.put"),
643
+ transfer: () => unavailable("blob.transfer"),
644
+ commit: call("blob.commit"),
645
+ get: call("blob.get"),
646
+ read: () => unavailable("blob.read"),
647
+ list: call("blob.list"),
648
+ delete: call("blob.delete")
649
+ },
650
+ queue: {
651
+ enqueue: call("queue.enqueue"),
652
+ status: call("queue.status"),
653
+ cancel: call("queue.cancel"),
654
+ stats: call("queue.stats"),
655
+ ...familyEvents("queue")
656
+ },
657
+ search: { index: call("search.index"), query: call("search.query"), remove: call("search.remove") },
658
+ ai: {
659
+ generate: call("ai.generate"),
660
+ converse: call("ai.converse"),
661
+ speak: call("ai.speak"),
662
+ transcribe: call("ai.transcribe"),
663
+ image: call("ai.image"),
664
+ translate: call("ai.translate"),
665
+ prefetch: call("ai.prefetch"),
666
+ cancel: call("ai.cancel"),
667
+ forget: call("ai.forget"),
668
+ usage: call0("ai.usage"),
669
+ content: call("ai.content"),
670
+ content_prefetch: call("ai.content_prefetch"),
671
+ watch(run, listener) {
672
+ return run.grant ? core.subscribe(run.grant, (event) => listener(event.event)) : (run.result && listener({ kind: "completed", result: run.result }), () => {
673
+ });
674
+ },
675
+ ...familyEvents("ai")
676
+ },
677
+ generate: chunkE2QPPH7I_js.createGenerate({ content: call("ai.content"), content_prefetch: call("ai.content_prefetch") }),
678
+ pubsub: {
679
+ async subscribe(request) {
680
+ let subscription = await core.call("pubsub.subscribe", request), publisher = new ChannelPublisher(core.lane, subscription.slot, subscription.max_payload_bytes);
681
+ return {
682
+ subscription,
683
+ slot: subscription.slot,
684
+ max_payload_bytes: publisher.max_payload_bytes,
685
+ payload: () => publisher.payload(),
686
+ send: (length, flags) => publisher.send(length, flags),
687
+ publish: bound("pubsub.publish", "topic", subscription.topic),
688
+ on_message: (listener) => onSlot(core.lane.channels, subscription.slot, listener),
689
+ close: () => core.call("events.cancel", { subscription_id: subscription.grant.subscription_id }).then(() => {
690
+ })
691
+ };
692
+ }
693
+ },
694
+ analytics: { track: call("analytics.track"), record: call("analytics.record"), summary: call("analytics.summary") },
695
+ secrets: { handle: call("secrets.handle"), sign: call("secrets.sign") },
696
+ ui,
697
+ graphics: profile?.graphics ?? missing("graphics", ["features", "engine", "acquire_surface", "attach_engine", "on_context_lost", "on_context_restored"]),
698
+ input: profile?.input ?? missing("input", ["bind", "pointers", "remap"]),
699
+ audio: profile?.audio ?? missing("audio", ["unlocked", "unlock", "bus", "load", "play", "stop"]),
700
+ media: clipMedia(core),
701
+ files: missing("files", ["pick", "save"]),
702
+ assets: profile?.assets ?? missing("assets", ["take", "module"]),
703
+ camera: {
704
+ request: call("camera.request"),
705
+ release: call("camera.release"),
706
+ track_face: camera ? (grant) => camera.track_face(grant) : () => unavailable("camera.track_face"),
707
+ view: camera ? (grant, placement) => camera.view(grant, placement) : () => unavailable("camera.view"),
708
+ capture_identity: camera ? (grant) => camera.capture_identity(grant) : () => Promise.reject(new chunkZXREOYOW_js.IdentityCaptureError("unavailable"))
709
+ },
710
+ lifecycle: core.lifecycle,
711
+ events: {
712
+ subscribe: (family, listener) => core.family(family, (event) => listener(event.event)),
713
+ cancel: call("events.cancel"),
714
+ resume: call("events.resume")
715
+ },
716
+ crypto: localCrypto(core.services),
717
+ id: localIds(core.services),
718
+ on_dispose: (callback) => core.on_dispose(callback)
719
+ };
720
+ }
721
+
722
+ // src/interactives/runtime/guards.ts
723
+ var WASM_GLOBAL = "WebAssembly", GuardError = class extends Error {
724
+ constructor(member) {
725
+ super(`${member} is not available to Interactives; reach the platform through ctx`), this.name = "GuardError";
726
+ }
727
+ }, REMOVED_GLOBALS = [
728
+ "eval",
729
+ "Function",
730
+ "fetch",
731
+ "XMLHttpRequest",
732
+ "WebSocket",
733
+ "WebTransport",
734
+ "EventSource",
735
+ "importScripts",
736
+ "Worker",
737
+ "SharedWorker",
738
+ "indexedDB",
739
+ "caches",
740
+ "WebAssembly",
741
+ "postMessage",
742
+ "onmessage",
743
+ "onmessageerror",
744
+ "addEventListener",
745
+ "removeEventListener",
746
+ "close",
747
+ "BroadcastChannel",
748
+ "navigator",
749
+ "location",
750
+ "__cimplify_host"
751
+ ], FROZEN_GLOBALS = [
752
+ "Object",
753
+ "Array",
754
+ "Function",
755
+ "String",
756
+ "Number",
757
+ "Boolean",
758
+ "Symbol",
759
+ "BigInt",
760
+ "Promise",
761
+ "Map",
762
+ "Set",
763
+ "WeakMap",
764
+ "WeakSet",
765
+ "WeakRef",
766
+ "RegExp",
767
+ "Date",
768
+ "Error",
769
+ "TypeError",
770
+ "RangeError",
771
+ "SyntaxError",
772
+ "ReferenceError",
773
+ "EvalError",
774
+ "URIError",
775
+ "AggregateError",
776
+ "ArrayBuffer",
777
+ "DataView",
778
+ "Int8Array",
779
+ "Uint8Array",
780
+ "Uint8ClampedArray",
781
+ "Int16Array",
782
+ "Uint16Array",
783
+ "Int32Array",
784
+ "Uint32Array",
785
+ "Float32Array",
786
+ "Float64Array",
787
+ "BigInt64Array",
788
+ "BigUint64Array",
789
+ "JSON",
790
+ "Math",
791
+ "Reflect",
792
+ "Intl",
793
+ "TextEncoder",
794
+ "TextDecoder"
795
+ ], STRING_TIMERS = ["setTimeout", "setInterval"], OVERRIDABLE = ["constructor", "toString", "valueOf", "toJSON", "name", "message"], CODE_CONSTRUCTOR_SOURCES = [
796
+ () => Object.getPrototypeOf(async () => {
797
+ }),
798
+ () => Object.getPrototypeOf(function* () {
799
+ }),
800
+ () => Object.getPrototypeOf(async function* () {
801
+ })
802
+ ];
803
+ function thrower(member) {
804
+ return () => {
805
+ throw new GuardError(member);
806
+ };
807
+ }
808
+ function seal(target, name, value) {
809
+ let existing = Object.getOwnPropertyDescriptor(target, name);
810
+ existing !== void 0 && existing.configurable === false || Object.defineProperty(target, name, { value, writable: false, enumerable: false, configurable: false });
811
+ }
812
+ function enableOverride(target, name) {
813
+ let found = Object.getOwnPropertyDescriptor(target, name);
814
+ if (found === void 0 || !("value" in found) || found.configurable === false) return;
815
+ let value = found.value;
816
+ Object.defineProperty(target, name, {
817
+ get() {
818
+ return value;
819
+ },
820
+ set(next) {
821
+ if (this === target) throw new GuardError(`assigning ${name} on a shared prototype`);
822
+ Object.defineProperty(this, name, { value: next, writable: true, enumerable: true, configurable: true });
823
+ },
824
+ enumerable: found.enumerable,
825
+ configurable: false
826
+ });
827
+ }
828
+ function freezeDeep(root, seen) {
829
+ if (typeof root != "object" && typeof root != "function" || root === null || seen.has(root)) return;
830
+ seen.add(root);
831
+ let prototype = root.prototype;
832
+ for (let name of OVERRIDABLE) enableOverride(root, name);
833
+ if (typeof prototype == "object" && prototype !== null)
834
+ for (let name of OVERRIDABLE) enableOverride(prototype, name);
835
+ Object.freeze(root);
836
+ for (let key of Reflect.ownKeys(root)) {
837
+ let descriptor = Object.getOwnPropertyDescriptor(root, key);
838
+ descriptor && "value" in descriptor && freezeDeep(descriptor.value, seen);
839
+ }
840
+ freezeDeep(Object.getPrototypeOf(root), seen);
841
+ }
842
+ function hardenGlobals(global, onTask, runtimeWasm = false) {
843
+ runtimeWasm || chunk6SWKWCMS_js.withdrawWasm();
844
+ let functionThrower = thrower("Function");
845
+ seal(Function.prototype, "constructor", functionThrower);
846
+ for (let source of CODE_CONSTRUCTOR_SOURCES) seal(source(), "constructor", functionThrower);
847
+ for (let name of REMOVED_GLOBALS)
848
+ name !== "Function" && (name in global || Object.getOwnPropertyDescriptor(global, name) !== void 0) && seal(global, name, name === WASM_GLOBAL && runtimeWasm ? chunk6SWKWCMS_js.guardedWebAssembly() : void 0);
849
+ seal(global, "eval", thrower("eval"));
850
+ for (let name of STRING_TIMERS) {
851
+ let timer = global[name];
852
+ if (typeof timer != "function") continue;
853
+ let schedule = timer;
854
+ seal(global, name, (handler, ...rest) => {
855
+ if (typeof handler != "function") throw new GuardError(`${name} with a string`);
856
+ let task = handler;
857
+ return schedule((...args) => (onTask(), task(...args)), ...rest);
858
+ });
859
+ }
860
+ let seen = /* @__PURE__ */ new Set();
861
+ for (let name of FROZEN_GLOBALS) freezeDeep(global[name], seen);
862
+ for (let source of CODE_CONSTRUCTOR_SOURCES) freezeDeep(source(), seen);
863
+ seal(global, "Function", functionThrower), lockGlobal(global);
864
+ }
865
+ function lockGlobal(global) {
866
+ try {
867
+ Object.freeze(global);
868
+ return;
869
+ } catch {
870
+ for (let key of Reflect.ownKeys(global)) {
871
+ let descriptor = Object.getOwnPropertyDescriptor(global, key);
872
+ if (descriptor === void 0 || descriptor.configurable === false) continue;
873
+ let locked = "value" in descriptor ? { value: descriptor.value, writable: false, configurable: false } : { configurable: false };
874
+ Reflect.defineProperty(global, key, locked);
875
+ }
876
+ }
877
+ Reflect.preventExtensions(global);
878
+ }
879
+
880
+ // src/interactives/runtime/slice.ts
881
+ var TICK_GLOBAL = "__cimplify_tick", TICKS_PER_CHECK = 1024, DEFAULT_SLICE_MS = 2e3, SliceExceeded = class extends Error {
882
+ constructor() {
883
+ super("the Interactive ran past its time slice without returning to the host"), this.name = "SliceExceeded";
884
+ }
885
+ };
886
+ function clockBudget(now, slice_ms = 2e3) {
887
+ let deadline = Number.POSITIVE_INFINITY;
888
+ return {
889
+ begin() {
890
+ deadline = now() + slice_ms;
891
+ },
892
+ over() {
893
+ return now() > deadline;
894
+ }
895
+ };
896
+ }
897
+ var COUNT = 0, Slice = class {
898
+ constructor(budget) {
899
+ this.budget = budget;
900
+ this.counter = new Int32Array(1);
901
+ this.exceeded = false;
902
+ this.tick = () => {
903
+ let c = this.counter;
904
+ ++c[(0)] < 1024 || this.check();
905
+ };
906
+ }
907
+ get dead() {
908
+ return this.exceeded;
909
+ }
910
+ begin() {
911
+ this.exceeded || this.budget.begin();
912
+ }
913
+ check() {
914
+ let c = this.counter;
915
+ if (c[(0)] = 0, !this.exceeded) {
916
+ if (!this.budget.over()) return;
917
+ this.exceeded = true;
918
+ }
919
+ throw c[(0)] = 1024, new SliceExceeded();
920
+ }
921
+ };
922
+
923
+ // src/interactives/runtime/guest.ts
924
+ var CTX_REQUEST_DEADLINE_MS = 5e3, CTX_CONFIRMED_REQUEST_DEADLINE_MS = 3e5, CTX_LONG_REQUEST_DEADLINES_MS = {
925
+ ai: 12e4,
926
+ compute: 6e4,
927
+ worker: 6e4,
928
+ agent: 12e4,
929
+ flow: 3e5,
930
+ share: 3e5,
931
+ camera: 3e5
932
+ }, CAPABILITY_FAMILIES = chunkWWKMOA76_js.CTX_CAPABILITIES, NEVER_CONFIRMED = "never", SEGMENT = ".";
933
+ function ctxFamilyOf(operation) {
934
+ let name = operation;
935
+ for (; !(name in CAPABILITY_FAMILIES); ) {
936
+ let at = name.lastIndexOf(SEGMENT);
937
+ if (at < 0) return operation.slice(0, Math.max(0, operation.indexOf(SEGMENT)));
938
+ name = name.slice(0, at);
939
+ }
940
+ return name;
941
+ }
942
+ function ctxRequestDeadlineMs(family) {
943
+ let long = CTX_LONG_REQUEST_DEADLINES_MS[family];
944
+ return long !== void 0 ? long : (CAPABILITY_FAMILIES[family]?.confirmation ?? NEVER_CONFIRMED) === NEVER_CONFIRMED ? (5e3) : (3e5);
945
+ }
946
+ function timerStart() {
947
+ return typeof globalThis.setTimeout == "function" ? globalThis.setTimeout.bind(globalThis) : null;
948
+ }
949
+ function timerStop() {
950
+ return typeof globalThis.clearTimeout == "function" ? globalThis.clearTimeout.bind(globalThis) : null;
951
+ }
952
+ var SLICE_MESSAGE = new SliceExceeded().message, LIFECYCLE_STATE = {
953
+ ready: "ready",
954
+ visible: "visible",
955
+ hidden: "hidden",
956
+ suspend: "suspended",
957
+ resume: "visible",
958
+ revision_update: null,
959
+ dispose: "disposed"
960
+ };
961
+ function describe(error, phase) {
962
+ return error instanceof Error ? error.message : phase === "slice" ? SLICE_MESSAGE : typeof error == "object" && error !== null ? JSON.stringify(error) : String(error);
963
+ }
964
+ function remove(list, item) {
965
+ let at = list.indexOf(item);
966
+ at >= 0 && list.splice(at, 1);
967
+ }
968
+ var GuestRuntime = class {
969
+ constructor(options) {
970
+ this.options = options;
971
+ this.writer = new chunk4ZDR72SG_js.MessageWriter();
972
+ this.pending = /* @__PURE__ */ new Map();
973
+ this.subscriptions = /* @__PURE__ */ new Map();
974
+ this.families = /* @__PURE__ */ new Map();
975
+ this.uiListeners = [];
976
+ this.gameUiListeners = [];
977
+ this.replies = /* @__PURE__ */ new Map();
978
+ this.lifecycleListeners = /* @__PURE__ */ new Map();
979
+ this.disposers = [];
980
+ this.replayListeners = [];
981
+ this.heldReplay = null;
982
+ this.differ = new chunkGDZT5LZ5_js.TreeDiffer();
983
+ this.pong = new Uint8Array(chunk4ZDR72SG_js.PONG_BYTES);
984
+ this.milestoneMessage = new Uint8Array(chunk4ZDR72SG_js.MILESTONE_BYTES);
985
+ this.completeMessage = new Uint8Array(chunk4ZDR72SG_js.SESSION_COMPLETE_BYTES);
986
+ this.reached = /* @__PURE__ */ new Set();
987
+ this.pongView = new DataView(this.pong.buffer);
988
+ this.boot = null;
989
+ this.state = "loading";
990
+ this.nextRequest = 0;
991
+ this.nextCommand = 0;
992
+ this.sliceReported = false;
993
+ this.arriving = [];
994
+ this.wanted = /* @__PURE__ */ new Map();
995
+ this.requested = new chunk4ZDR72SG_js.ChunkBatch(chunk4ZDR72SG_js.MessageTag.chunk_request, chunk4ZDR72SG_js.CHUNK_REQUEST_ENTRY_BYTES);
996
+ this.released = new chunk4ZDR72SG_js.ChunkBatch(chunk4ZDR72SG_js.MessageTag.chunk_release, chunk4ZDR72SG_js.CHUNK_RELEASE_ENTRY_BYTES);
997
+ this.chunkFlushQueued = false;
998
+ this.studioIn = new chunkXK6UDWJS_js.StudioAssembler();
999
+ this.studioOut = new chunkXK6UDWJS_js.StudioSender(chunk4ZDR72SG_js.MessageTag.studio_report, (frame) => this.bridge.send(frame, frame.length));
1000
+ this.flushChunks = () => {
1001
+ this.chunkFlushQueued = false, this.released.size > 0 && this.bridge.send(this.released.bytes, this.released.seal()), this.requested.size > 0 && this.bridge.send(this.requested.bytes, this.requested.seal());
1002
+ };
1003
+ this.chunkChannel = {
1004
+ request: (digest, priority) => this.queueChunk(this.requested, digest, priority),
1005
+ release: (digest) => this.queueChunk(this.released, digest, chunk4ZDR72SG_js.ChunkPriority.now)
1006
+ };
1007
+ this.starting = false;
1008
+ this.startTimer = void 0;
1009
+ this.stopTimer = void 0;
1010
+ this.lifecycle = lifecycleOf(this);
1011
+ this.bridge = options.bridge, this.services = options.services, this.assembler = new chunkZMIL4ZOA_js.PackageAssembler(options.on_runtime_wasm ?? null, options.native_runtimes ?? null, options.assets ?? null), this.lane = new FrameLane(this.bridge), this.bridge.on_message((bytes) => this.receive(bytes)), chunkXK6UDWJS_js.reportMetersTo((live) => this.send(this.writer.json(chunk4ZDR72SG_js.MessageTag.meter_report, live)), options.heap_bytes ?? null), this.pong[0] = chunk4ZDR72SG_js.MessageTag.pong, this.send(this.writer.tag(chunk4ZDR72SG_js.MessageTag.ready));
1012
+ }
1013
+ get program() {
1014
+ return this.boot.program;
1015
+ }
1016
+ get locale() {
1017
+ return this.boot.locale;
1018
+ }
1019
+ get clock_offset_ms() {
1020
+ return this.boot.clock_offset_ms;
1021
+ }
1022
+ current() {
1023
+ return this.state;
1024
+ }
1025
+ onLifecycle(event, listener) {
1026
+ let list = this.lifecycleListeners.get(event) ?? [];
1027
+ return list.push(listener), this.lifecycleListeners.set(event, list), () => remove(list, listener);
1028
+ }
1029
+ needRuntime(unit, priority = chunk4ZDR72SG_js.ChunkPriority.now) {
1030
+ let digest = this.assembler.lateRuntime(unit);
1031
+ return digest === null || this.assembler.holdsWasm(digest) ? false : (this.queueChunk(this.requested, digest, priority), true);
1032
+ }
1033
+ mark(name) {
1034
+ let code = chunk4ZDR72SG_js.Milestone[name];
1035
+ this.reached.has(code) || (this.reached.add(code), this.milestoneMessage[0] = chunk4ZDR72SG_js.MessageTag.milestone, this.milestoneMessage[1] = code, this.bridge.send(this.milestoneMessage, chunk4ZDR72SG_js.MILESTONE_BYTES));
1036
+ }
1037
+ send(length) {
1038
+ this.bridge.send(this.writer.bytes, length);
1039
+ }
1040
+ fault(phase, error) {
1041
+ if (this.services.slice.dead) {
1042
+ if (this.sliceReported) return;
1043
+ this.sliceReported = true, phase = "slice";
1044
+ }
1045
+ let fault = {
1046
+ phase,
1047
+ message: describe(error, phase),
1048
+ stack: error instanceof Error && typeof error.stack == "string" ? error.stack : null
1049
+ };
1050
+ this.send(this.writer.json(chunk4ZDR72SG_js.MessageTag.fault, fault));
1051
+ }
1052
+ call(operation, request) {
1053
+ let boot = this.boot, request_id = `g${this.nextRequest++}`, envelope = {
1054
+ contract_version: 1,
1055
+ request_id,
1056
+ interactive_id: boot.program.interactive_id,
1057
+ revision: boot.program.revision,
1058
+ deadline_ms: boot.deadline_ms,
1059
+ call: { operation, arguments: request }
1060
+ }, family = ctxFamilyOf(operation), deadline = this.options.request_deadline_ms?.(family) ?? ctxRequestDeadlineMs(family);
1061
+ this.startTimer ?? (this.startTimer = timerStart());
1062
+ let startTimer = this.startTimer;
1063
+ return new Promise((resolve, reject) => {
1064
+ let timer = startTimer === null ? null : startTimer(() => this.expire(request_id, family), deadline);
1065
+ this.pending.set(request_id, { resolve, reject, timer }), this.send(this.writer.json(chunk4ZDR72SG_js.MessageTag.request, envelope));
1066
+ });
1067
+ }
1068
+ expire(request_id, family) {
1069
+ let waiting = this.pending.get(request_id);
1070
+ waiting !== void 0 && (this.pending.delete(request_id), waiting.reject({ code: "unavailable", family, retry_after_ms: null }));
1071
+ }
1072
+ subscribe(grant, listener) {
1073
+ return this.listen(this.subscriptions, grant.subscription_id, listener);
1074
+ }
1075
+ family(family, listener) {
1076
+ return this.listen(this.families, family, listener);
1077
+ }
1078
+ listen(table, key, listener) {
1079
+ return table.set(key, [...table.get(key) ?? [], listener]), () => {
1080
+ let rest = (table.get(key) ?? []).filter((l) => l !== listener);
1081
+ rest.length === 0 ? table.delete(key) : table.set(key, rest);
1082
+ };
1083
+ }
1084
+ render(tree) {
1085
+ if (this.state !== "disposed")
1086
+ try {
1087
+ let patches = this.differ.diff(tree);
1088
+ patches.length > 0 && this.send(this.writer.json(chunk4ZDR72SG_js.MessageTag.render, patches));
1089
+ } catch (error) {
1090
+ this.fault("render", error);
1091
+ }
1092
+ }
1093
+ command(command, awaited) {
1094
+ let id = awaited ? ++this.nextCommand : 0;
1095
+ return this.send(this.writer.json(chunk4ZDR72SG_js.MessageTag.ui_command, { id, command })), awaited ? new Promise((resolve) => this.replies.set(id, resolve)) : Promise.resolve(void 0);
1096
+ }
1097
+ on_ui(listener) {
1098
+ return this.uiListeners.push(listener), () => remove(this.uiListeners, listener);
1099
+ }
1100
+ complete(message) {
1101
+ this.state !== "disposed" && this.bridge.send(this.completeMessage, chunk4ZDR72SG_js.writeSessionComplete(this.completeMessage, message));
1102
+ }
1103
+ game_ui(bytes, length) {
1104
+ this.state !== "disposed" && (bytes[0] = chunk4ZDR72SG_js.MessageTag.game_ui, this.bridge.send(bytes, length));
1105
+ }
1106
+ on_game_ui(listener) {
1107
+ return this.gameUiListeners.push(listener), () => remove(this.gameUiListeners, listener);
1108
+ }
1109
+ dispatchGameUi(bytes) {
1110
+ for (let i = 0; i < this.gameUiListeners.length; i++)
1111
+ try {
1112
+ this.gameUiListeners[i](bytes);
1113
+ } catch (error) {
1114
+ this.fault("run", error);
1115
+ }
1116
+ }
1117
+ on_dispose(callback) {
1118
+ this.disposers.push(callback);
1119
+ }
1120
+ receive(bytes) {
1121
+ this.services.slice.begin();
1122
+ try {
1123
+ this.handle(bytes);
1124
+ } catch (error) {
1125
+ this.fault("run", error);
1126
+ }
1127
+ this.services.slice.dead && this.fault("slice", null);
1128
+ }
1129
+ notify(listeners, event) {
1130
+ if (listeners !== void 0)
1131
+ for (let i = 0; i < listeners.length; i++)
1132
+ try {
1133
+ listeners[i](event);
1134
+ } catch (error) {
1135
+ this.fault("run", error);
1136
+ }
1137
+ }
1138
+ handle(bytes) {
1139
+ switch (bytes[0]) {
1140
+ case chunk4ZDR72SG_js.MessageTag.response:
1141
+ this.answer(chunk4ZDR72SG_js.readJson(bytes));
1142
+ return;
1143
+ case chunk4ZDR72SG_js.MessageTag.event:
1144
+ this.deliver(chunk4ZDR72SG_js.readJson(bytes));
1145
+ return;
1146
+ case chunk4ZDR72SG_js.MessageTag.frames:
1147
+ this.lane.receive(bytes);
1148
+ return;
1149
+ case chunk4ZDR72SG_js.MessageTag.ui_event:
1150
+ this.dispatchUi(chunk4ZDR72SG_js.readJson(bytes));
1151
+ return;
1152
+ case chunk4ZDR72SG_js.MessageTag.ui_reply:
1153
+ this.reply(chunk4ZDR72SG_js.readJson(bytes));
1154
+ return;
1155
+ case chunk4ZDR72SG_js.MessageTag.game_ui_event:
1156
+ this.dispatchGameUi(bytes);
1157
+ return;
1158
+ case chunk4ZDR72SG_js.MessageTag.ping:
1159
+ this.answerPing(bytes);
1160
+ return;
1161
+ case chunk4ZDR72SG_js.MessageTag.lifecycle:
1162
+ this.transition(chunk4ZDR72SG_js.LIFECYCLE_BY_CODE[bytes[chunk4ZDR72SG_js.TAG_BYTES]] ?? null);
1163
+ return;
1164
+ case chunk4ZDR72SG_js.MessageTag.boot:
1165
+ this.boot = chunk4ZDR72SG_js.readJson(bytes), this.options.on_boot?.(this.boot), (this.boot.chunk_requests ?? 0) >= chunk4ZDR72SG_js.CHUNK_REQUESTS_VERSION && this.options.assets?.connect?.(this.chunkChannel), this.boot.network !== void 0 && this.options.assets?.network?.(this.boot.network);
1166
+ return;
1167
+ case chunk4ZDR72SG_js.MessageTag.network: {
1168
+ let hint = chunkT7LOXGYX_js.readNetworkHint(bytes);
1169
+ hint !== null && this.options.assets?.network?.(hint);
1170
+ return;
1171
+ }
1172
+ case chunk4ZDR72SG_js.MessageTag.inspector:
1173
+ chunkPTRNO5UD_js.requestInspector(bytes[chunk4ZDR72SG_js.TAG_BYTES] === chunk4ZDR72SG_js.INSPECTOR_SHOWN);
1174
+ return;
1175
+ case chunk4ZDR72SG_js.MessageTag.meters:
1176
+ chunkXK6UDWJS_js.requestMeters(chunk4ZDR72SG_js.readJson(bytes));
1177
+ return;
1178
+ case chunk4ZDR72SG_js.MessageTag.studio: {
1179
+ chunkXK6UDWJS_js.openStudioChannel((message2) => this.studioOut.post(message2));
1180
+ let message = this.studioIn.accept(bytes);
1181
+ message !== null && chunkXK6UDWJS_js.deliverStudio(message);
1182
+ return;
1183
+ }
1184
+ case chunk4ZDR72SG_js.MessageTag.chunk_failed:
1185
+ this.chunkFailed(bytes);
1186
+ return;
1187
+ case chunk4ZDR72SG_js.MessageTag.chunk:
1188
+ this.acceptChunk(bytes);
1189
+ return;
1190
+ case chunk4ZDR72SG_js.MessageTag.stage:
1191
+ this.stageChunk(bytes);
1192
+ return;
1193
+ case chunk4ZDR72SG_js.MessageTag.chunk_ref:
1194
+ this.acceptRef(bytes, false);
1195
+ return;
1196
+ case chunk4ZDR72SG_js.MessageTag.stage_ref:
1197
+ this.acceptRef(bytes, true);
1198
+ return;
1199
+ case chunk4ZDR72SG_js.MessageTag.warm:
1200
+ this.warm(chunk4ZDR72SG_js.readJson(bytes));
1201
+ return;
1202
+ case chunk4ZDR72SG_js.MessageTag.start:
1203
+ this.start();
1204
+ return;
1205
+ case chunk4ZDR72SG_js.MessageTag.hot:
1206
+ this.hot(chunk4ZDR72SG_js.readJson(bytes));
1207
+ return;
1208
+ case chunk4ZDR72SG_js.MessageTag.replay: {
1209
+ let opened = chunkGDZT5LZ5_js.readReplayMessage(bytes);
1210
+ if (opened === null) return;
1211
+ this.replayListeners.length === 0 && (this.heldReplay = opened);
1212
+ for (let i = 0; i < this.replayListeners.length; i++) this.replayListeners[i](opened.replay, opened.mode);
1213
+ return;
1214
+ }
1215
+ }
1216
+ }
1217
+ on_replay(listener) {
1218
+ this.replayListeners.push(listener);
1219
+ let held = this.heldReplay;
1220
+ return this.heldReplay = null, held !== null && listener(held.replay, held.mode), () => remove(this.replayListeners, listener);
1221
+ }
1222
+ async hot(request) {
1223
+ let done = (result) => this.send(this.writer.json(chunk4ZDR72SG_js.MessageTag.hot_done, result)), linker = this.services.linker;
1224
+ if (!this.starting || this.state === "loading" || this.state === "disposed") return done({ swapped: false, reason: "the Interactive is not running" });
1225
+ if (linker.relink === void 0) return done({ swapped: false, reason: "this host cannot swap code in place" });
1226
+ if (!chunkT7LOXGYX_js.hotAccepted()) return done({ swapped: false, reason: "the Interactive does not accept code swaps" });
1227
+ await this.arrivals();
1228
+ let changedAssets = this.assembler.swapIndex(request.chunks);
1229
+ if (changedAssets === null) return done({ swapped: false, reason: "more than the code and assets changed" });
1230
+ try {
1231
+ let { entry, modules } = this.assembler.modules(new Set(this.boot?.bytecode_modules ?? [])), linked = await chunkT7LOXGYX_js.relinkingDefinitions(() => linker.relink.call(linker, modules, entry, this.services.slice.tick)), report = chunkT7LOXGYX_js.applyHot(linked, changedAssets);
1232
+ done(report === null ? { swapped: !1, reason: "the new code has no hot export" } : { swapped: !0, report });
1233
+ } catch (error) {
1234
+ done({ swapped: false, reason: error instanceof Error ? error.message : String(error) });
1235
+ }
1236
+ }
1237
+ acceptChunk(bytes) {
1238
+ chunkQQABGCMM_js.readinessProbe()?.chunk(bytes.length - chunk4ZDR72SG_js.TAG_BYTES - chunk4ZDR72SG_js.DIGEST_BYTES);
1239
+ try {
1240
+ this.assembler.accept(bytes.subarray(chunk4ZDR72SG_js.TAG_BYTES, chunk4ZDR72SG_js.TAG_BYTES + chunk4ZDR72SG_js.DIGEST_BYTES), bytes.subarray(chunk4ZDR72SG_js.TAG_BYTES + chunk4ZDR72SG_js.DIGEST_BYTES));
1241
+ } catch (error) {
1242
+ this.fault("boot", error);
1243
+ }
1244
+ this.arrived(bytes);
1245
+ }
1246
+ arrived(bytes) {
1247
+ if (this.wanted.size === 0) return;
1248
+ let digest = chunk4ZDR72SG_js.hex(bytes.subarray(chunk4ZDR72SG_js.TAG_BYTES, chunk4ZDR72SG_js.TAG_BYTES + chunk4ZDR72SG_js.DIGEST_BYTES)), resolve = this.wanted.get(digest);
1249
+ resolve !== void 0 && (this.wanted.delete(digest), resolve());
1250
+ }
1251
+ acceptRef(bytes, staged) {
1252
+ let digest = chunk4ZDR72SG_js.hex(bytes.subarray(chunk4ZDR72SG_js.TAG_BYTES, chunk4ZDR72SG_js.TAG_BYTES + chunk4ZDR72SG_js.DIGEST_BYTES)), payload = chunk4ZDR72SG_js.hex(bytes.subarray(chunk4ZDR72SG_js.TAG_BYTES + chunk4ZDR72SG_js.DIGEST_BYTES, chunk4ZDR72SG_js.TAG_BYTES + chunk4ZDR72SG_js.DIGEST_BYTES + chunk4ZDR72SG_js.DIGEST_BYTES));
1253
+ this.arriving.push(this.fetchRef(digest, payload, staged));
1254
+ }
1255
+ async fetchRef(digest, payload, staged) {
1256
+ let fetched = this.options.fetch_wasm?.(digest, payload) ?? null, bytes = fetched === null ? null : await fetched.catch(() => null);
1257
+ if (bytes === null) {
1258
+ await this.want(digest);
1259
+ return;
1260
+ }
1261
+ staged ? this.options.on_staged_wasm?.(digest, this.assembler.stage(digest, bytes)) : this.assembler.acceptWasmPayload(digest, bytes);
1262
+ }
1263
+ want(digest) {
1264
+ return new Promise((resolve) => {
1265
+ this.wanted.set(digest, resolve), this.queueChunk(this.requested, digest, chunk4ZDR72SG_js.ChunkPriority.now);
1266
+ });
1267
+ }
1268
+ queueChunk(batch, digest, priority) {
1269
+ batch.full && this.flushChunks(), batch.add(digest, priority) && (this.chunkFlushQueued || (this.chunkFlushQueued = true, queueMicrotask(this.flushChunks)));
1270
+ }
1271
+ chunkFailed(bytes) {
1272
+ let failed = chunk4ZDR72SG_js.readChunkFailed(bytes);
1273
+ failed !== null && (this.wanted.has(failed.digest) && (this.wanted.delete(failed.digest), this.fault("boot", new Error(`the host could not deliver chunk ${failed.digest} (${failed.reason})`))), this.options.assets?.fail?.(failed.digest, failed.reason));
1274
+ }
1275
+ async arrivals() {
1276
+ for (; this.arriving.length > 0; ) await Promise.all(this.arriving.splice(0));
1277
+ }
1278
+ async warm(image) {
1279
+ await this.arrivals(), await this.options.on_warm?.(image)?.catch(() => {
1280
+ }), this.send(this.writer.tag(chunk4ZDR72SG_js.MessageTag.warmed));
1281
+ }
1282
+ stageChunk(bytes) {
1283
+ try {
1284
+ let chunk = chunkZMIL4ZOA_js.decodeChunk(bytes.subarray(chunk4ZDR72SG_js.TAG_BYTES + chunk4ZDR72SG_js.DIGEST_BYTES)), digest = chunk4ZDR72SG_js.hex(bytes.subarray(chunk4ZDR72SG_js.TAG_BYTES, chunk4ZDR72SG_js.TAG_BYTES + chunk4ZDR72SG_js.DIGEST_BYTES));
1285
+ chunk.kind === chunkZMIL4ZOA_js.ChunkKind.data ? this.options.assets?.accept(digest, chunk.payload) : chunk.kind === chunkZMIL4ZOA_js.ChunkKind.wasm ? this.options.on_staged_wasm?.(digest, this.assembler.stage(digest, chunk.payload)) : chunk.kind === chunkZMIL4ZOA_js.ChunkKind.code && this.options.on_staged_code?.(this.assembler.stageCode(digest, chunk.payload));
1286
+ } catch (error) {
1287
+ this.fault("boot", error);
1288
+ }
1289
+ this.arrived(bytes);
1290
+ }
1291
+ answerPing(bytes) {
1292
+ this.pong[1] = bytes[1], this.pong[2] = bytes[2], this.pong[3] = bytes[3], this.pong[4] = bytes[4], this.pongView.setFloat64(5, this.options.heap_bytes?.() ?? 0, true), this.bridge.send(this.pong, chunk4ZDR72SG_js.PONG_BYTES);
1293
+ }
1294
+ answer(envelope) {
1295
+ let waiting = this.pending.get(envelope.request_id);
1296
+ waiting !== void 0 && (this.pending.delete(envelope.request_id), this.stopTimer ?? (this.stopTimer = timerStop()), waiting.timer !== null && this.stopTimer !== null && this.stopTimer(waiting.timer), envelope.outcome.status === "ok" ? waiting.resolve(envelope.outcome.response.result) : waiting.reject(envelope.outcome.error));
1297
+ }
1298
+ deliver(envelope) {
1299
+ let event = envelope.event;
1300
+ if (event.family === "ui") {
1301
+ this.dispatchUi(event.event);
1302
+ return;
1303
+ }
1304
+ this.notify(this.subscriptions.get(envelope.subscription_id), event), this.notify(this.families.get(event.family), event);
1305
+ }
1306
+ dispatchUi(event) {
1307
+ if (this.state === "disposed") return;
1308
+ let listeners = this.uiListeners.slice();
1309
+ for (let i = 0; i < listeners.length; i++)
1310
+ try {
1311
+ listeners[i](event);
1312
+ } catch (error) {
1313
+ this.fault("run", error);
1314
+ }
1315
+ }
1316
+ reply(reply) {
1317
+ let resolve = this.replies.get(reply.id);
1318
+ resolve !== void 0 && (this.replies.delete(reply.id), resolve(reply.value));
1319
+ }
1320
+ transition(event) {
1321
+ if (event === null || this.state === "disposed") return;
1322
+ let next = LIFECYCLE_STATE[event];
1323
+ next !== null && (this.state = next);
1324
+ let listeners = (this.lifecycleListeners.get(event) ?? []).slice();
1325
+ for (let listener of listeners)
1326
+ try {
1327
+ listener();
1328
+ } catch (error) {
1329
+ this.fault("run", error);
1330
+ }
1331
+ if (event === "dispose") {
1332
+ for (let i = this.disposers.length - 1; i >= 0; i--)
1333
+ try {
1334
+ this.disposers[i]();
1335
+ } catch (error) {
1336
+ this.fault("run", error);
1337
+ }
1338
+ this.disposers.length = 0, this.uiListeners.length = 0, this.lane.flush(), this.send(this.writer.tag(chunk4ZDR72SG_js.MessageTag.disposed));
1339
+ }
1340
+ }
1341
+ async start() {
1342
+ if (this.boot === null || this.state !== "loading" || this.starting) {
1343
+ this.fault("start", new Error("start arrived before boot or twice"));
1344
+ return;
1345
+ }
1346
+ this.starting = true, await this.arrivals();
1347
+ try {
1348
+ this.services.harden();
1349
+ } catch (error) {
1350
+ this.fault("guard", error);
1351
+ return;
1352
+ }
1353
+ let entry;
1354
+ try {
1355
+ let { entry: path, modules, runtimes } = this.assembler.modules(new Set(this.boot.bytecode_modules ?? [])), linked = await this.services.linker.link(modules, path, this.services.slice.tick, runtimes);
1356
+ if (typeof linked.default != "function") throw new Error(`${path} does not export a default function`);
1357
+ entry = linked.default;
1358
+ } catch (error) {
1359
+ this.fault("link", error);
1360
+ return;
1361
+ }
1362
+ this.mark("linked");
1363
+ try {
1364
+ let ctx = (this.options.ctx ?? createGuestCtx)(this);
1365
+ this.transition("ready"), this.mark("main_entered"), await entry(ctx);
1366
+ } catch (error) {
1367
+ this.fault("start", error);
1368
+ return;
1369
+ }
1370
+ this.current() === "ready" && this.transition("visible"), this.send(this.writer.tag(chunk4ZDR72SG_js.MessageTag.started));
1371
+ }
1372
+ };
1373
+ function lifecycleOf(runtime) {
1374
+ return {
1375
+ get state() {
1376
+ return runtime.current();
1377
+ },
1378
+ on: (event, listener) => runtime.onLifecycle(event, listener)
1379
+ };
1380
+ }
1381
+
1382
+ exports.CTX_CONFIRMED_REQUEST_DEADLINE_MS = (3e5);
1383
+ exports.CTX_LONG_REQUEST_DEADLINES_MS = CTX_LONG_REQUEST_DEADLINES_MS;
1384
+ exports.CTX_REQUEST_DEADLINE_MS = (5e3);
1385
+ exports.ChannelPublisher = ChannelPublisher;
1386
+ exports.ClipError = ClipError;
1387
+ exports.DEFAULT_SLICE_MS = (2e3);
1388
+ exports.FrameLane = FrameLane;
1389
+ exports.GuardError = GuardError;
1390
+ exports.GuestRuntime = GuestRuntime;
1391
+ exports.GuestUnavailableError = GuestUnavailableError;
1392
+ exports.LaneCounter = LaneCounter;
1393
+ exports.LaneFastReader = LaneFastReader;
1394
+ exports.RoomInputPublisher = RoomInputPublisher;
1395
+ exports.Slice = Slice;
1396
+ exports.SliceExceeded = SliceExceeded;
1397
+ exports.TICKS_PER_CHECK = (1024);
1398
+ exports.TICK_GLOBAL = TICK_GLOBAL;
1399
+ exports.clockBudget = clockBudget;
1400
+ exports.createGuestCtx = createGuestCtx;
1401
+ exports.ctxFamilyOf = ctxFamilyOf;
1402
+ exports.ctxRequestDeadlineMs = ctxRequestDeadlineMs;
1403
+ exports.hardenGlobals = hardenGlobals;