@oasys/oecs 0.5.4 → 0.6.0

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 (510) hide show
  1. package/CHANGELOG.md +1223 -266
  2. package/README.md +217 -112
  3. package/dist/core/ecs/access_check.d.cts +29 -29
  4. package/dist/core/ecs/access_check.d.ts +29 -29
  5. package/dist/core/ecs/access_check.d.ts.map +1 -1
  6. package/dist/core/ecs/archetype.d.cts +217 -209
  7. package/dist/core/ecs/archetype.d.ts +217 -209
  8. package/dist/core/ecs/archetype.d.ts.map +1 -1
  9. package/dist/core/ecs/archetype_closure.d.cts +23 -0
  10. package/dist/core/ecs/archetype_closure.d.ts +23 -0
  11. package/dist/core/ecs/archetype_closure.d.ts.map +1 -0
  12. package/dist/core/ecs/archetype_graph.d.cts +33 -33
  13. package/dist/core/ecs/archetype_graph.d.ts +33 -33
  14. package/dist/core/ecs/archetype_graph.d.ts.map +1 -1
  15. package/dist/core/ecs/archetype_types.d.cts +55 -0
  16. package/dist/core/ecs/archetype_types.d.ts +55 -0
  17. package/dist/core/ecs/archetype_types.d.ts.map +1 -0
  18. package/dist/core/ecs/change_feed.d.cts +53 -0
  19. package/dist/core/ecs/change_feed.d.ts +53 -0
  20. package/dist/core/ecs/change_feed.d.ts.map +1 -0
  21. package/dist/core/ecs/changed_query.d.cts +36 -0
  22. package/dist/core/ecs/changed_query.d.ts +36 -0
  23. package/dist/core/ecs/changed_query.d.ts.map +1 -0
  24. package/dist/core/ecs/chunk_columns.d.cts +49 -0
  25. package/dist/core/ecs/chunk_columns.d.ts +49 -0
  26. package/dist/core/ecs/chunk_columns.d.ts.map +1 -0
  27. package/dist/core/ecs/command_log.d.cts +26 -26
  28. package/dist/core/ecs/command_log.d.ts +26 -26
  29. package/dist/core/ecs/command_log.d.ts.map +1 -1
  30. package/dist/core/ecs/component.d.cts +43 -42
  31. package/dist/core/ecs/component.d.ts +43 -42
  32. package/dist/core/ecs/component.d.ts.map +1 -1
  33. package/dist/core/ecs/component_registry.d.cts +53 -0
  34. package/dist/core/ecs/component_registry.d.ts +53 -0
  35. package/dist/core/ecs/component_registry.d.ts.map +1 -0
  36. package/dist/core/ecs/compute_backend.d.cts +18 -7
  37. package/dist/core/ecs/compute_backend.d.ts +18 -7
  38. package/dist/core/ecs/compute_backend.d.ts.map +1 -1
  39. package/dist/core/ecs/deferred_commands.d.cts +15 -14
  40. package/dist/core/ecs/deferred_commands.d.ts +15 -14
  41. package/dist/core/ecs/deferred_commands.d.ts.map +1 -1
  42. package/dist/core/ecs/dispatch_trace.d.cts +32 -31
  43. package/dist/core/ecs/dispatch_trace.d.ts +32 -31
  44. package/dist/core/ecs/dispatch_trace.d.ts.map +1 -1
  45. package/dist/core/ecs/ecs.d.cts +289 -270
  46. package/dist/core/ecs/ecs.d.ts +289 -270
  47. package/dist/core/ecs/ecs.d.ts.map +1 -1
  48. package/dist/core/ecs/ecs_memory.d.cts +134 -136
  49. package/dist/core/ecs/ecs_memory.d.ts +134 -136
  50. package/dist/core/ecs/ecs_memory.d.ts.map +1 -1
  51. package/dist/core/ecs/ecs_options.d.cts +89 -0
  52. package/dist/core/ecs/ecs_options.d.ts +89 -0
  53. package/dist/core/ecs/ecs_options.d.ts.map +1 -0
  54. package/dist/core/ecs/entity.d.cts +4 -4
  55. package/dist/core/ecs/entity.d.ts +4 -4
  56. package/dist/core/ecs/entity_allocator.d.cts +20 -18
  57. package/dist/core/ecs/entity_allocator.d.ts +20 -18
  58. package/dist/core/ecs/entity_allocator.d.ts.map +1 -1
  59. package/dist/core/ecs/event.d.cts +36 -22
  60. package/dist/core/ecs/event.d.ts +36 -22
  61. package/dist/core/ecs/event.d.ts.map +1 -1
  62. package/dist/core/ecs/facades.d.cts +12 -126
  63. package/dist/core/ecs/facades.d.ts +12 -126
  64. package/dist/core/ecs/facades.d.ts.map +1 -1
  65. package/dist/core/ecs/frame_stepper.d.cts +12 -12
  66. package/dist/core/ecs/frame_stepper.d.ts +12 -12
  67. package/dist/core/ecs/frame_stepper.d.ts.map +1 -1
  68. package/dist/core/ecs/frame_trace.d.cts +32 -32
  69. package/dist/core/ecs/frame_trace.d.ts +32 -32
  70. package/dist/core/ecs/frame_trace.d.ts.map +1 -1
  71. package/dist/core/ecs/host_commands.d.cts +103 -85
  72. package/dist/core/ecs/host_commands.d.ts +103 -85
  73. package/dist/core/ecs/host_commands.d.ts.map +1 -1
  74. package/dist/core/ecs/index.d.cts +21 -11
  75. package/dist/core/ecs/index.d.ts +21 -11
  76. package/dist/core/ecs/index.d.ts.map +1 -1
  77. package/dist/core/ecs/observer.d.cts +39 -120
  78. package/dist/core/ecs/observer.d.ts +39 -120
  79. package/dist/core/ecs/observer.d.ts.map +1 -1
  80. package/dist/core/ecs/phase.d.cts +79 -0
  81. package/dist/core/ecs/phase.d.ts +79 -0
  82. package/dist/core/ecs/phase.d.ts.map +1 -0
  83. package/dist/core/ecs/plugin.d.cts +125 -0
  84. package/dist/core/ecs/plugin.d.ts +125 -0
  85. package/dist/core/ecs/plugin.d.ts.map +1 -0
  86. package/dist/core/ecs/plugin_slots.d.cts +26 -0
  87. package/dist/core/ecs/plugin_slots.d.ts +26 -0
  88. package/dist/core/ecs/plugin_slots.d.ts.map +1 -0
  89. package/dist/core/ecs/query.d.cts +208 -578
  90. package/dist/core/ecs/query.d.ts +208 -578
  91. package/dist/core/ecs/query.d.ts.map +1 -1
  92. package/dist/core/ecs/query_cache.d.cts +130 -0
  93. package/dist/core/ecs/query_cache.d.ts +130 -0
  94. package/dist/core/ecs/query_cache.d.ts.map +1 -0
  95. package/dist/core/ecs/query_registry.d.cts +47 -0
  96. package/dist/core/ecs/query_registry.d.ts +47 -0
  97. package/dist/core/ecs/query_registry.d.ts.map +1 -0
  98. package/dist/core/ecs/query_terms.d.cts +126 -0
  99. package/dist/core/ecs/query_terms.d.ts +126 -0
  100. package/dist/core/ecs/query_terms.d.ts.map +1 -0
  101. package/dist/core/ecs/ref.d.cts +100 -39
  102. package/dist/core/ecs/ref.d.ts +100 -39
  103. package/dist/core/ecs/ref.d.ts.map +1 -1
  104. package/dist/core/ecs/relation.d.cts +101 -182
  105. package/dist/core/ecs/relation.d.ts +101 -182
  106. package/dist/core/ecs/relation.d.ts.map +1 -1
  107. package/dist/core/ecs/resource.d.cts +13 -13
  108. package/dist/core/ecs/resource.d.ts +13 -13
  109. package/dist/core/ecs/resource_registry.d.cts +5 -5
  110. package/dist/core/ecs/resource_registry.d.ts +5 -5
  111. package/dist/core/ecs/resource_registry.d.ts.map +1 -1
  112. package/dist/core/ecs/row_kinds.d.cts +24 -0
  113. package/dist/core/ecs/row_kinds.d.ts +24 -0
  114. package/dist/core/ecs/row_kinds.d.ts.map +1 -0
  115. package/dist/core/ecs/run_condition.d.cts +23 -23
  116. package/dist/core/ecs/run_condition.d.ts +23 -23
  117. package/dist/core/ecs/run_condition.d.ts.map +1 -1
  118. package/dist/core/ecs/schedule.d.cts +91 -120
  119. package/dist/core/ecs/schedule.d.ts +91 -120
  120. package/dist/core/ecs/schedule.d.ts.map +1 -1
  121. package/dist/core/ecs/schedule_plan.d.cts +33 -0
  122. package/dist/core/ecs/schedule_plan.d.ts +33 -0
  123. package/dist/core/ecs/schedule_plan.d.ts.map +1 -0
  124. package/dist/core/ecs/snapshot.d.cts +77 -0
  125. package/dist/core/ecs/snapshot.d.ts +77 -0
  126. package/dist/core/ecs/snapshot.d.ts.map +1 -0
  127. package/dist/core/ecs/snapshot_mount.d.cts +42 -0
  128. package/dist/core/ecs/snapshot_mount.d.ts +42 -0
  129. package/dist/core/ecs/snapshot_mount.d.ts.map +1 -0
  130. package/dist/core/ecs/sparse_store.d.cts +108 -51
  131. package/dist/core/ecs/sparse_store.d.ts +108 -51
  132. package/dist/core/ecs/sparse_store.d.ts.map +1 -1
  133. package/dist/core/ecs/store.d.cts +527 -473
  134. package/dist/core/ecs/store.d.ts +527 -473
  135. package/dist/core/ecs/store.d.ts.map +1 -1
  136. package/dist/core/ecs/store_layout_listener.d.cts +6 -6
  137. package/dist/core/ecs/store_layout_listener.d.ts +6 -6
  138. package/dist/core/ecs/store_types.d.cts +122 -0
  139. package/dist/core/ecs/store_types.d.ts +122 -0
  140. package/dist/core/ecs/store_types.d.ts.map +1 -0
  141. package/dist/core/ecs/system.d.cts +146 -61
  142. package/dist/core/ecs/system.d.ts +146 -61
  143. package/dist/core/ecs/system.d.ts.map +1 -1
  144. package/dist/core/ecs/system_context.d.cts +296 -0
  145. package/dist/core/ecs/system_context.d.ts +296 -0
  146. package/dist/core/ecs/system_context.d.ts.map +1 -0
  147. package/dist/core/ecs/system_set.d.cts +48 -0
  148. package/dist/core/ecs/system_set.d.ts +48 -0
  149. package/dist/core/ecs/system_set.d.ts.map +1 -0
  150. package/dist/core/ecs/utils/arrays.d.cts +15 -1
  151. package/dist/core/ecs/utils/arrays.d.ts +15 -1
  152. package/dist/core/ecs/utils/arrays.d.ts.map +1 -1
  153. package/dist/core/ecs/utils/error.d.cts +82 -6
  154. package/dist/core/ecs/utils/error.d.ts +82 -6
  155. package/dist/core/ecs/utils/error.d.ts.map +1 -1
  156. package/dist/core/ecs/utils/plugin_error.d.cts +10 -0
  157. package/dist/core/ecs/utils/plugin_error.d.ts +10 -0
  158. package/dist/core/ecs/utils/plugin_error.d.ts.map +1 -0
  159. package/dist/core/restore_errors.d.cts +30 -0
  160. package/dist/core/restore_errors.d.ts +30 -0
  161. package/dist/core/restore_errors.d.ts.map +1 -0
  162. package/dist/core/store/action_ring.d.cts +44 -44
  163. package/dist/core/store/action_ring.d.ts +44 -44
  164. package/dist/core/store/action_ring.d.ts.map +1 -1
  165. package/dist/core/store/allocator.d.cts +149 -95
  166. package/dist/core/store/allocator.d.ts +149 -95
  167. package/dist/core/store/allocator.d.ts.map +1 -1
  168. package/dist/core/store/buffer_backed_column.d.cts +17 -17
  169. package/dist/core/store/buffer_backed_column.d.ts +17 -17
  170. package/dist/core/store/buffer_backed_column.d.ts.map +1 -1
  171. package/dist/core/store/column_store.d.cts +124 -86
  172. package/dist/core/store/column_store.d.ts +124 -86
  173. package/dist/core/store/column_store.d.ts.map +1 -1
  174. package/dist/core/store/command_dispatch.d.cts +14 -15
  175. package/dist/core/store/command_dispatch.d.ts +14 -15
  176. package/dist/core/store/command_dispatch.d.ts.map +1 -1
  177. package/dist/core/store/command_ring.d.cts +36 -39
  178. package/dist/core/store/command_ring.d.ts +36 -39
  179. package/dist/core/store/command_ring.d.ts.map +1 -1
  180. package/dist/core/store/descriptor.d.cts +34 -17
  181. package/dist/core/store/descriptor.d.ts +34 -17
  182. package/dist/core/store/descriptor.d.ts.map +1 -1
  183. package/dist/core/store/entity_index.d.cts +34 -35
  184. package/dist/core/store/entity_index.d.ts +34 -35
  185. package/dist/core/store/entity_index.d.ts.map +1 -1
  186. package/dist/core/store/event_ring.d.cts +36 -38
  187. package/dist/core/store/event_ring.d.ts +36 -38
  188. package/dist/core/store/event_ring.d.ts.map +1 -1
  189. package/dist/core/store/extend.d.cts +13 -7
  190. package/dist/core/store/extend.d.ts +13 -7
  191. package/dist/core/store/extend.d.ts.map +1 -1
  192. package/dist/core/store/grow.d.cts +2 -2
  193. package/dist/core/store/grow.d.ts +2 -2
  194. package/dist/core/store/grow.d.ts.map +1 -1
  195. package/dist/core/store/header.d.cts +31 -27
  196. package/dist/core/store/header.d.ts +31 -27
  197. package/dist/core/store/header.d.ts.map +1 -1
  198. package/dist/core/store/index.d.cts +10 -10
  199. package/dist/core/store/index.d.ts +10 -10
  200. package/dist/core/store/index.d.ts.map +1 -1
  201. package/dist/core/store/layout_ops.d.cts +71 -62
  202. package/dist/core/store/layout_ops.d.ts +71 -62
  203. package/dist/core/store/layout_ops.d.ts.map +1 -1
  204. package/dist/core/store/region_table.d.cts +28 -21
  205. package/dist/core/store/region_table.d.ts +28 -21
  206. package/dist/core/store/region_table.d.ts.map +1 -1
  207. package/dist/core/store/snapshot.d.cts +31 -16
  208. package/dist/core/store/snapshot.d.ts +31 -16
  209. package/dist/core/store/snapshot.d.ts.map +1 -1
  210. package/dist/core/store/state_hash.d.cts +12 -12
  211. package/dist/core/store/state_hash.d.ts +12 -12
  212. package/dist/core/store/state_hash.d.ts.map +1 -1
  213. package/dist/core/store/store_regions.d.cts +10 -10
  214. package/dist/core/store/store_regions.d.ts +10 -10
  215. package/dist/core/store/store_regions.d.ts.map +1 -1
  216. package/dist/core/store/vendored_abi/abi.d.cts +27 -2
  217. package/dist/core/store/vendored_abi/abi.d.ts +27 -2
  218. package/dist/core/store/vendored_abi/abi.d.ts.map +1 -1
  219. package/dist/host_commands-B2KMx8O2.cjs +1 -0
  220. package/dist/host_commands-ClVPvhSa.cjs +2 -0
  221. package/dist/host_commands-CwxVQS1z.js +1524 -0
  222. package/dist/host_commands-nJvTy88E.js +1667 -0
  223. package/dist/index.cjs +1 -1
  224. package/dist/index.d.cts +15 -10
  225. package/dist/index.d.ts +15 -10
  226. package/dist/index.d.ts.map +1 -1
  227. package/dist/index.development.cjs +1 -1
  228. package/dist/index.development.js +5804 -5203
  229. package/dist/index.js +5323 -4764
  230. package/dist/internal.cjs +2 -2
  231. package/dist/internal.d.cts +5 -2
  232. package/dist/internal.d.ts +5 -2
  233. package/dist/internal.d.ts.map +1 -1
  234. package/dist/internal.development.cjs +1 -1
  235. package/dist/internal.development.js +70 -20
  236. package/dist/internal.js +138 -83
  237. package/dist/plugins/abi-D3V-QUSf.cjs +1 -0
  238. package/dist/plugins/abi-NP8pNxpd.js +42 -0
  239. package/dist/plugins/arrays-Dr_1hCjL.js +28 -0
  240. package/dist/plugins/arrays-Dt-Joc4i.cjs +1 -0
  241. package/dist/plugins/assertions-gtDVfbnQ.js +6 -0
  242. package/dist/plugins/assertions-z5GQd_bB.cjs +1 -0
  243. package/dist/{extensions → plugins}/editor/editor.d.cts +54 -54
  244. package/dist/{extensions → plugins}/editor/editor.d.ts +54 -54
  245. package/dist/plugins/editor/editor.d.ts.map +1 -0
  246. package/dist/{extensions → plugins}/editor/field_handle.d.cts +12 -12
  247. package/dist/{extensions → plugins}/editor/field_handle.d.ts +12 -12
  248. package/dist/plugins/editor/field_handle.d.ts.map +1 -0
  249. package/dist/plugins/editor/index.d.cts +22 -0
  250. package/dist/plugins/editor/index.d.ts +22 -0
  251. package/dist/plugins/editor/index.d.ts.map +1 -0
  252. package/dist/plugins/editor.cjs +1 -0
  253. package/dist/plugins/editor.d.cts +1 -0
  254. package/dist/plugins/editor.d.ts +1 -0
  255. package/dist/plugins/editor.development.cjs +1 -0
  256. package/dist/{extensions/editor/index.development.js → plugins/editor.development.js} +81 -64
  257. package/dist/{extensions/editor/index.js → plugins/editor.js} +81 -64
  258. package/dist/plugins/events/event_channel.d.cts +13 -0
  259. package/dist/plugins/events/event_channel.d.ts +13 -0
  260. package/dist/plugins/events/event_channel.d.ts.map +1 -0
  261. package/dist/plugins/events/event_registry.d.cts +22 -0
  262. package/dist/plugins/events/event_registry.d.ts +22 -0
  263. package/dist/plugins/events/event_registry.d.ts.map +1 -0
  264. package/dist/plugins/events/facade.d.cts +26 -0
  265. package/dist/plugins/events/facade.d.ts +26 -0
  266. package/dist/plugins/events/facade.d.ts.map +1 -0
  267. package/dist/plugins/events/index.d.cts +10 -0
  268. package/dist/plugins/events/index.d.ts +10 -0
  269. package/dist/plugins/events/index.d.ts.map +1 -0
  270. package/dist/plugins/events.cjs +1 -0
  271. package/dist/plugins/events.d.cts +1 -0
  272. package/dist/plugins/events.d.ts +1 -0
  273. package/dist/plugins/events.development.cjs +1 -0
  274. package/dist/plugins/events.development.js +174 -0
  275. package/dist/plugins/events.js +159 -0
  276. package/dist/plugins/observers/index.d.cts +23 -0
  277. package/dist/plugins/observers/index.d.ts +23 -0
  278. package/dist/plugins/observers/index.d.ts.map +1 -0
  279. package/dist/plugins/observers/observer_registry.d.cts +101 -0
  280. package/dist/plugins/observers/observer_registry.d.ts +101 -0
  281. package/dist/plugins/observers/observer_registry.d.ts.map +1 -0
  282. package/dist/plugins/observers.cjs +1 -0
  283. package/dist/plugins/observers.d.cts +1 -0
  284. package/dist/plugins/observers.d.ts +1 -0
  285. package/dist/plugins/observers.development.cjs +1 -0
  286. package/dist/plugins/observers.development.js +431 -0
  287. package/dist/plugins/observers.js +403 -0
  288. package/dist/plugins/relation_store-BsoegrZh.js +313 -0
  289. package/dist/plugins/relation_store-DQKSnxsm.cjs +1 -0
  290. package/dist/plugins/relation_store-RBhpcE28.cjs +1 -0
  291. package/dist/plugins/relation_store-RqW5Snx6.js +328 -0
  292. package/dist/plugins/relations/builtin_relations.d.cts +48 -0
  293. package/dist/plugins/relations/builtin_relations.d.ts +48 -0
  294. package/dist/plugins/relations/builtin_relations.d.ts.map +1 -0
  295. package/dist/plugins/relations/facade.d.cts +73 -0
  296. package/dist/plugins/relations/facade.d.ts +73 -0
  297. package/dist/plugins/relations/facade.d.ts.map +1 -0
  298. package/dist/plugins/relations/index.d.cts +11 -0
  299. package/dist/plugins/relations/index.d.ts +11 -0
  300. package/dist/plugins/relations/index.d.ts.map +1 -0
  301. package/dist/{core/ecs → plugins/relations}/relation_service.d.cts +85 -97
  302. package/dist/{core/ecs → plugins/relations}/relation_service.d.ts +85 -97
  303. package/dist/plugins/relations/relation_service.d.ts.map +1 -0
  304. package/dist/plugins/relations/relation_store.d.cts +177 -0
  305. package/dist/plugins/relations/relation_store.d.ts +177 -0
  306. package/dist/plugins/relations/relation_store.d.ts.map +1 -0
  307. package/dist/plugins/relations.cjs +1 -0
  308. package/dist/plugins/relations.d.cts +1 -0
  309. package/dist/plugins/relations.d.ts +1 -0
  310. package/dist/plugins/relations.development.cjs +1 -0
  311. package/dist/plugins/relations.development.js +603 -0
  312. package/dist/plugins/relations.js +553 -0
  313. package/dist/plugins/snapshots/index.d.cts +33 -0
  314. package/dist/plugins/snapshots/index.d.ts +33 -0
  315. package/dist/plugins/snapshots/index.d.ts.map +1 -0
  316. package/dist/plugins/snapshots/resume.d.cts +57 -0
  317. package/dist/plugins/snapshots/resume.d.ts +57 -0
  318. package/dist/plugins/snapshots/resume.d.ts.map +1 -0
  319. package/dist/plugins/snapshots/snapshot_service.d.cts +59 -0
  320. package/dist/plugins/snapshots/snapshot_service.d.ts +59 -0
  321. package/dist/plugins/snapshots/snapshot_service.d.ts.map +1 -0
  322. package/dist/plugins/snapshots.cjs +1 -0
  323. package/dist/plugins/snapshots.d.cts +1 -0
  324. package/dist/plugins/snapshots.d.ts +1 -0
  325. package/dist/plugins/snapshots.development.cjs +1 -0
  326. package/dist/plugins/snapshots.development.js +737 -0
  327. package/dist/plugins/snapshots.js +737 -0
  328. package/dist/plugins/solid/index.d.cts +8 -0
  329. package/dist/plugins/solid/index.d.ts +8 -0
  330. package/dist/plugins/solid/index.d.ts.map +1 -0
  331. package/dist/plugins/solid/solid.d.cts +97 -0
  332. package/dist/plugins/solid/solid.d.ts +97 -0
  333. package/dist/plugins/solid/solid.d.ts.map +1 -0
  334. package/dist/plugins/solid.cjs +1 -0
  335. package/dist/plugins/solid.d.cts +1 -0
  336. package/dist/plugins/solid.d.ts +1 -0
  337. package/dist/plugins/solid.development.cjs +1 -0
  338. package/dist/plugins/solid.development.js +319 -0
  339. package/dist/plugins/solid.js +319 -0
  340. package/dist/plugins/workers/index.d.cts +75 -0
  341. package/dist/plugins/workers/index.d.ts +75 -0
  342. package/dist/plugins/workers/index.d.ts.map +1 -0
  343. package/dist/plugins/workers/node_threads.d.cts +25 -0
  344. package/dist/plugins/workers/node_threads.d.ts +25 -0
  345. package/dist/plugins/workers/node_threads.d.ts.map +1 -0
  346. package/dist/plugins/workers/plan.d.cts +61 -0
  347. package/dist/plugins/workers/plan.d.ts +61 -0
  348. package/dist/plugins/workers/plan.d.ts.map +1 -0
  349. package/dist/plugins/workers/pool.d.cts +144 -0
  350. package/dist/plugins/workers/pool.d.ts +144 -0
  351. package/dist/plugins/workers/pool.d.ts.map +1 -0
  352. package/dist/plugins/workers/protocol.d.cts +112 -0
  353. package/dist/plugins/workers/protocol.d.ts +112 -0
  354. package/dist/plugins/workers/protocol.d.ts.map +1 -0
  355. package/dist/plugins/workers/worker_bind.d.cts +64 -0
  356. package/dist/plugins/workers/worker_bind.d.ts +64 -0
  357. package/dist/plugins/workers/worker_bind.d.ts.map +1 -0
  358. package/dist/plugins/workers/worker_loop.d.cts +14 -0
  359. package/dist/plugins/workers/worker_loop.d.ts +14 -0
  360. package/dist/plugins/workers/worker_loop.d.ts.map +1 -0
  361. package/dist/plugins/workers.cjs +1 -0
  362. package/dist/plugins/workers.d.cts +1 -0
  363. package/dist/plugins/workers.d.ts +1 -0
  364. package/dist/plugins/workers.development.cjs +1 -0
  365. package/dist/plugins/workers.development.js +596 -0
  366. package/dist/plugins/workers.js +474 -0
  367. package/dist/primitives.cjs +1 -1
  368. package/dist/primitives.d.cts +4 -4
  369. package/dist/primitives.d.ts +4 -4
  370. package/dist/primitives.development.cjs +1 -1
  371. package/dist/primitives.development.js +66 -22
  372. package/dist/primitives.js +66 -22
  373. package/dist/shared-BKl12xF1.js +132 -0
  374. package/dist/shared-Dk-pACZT.cjs +1 -0
  375. package/dist/shared.cjs +1 -1
  376. package/dist/shared.d.cts +7 -7
  377. package/dist/shared.d.ts +7 -7
  378. package/dist/shared.d.ts.map +1 -1
  379. package/dist/shared.development.cjs +1 -1
  380. package/dist/shared.development.js +4 -3
  381. package/dist/shared.js +4 -3
  382. package/dist/topological_sort-Cc_yXqPT.js +346 -0
  383. package/dist/topological_sort-vp1imU6D.cjs +1 -0
  384. package/dist/type_primitives/assertions.d.cts +12 -16
  385. package/dist/type_primitives/assertions.d.ts +12 -16
  386. package/dist/type_primitives/assertions.d.ts.map +1 -1
  387. package/dist/type_primitives/binary_heap/binary_heap.d.cts +2 -6
  388. package/dist/type_primitives/binary_heap/binary_heap.d.ts +2 -6
  389. package/dist/type_primitives/binary_heap/binary_heap.d.ts.map +1 -1
  390. package/dist/type_primitives/bitset/bitset.d.cts +7 -11
  391. package/dist/type_primitives/bitset/bitset.d.ts +7 -11
  392. package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
  393. package/dist/type_primitives/brand.d.cts +2 -7
  394. package/dist/type_primitives/brand.d.ts +2 -7
  395. package/dist/type_primitives/brand.d.ts.map +1 -1
  396. package/dist/type_primitives/error.d.cts +1 -2
  397. package/dist/type_primitives/error.d.ts +1 -2
  398. package/dist/type_primitives/error.d.ts.map +1 -1
  399. package/dist/type_primitives/index.d.cts +1 -1
  400. package/dist/type_primitives/index.d.ts +1 -1
  401. package/dist/type_primitives/sparse_map/sparse_map.d.cts +3 -7
  402. package/dist/type_primitives/sparse_map/sparse_map.d.ts +3 -7
  403. package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
  404. package/dist/type_primitives/sparse_set/sparse_set.d.cts +2 -6
  405. package/dist/type_primitives/sparse_set/sparse_set.d.ts +2 -6
  406. package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
  407. package/dist/type_primitives/topological_sort/topological_sort.d.cts +1 -5
  408. package/dist/type_primitives/topological_sort/topological_sort.d.ts +1 -5
  409. package/dist/type_primitives/topological_sort/topological_sort.d.ts.map +1 -1
  410. package/dist/type_primitives/typed_arrays/typed_arrays.d.cts +16 -15
  411. package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +16 -15
  412. package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
  413. package/dist/utils/error.d.ts.map +1 -1
  414. package/dist/version.d.cts +3 -3
  415. package/dist/version.d.ts +3 -3
  416. package/dist/worker.cjs +1 -0
  417. package/dist/worker.d.cts +17 -0
  418. package/dist/worker.d.ts +17 -0
  419. package/dist/worker.d.ts.map +1 -0
  420. package/dist/worker.development.cjs +1 -0
  421. package/dist/worker.development.js +253 -0
  422. package/dist/worker.js +253 -0
  423. package/package.json +363 -191
  424. package/dist/core/ecs/builtin_relations.d.cts +0 -43
  425. package/dist/core/ecs/builtin_relations.d.ts +0 -43
  426. package/dist/core/ecs/builtin_relations.d.ts.map +0 -1
  427. package/dist/core/ecs/event_registry.d.cts +0 -22
  428. package/dist/core/ecs/event_registry.d.ts +0 -22
  429. package/dist/core/ecs/event_registry.d.ts.map +0 -1
  430. package/dist/core/ecs/relation_service.d.ts.map +0 -1
  431. package/dist/core/ecs/resume.d.cts +0 -85
  432. package/dist/core/ecs/resume.d.ts +0 -85
  433. package/dist/core/ecs/resume.d.ts.map +0 -1
  434. package/dist/core/ecs/snapshot_service.d.cts +0 -94
  435. package/dist/core/ecs/snapshot_service.d.ts +0 -94
  436. package/dist/core/ecs/snapshot_service.d.ts.map +0 -1
  437. package/dist/extensions/editor/editor.d.ts.map +0 -1
  438. package/dist/extensions/editor/field_handle.d.ts.map +0 -1
  439. package/dist/extensions/editor/index.cjs +0 -1
  440. package/dist/extensions/editor/index.d.cts +0 -21
  441. package/dist/extensions/editor/index.d.ts +0 -21
  442. package/dist/extensions/editor/index.d.ts.map +0 -1
  443. package/dist/extensions/editor/index.development.cjs +0 -1
  444. package/dist/extensions/reactive/ecs_sync.d.cts +0 -214
  445. package/dist/extensions/reactive/ecs_sync.d.ts +0 -214
  446. package/dist/extensions/reactive/ecs_sync.d.ts.map +0 -1
  447. package/dist/extensions/reactive/index.cjs +0 -1
  448. package/dist/extensions/reactive/index.d.cts +0 -23
  449. package/dist/extensions/reactive/index.d.ts +0 -23
  450. package/dist/extensions/reactive/index.d.ts.map +0 -1
  451. package/dist/extensions/reactive/index.development.cjs +0 -1
  452. package/dist/extensions/reactive/index.development.js +0 -215
  453. package/dist/extensions/reactive/index.js +0 -215
  454. package/dist/extensions/solid/index.cjs +0 -1
  455. package/dist/extensions/solid/index.d.cts +0 -6
  456. package/dist/extensions/solid/index.d.ts +0 -6
  457. package/dist/extensions/solid/index.d.ts.map +0 -1
  458. package/dist/extensions/solid/index.development.cjs +0 -1
  459. package/dist/extensions/solid/index.development.js +0 -40
  460. package/dist/extensions/solid/index.js +0 -36
  461. package/dist/extensions/solid/kernel_solid.d.cts +0 -45
  462. package/dist/extensions/solid/kernel_solid.d.ts +0 -45
  463. package/dist/extensions/solid/kernel_solid.d.ts.map +0 -1
  464. package/dist/host_commands-BlR3oZ3x.js +0 -2406
  465. package/dist/host_commands-C2cpU3yC.cjs +0 -1
  466. package/dist/internal-BoxWl4dG.js +0 -2565
  467. package/dist/internal-CGBEwfeB.cjs +0 -2
  468. package/dist/interop-CT-REx0W.cjs +0 -1
  469. package/dist/interop-CcY6ASQc.js +0 -18
  470. package/dist/interop-DqxleBo7.js +0 -18
  471. package/dist/interop-T1HZ-Dpa.cjs +0 -1
  472. package/dist/kernel-Cz2Kxlwl.js +0 -240
  473. package/dist/kernel-DgyrLFjW.js +0 -227
  474. package/dist/kernel-sw7ScKWu.cjs +0 -1
  475. package/dist/kernel-yWV3XnAb.cjs +0 -1
  476. package/dist/reactive/array.d.cts +0 -24
  477. package/dist/reactive/array.d.ts +0 -24
  478. package/dist/reactive/array.d.ts.map +0 -1
  479. package/dist/reactive/index.cjs +0 -1
  480. package/dist/reactive/index.d.cts +0 -11
  481. package/dist/reactive/index.d.ts +0 -11
  482. package/dist/reactive/index.d.ts.map +0 -1
  483. package/dist/reactive/index.development.cjs +0 -1
  484. package/dist/reactive/index.development.js +0 -18
  485. package/dist/reactive/index.js +0 -18
  486. package/dist/reactive/interop.d.cts +0 -19
  487. package/dist/reactive/interop.d.ts +0 -19
  488. package/dist/reactive/interop.d.ts.map +0 -1
  489. package/dist/reactive/kernel.d.cts +0 -73
  490. package/dist/reactive/kernel.d.ts +0 -73
  491. package/dist/reactive/kernel.d.ts.map +0 -1
  492. package/dist/reactive/map.d.cts +0 -16
  493. package/dist/reactive/map.d.ts +0 -16
  494. package/dist/reactive/map.d.ts.map +0 -1
  495. package/dist/reactive/shallow.d.cts +0 -11
  496. package/dist/reactive/shallow.d.ts +0 -11
  497. package/dist/reactive/shallow.d.ts.map +0 -1
  498. package/dist/reactive/struct.d.cts +0 -10
  499. package/dist/reactive/struct.d.ts +0 -10
  500. package/dist/reactive/struct.d.ts.map +0 -1
  501. package/dist/shallow-Bs39EPh1.js +0 -150
  502. package/dist/shallow-C5YmTbtb.cjs +0 -1
  503. package/dist/shallow-CiFC70Dz.js +0 -159
  504. package/dist/shallow-DQ8aG51_.cjs +0 -1
  505. package/dist/shared-B4v0L1cw.js +0 -109
  506. package/dist/shared-DU78k0pU.cjs +0 -1
  507. package/dist/topological_sort-BDvEyb9W.cjs +0 -1
  508. package/dist/topological_sort-DK6EjpWa.js +0 -135
  509. package/dist/typed_arrays-D3NmwtCG.cjs +0 -1
  510. package/dist/typed_arrays-DIVwVy5_.js +0 -258
@@ -1,23 +1,23 @@
1
1
  import { ColumnStore } from './column_store.cjs';
2
- /** FNV-1a 32-bit offset basis (Fowler/Noll/Vo). */
2
+ /** FNV-1a 32-bit offset basis (Fowler, Noll and Vo). */
3
3
  export declare const FNV1A_OFFSET_BASIS = 2166136261;
4
4
  /** FNV-1a 32-bit prime. */
5
5
  export declare const FNV1A_PRIME = 16777619;
6
6
  /** One FNV-1a round folding a single **byte** (the low 8 bits of `b`) into the
7
7
  * running `hash`: `hash = imul((hash ^ (b & 0xff)) >>> 0, PRIME) >>> 0`. The
8
- * single canonical definition of the byte step reused by `fnv1a32`
9
- * here, by the sparse-store `schemaFingerprint`, and by the server determinism
10
- * byte/u32 folds, so the constants and the round live in exactly one place.
8
+ * single canonical definition of the byte step, reused by `fnv1a32`
9
+ * here, by the sparse-store `schemaFingerprint`, and by the determinism
10
+ * byte and u32 folds, so the constants and the round live in exactly one place.
11
11
  *
12
- * Trivially inlinable (monomorphic, no allocation); the intermediate `>>> 0`s
13
- * never change a later round (xor/imul see the same 32-bit pattern signed or
14
- * unsigned), they just keep the value unsigned for readers. */
12
+ * Trivially inlinable, monomorphic and allocation-free. The intermediate `>>> 0`s
13
+ * never change a later round (xor and imul see the same 32-bit pattern signed or
14
+ * unsigned), they only keep the value unsigned for readers. */
15
15
  export declare function fnv1aStep(hash: number, b: number): number;
16
- /** One FNV-1a round folding a full 32-bit **word** into `hash` the whole word
16
+ /** One FNV-1a round folding a full 32-bit **word** into `hash`, the whole word
17
17
  * xored at once, not four byte rounds. A coarser fold than per-byte FNV-1a, but
18
- * equally deterministic and ~4× cheaper, which is why `Store.stateHash` folds
18
+ * equally deterministic and far cheaper, which is why `Store.stateHash` folds
19
19
  * its columns this way. This is the canonical word-step definition its
20
- * cold sparse/relation folds call; its hot dense-column inner loop inlines this
20
+ * cold sparse and relation folds call. Its hot dense-column inner loop inlines this
21
21
  * exact step for speed and must stay in sync. Same `>>> 0` reasoning as
22
22
  * `fnv1aStep`. */
23
23
  export declare function fnv1aStepWord(hash: number, word: number): number;
@@ -28,11 +28,11 @@ export declare function fnv1aStepWord(hash: number, word: number): number;
28
28
  * snapshot, bytes off disk, a hot subrange) can hash without round-tripping
29
29
  * through `ColumnStore`. */
30
30
  export declare function fnv1a32(bytes: Uint8Array): number;
31
- /** FNV-1a 32-bit hash of the entire SAB region header + descriptors +
31
+ /** FNV-1a 32-bit hash of the entire SAB region, header + descriptors +
32
32
  * column bytes. The canonical state identifier for cross-replay determinism
33
33
  * checks.
34
34
  *
35
- * The snapshot view is zero-copy (`snapshotColumnStore` is a view, not a
35
+ * The snapshot view is zero-copy (`columnStoreBytesView` is a view, not a
36
36
  * copy), so this is one scan over the live SAB with no allocation. */
37
37
  export declare function columnStoreStateHash(store: ColumnStore): number;
38
38
  //# sourceMappingURL=state_hash.d.ts.map
@@ -1,23 +1,23 @@
1
1
  import { ColumnStore } from './column_store.js';
2
- /** FNV-1a 32-bit offset basis (Fowler/Noll/Vo). */
2
+ /** FNV-1a 32-bit offset basis (Fowler, Noll and Vo). */
3
3
  export declare const FNV1A_OFFSET_BASIS = 2166136261;
4
4
  /** FNV-1a 32-bit prime. */
5
5
  export declare const FNV1A_PRIME = 16777619;
6
6
  /** One FNV-1a round folding a single **byte** (the low 8 bits of `b`) into the
7
7
  * running `hash`: `hash = imul((hash ^ (b & 0xff)) >>> 0, PRIME) >>> 0`. The
8
- * single canonical definition of the byte step reused by `fnv1a32`
9
- * here, by the sparse-store `schemaFingerprint`, and by the server determinism
10
- * byte/u32 folds, so the constants and the round live in exactly one place.
8
+ * single canonical definition of the byte step, reused by `fnv1a32`
9
+ * here, by the sparse-store `schemaFingerprint`, and by the determinism
10
+ * byte and u32 folds, so the constants and the round live in exactly one place.
11
11
  *
12
- * Trivially inlinable (monomorphic, no allocation); the intermediate `>>> 0`s
13
- * never change a later round (xor/imul see the same 32-bit pattern signed or
14
- * unsigned), they just keep the value unsigned for readers. */
12
+ * Trivially inlinable, monomorphic and allocation-free. The intermediate `>>> 0`s
13
+ * never change a later round (xor and imul see the same 32-bit pattern signed or
14
+ * unsigned), they only keep the value unsigned for readers. */
15
15
  export declare function fnv1aStep(hash: number, b: number): number;
16
- /** One FNV-1a round folding a full 32-bit **word** into `hash` the whole word
16
+ /** One FNV-1a round folding a full 32-bit **word** into `hash`, the whole word
17
17
  * xored at once, not four byte rounds. A coarser fold than per-byte FNV-1a, but
18
- * equally deterministic and ~4× cheaper, which is why `Store.stateHash` folds
18
+ * equally deterministic and far cheaper, which is why `Store.stateHash` folds
19
19
  * its columns this way. This is the canonical word-step definition its
20
- * cold sparse/relation folds call; its hot dense-column inner loop inlines this
20
+ * cold sparse and relation folds call. Its hot dense-column inner loop inlines this
21
21
  * exact step for speed and must stay in sync. Same `>>> 0` reasoning as
22
22
  * `fnv1aStep`. */
23
23
  export declare function fnv1aStepWord(hash: number, word: number): number;
@@ -28,11 +28,11 @@ export declare function fnv1aStepWord(hash: number, word: number): number;
28
28
  * snapshot, bytes off disk, a hot subrange) can hash without round-tripping
29
29
  * through `ColumnStore`. */
30
30
  export declare function fnv1a32(bytes: Uint8Array): number;
31
- /** FNV-1a 32-bit hash of the entire SAB region header + descriptors +
31
+ /** FNV-1a 32-bit hash of the entire SAB region, header + descriptors +
32
32
  * column bytes. The canonical state identifier for cross-replay determinism
33
33
  * checks.
34
34
  *
35
- * The snapshot view is zero-copy (`snapshotColumnStore` is a view, not a
35
+ * The snapshot view is zero-copy (`columnStoreBytesView` is a view, not a
36
36
  * copy), so this is one scan over the live SAB with no allocation. */
37
37
  export declare function columnStoreStateHash(store: ColumnStore): number;
38
38
  //# sourceMappingURL=state_hash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"state_hash.d.ts","sourceRoot":"","sources":["../../../src/core/store/state_hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,mDAAmD;AACnD,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,2BAA2B;AAC3B,eAAO,MAAM,WAAW,WAAa,CAAC;AAEtC;;;;;;;;+DAQ+D;AAC/D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;;;;kBAMkB;AAClB,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED;;;;;4BAK4B;AAC5B,wBAAgB,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIjD;AAED;;;;;sEAKsE;AACtE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAE/D"}
1
+ {"version":3,"file":"state_hash.d.ts","sourceRoot":"","sources":["../../../src/core/store/state_hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,wDAAwD;AACxD,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,2BAA2B;AAC3B,eAAO,MAAM,WAAW,WAAa,CAAC;AAEtC;;;;;;;;+DAQ+D;AAC/D,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;;;;kBAMkB;AAClB,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED;;;;;4BAK4B;AAC5B,wBAAgB,OAAO,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIjD;AAED;;;;;sEAKsE;AACtE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAE/D"}
@@ -1,8 +1,8 @@
1
1
  import { CreateColumnStoreOptions } from './column_store.cjs';
2
- /** The `StoreHeader` fields that hold a MECHANISM region's byte offset (0 ⇒
3
- * region absent). Exactly the four fields a `MechanismRegionSpec` can own; the
4
- * always-present `bindings_off` / `layout_descriptor_off` and the generic
5
- * `region_table_off` / `region_table_count` pair are not mechanism regions in
2
+ /** The `StoreHeader` fields that hold a mechanism region's byte offset (0 ⇒
3
+ * region absent). Exactly the four fields a `MechanismRegionSpec` can own. The
4
+ * always-present `bindings_off` and `layout_descriptor_off`, and the generic
5
+ * `region_table_off` and `region_table_count` pair, are not mechanism regions in
6
6
  * this sense and are computed directly outside the loop. */
7
7
  export type StoreRegionOffsetField = "command_ring_off" | "entity_index_off" | "event_ring_off" | "action_ring_off";
8
8
  /** Mutable accumulator for building `CreateColumnStoreOptions` field by field as
@@ -10,18 +10,18 @@ export type StoreRegionOffsetField = "command_ring_off" | "entity_index_off" | "
10
10
  export type MutableColumnStoreOptions = {
11
11
  -readonly [K in keyof CreateColumnStoreOptions]: CreateColumnStoreOptions[K];
12
12
  };
13
- /** One engine MECHANISM region. The four closures are the per-region half of
14
- * each generic pass; see the module doc for which consumer drives which.
13
+ /** One engine mechanism region. The four closures are the per-region half of
14
+ * each generic pass. See the module doc for which consumer drives which.
15
15
  *
16
- * (Consumer/game regions use the separate self-contained `StoreRegionSpec` in
17
- * `region_table.ts` they carry a precomputed `bytes` + `init` and are
16
+ * (A consumer's own regions use the separate self-contained `StoreRegionSpec` in
17
+ * `region_table.ts`. They carry a precomputed `bytes` + `init` and are
18
18
  * addressed by an opaque `region_id`, not a named header field.) */
19
19
  export interface MechanismRegionSpec {
20
- /** Stable name reads in diagnostics and keeps the array self-documenting. */
20
+ /** Stable name, reads in diagnostics and keeps the array self-documenting. */
21
21
  readonly name: string;
22
22
  /** `StoreHeader` field this region's byte offset is written to. */
23
23
  readonly headerOff: StoreRegionOffsetField;
24
- /** Byte size implied by `options` (0 ⇒ region absent, so no offset/init). */
24
+ /** Byte size implied by `options` (0 ⇒ region absent, so no offset and no init). */
25
25
  readonly sizeFromOptions: (options: CreateColumnStoreOptions) => number;
26
26
  /** Initialise the region's header at `off`. Called by `createColumnStore`
27
27
  * only when the region is present (`off !== 0`). */
@@ -1,8 +1,8 @@
1
1
  import { CreateColumnStoreOptions } from './column_store.js';
2
- /** The `StoreHeader` fields that hold a MECHANISM region's byte offset (0 ⇒
3
- * region absent). Exactly the four fields a `MechanismRegionSpec` can own; the
4
- * always-present `bindings_off` / `layout_descriptor_off` and the generic
5
- * `region_table_off` / `region_table_count` pair are not mechanism regions in
2
+ /** The `StoreHeader` fields that hold a mechanism region's byte offset (0 ⇒
3
+ * region absent). Exactly the four fields a `MechanismRegionSpec` can own. The
4
+ * always-present `bindings_off` and `layout_descriptor_off`, and the generic
5
+ * `region_table_off` and `region_table_count` pair, are not mechanism regions in
6
6
  * this sense and are computed directly outside the loop. */
7
7
  export type StoreRegionOffsetField = "command_ring_off" | "entity_index_off" | "event_ring_off" | "action_ring_off";
8
8
  /** Mutable accumulator for building `CreateColumnStoreOptions` field by field as
@@ -10,18 +10,18 @@ export type StoreRegionOffsetField = "command_ring_off" | "entity_index_off" | "
10
10
  export type MutableColumnStoreOptions = {
11
11
  -readonly [K in keyof CreateColumnStoreOptions]: CreateColumnStoreOptions[K];
12
12
  };
13
- /** One engine MECHANISM region. The four closures are the per-region half of
14
- * each generic pass; see the module doc for which consumer drives which.
13
+ /** One engine mechanism region. The four closures are the per-region half of
14
+ * each generic pass. See the module doc for which consumer drives which.
15
15
  *
16
- * (Consumer/game regions use the separate self-contained `StoreRegionSpec` in
17
- * `region_table.ts` they carry a precomputed `bytes` + `init` and are
16
+ * (A consumer's own regions use the separate self-contained `StoreRegionSpec` in
17
+ * `region_table.ts`. They carry a precomputed `bytes` + `init` and are
18
18
  * addressed by an opaque `region_id`, not a named header field.) */
19
19
  export interface MechanismRegionSpec {
20
- /** Stable name reads in diagnostics and keeps the array self-documenting. */
20
+ /** Stable name, reads in diagnostics and keeps the array self-documenting. */
21
21
  readonly name: string;
22
22
  /** `StoreHeader` field this region's byte offset is written to. */
23
23
  readonly headerOff: StoreRegionOffsetField;
24
- /** Byte size implied by `options` (0 ⇒ region absent, so no offset/init). */
24
+ /** Byte size implied by `options` (0 ⇒ region absent, so no offset and no init). */
25
25
  readonly sizeFromOptions: (options: CreateColumnStoreOptions) => number;
26
26
  /** Initialise the region's header at `off`. Called by `createColumnStore`
27
27
  * only when the region is present (`off !== 0`). */
@@ -1 +1 @@
1
- {"version":3,"file":"store_regions.d.ts","sourceRoot":"","sources":["../../../src/core/store/store_regions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAUH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;4DAI4D;AAC5D,MAAM,MAAM,sBAAsB,GAC/B,kBAAkB,GAClB,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,CAAC;AAErB;2EAC2E;AAC3E,MAAM,MAAM,yBAAyB,GAAG;IACvC,CAAC,UAAU,CAAC,IAAI,MAAM,wBAAwB,GAAG,wBAAwB,CAAC,CAAC,CAAC;CAC5E,CAAC;AAEF;;;;;oEAKoE;AACpE,MAAM,WAAW,mBAAmB;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAC3C,6EAA6E;IAC7E,QAAQ,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,MAAM,CAAC;IACxE;wDACoD;IACpD,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACxF;mEAC+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9D;qEACiE;IACjE,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,yBAAyB,KAAK,IAAI,CAAC;CAC5F;AAED,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,EAAE,SAAS,mBAAmB,EAgE9D,CAAC"}
1
+ {"version":3,"file":"store_regions.d.ts","sourceRoot":"","sources":["../../../src/core/store/store_regions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAUH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;4DAI4D;AAC5D,MAAM,MAAM,sBAAsB,GAC/B,kBAAkB,GAClB,kBAAkB,GAClB,gBAAgB,GAChB,iBAAiB,CAAC;AAErB;2EAC2E;AAC3E,MAAM,MAAM,yBAAyB,GAAG;IACvC,CAAC,UAAU,CAAC,IAAI,MAAM,wBAAwB,GAAG,wBAAwB,CAAC,CAAC,CAAC;CAC5E,CAAC;AAEF;;;;;oEAKoE;AACpE,MAAM,WAAW,mBAAmB;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,sBAAsB,CAAC;IAC3C,oFAAoF;IACpF,QAAQ,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,wBAAwB,KAAK,MAAM,CAAC;IACxE;wDACoD;IACpD,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACxF;mEAC+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9D;qEACiE;IACjE,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,yBAAyB,KAAK,IAAI,CAAC;CAC5F;AAED,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,EAAE,SAAS,mBAAmB,EA0D9D,CAAC"}
@@ -1,5 +1,29 @@
1
1
  export declare const STORE_MAGIC = 827148627;
2
- export declare const SIM_ABI_VERSION = 0;
2
+ /** Schema version of the header, the descriptors and the region table.
3
+ *
4
+ * Version 1 makes every `*_off` in the header, every `byte_off` in a column
5
+ * descriptor and every region-table offset relative to the store base, and
6
+ * makes `capacity` the store span measured from that base. Version 0 measured
7
+ * all of them from buffer byte 0. Restore and resume reject a version they do
8
+ * not know, because the two readings of one offset disagree.
9
+ *
10
+ * Version 1 also reserves `entity_ids_off` in the archetype descriptor header.
11
+ * The version stays at 1 because no store of version 1 has shipped. Nothing
12
+ * outside this repository can hold the narrower header, so growing it now
13
+ * costs nothing. Reserving the field after the release costs a version bump
14
+ * and a reader that must branch on two header widths. */
15
+ export declare const SIM_ABI_VERSION = 1;
16
+ /** The version the published 0.5 line wrote. Every store of that version sat
17
+ * at buffer byte 0, so its offsets read correctly as version 1 offsets from the
18
+ * header. Restore and resume accept it and stamp the current version. */
19
+ export declare const LEGACY_ABSOLUTE_ABI_VERSION = 0;
20
+ /** The archetype descriptor header width version 0 wrote, before
21
+ * `entity_ids_off` joined the header. Every field version 0 carries sits at the
22
+ * offset version 1 gives it, so a version 0 region differs from a version 1
23
+ * region only in where the columns start and how far one record reaches.
24
+ * Restore walks a version 0 region with this width and re-emits it at the
25
+ * current width. */
26
+ export declare const LEGACY_ARCHETYPE_DESCRIPTOR_HEADER_BYTES = 36;
3
27
  export declare const COMPONENT_MASK_WORDS = 4;
4
28
  export declare const STORE_HEADER_BYTES = 52;
5
29
  export declare const STORE_HEADER_OFFSETS: {
@@ -31,7 +55,7 @@ export declare const COLUMN_DESCRIPTOR_OFFSETS: {
31
55
  readonly byte_off: 8;
32
56
  readonly stride: 12;
33
57
  };
34
- export declare const ARCHETYPE_DESCRIPTOR_HEADER_BYTES = 36;
58
+ export declare const ARCHETYPE_DESCRIPTOR_HEADER_BYTES = 40;
35
59
  export declare const ARCHETYPE_DESCRIPTOR_OFFSETS: {
36
60
  readonly archetype_id: 0;
37
61
  readonly component_mask: 4;
@@ -39,5 +63,6 @@ export declare const ARCHETYPE_DESCRIPTOR_OFFSETS: {
39
63
  readonly row_capacity: 24;
40
64
  readonly column_count: 28;
41
65
  readonly enabled_count: 32;
66
+ readonly entity_ids_off: 36;
42
67
  };
43
68
  //# sourceMappingURL=abi.d.ts.map
@@ -1,5 +1,29 @@
1
1
  export declare const STORE_MAGIC = 827148627;
2
- export declare const SIM_ABI_VERSION = 0;
2
+ /** Schema version of the header, the descriptors and the region table.
3
+ *
4
+ * Version 1 makes every `*_off` in the header, every `byte_off` in a column
5
+ * descriptor and every region-table offset relative to the store base, and
6
+ * makes `capacity` the store span measured from that base. Version 0 measured
7
+ * all of them from buffer byte 0. Restore and resume reject a version they do
8
+ * not know, because the two readings of one offset disagree.
9
+ *
10
+ * Version 1 also reserves `entity_ids_off` in the archetype descriptor header.
11
+ * The version stays at 1 because no store of version 1 has shipped. Nothing
12
+ * outside this repository can hold the narrower header, so growing it now
13
+ * costs nothing. Reserving the field after the release costs a version bump
14
+ * and a reader that must branch on two header widths. */
15
+ export declare const SIM_ABI_VERSION = 1;
16
+ /** The version the published 0.5 line wrote. Every store of that version sat
17
+ * at buffer byte 0, so its offsets read correctly as version 1 offsets from the
18
+ * header. Restore and resume accept it and stamp the current version. */
19
+ export declare const LEGACY_ABSOLUTE_ABI_VERSION = 0;
20
+ /** The archetype descriptor header width version 0 wrote, before
21
+ * `entity_ids_off` joined the header. Every field version 0 carries sits at the
22
+ * offset version 1 gives it, so a version 0 region differs from a version 1
23
+ * region only in where the columns start and how far one record reaches.
24
+ * Restore walks a version 0 region with this width and re-emits it at the
25
+ * current width. */
26
+ export declare const LEGACY_ARCHETYPE_DESCRIPTOR_HEADER_BYTES = 36;
3
27
  export declare const COMPONENT_MASK_WORDS = 4;
4
28
  export declare const STORE_HEADER_BYTES = 52;
5
29
  export declare const STORE_HEADER_OFFSETS: {
@@ -31,7 +55,7 @@ export declare const COLUMN_DESCRIPTOR_OFFSETS: {
31
55
  readonly byte_off: 8;
32
56
  readonly stride: 12;
33
57
  };
34
- export declare const ARCHETYPE_DESCRIPTOR_HEADER_BYTES = 36;
58
+ export declare const ARCHETYPE_DESCRIPTOR_HEADER_BYTES = 40;
35
59
  export declare const ARCHETYPE_DESCRIPTOR_OFFSETS: {
36
60
  readonly archetype_id: 0;
37
61
  readonly component_mask: 4;
@@ -39,5 +63,6 @@ export declare const ARCHETYPE_DESCRIPTOR_OFFSETS: {
39
63
  readonly row_capacity: 24;
40
64
  readonly column_count: 28;
41
65
  readonly enabled_count: 32;
66
+ readonly entity_ids_off: 36;
42
67
  };
43
68
  //# sourceMappingURL=abi.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../../../../src/core/store/vendored_abi/abi.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,WAAW,YAAa,CAAC;AACtC,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;CAcvB,CAAC;AAEX,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,0BAA0B;;;;CAI7B,CAAC;AAEX,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,yBAAyB;;;;;;CAM5B,CAAC;AAEX,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,eAAO,MAAM,4BAA4B;;;;;;;CAO/B,CAAC"}
1
+ {"version":3,"file":"abi.d.ts","sourceRoot":"","sources":["../../../../src/core/store/vendored_abi/abi.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,WAAW,YAAa,CAAC;AACtC;;;;;;;;;;;;yDAYyD;AACzD,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC;;yEAEyE;AACzE,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C;;;;;oBAKoB;AACpB,eAAO,MAAM,wCAAwC,KAAK,CAAC;AAC3D,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;CAcvB,CAAC;AAEX,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,0BAA0B;;;;CAI7B,CAAC;AAEX,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,yBAAyB;;;;;;CAM5B,CAAC;AAoBX,eAAO,MAAM,iCAAiC,KAAK,CAAC;AACpD,eAAO,MAAM,4BAA4B;;;;;;;;CAQ/B,CAAC"}
@@ -0,0 +1 @@
1
+ "use strict";const H=require("./shared-Dk-pACZT.cjs");class ve extends Error{constructor(t,n,o){super(t),this.isOperational=n,this.context=o,this.name=this.constructor.name,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,this.constructor)}}var Be=(e=>(e.ASSERTION_FAIL_CONDITION="ASSERTION_FAIL_CONDITION",e.VALIDATION_FAIL_CONDITION="VALIDATION_FAIL_CONDITION",e.ASSERTION_FAIL_NON_NULLABLE="ASSERTION_FAIL_NON_NULLABLE",e.ASSERTION_FAIL_UNREACHABLE="ASSERTION_FAIL_UNREACHABLE",e))(Be||{});class qe extends ve{constructor(t,n,o){super(n,!1,o),this.category=t,this.name="AssertionError"}}function Je(e,t,n){return e}function Ze(e){return e}function et(e,t){throw new qe(Be.ASSERTION_FAIL_UNREACHABLE,`Unhandled ${t}: ${String(e)}`)}var A=(e=>(e.EID_MAX_INDEX_OVERFLOW="EID_MAX_INDEX_OVERFLOW",e.EID_MAX_GEN_OVERFLOW="EID_MAX_GEN_OVERFLOW",e.COMPONENT_NOT_REGISTERED="COMPONENT_NOT_REGISTERED",e.COMPONENT_LIMIT_EXCEEDED="COMPONENT_LIMIT_EXCEEDED",e.ENTITY_NOT_ALIVE="ENTITY_NOT_ALIVE",e.CIRCULAR_SYSTEM_DEPENDENCY="CIRCULAR_SYSTEM_DEPENDENCY",e.DUPLICATE_SYSTEM="DUPLICATE_SYSTEM",e.UNKNOWN_PHASE="UNKNOWN_PHASE",e.CIRCULAR_PHASE_DEPENDENCY="CIRCULAR_PHASE_DEPENDENCY",e.ARCHETYPE_NOT_FOUND="ARCHETYPE_NOT_FOUND",e.RESOURCE_NOT_REGISTERED="RESOURCE_NOT_REGISTERED",e.RESOURCE_ALREADY_REGISTERED="RESOURCE_ALREADY_REGISTERED",e.EVENT_ALREADY_REGISTERED="EVENT_ALREADY_REGISTERED",e.EVENT_NOT_REGISTERED="EVENT_NOT_REGISTERED",e.INVALID_EVENT_ID="INVALID_EVENT_ID",e.FIELD_NOT_REGISTERED="FIELD_NOT_REGISTERED",e.RELATION_NOT_REGISTERED="RELATION_NOT_REGISTERED",e.RELATION_MODE_INVALID="RELATION_MODE_INVALID",e.RELATION_MODE_MISMATCH="RELATION_MODE_MISMATCH",e.RELATION_CYCLE="RELATION_CYCLE",e.SPARSE_CACHE_KEY_OVERFLOW="SPARSE_CACHE_KEY_OVERFLOW",e.SPARSE_QUERY_DENSE_PATH="SPARSE_QUERY_DENSE_PATH",e.QUERY_TERM_DENSE_PATH="QUERY_TERM_DENSE_PATH",e.HIERARCHY_ALREADY_SET="HIERARCHY_ALREADY_SET",e.HIERARCHY_INVALID_MAX_DEPTH="HIERARCHY_INVALID_MAX_DEPTH",e.OBSERVER_NON_CONVERGENT="OBSERVER_NON_CONVERGENT",e.OBSERVER_INVALID_CONFIG="OBSERVER_INVALID_CONFIG",e.OBSERVER_ONSET_EMIT="OBSERVER_ONSET_EMIT",e.ROW_TICKS_NOT_TRACKED="ROW_TICKS_NOT_TRACKED",e.INVALID_FIXED_TIMESTEP="INVALID_FIXED_TIMESTEP",e.INVALID_MAX_FIXED_STEPS="INVALID_MAX_FIXED_STEPS",e.INVALID_RECORDER_SCHEDULE="INVALID_RECORDER_SCHEDULE",e.EMPTY_ARCHETYPE_MATERIALIZE="EMPTY_ARCHETYPE_MATERIALIZE",e.COMPONENT_INDEX_INVARIANT="COMPONENT_INDEX_INVARIANT",e.ARCHETYPE_ROW_INVARIANT="ARCHETYPE_ROW_INVARIANT",e.OPTIONAL_TERM_NOT_DECLARED="OPTIONAL_TERM_NOT_DECLARED",e.QUERY_ACCESS_UNDECLARED="QUERY_ACCESS_UNDECLARED",e.ACCESS_UNDECLARED="ACCESS_UNDECLARED",e.QUERY_NOT_SINGLETON="QUERY_NOT_SINGLETON",e.INVALID_RUN_CONDITION="INVALID_RUN_CONDITION",e.SYSTEM_FN_ARITY="SYSTEM_FN_ARITY",e.INVALID_SYSTEM_ID="INVALID_SYSTEM_ID",e.PARTITION_APPEND_NEEDS_ENTITY_ROW="PARTITION_APPEND_NEEDS_ENTITY_ROW",e.PARTITION_BULK_INTO_DISABLED="PARTITION_BULK_INTO_DISABLED",e.STRUCTURAL_DURING_ITERATION="STRUCTURAL_DURING_ITERATION",e.BACKEND_ALREADY_ATTACHED="BACKEND_ALREADY_ATTACHED",e.DETERMINISM_DISABLED="DETERMINISM_DISABLED",e.SNAPSHOT_RESTORE_FAILED="SNAPSHOT_RESTORE_FAILED",e.NON_DETERMINISTIC_COLUMN_TYPE="NON_DETERMINISTIC_COLUMN_TYPE",e.INVALID_MEMORY_OPTIONS="INVALID_MEMORY_OPTIONS",e.STORE_CAP_EXCEEDED="STORE_CAP_EXCEEDED",e.REGION_NOT_DECLARED="REGION_NOT_DECLARED",e.COMMAND_LOG_TAG_COLLISION="COMMAND_LOG_TAG_COLLISION",e.INVALID_FRAME_STEP="INVALID_FRAME_STEP",e.INVALID_TEMPLATE="INVALID_TEMPLATE",e.PLUGIN_NOT_INSTALLED="PLUGIN_NOT_INSTALLED",e.PLUGIN_ALREADY_INSTALLED="PLUGIN_ALREADY_INSTALLED",e.PLUGIN_SURFACE_COLLISION="PLUGIN_SURFACE_COLLISION",e.WORKERS_ATTACHED="WORKERS_ATTACHED",e.WORKERS_NEED_SHARED_BACKING="WORKERS_NEED_SHARED_BACKING",e.WORKERS_HOST_CANNOT_PARK="WORKERS_HOST_CANNOT_PARK",e.WORKERS_COUNT_INVALID="WORKERS_COUNT_INVALID",e.WORKERS_ENTRY_UNREACHABLE="WORKERS_ENTRY_UNREACHABLE",e.PARALLEL_ACCESS="PARALLEL_ACCESS",e.PARALLEL_KERNEL_MODULE="PARALLEL_KERNEL_MODULE",e.PARALLEL_KERNEL_FAILED="PARALLEL_KERNEL_FAILED",e))(A||{});class E extends ve{constructor(t,n,o){super(n??t,!0,o),this.category=t,this.name="ECSError"}}function tt(e){return e instanceof E}class nt extends E{constructor(t){super("SNAPSHOT_RESTORE_FAILED",t),this.name="ECSRestoreError"}}const ot=-1,rt=-1,it=Object.freeze(Object.create(null)),st=2654435769,at=1367130551,Ye=1024,ct=0,_t=31,dt=1/60,lt=4,ut=0,$=20,ue=(1<<$)-1,$e=ue,Et=_t-$,Z=(1<<Et)-1,At=Z,mt=Z-1,ft=Z<<$|$e,Tt=(e,t)=>t<<$|e,ie=e=>e&ue,se=e=>e>>$,It=(e,t,n)=>new E(A.ENTITY_NOT_ALIVE,`${e}: entity ${t} (index ${ie(t)}, generation ${se(t)}) is not alive${n?`, ${n}`:""}. It was destroyed, never created, or the handle is stale. Guard with isAlive() first`,{entity:t,index:ie(t),generation:se(t),op:e}),Ee=new WeakMap;function pt(e,t){Ee.set(e,t)}function Nt(e){return Ee.get(e)}function Fe(e){const t=Ee.get(e);return t!==void 0?`'${t}' (component ${e.id})`:`component ${e.id}`}const ht=827148627,St=1,Ae=4,gt=52,N={magic:0,sim_abi_version:4,view_stamp:8,capacity:12,archetype_count:16,layout_descriptor_off:20,command_ring_off:24,action_ring_off:28,entity_index_off:32,event_ring_off:36,region_table_off:40,region_table_count:44,bindings_off:48},k=12,P={region_id:0,byte_offset:4,byte_length:8},me=16,x={component_id:0,field_id:2,type_tag:4,byte_off:8,stride:12},fe=40,b={archetype_id:0,component_mask:4,row_count:20,row_capacity:24,column_count:28,enabled_count:32,entity_ids_off:36},m={u8:0,i8:1,u16:2,i16:3,u32:4,i32:5,f32:6,f64:7},ae=Object.freeze({[m.u8]:1,[m.i8]:1,[m.u16]:2,[m.i16]:2,[m.u32]:4,[m.i32]:4,[m.f32]:4,[m.f64]:8}),yt={u8:m.u8,i8:m.i8,u16:m.u16,i16:m.i16,u32:m.u32,i32:m.i32,f32:m.f32,f64:m.f64};function Dt(e,t,n){e.setUint16(t+x.component_id,n.componentId,!0),e.setUint16(t+x.field_id,n.fieldId,!0),e.setUint8(t+x.type_tag,n.typeTag),e.setUint32(t+x.byte_off,n.byteOff,!0),e.setUint16(t+x.stride,n.stride,!0)}const Ot=Ae*32;function Te(e,t=fe){return t+e*me}function xe(e,t,n){e.setUint32(t+b.archetype_id,n.archetypeId,!0);for(let r=0;r<Ae;r++)e.setUint32(t+b.component_mask+r*4,n.componentMask[r]??0,!0);e.setUint32(t+b.row_count,n.rowCount,!0),e.setUint32(t+b.row_capacity,n.rowCapacity,!0),e.setUint32(t+b.column_count,n.columns.length,!0),e.setUint32(t+b.enabled_count,n.enabledCount,!0),e.setUint32(t+b.entity_ids_off,0,!0);let o=t+fe;for(let r=0;r<n.columns.length;r++)Dt(e,o,n.columns[r]),o+=me;return o}function Rt(e,t,n){let o=t;for(let r=0;r<n.length;r++)o=xe(e,o,n[r]);return o}function wt(e){let t=0;for(let n=0;n<e.length;n++)t+=Te(e[n].columns.length);return t}function Lt(e,t){e.setUint32(N.magic,t.magic,!0),e.setUint32(N.sim_abi_version,t.simAbiVersion,!0),e.setUint32(N.view_stamp,t.viewStamp,!0),e.setUint32(N.capacity,t.capacity,!0),e.setUint32(N.archetype_count,t.archetypeCount,!0),e.setUint32(N.layout_descriptor_off,t.layoutDescriptorOff,!0),e.setUint32(N.command_ring_off,t.commandRingOff,!0),e.setUint32(N.action_ring_off,t.actionRingOff,!0),e.setUint32(N.entity_index_off,t.entityIndexOff,!0),e.setUint32(N.event_ring_off,t.eventRingOff,!0),e.setUint32(N.region_table_off,t.regionTableOff,!0),e.setUint32(N.region_table_count,t.regionTableCount,!0),e.setUint32(N.bindings_off,t.bindingsOff,!0)}const He=16,U=16,bt=256,O={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},Ie=0;function ge(e){return He+e*U}function Ct(e){return e>0&&(e&e-1)===0}class w extends Error{constructor(t){super(t),this.name="CommandRingError"}}function Pt(e,t,n){if(!Ct(n))throw new w(`command ring capacity_slots must be a positive power of two (got ${n})`);e.setUint32(t+O.write_head,0,!0),e.setUint32(t+O.read_head,0,!0),e.setUint32(t+O.capacity_slots,n,!0),e.setUint32(t+O.overflow_flag,0,!0)}function Mt(e,t){return e.getUint32(t+O.write_head,!0)}function Ut(e,t){return e.getUint32(t+O.read_head,!0)}function vt(e,t){return e.getUint32(t+O.capacity_slots,!0)}function Bt(e,t,n){if(n.byteLength!==U-1)throw new w(`outPayload must be ${U-1} bytes (got ${n.byteLength})`);const o=Mt(e,t),r=Ut(e,t);if(o===r)return Ie;const s=vt(e,t),d=r&s-1,_=t+He+d*U,c=e.getUint8(_),l=new Uint8Array(e.buffer,e.byteOffset+_+1,U-1);return n.set(l),e.setUint32(t+O.read_head,r+1>>>0,!0),c}function Yt(e,t,n){let o=0;const r=new Uint8Array(U-1);for(;;){const s=Bt(e,t,r);if(s===Ie)return o;n(s,r.slice()),o++}}const ee=16,C=12,V={length:0,capacity:4},ce=1<<20;function ye(e){if(e<0||!Number.isInteger(e))throw new Ge(`entity index capacity must be a non-negative integer (got ${e})`);return ee+e*C}function $t(e){return e+ee}function Ft(e,t){return e+ee+t*4}function xt(e,t){return e+ee+t*8}class Ge extends Error{constructor(t){super(t),this.name="EntityIndexError"}}function Ht(e,t,n){if(n<0||!Number.isInteger(n))throw new Ge(`entity index capacity must be a non-negative integer (got ${n})`);e.setUint32(t+V.length,0,!0),e.setUint32(t+V.capacity,n,!0)}function Gt(e,t,n){return{generations:new Int32Array(e,$t(t),n),archetypes:new Int32Array(e,Ft(t,n),n),rows:new Int32Array(e,xt(t,n),n)}}const Vt=16,kt=16,Wt=256,v={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12};function De(e){return Vt+e*kt}function Xt(e){return e>0&&(e&e-1)===0}class Kt extends Error{constructor(t){super(t),this.name="EventRingError"}}function zt(e,t,n){if(!Xt(n))throw new Kt(`event ring capacity_slots must be a positive power of two (got ${n})`);e.setUint32(t+v.write_head,0,!0),e.setUint32(t+v.read_head,0,!0),e.setUint32(t+v.capacity_slots,n,!0),e.setUint32(t+v.overflow_flag,0,!0)}const jt=16,Qt=16,qt=256,Y={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},Jt=Y.write_head/4,Zt=Y.read_head/4,en=Y.capacity_slots/4,tn=Y.overflow_flag/4;function nn(e,t){return new Int32Array(e.buffer,e.byteOffset+t,4)}function Oe(e){return jt+e*Qt}function on(e){return e>0&&(e&e-1)===0}class Re extends Error{constructor(t){super(t),this.name="ActionRingError"}}function rn(e,t,n){if(!on(n))throw new Re(`action ring capacity_slots must be a positive power of two (got ${n})`);if((e.byteOffset+t)%4!==0)throw new Re(`action ring header must be 4-byte aligned for Atomics (view.byteOffset ${e.byteOffset} + ringOff ${t} is not a multiple of 4)`);const o=nn(e,t);Atomics.store(o,Jt,0),Atomics.store(o,Zt,0),Atomics.store(o,en,n),Atomics.store(o,tn,0)}const G=[{name:"command_ring",headerOff:"command_ring_off",sizeFromOptions:e=>e.commandRingCapacitySlots!==void 0?ge(e.commandRingCapacitySlots):0,init:(e,t,n)=>Pt(e,t,n.commandRingCapacitySlots),regionBytes:(e,t)=>ge(e.getUint32(t+O.capacity_slots,!0)),readOptions:(e,t,n)=>{n.commandRingCapacitySlots=e.getUint32(t+O.capacity_slots,!0)}},{name:"entity_index",headerOff:"entity_index_off",sizeFromOptions:e=>e.entityIndexCapacity!==void 0?ye(e.entityIndexCapacity):0,init:(e,t,n)=>Ht(e,t,n.entityIndexCapacity),regionBytes:(e,t)=>ye(e.getUint32(t+V.capacity,!0)),readOptions:(e,t,n)=>{n.entityIndexCapacity=e.getUint32(t+V.capacity,!0)}},{name:"event_ring",headerOff:"event_ring_off",sizeFromOptions:e=>e.eventRingCapacitySlots!==void 0?De(e.eventRingCapacitySlots):0,init:(e,t,n)=>zt(e,t,n.eventRingCapacitySlots),regionBytes:(e,t)=>De(e.getUint32(t+v.capacity_slots,!0)),readOptions:(e,t,n)=>{n.eventRingCapacitySlots=e.getUint32(t+v.capacity_slots,!0)}},{name:"action_ring",headerOff:"action_ring_off",sizeFromOptions:e=>e.actionRingCapacitySlots!==void 0?Oe(e.actionRingCapacitySlots):0,init:(e,t,n)=>rn(e,t,n.actionRingCapacitySlots),regionBytes:(e,t)=>Oe(e.getUint32(t+Y.capacity_slots,!0)),readOptions:(e,t,n)=>{n.actionRingCapacitySlots=e.getUint32(t+Y.capacity_slots,!0)}}];class W extends Error{constructor(t){super(t),this.name="RegionRegistryError"}}function Ve(e){return e*k}function pe(e,t){const n=e.getUint32(N.region_table_count,!0);if(t+Ve(n)>e.byteLength)throw new W(`region table of ${n} entries at byte ${t} overruns the buffer (${e.byteLength} bytes)`);return n}function sn(e){const t=new Set;for(let n=0;n<e.length;n++){const o=e[n];if(!Number.isInteger(o.id)||o.id<=0)throw new W(`region "${o.name}" has invalid id ${o.id}, region ids must be positive integers (0 is the absent sentinel)`);if(t.has(o.id))throw new W(`duplicate region id ${o.id} (region "${o.name}"), ids must be distinct within a consumer's region set`);if(t.add(o.id),!Number.isInteger(o.bytes)||o.bytes<=0)throw new W(`region "${o.name}" (id ${o.id}) has invalid byte size ${o.bytes}, must be a positive integer`)}}function an(e,t,n){e.setUint32(t+P.region_id,n.regionId,!0),e.setUint32(t+P.byte_offset,n.byteOffset,!0),e.setUint32(t+P.byte_length,n.byteLength,!0)}function ke(e,t){return{regionId:e.getUint32(t+P.region_id,!0),byteOffset:e.getUint32(t+P.byte_offset,!0),byteLength:e.getUint32(t+P.byte_length,!0)}}function cn(e,t,n){for(let o=0;o<n.length;o++)an(e,t+o*k,n[o])}function _n(e,t,n){const o=new Array(n);for(let r=0;r<n;r++)o[r]=ke(e,t+r*k);return o}function dn(e){const t=e.getUint32(N.region_table_off,!0);if(t===0)return[];const n=pe(e,t);return _n(e,t,n)}function ln(e,t){const n=e.getUint32(N.region_table_off,!0);if(n===0)return 0;const o=pe(e,n);for(let r=0;r<o;r++){const s=n+r*k;if(e.getUint32(s+P.region_id,!0)===t)return e.getUint32(s+P.byte_offset,!0)}return 0}function un(e,t){const n=e.getUint32(N.region_table_off,!0);if(n===0)return null;const o=pe(e,n);for(let r=0;r<o;r++){const s=ke(e,n+r*k);if(s.regionId===t)return s}return null}function We(e,t){return e<<16|t}const te=2**31;class Ne extends Error{constructor(t){super(`SAB column layout offset ${t} reaches or exceeds the 2³¹ (${te}-byte) ceiling. Past 2 GiB the signed-32-bit bitwise alignment math wraps to a negative or misaligned offset. This is a structural limit independent of the allocator cap, so a single store cannot back more than 2 GiB of column data.`),this.name="StoreLayoutOverflowError"}}function he(e,t){if(e+t>te)throw new Ne(e);return e+(t-1)&~(t-1)}function En(e,t,n,o,r){const s=t+o;switch(n){case m.u8:return new Uint8Array(e,s,r);case m.i8:return new Int8Array(e,s,r);case m.u16:return new Uint16Array(e,s,r);case m.i16:return new Int16Array(e,s,r);case m.u32:return new Uint32Array(e,s,r);case m.i32:return new Int32Array(e,s,r);case m.f32:return new Float32Array(e,s,r);case m.f64:return new Float64Array(e,s,r)}}function An(e,t,n=0){const r=wt(e.map(_=>({archetypeId:_.archetypeId,componentMask:_.componentMask,rowCount:0,enabledCount:0,rowCapacity:_.rowCapacity,columns:_.columns.map(c=>({componentId:c.componentId,fieldId:c.fieldId,typeTag:c.typeTag,byteOff:0,stride:ae[c.typeTag]}))})))+n;let s=t+r;const d=new Array(e.length);for(let _=0;_<e.length;_++){const c=e[_],l=new Array(c.columns.length);for(let f=0;f<c.columns.length;f++){const p=c.columns[f],I=ae[p.typeTag];s=he(s,I),l[f]={componentId:p.componentId,fieldId:p.fieldId,typeTag:p.typeTag,byteOff:s,stride:I},s+=I*c.rowCapacity}d[_]={archetypeId:c.archetypeId,componentMask:c.componentMask,rowCount:0,enabledCount:0,rowCapacity:c.rowCapacity,columns:l}}if(s>te)throw new Ne(s);return{descriptors:d,totalBytes:s,regionBytes:r}}const K=16;function mn(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`createColumnStore: storeBase must be an integer >= 0, got ${e}`);if(e%K!==0)throw new RangeError(`createColumnStore: storeBase must be a multiple of ${K}, got ${e}`)}function Xe(e){let t=0;for(const[,n]of e)t+=Te(n.columnsInOrder.length);return t}function fn(e){const t=e;return typeof t._regionBytes=="number"&&typeof t._allocator=="function"&&typeof t._reservedDescriptorBytes=="number"}function Tn(e,t=H.DEFAULT_SAB_ALLOCATOR,n={}){const o=n.storeBase??0;mn(o);const r={};let s=gt;for(let h=0;h<G.length;h++){const R=G[h],F=R.sizeFromOptions(n);r[R.headerOff]=F===0?0:s,s+=F}const d=n.regions??[];sn(d);const _=d.length,c=_>0?s:0;s+=Ve(_);const l=new Array(_);for(let h=0;h<d.length;h++){const R=d[h];l[h]={regionId:R.id,byteOffset:s,byteLength:R.bytes},s+=R.bytes}const f=n.bindingsRegionBytes??0,p=f===0?0:s;s+=f;const I=s,{descriptors:y,totalBytes:S,regionBytes:a}=An(e,I,n.reservedDescriptorBytes??0),i=t(o+S),u=new DataView(i,o),D={magic:ht,simAbiVersion:St,viewStamp:0,capacity:S,archetypeCount:e.length,layoutDescriptorOff:I,bindingsOff:p,regionTableOff:c,regionTableCount:_,commandRingOff:r.command_ring_off,entityIndexOff:r.entity_index_off,eventRingOff:r.event_ring_off,actionRingOff:r.action_ring_off};Lt(u,D),f>0&&new Uint8Array(i,o+p,f).fill(0);for(let h=0;h<G.length;h++){const R=G[h],F=r[R.headerOff];F!==0&&R.init(u,F,n)}c!==0&&cn(u,c,l);for(let h=0;h<d.length;h++)d[h].init(u,l[h].byteOffset);Rt(u,I,y);const g=Ke(i,o,y);return{buffer:i,view:u,header:D,storeBase:o,archetypes:g,_regionBytes:a,_allocator:t,_reservedDescriptorBytes:n.reservedDescriptorBytes??0,_usedDescriptorBytes:Xe(g)}}function Ke(e,t,n){const o=new Map;for(let r=0;r<n.length;r++){const s=n[r],d=new Array(s.columns.length),_=new Map;for(let c=0;c<s.columns.length;c++){const l=s.columns[c],f={componentId:l.componentId,fieldId:l.fieldId,typeTag:l.typeTag,byteOff:l.byteOff,stride:l.stride,view:En(e,t,l.typeTag,l.byteOff,s.rowCapacity)};d[c]=f,_.set(We(l.componentId,l.fieldId),f)}o.set(s.archetypeId,{archetypeId:s.archetypeId,componentMask:s.componentMask,rowCapacity:s.rowCapacity,columns:_,columnsInOrder:d})}return o}const _e=2147483647,we=new WeakMap;function In(e){const t=new Set,n=new Set,o=new Set,r=new Set,s=new Set,d=new Set,_=new Set,c=new Set,l=new Set,f=new Set;for(let a=0;a<e.writes.length;a++){const i=e.writes[a].id;n.add(i),t.add(i),o.add(i)}for(let a=0;a<e.reads.length;a++)t.add(e.reads[a].id);for(let a=0;a<e.spawns.length;a++){const i=e.spawns[a];for(let u=0;u<i.length;u++)o.add(i[u].id)}for(let a=0;a<e.transitions.length;a++){const i=e.transitions[a];if(i.add)for(let u=0;u<i.add.length;u++)o.add(i.add[u].id);if(i.remove)for(let u=0;u<i.remove.length;u++)r.add(i.remove[u].id)}for(let a=0;a<e.despawns.length;a++)r.add(e.despawns[a].id);for(let a=0;a<e.resourceReads.length;a++)s.add(e.resourceReads[a]);for(let a=0;a<e.resourceWrites.length;a++){const i=e.resourceWrites[a];d.add(i),s.add(i)}const p=e.sparseWrites;if(p!==void 0)for(let a=0;a<p.length;a++){const i=p[a];c.add(i),_.add(i)}const I=e.sparseReads;if(I!==void 0)for(let a=0;a<I.length;a++)_.add(I[a]);const y=e.relationWrites;if(y!==void 0)for(let a=0;a<y.length;a++){const i=y[a];f.add(i),l.add(i)}const S=e.relationReads;if(S!==void 0)for(let a=0;a<S.length;a++)l.add(S[a]);return{reads:t,writes:n,addAllowed:o,removeAllowed:r,hasDespawns:e.despawns.length>0,resourceReads:s,resourceWrites:d,sparseReads:_,sparseWrites:c,relationReads:l,relationWrites:f}}function pn(e){const t=we.get(e);if(t!==void 0)return t;const n=In(e);return we.set(e,n),n}const Le=new WeakMap;function Nn(e){const t=new Set,n=new Set;if(e.reads!==void 0)for(let o=0;o<e.reads.length;o++)t.add(e.reads[o].id);if(e.resourceReads!==void 0)for(let o=0;o<e.resourceReads.length;o++)n.add(e.resourceReads[o]);return{reads:t,writes:new Set,addAllowed:new Set,removeAllowed:new Set,hasDespawns:!1,resourceReads:n,resourceWrites:new Set,sparseReads:new Set,sparseWrites:new Set,relationReads:new Set,relationWrites:new Set}}function hn(e){const t=Le.get(e);if(t!==void 0)return t;const n=Nn(e);return Le.set(e,n),n}class Sn{_activeSystem=null;_activeSets=null;_activeName=null;_exclusive=!1;enter(t){this._activeSystem=t,this._activeName=t.name??`system_${t.id}`,this._exclusive=t.exclusive===!0,this._activeSets=this._exclusive?null:pn(t)}enterCondition(t){this._activeSystem=null,this._activeName=t.name,this._activeSets=hn(t)}leave(){this._activeSystem=null,this._activeName=null,this._activeSets=null,this._exclusive=!1}isActive(){return this._activeSets!==null||this._exclusive}current(){return this._activeSystem}assertRead(t){this._activeSets!==null&&(this._activeSets.reads.has(t.id)||this._failComponent("read",t,"reads"))}assertWrite(t){this._activeSets!==null&&(this._activeSets.writes.has(t.id)||this._failComponent("write",t,"writes"))}assertAdd(t){this._activeSets!==null&&(this._activeSets.addAllowed.has(t.id)||this._failComponent("addComponent",t,"spawns, transitions.add or writes"))}assertRemove(t){this._activeSets!==null&&(this._activeSets.removeAllowed.has(t.id)||this._failComponent("removeComponent",t,"despawns or transitions.remove"))}assertDespawn(){if(this._activeSets===null||this._activeSets.hasDespawns)return;const t=this._activeName;throw new E(A.ACCESS_UNDECLARED,`system '${t}' called despawn but did not declare any despawns. Name the components it removes in 'despawns'`,{system:t,op:"despawn"})}assertResourceRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.resourceReads.has(n)||this._failResource("read",t,"resourceReads")}assertResourceWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.resourceWrites.has(n)||this._failResource("write",t,"resourceWrites")}assertSparseRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.sparseReads.has(n)||this._failSparse("read",n,"sparseReads")}assertSparseWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.sparseWrites.has(n)||this._failSparse("write",n,"sparseWrites")}assertRelationRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.relationReads.has(n)||this._failRelation("read",n,"relationReads")}assertRelationWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.relationWrites.has(n)||this._failRelation("write",n,"relationWrites")}assertRelationReadAny(){this._activeSets!==null&&(this._activeSets.relationReads.has(_e)||this._failRelation("(*, T) wildcard read",_e,"relationReads (as ANY_RELATION)"))}_optionalScopes=[];enterOptionalScope(t){this._optionalScopes.push(t)}leaveOptionalScope(){this._optionalScopes.pop()}assertOptionalFetch(t){const n=this._optionalScopes.length;if(n===0)return;const o=this._optionalScopes[n-1],r=t.id;for(let s=0;s<o.length;s++)if(o[s]===r)return;throw new E(A.OPTIONAL_TERM_NOT_DECLARED,`getOptionalColumnRead fetched optional component ${r} but the iterating query did not declare it. Add .optional(component) to the query before the fetch`)}_failComponent(t,n,o){const r=this._activeName,s=Fe(n);throw new E(A.ACCESS_UNDECLARED,`system '${r}' performed ${t} on ${s} but did not declare it. Add it to '${o}'`,{system:r,op:t,component:n.id})}_failSparse(t,n,o){const r=this._activeName;throw new E(A.ACCESS_UNDECLARED,`system '${r}' performed ${t} on sparse component ${n} but did not declare it. Add it to '${o}'`,{system:r,op:t,sparse:n})}_failRelation(t,n,o){const r=this._activeName;throw new E(A.ACCESS_UNDECLARED,`system '${r}' performed ${t} on relation ${n} but did not declare it. Add it to '${o}'`,{system:r,op:t,relation:n})}_failResource(t,n,o){const r=this._activeName,s=n.description??"<unnamed>";throw new E(A.ACCESS_UNDECLARED,`system '${r}' performed resource ${t} on '${s}' but did not declare it. Add the resource key to '${o}'`,{system:r,op:t,resource:s})}}const gn=new Sn;function yn(e,t){return new E(A.PLUGIN_NOT_INSTALLED,`${t} needs the ${e} plugin, which this world did not install. Pass it at construction: ECS.create({ plugins: [${e}()] }), imported from @oasys/oecs/${e}`,{plugin:e})}function Dn(e){return new E(A.PLUGIN_ALREADY_INSTALLED,`${e} is already installed on this world. Pass each plugin once to ECS.create`,{plugin:e})}var z=(e=>(e.PRE_STARTUP="PRE_STARTUP",e.STARTUP="STARTUP",e.POST_STARTUP="POST_STARTUP",e.FIXED_UPDATE="FIXED_UPDATE",e.PRE_UPDATE="PRE_UPDATE",e.UPDATE="UPDATE",e.POST_UPDATE="POST_UPDATE",e))(z||{});function be(e){if(typeof e!="string")return e.loop;switch(e){case"PRE_STARTUP":case"STARTUP":case"POST_STARTUP":return"startup";case"FIXED_UPDATE":return"fixed";case"PRE_UPDATE":case"UPDATE":case"POST_UPDATE":return"update"}}function Ce(e){return typeof e=="string"?e:e.name}const j=1024,Q=1024*j,B=64*j,q=B;function On(e,t=0){if(!Number.isFinite(t)||t<0)throw new E(A.INVALID_MEMORY_OPTIONS,`storeBaseAbove: extraBytes must be a finite number >= 0, got ${String(t)}`);const n=e?.__heap_base,o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;if(typeof o!="number"||!Number.isFinite(o))throw new E(A.INVALID_MEMORY_OPTIONS,`storeBaseAbove: the module exports no numeric '__heap_base', got ${String(o)}. Link with --export=__heap_base, or pass memory.storeBase by hand.`);const r=Math.ceil((o+t)/B)*B;return Math.max(q,r)}const X=256*Q,de=3,ze=64,je=8,Pe=4*Q,Me=e=>2**Math.ceil(Math.log2(Math.max(1,e))),Rn=e=>2**Math.floor(Math.log2(Math.max(1,e))),re=(e,t,n)=>Math.min(n,Math.max(t,e)),T=e=>e>=Q?`${(e/Q).toFixed(1)} MiB`:e>=j?`${(e/j).toFixed(0)} KiB`:`${e} B`;function wn(e,t){if(e===void 0)return t?q:0;if(!Number.isInteger(e)||e<0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.storeBase must be an integer >= 0, got ${e}`);if(e%K!==0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.storeBase must be a multiple of ${K}, got ${e}. The alignment keeps every column on its element boundary.`);if(t&&e===0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.storeBase is 0, and a header at address 0 is unreadable from a safe build of a WASM module. Pass a storeBase of at least one page (${q}), above the module's own data.`);return e}function M(e,t){if(!Number.isInteger(t)||t<=0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.${e} must be a positive integer (got ${t})`)}const Ue={budget:"{ budget: { entities: N } } → { entities: N }",heap:'{ heap: { maxBytes: X } } → { maxBytes: X, backing: "heap" }',shared:'{ shared: { maxBytes: X } } → { maxBytes: X, backing: "shared" }',wasm:"{ wasm: W } → { backing: { wasm: W } }",allocator:"{ allocator: A } → { backing: { allocator: A } }",capBytesHint:"{ capBytesHint: X } → { maxBytes: X }"};function Ln(e){const t=Object.prototype.hasOwnProperty,n=Object.keys(Ue).filter(o=>t.call(e,o));if(n.length!==0)throw new E(A.INVALID_MEMORY_OPTIONS,`${n.map(o=>`memory.${o}`).join(" and ")} ${n.length>1?"were":"was"} removed in 0.6. Sizing and backing are now two independent fields, so every combination of them is expressible. Rewrite as: `+n.map(o=>Ue[o]).join(". "))}function bn(e){e!==void 0&&Ln(e);const t=e?.entities,n=e?.maxBytes,o=e?.columnCapacity,r=e?.backing??"heap",s=typeof r=="object"&&r.wasm!==void 0,d=wn(e?.storeBase,s);if(o!==void 0&&M("columnCapacity",o),n!==void 0&&M("maxBytes",n),t===void 0){for(const i of["archetypes","bytesPerEntity"])if(e?.[i]!==void 0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.${i} shapes the sizing derived from memory.entities, which was not given. Add memory.entities, or drop memory.${i}.`)}let _,c,l=null;const f=[];if(t!==void 0){const i=e?.archetypes??je,u=e?.bytesPerEntity??ze;if(M("entities",t),M("archetypes",i),M("bytesPerEntity",u),t>1<<20)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.entities=${t} exceeds the EntityID index space (1<<20 = ${1<<20})`);_=o??re(Me(Math.ceil(t/i)),64,1<<20),c=re(Me(t*2),4096,1<<20);const D=c*C,g=t*u*de;l=he(Math.max(D+g,Pe),B),f.push(`columnCapacity = ${o!==void 0?`${_} (pinned)`:`pow2(${t}/${i} per archetype) = ${_}`}`,`entityIndex = pow2(2 × ${t}) = ${c} slots × ${C} B = ${T(D)}`,`columns = ${t} × ${u} B × ${de} (double+holes headroom) = ${T(g)}`)}else _=o??Ye,c=ce,f.push(`columnCapacity = ${_} (${o!==void 0?"pinned":"default"})`);const p=i=>re(Rn(i/4/C),4096,ce),I=t!==void 0?n!==void 0?"entities+maxBytes":"entities":n!==void 0?"maxBytes":"default",y=i=>n!==void 0?`${T(i)} (caller-declared maxBytes; the ${T(l??i)} the entity count implies is overridden)`:`align64K(max(index + columns, ${T(Pe)} floor)) = ${T(i)}`,S=(i,u,D,g,L)=>(t===void 0&&(c=p(i)),{source:u,sizing:I,allocator:D,columnCapacity:_,entityIndexCapacity:c,capBytes:i,storeBase:d,intentLabel:g,budgetEntities:t??null,derivation:[...L,...d>0?[`storeBase = ${T(d)}, the store writes nothing below it`]:[],...f,t===void 0?`entityIndex = floor_pow2(cap/4 ÷ ${C} B) = ${c} slots`:`cap = ${y(i)}`],wasmMemory:null});if(typeof r=="object"&&r.wasm!==void 0){const i=r.wasm;if(i.memory!==void 0){if(!(i.memory.buffer instanceof SharedArrayBuffer))throw new E(A.INVALID_MEMORY_OPTIONS,"memory.backing.wasm.memory must be constructed with `shared: true`, the SAB substrate requires a SharedArrayBuffer-backed WebAssembly.Memory");const L=n??X;return t===void 0&&(c=p(Math.max(L-d,0))),{source:"wasm",sizing:I,allocator:H.wasmMemoryAllocator(i.memory),columnCapacity:_,entityIndexCapacity:c,capBytes:L,storeBase:d,intentLabel:`caller-supplied WebAssembly.Memory (declared cap ${T(L)})`,budgetEntities:t??null,derivation:["backing = wasm_memory_allocator(memory), zero-copy with a WASM compute backend (is_in_place ✓)",n!==void 0?`cap = ${T(L)} (caller-declared maxBytes; the Memory's own maximum is not readable from JS)`:`cap = ${T(L)} (default; the Memory's own maximum is not readable from JS)`,`storeBase = ${T(d)}, the module owns every byte below it`,...f,t===void 0?`entityIndex = floor_pow2((cap - storeBase)/4 ÷ ${C} B) = ${c} slots`:"entityIndex sized from the entity count above"],wasmMemory:i.memory}}M("backing.wasm.maximumPages",i.maximumPages);const u=i.initialPages??Math.min(32,i.maximumPages);if(M("backing.wasm.initialPages",u),u>i.maximumPages)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.backing.wasm.initialPages (${u}) exceeds maximumPages (${i.maximumPages})`);if(n!==void 0)throw new E(A.INVALID_MEMORY_OPTIONS,`memory.maxBytes (${T(n)}) cannot be given beside memory.backing.wasm.maximumPages (${i.maximumPages} pages = ${T(i.maximumPages*B)}), the Memory's page maximum IS the ceiling. Declare it once, in pages.`);const D=new WebAssembly.Memory({initial:u,maximum:i.maximumPages,shared:!0}),g=i.maximumPages*B;return t===void 0&&(c=p(Math.max(g-d,0))),{source:"wasm",sizing:I,allocator:H.wasmMemoryAllocator(D),columnCapacity:_,entityIndexCapacity:c,capBytes:g,storeBase:d,intentLabel:`engine-constructed WebAssembly.Memory (max ${i.maximumPages} pages)`,budgetEntities:t??null,derivation:[`cap = ${i.maximumPages} pages × 64 KiB = ${T(g)} (Memory maximum)`,`initial = ${u} pages (${i.initialPages!==void 0?"declared":"default"})`,`storeBase = ${T(d)}, the module owns every byte below it`,...f,t===void 0?`entityIndex = floor_pow2((cap - storeBase)/4 ÷ ${C} B) = ${c} slots`:"entityIndex sized from the entity count above"],wasmMemory:D}}if(typeof r=="object"&&r.allocator!==void 0){if(r.allocator.isInPlace!==!0)throw new E(A.INVALID_MEMORY_OPTIONS,"memory.backing.allocator must declare `isInPlace: true`. A live Store's flush loops hoist entity-index views across grows, so an allocator that is not in-place (DEFAULT_SAB_ALLOCATOR, for example) corrupts the entity→row mapping. Use growableSabAllocator, fixedSabAllocator or wasmMemoryAllocator. An allocator that is not in-place is for snapshot and test sizing only.");const i=n??null;return t===void 0&&i!==null&&(c=p(i)),{source:"allocator",sizing:I,allocator:r.allocator,columnCapacity:_,entityIndexCapacity:c,capBytes:i,storeBase:d,intentLabel:i!==null?`custom in-place allocator (declared cap ${T(i)})`:"custom in-place allocator",budgetEntities:t??null,derivation:["backing = caller allocator (is_in_place ✓ checked at construction)",i!==null?`cap = ${T(i)} (caller-declared; the allocator owns the real ceiling)`:"cap = allocator-owned (no maxBytes declared)",...f,t!==void 0?"entityIndex sized from the entity count above":i!==null?`entityIndex = floor_pow2(cap/4 ÷ ${C} B) = ${c} slots`:`entityIndex = ${c} slots (default, no entity count and no declared cap)`],wasmMemory:null}}if(r==="shared"){const i=n??l??X;return S(i,"shared",H.growableSabAllocator(i),`shared SharedArrayBuffer backing (${T(i)} growable cap, needs COOP and COEP)`,[`backing = growable_sab_allocator(${T(i)}), growable SharedArrayBuffer (is_in_place ✓), needs cross-origin isolation`,"enables worker offload + a WASM compute backend (transferable SharedArrayBuffer)"])}if(r!=="heap")throw new E(A.INVALID_MEMORY_OPTIONS,`memory.backing must be "heap", "shared", { wasm }, or { allocator } (got ${JSON.stringify(r)})`);const a=n??l??X;return S(a,"heap",H.heapArrayBufferAllocator(a),I==="default"?`default sizing (${T(a)} reserved cap)`:t!==void 0?`budget of ${t} entities`:`explicit cap of ${T(a)}`,[`backing = heap_arraybuffer_allocator(${T(a)}), fixed ArrayBuffer reserved at the cap, no SAB and no COOP+COEP (is_in_place ✓)`,"trade-off: no worker offload and no WASM backend (both need a transferable SharedArrayBuffer)"])}function Cn(e,t){return{def:e,values:t}}function J(e,t){switch(t.kind){case"spawn":{const n=e.commands.spawn();for(const o of t.components)e.commands.add(n,o.def,o.values);return t.onSpawned?.(n),n}case"despawn":e.commands.despawn(t.eid);return;case"add_component":e.commands.add(t.eid,t.def,t.values);return;case"remove_component":e.commands.remove(t.eid,t.def);return;case"set_field":e.setField(t.eid,t.def,t.field,t.value);return;case"disable":e.commands.disable(t.eid);return;case"enable":e.commands.enable(t.eid);return;default:return et(t,"HostCommand kind")}}class Qe{_pending=[];spawn(t,n){return this._pending.push({kind:"spawn",components:t,onSpawned:n}),this}despawn(t){return this._pending.push({kind:"despawn",eid:t}),this}add(t,n,o){return this._pending.push({kind:"add_component",eid:t,def:n,values:o}),this}remove(t,n){return this._pending.push({kind:"remove_component",eid:t,def:n}),this}setField(t,n,o,r){return this._pending.push({kind:"set_field",eid:t,def:n,field:o,value:r}),this}disable(t){return this._pending.push({kind:"disable",eid:t}),this}enable(t){return this._pending.push({kind:"enable",eid:t}),this}push(t){return this._pending.push(t),this}get pendingCount(){return this._pending.length}clear(){const t=this._pending.length;return this._pending.length=0,t}drain(t,n){const o=this._pending.length;if(o===0)return 0;if(n===void 0)for(let r=0;r<o;r++)J(t,this._pending[r]);else for(let r=0;r<o;r++){const s=this._pending[r];n(s),J(t,s)}return this._pending.splice(0,o),o}}const Se=U-1;function Pn(e){if(e===Ie)throw new w("cannot bind opCode 0 (reserved as the command-ring empty-slot marker)");if(e<0||e>255||!Number.isInteger(e))throw new w(`command opCode must be a u8 in [1, 255] (got ${e})`)}function ne(e){const t=new Uint8Array(Se);return new DataView(t.buffer).setUint32(0,e,!0),t}function oe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!0)}function Mn(e,t){return{encode(n){if(n.kind!=="set_field")throw new w(`ringSetFieldCodec encodes a "set_field" command (got "${n.kind}")`);const o=new Uint8Array(Se),r=new DataView(o.buffer);return r.setUint32(0,n.eid,!0),r.setFloat64(4,n.value,!0),o},decode(n){const o=new DataView(n.buffer,n.byteOffset,n.byteLength);return{kind:"set_field",eid:o.getUint32(0,!0),def:e,field:t,value:o.getFloat64(4,!0)}}}}function Un(){return{encode(e){if(e.kind!=="despawn")throw new w(`ringDespawnCodec encodes a "despawn" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"despawn",eid:oe(e)})}}function vn(){return{encode(e){if(e.kind!=="disable")throw new w(`ringDisableCodec encodes a "disable" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"disable",eid:oe(e)})}}function Bn(){return{encode(e){if(e.kind!=="enable")throw new w(`ringEnableCodec encodes an "enable" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"enable",eid:oe(e)})}}function Yn(e){return{encode(t){if(t.kind!=="remove_component")throw new w(`ringRemoveComponentCodec encodes a "remove_component" command (got "${t.kind}")`);return ne(t.eid)},decode:t=>({kind:"remove_component",eid:oe(t),def:e})}}class $n{_appliers=new Map;on(t,n){return Pn(t),this._appliers.set(t,n),this}off(t){return this._appliers.delete(t)}onCommand(t,n){return this.on(t,(o,r,s)=>{const d=n.decode(r);s?.(d),J(o,d)})}drain(t,n,o,r){return Yt(n,o,(s,d)=>{const _=this._appliers.get(s);_!==void 0&&_(t,d,r)})}}const le=new WeakMap;function Fn(e,t){const n=le.get(t);if(n===void 0)return!1;for(const o of n)e.removeSystem(o);return le.delete(t),t.clear(),!0}function xn(e,t){const n=new Qe,o=[];le.set(n,o);const r=t?.name??"host_command_apply",s=t?.ring,d=t?.recorder,_=d?.record,c=t?.schedules??[z.PRE_STARTUP,z.PRE_UPDATE];if(d!==void 0){for(const l of c)if(be(l)==="fixed")throw new E(A.INVALID_RECORDER_SCHEDULE,`installHostCommandSeam: a recorder cannot drain at ${Ce(l)}, a phase of the fixed loop. It would log the fixed timestep and not the host update dt, so a replay would diverge. Drain at a phase of the update loop instead.`)}for(const l of c){const f=be(l)!=="startup",p=e.registerSystem({name:`${r}:${Ce(l)}`,reads:[],writes:[],exclusive:!0,fn:(I,y)=>{if(d!==void 0&&f&&d.openTick(I.ecsTick,y),n.drain(I,_),s!==void 0){const S=e.columnStore,a=S.header.commandRingOff;a!==0&&s.drain(I,S.view,a,_)}}});e.addSystems(l,p),o.push(p)}return n}exports.ACTION_RING_DEFAULT_CAPACITY_SLOTS=qt;exports.ANY_RELATION=_e;exports.ARCHETYPE_DESCRIPTOR_HEADER_BYTES=fe;exports.ARCHETYPE_DESCRIPTOR_OFFSETS=b;exports.BUDGET_DEFAULT_ARCHETYPES=je;exports.BUDGET_DEFAULT_BYTES_PER_ENTITY=ze;exports.BUDGET_GROWTH_HEADROOM=de;exports.COLUMN_DESCRIPTOR_BYTES=me;exports.COMMAND_RING_DEFAULT_CAPACITY_SLOTS=bt;exports.COMPONENT_MASK_WORDS=Ae;exports.DEFAULT_COLUMN_CAPACITY=Ye;exports.DEFAULT_ECS_CAP_BYTES=X;exports.DEFAULT_FIXED_TIMESTEP=dt;exports.DEFAULT_MAX_FIXED_STEPS=lt;exports.ECSError=E;exports.ECSRestoreError=nt;exports.ECS_ERROR=A;exports.EMPTY_VALUES=it;exports.ENTITY_INDEX_DEFAULT_CAPACITY=ce;exports.ENTITY_INDEX_HEADER_OFFSETS=V;exports.EVENT_RING_DEFAULT_CAPACITY_SLOTS=Wt;exports.HASH_GOLDEN_RATIO=st;exports.HASH_SECONDARY_PRIME=at;exports.HOST_COMMAND_PAYLOAD_BYTES=Se;exports.HostCommandDispatcher=$n;exports.HostCommandQueue=Qe;exports.INDEX_BITS=$;exports.INDEX_MASK=ue;exports.INITIAL_GENERATION=ct;exports.MAX_ENTITY_ID=ft;exports.MAX_GENERATION=Z;exports.MAX_INDEX=$e;exports.MAX_LIVE_GENERATION=mt;exports.NO_SWAP=rt;exports.RETIRED_GENERATION=At;exports.SCHEDULE=z;exports.STARTUP_DELTA_TIME=ut;exports.STORE_DESCRIPTOR_COMPONENT_LIMIT=Ot;exports.STORE_HEADER_OFFSETS=N;exports.STORE_MAX_BYTE_OFFSET=te;exports.STORE_PREFIX_REGIONS=G;exports.StoreLayoutOverflowError=Ne;exports.TYPED_ARRAY_TAG_TO_TYPE_TAG=yt;exports.TYPE_TAG=m;exports.TYPE_TAG_STRIDE=ae;exports.UNASSIGNED=ot;exports.WASM_STORE_BASE_BYTES=q;exports.accessCheck=gn;exports.alignUp=he;exports.applyHostCommand=J;exports.archetypeDescriptorBytes=Te;exports.columnKey=We;exports.componentDebugName=Nt;exports.componentLabel=Fe;exports.createArchetypeViews=Ke;exports.createColumnStore=Tn;exports.createEntityId=Tt;exports.createEntityIndexViews=Gt;exports.entityNotAliveError=It;exports.findRegionEntry=un;exports.findRegionOffset=ln;exports.getEntityGeneration=se;exports.getEntityIndex=ie;exports.installHostCommandSeam=xn;exports.isColumnStoreInternal=fn;exports.isEcsError=tt;exports.pluginInstalledTwiceError=Dn;exports.pluginMissingError=yn;exports.readHeaderRegionTable=dn;exports.resolveECSMemory=bn;exports.ringDespawnCodec=Un;exports.ringDisableCodec=vn;exports.ringEnableCodec=Bn;exports.ringRemoveComponentCodec=Yn;exports.ringSetFieldCodec=Mn;exports.setComponentDebugName=pt;exports.spawnEntry=Cn;exports.storeBaseAbove=On;exports.uninstallHostCommandSeam=Fn;exports.unsafeCast=Ze;exports.usedDescriptorBytes=Xe;exports.validateAndCast=Je;exports.writeArchetypeDescriptor=xe;
@@ -0,0 +1,2 @@
1
+ "use strict";const H=require("./shared-Dk-pACZT.cjs");class Ye extends Error{constructor(t,n,o){super(t),this.isOperational=n,this.context=o,this.name=this.constructor.name,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,this.constructor)}}var ue=(e=>(e.ASSERTION_FAIL_CONDITION="ASSERTION_FAIL_CONDITION",e.VALIDATION_FAIL_CONDITION="VALIDATION_FAIL_CONDITION",e.ASSERTION_FAIL_NON_NULLABLE="ASSERTION_FAIL_NON_NULLABLE",e.ASSERTION_FAIL_UNREACHABLE="ASSERTION_FAIL_UNREACHABLE",e))(ue||{});class Fe extends Ye{constructor(t,n,o){super(n,!1,o),this.category=t,this.name="AssertionError"}}const Ze=e=>Number.isInteger(e)&&e>=0;function et(e,t,n){if(!t(e))throw new Fe(ue.VALIDATION_FAIL_CONDITION,`Expected value to meet validation: ${n}`);return e}function tt(e){return e}function nt(e,t){throw new Fe(ue.ASSERTION_FAIL_UNREACHABLE,`Unhandled ${t}: ${String(e)}`)}var f=(e=>(e.EID_MAX_INDEX_OVERFLOW="EID_MAX_INDEX_OVERFLOW",e.EID_MAX_GEN_OVERFLOW="EID_MAX_GEN_OVERFLOW",e.COMPONENT_NOT_REGISTERED="COMPONENT_NOT_REGISTERED",e.COMPONENT_LIMIT_EXCEEDED="COMPONENT_LIMIT_EXCEEDED",e.ENTITY_NOT_ALIVE="ENTITY_NOT_ALIVE",e.CIRCULAR_SYSTEM_DEPENDENCY="CIRCULAR_SYSTEM_DEPENDENCY",e.DUPLICATE_SYSTEM="DUPLICATE_SYSTEM",e.UNKNOWN_PHASE="UNKNOWN_PHASE",e.CIRCULAR_PHASE_DEPENDENCY="CIRCULAR_PHASE_DEPENDENCY",e.ARCHETYPE_NOT_FOUND="ARCHETYPE_NOT_FOUND",e.RESOURCE_NOT_REGISTERED="RESOURCE_NOT_REGISTERED",e.RESOURCE_ALREADY_REGISTERED="RESOURCE_ALREADY_REGISTERED",e.EVENT_ALREADY_REGISTERED="EVENT_ALREADY_REGISTERED",e.EVENT_NOT_REGISTERED="EVENT_NOT_REGISTERED",e.INVALID_EVENT_ID="INVALID_EVENT_ID",e.FIELD_NOT_REGISTERED="FIELD_NOT_REGISTERED",e.RELATION_NOT_REGISTERED="RELATION_NOT_REGISTERED",e.RELATION_MODE_INVALID="RELATION_MODE_INVALID",e.RELATION_MODE_MISMATCH="RELATION_MODE_MISMATCH",e.RELATION_CYCLE="RELATION_CYCLE",e.SPARSE_CACHE_KEY_OVERFLOW="SPARSE_CACHE_KEY_OVERFLOW",e.SPARSE_QUERY_DENSE_PATH="SPARSE_QUERY_DENSE_PATH",e.QUERY_TERM_DENSE_PATH="QUERY_TERM_DENSE_PATH",e.HIERARCHY_ALREADY_SET="HIERARCHY_ALREADY_SET",e.HIERARCHY_INVALID_MAX_DEPTH="HIERARCHY_INVALID_MAX_DEPTH",e.OBSERVER_NON_CONVERGENT="OBSERVER_NON_CONVERGENT",e.OBSERVER_INVALID_CONFIG="OBSERVER_INVALID_CONFIG",e.OBSERVER_ONSET_EMIT="OBSERVER_ONSET_EMIT",e.ROW_TICKS_NOT_TRACKED="ROW_TICKS_NOT_TRACKED",e.INVALID_FIXED_TIMESTEP="INVALID_FIXED_TIMESTEP",e.INVALID_MAX_FIXED_STEPS="INVALID_MAX_FIXED_STEPS",e.INVALID_RECORDER_SCHEDULE="INVALID_RECORDER_SCHEDULE",e.EMPTY_ARCHETYPE_MATERIALIZE="EMPTY_ARCHETYPE_MATERIALIZE",e.COMPONENT_INDEX_INVARIANT="COMPONENT_INDEX_INVARIANT",e.ARCHETYPE_ROW_INVARIANT="ARCHETYPE_ROW_INVARIANT",e.OPTIONAL_TERM_NOT_DECLARED="OPTIONAL_TERM_NOT_DECLARED",e.QUERY_ACCESS_UNDECLARED="QUERY_ACCESS_UNDECLARED",e.ACCESS_UNDECLARED="ACCESS_UNDECLARED",e.QUERY_NOT_SINGLETON="QUERY_NOT_SINGLETON",e.INVALID_RUN_CONDITION="INVALID_RUN_CONDITION",e.SYSTEM_FN_ARITY="SYSTEM_FN_ARITY",e.INVALID_SYSTEM_ID="INVALID_SYSTEM_ID",e.PARTITION_APPEND_NEEDS_ENTITY_ROW="PARTITION_APPEND_NEEDS_ENTITY_ROW",e.PARTITION_BULK_INTO_DISABLED="PARTITION_BULK_INTO_DISABLED",e.STRUCTURAL_DURING_ITERATION="STRUCTURAL_DURING_ITERATION",e.BACKEND_ALREADY_ATTACHED="BACKEND_ALREADY_ATTACHED",e.DETERMINISM_DISABLED="DETERMINISM_DISABLED",e.SNAPSHOT_RESTORE_FAILED="SNAPSHOT_RESTORE_FAILED",e.NON_DETERMINISTIC_COLUMN_TYPE="NON_DETERMINISTIC_COLUMN_TYPE",e.INVALID_MEMORY_OPTIONS="INVALID_MEMORY_OPTIONS",e.STORE_CAP_EXCEEDED="STORE_CAP_EXCEEDED",e.REGION_NOT_DECLARED="REGION_NOT_DECLARED",e.COMMAND_LOG_TAG_COLLISION="COMMAND_LOG_TAG_COLLISION",e.INVALID_FRAME_STEP="INVALID_FRAME_STEP",e.INVALID_TEMPLATE="INVALID_TEMPLATE",e.PLUGIN_NOT_INSTALLED="PLUGIN_NOT_INSTALLED",e.PLUGIN_ALREADY_INSTALLED="PLUGIN_ALREADY_INSTALLED",e.PLUGIN_SURFACE_COLLISION="PLUGIN_SURFACE_COLLISION",e.WORKERS_ATTACHED="WORKERS_ATTACHED",e.WORKERS_NEED_SHARED_BACKING="WORKERS_NEED_SHARED_BACKING",e.WORKERS_HOST_CANNOT_PARK="WORKERS_HOST_CANNOT_PARK",e.WORKERS_COUNT_INVALID="WORKERS_COUNT_INVALID",e.WORKERS_ENTRY_UNREACHABLE="WORKERS_ENTRY_UNREACHABLE",e.PARALLEL_ACCESS="PARALLEL_ACCESS",e.PARALLEL_KERNEL_MODULE="PARALLEL_KERNEL_MODULE",e.PARALLEL_KERNEL_FAILED="PARALLEL_KERNEL_FAILED",e))(f||{});class E extends Ye{constructor(t,n,o){super(n??t,!0,o),this.category=t,this.name="ECSError"}}function ot(e){return e instanceof E}class rt extends E{constructor(t){super("SNAPSHOT_RESTORE_FAILED",t),this.name="ECSRestoreError"}}const it=-1,st=-1,at=Object.freeze(Object.create(null)),ct=2654435769,_t=1367130551,xe=1024,dt=0,lt=31,ut=1/60,Et=4,ft=0,Y=20,Ee=(1<<Y)-1,fe=Ee,mt=lt-Y,k=(1<<mt)-1,At=k,Tt=k-1,It=k<<Y|fe,ht=(e,t)=>{{if(e<0||e>fe)throw new E(f.EID_MAX_INDEX_OVERFLOW);if(t<0||t>k)throw new E(f.EID_MAX_GEN_OVERFLOW)}return t<<Y|e},ie=e=>e&Ee,se=e=>e>>Y,pt=(e,t,n)=>new E(f.ENTITY_NOT_ALIVE,`${e}: entity ${t} (index ${ie(t)}, generation ${se(t)}) is not alive${n?`, ${n}`:""}. It was destroyed, never created, or the handle is stale. Guard with isAlive() first`,{entity:t,index:ie(t),generation:se(t),op:e}),me=new WeakMap;function Nt(e,t){me.set(e,t)}function gt(e){return me.get(e)}function He(e){const t=me.get(e);return t!==void 0?`'${t}' (component ${e.id})`:`component ${e.id}`}const St=827148627,yt=1,Ae=4,Dt=52,p={magic:0,sim_abi_version:4,view_stamp:8,capacity:12,archetype_count:16,layout_descriptor_off:20,command_ring_off:24,action_ring_off:28,entity_index_off:32,event_ring_off:36,region_table_off:40,region_table_count:44,bindings_off:48},W=12,P={region_id:0,byte_offset:4,byte_length:8},Te=16,x={component_id:0,field_id:2,type_tag:4,byte_off:8,stride:12},Ie=40,C={archetype_id:0,component_mask:4,row_count:20,row_capacity:24,column_count:28,enabled_count:32,entity_ids_off:36},A={u8:0,i8:1,u16:2,i16:3,u32:4,i32:5,f32:6,f64:7},ae=Object.freeze({[A.u8]:1,[A.i8]:1,[A.u16]:2,[A.i16]:2,[A.u32]:4,[A.i32]:4,[A.f32]:4,[A.f64]:8}),Ot={u8:A.u8,i8:A.i8,u16:A.u16,i16:A.i16,u32:A.u32,i32:A.i32,f32:A.f32,f64:A.f64};function Rt(e,t,n){e.setUint16(t+x.component_id,n.componentId,!0),e.setUint16(t+x.field_id,n.fieldId,!0),e.setUint8(t+x.type_tag,n.typeTag),e.setUint32(t+x.byte_off,n.byteOff,!0),e.setUint16(t+x.stride,n.stride,!0)}const wt=Ae*32;function he(e,t=Ie){return t+e*Te}function Ve(e,t,n){e.setUint32(t+C.archetype_id,n.archetypeId,!0);for(let r=0;r<Ae;r++)e.setUint32(t+C.component_mask+r*4,n.componentMask[r]??0,!0);e.setUint32(t+C.row_count,n.rowCount,!0),e.setUint32(t+C.row_capacity,n.rowCapacity,!0),e.setUint32(t+C.column_count,n.columns.length,!0),e.setUint32(t+C.enabled_count,n.enabledCount,!0),e.setUint32(t+C.entity_ids_off,0,!0);let o=t+Ie;for(let r=0;r<n.columns.length;r++)Rt(e,o,n.columns[r]),o+=Te;return o}function Lt(e,t,n){let o=t;for(let r=0;r<n.length;r++)o=Ve(e,o,n[r]);return o}function Ct(e){let t=0;for(let n=0;n<e.length;n++)t+=he(e[n].columns.length);return t}function bt(e,t){e.setUint32(p.magic,t.magic,!0),e.setUint32(p.sim_abi_version,t.simAbiVersion,!0),e.setUint32(p.view_stamp,t.viewStamp,!0),e.setUint32(p.capacity,t.capacity,!0),e.setUint32(p.archetype_count,t.archetypeCount,!0),e.setUint32(p.layout_descriptor_off,t.layoutDescriptorOff,!0),e.setUint32(p.command_ring_off,t.commandRingOff,!0),e.setUint32(p.action_ring_off,t.actionRingOff,!0),e.setUint32(p.entity_index_off,t.entityIndexOff,!0),e.setUint32(p.event_ring_off,t.eventRingOff,!0),e.setUint32(p.region_table_off,t.regionTableOff,!0),e.setUint32(p.region_table_count,t.regionTableCount,!0),e.setUint32(p.bindings_off,t.bindingsOff,!0)}const Ge=16,v=16,Pt=256,O={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},pe=0;function De(e){return Ge+e*v}function Mt(e){return e>0&&(e&e-1)===0}class w extends Error{constructor(t){super(t),this.name="CommandRingError"}}function vt(e,t,n){if(!Mt(n))throw new w(`command ring capacity_slots must be a positive power of two (got ${n})`);e.setUint32(t+O.write_head,0,!0),e.setUint32(t+O.read_head,0,!0),e.setUint32(t+O.capacity_slots,n,!0),e.setUint32(t+O.overflow_flag,0,!0)}function Ut(e,t){return e.getUint32(t+O.write_head,!0)}function Bt(e,t){return e.getUint32(t+O.read_head,!0)}function $t(e,t){return e.getUint32(t+O.capacity_slots,!0)}function Yt(e,t,n){if(n.byteLength!==v-1)throw new w(`outPayload must be ${v-1} bytes (got ${n.byteLength})`);const o=Ut(e,t),r=Bt(e,t);if(o===r)return pe;const i=$t(e,t),d=r&i-1,_=t+Ge+d*v,c=e.getUint8(_),l=new Uint8Array(e.buffer,e.byteOffset+_+1,v-1);return n.set(l),e.setUint32(t+O.read_head,r+1>>>0,!0),c}function Ft(e,t,n){let o=0;const r=new Uint8Array(v-1);for(;;){const i=Yt(e,t,r);if(i===pe)return o;n(i,r.slice()),o++}}const ee=16,b=12,G={length:0,capacity:4},ce=1<<20;function Oe(e){if(e<0||!Number.isInteger(e))throw new ke(`entity index capacity must be a non-negative integer (got ${e})`);return ee+e*b}function xt(e){return e+ee}function Ht(e,t){return e+ee+t*4}function Vt(e,t){return e+ee+t*8}class ke extends Error{constructor(t){super(t),this.name="EntityIndexError"}}function Gt(e,t,n){if(n<0||!Number.isInteger(n))throw new ke(`entity index capacity must be a non-negative integer (got ${n})`);e.setUint32(t+G.length,0,!0),e.setUint32(t+G.capacity,n,!0)}function kt(e,t,n){return{generations:new Int32Array(e,xt(t),n),archetypes:new Int32Array(e,Ht(t,n),n),rows:new Int32Array(e,Vt(t,n),n)}}const Wt=16,Xt=16,Kt=256,U={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12};function Re(e){return Wt+e*Xt}function zt(e){return e>0&&(e&e-1)===0}class jt extends Error{constructor(t){super(t),this.name="EventRingError"}}function Qt(e,t,n){if(!zt(n))throw new jt(`event ring capacity_slots must be a positive power of two (got ${n})`);e.setUint32(t+U.write_head,0,!0),e.setUint32(t+U.read_head,0,!0),e.setUint32(t+U.capacity_slots,n,!0),e.setUint32(t+U.overflow_flag,0,!0)}const qt=16,Jt=16,Zt=256,$={write_head:0,read_head:4,capacity_slots:8,overflow_flag:12},en=$.write_head/4,tn=$.read_head/4,nn=$.capacity_slots/4,on=$.overflow_flag/4;function rn(e,t){return new Int32Array(e.buffer,e.byteOffset+t,4)}function we(e){return qt+e*Jt}function sn(e){return e>0&&(e&e-1)===0}class Le extends Error{constructor(t){super(t),this.name="ActionRingError"}}function an(e,t,n){if(!sn(n))throw new Le(`action ring capacity_slots must be a positive power of two (got ${n})`);if((e.byteOffset+t)%4!==0)throw new Le(`action ring header must be 4-byte aligned for Atomics (view.byteOffset ${e.byteOffset} + ringOff ${t} is not a multiple of 4)`);const o=rn(e,t);Atomics.store(o,en,0),Atomics.store(o,tn,0),Atomics.store(o,nn,n),Atomics.store(o,on,0)}const V=[{name:"command_ring",headerOff:"command_ring_off",sizeFromOptions:e=>e.commandRingCapacitySlots!==void 0?De(e.commandRingCapacitySlots):0,init:(e,t,n)=>vt(e,t,n.commandRingCapacitySlots),regionBytes:(e,t)=>De(e.getUint32(t+O.capacity_slots,!0)),readOptions:(e,t,n)=>{n.commandRingCapacitySlots=e.getUint32(t+O.capacity_slots,!0)}},{name:"entity_index",headerOff:"entity_index_off",sizeFromOptions:e=>e.entityIndexCapacity!==void 0?Oe(e.entityIndexCapacity):0,init:(e,t,n)=>Gt(e,t,n.entityIndexCapacity),regionBytes:(e,t)=>Oe(e.getUint32(t+G.capacity,!0)),readOptions:(e,t,n)=>{n.entityIndexCapacity=e.getUint32(t+G.capacity,!0)}},{name:"event_ring",headerOff:"event_ring_off",sizeFromOptions:e=>e.eventRingCapacitySlots!==void 0?Re(e.eventRingCapacitySlots):0,init:(e,t,n)=>Qt(e,t,n.eventRingCapacitySlots),regionBytes:(e,t)=>Re(e.getUint32(t+U.capacity_slots,!0)),readOptions:(e,t,n)=>{n.eventRingCapacitySlots=e.getUint32(t+U.capacity_slots,!0)}},{name:"action_ring",headerOff:"action_ring_off",sizeFromOptions:e=>e.actionRingCapacitySlots!==void 0?we(e.actionRingCapacitySlots):0,init:(e,t,n)=>an(e,t,n.actionRingCapacitySlots),regionBytes:(e,t)=>we(e.getUint32(t+$.capacity_slots,!0)),readOptions:(e,t,n)=>{n.actionRingCapacitySlots=e.getUint32(t+$.capacity_slots,!0)}}];class X extends Error{constructor(t){super(t),this.name="RegionRegistryError"}}function We(e){return e*W}function Ne(e,t){const n=e.getUint32(p.region_table_count,!0);if(t+We(n)>e.byteLength)throw new X(`region table of ${n} entries at byte ${t} overruns the buffer (${e.byteLength} bytes)`);return n}function cn(e){const t=new Set;for(let n=0;n<e.length;n++){const o=e[n];if(!Number.isInteger(o.id)||o.id<=0)throw new X(`region "${o.name}" has invalid id ${o.id}, region ids must be positive integers (0 is the absent sentinel)`);if(t.has(o.id))throw new X(`duplicate region id ${o.id} (region "${o.name}"), ids must be distinct within a consumer's region set`);if(t.add(o.id),!Number.isInteger(o.bytes)||o.bytes<=0)throw new X(`region "${o.name}" (id ${o.id}) has invalid byte size ${o.bytes}, must be a positive integer`)}}function _n(e,t,n){e.setUint32(t+P.region_id,n.regionId,!0),e.setUint32(t+P.byte_offset,n.byteOffset,!0),e.setUint32(t+P.byte_length,n.byteLength,!0)}function Xe(e,t){return{regionId:e.getUint32(t+P.region_id,!0),byteOffset:e.getUint32(t+P.byte_offset,!0),byteLength:e.getUint32(t+P.byte_length,!0)}}function dn(e,t,n){for(let o=0;o<n.length;o++)_n(e,t+o*W,n[o])}function ln(e,t,n){const o=new Array(n);for(let r=0;r<n;r++)o[r]=Xe(e,t+r*W);return o}function un(e){const t=e.getUint32(p.region_table_off,!0);if(t===0)return[];const n=Ne(e,t);return ln(e,t,n)}function En(e,t){const n=e.getUint32(p.region_table_off,!0);if(n===0)return 0;const o=Ne(e,n);for(let r=0;r<o;r++){const i=n+r*W;if(e.getUint32(i+P.region_id,!0)===t)return e.getUint32(i+P.byte_offset,!0)}return 0}function fn(e,t){const n=e.getUint32(p.region_table_off,!0);if(n===0)return null;const o=Ne(e,n);for(let r=0;r<o;r++){const i=Xe(e,n+r*W);if(i.regionId===t)return i}return null}function Ke(e,t){return e<<16|t}const te=2**31;class ge extends Error{constructor(t){super(`SAB column layout offset ${t} reaches or exceeds the 2³¹ (${te}-byte) ceiling. Past 2 GiB the signed-32-bit bitwise alignment math wraps to a negative or misaligned offset. This is a structural limit independent of the allocator cap, so a single store cannot back more than 2 GiB of column data.`),this.name="StoreLayoutOverflowError"}}function Se(e,t){if(e+t>te)throw new ge(e);return e+(t-1)&~(t-1)}function mn(e,t,n,o,r){const i=t+o;switch(n){case A.u8:return new Uint8Array(e,i,r);case A.i8:return new Int8Array(e,i,r);case A.u16:return new Uint16Array(e,i,r);case A.i16:return new Int16Array(e,i,r);case A.u32:return new Uint32Array(e,i,r);case A.i32:return new Int32Array(e,i,r);case A.f32:return new Float32Array(e,i,r);case A.f64:return new Float64Array(e,i,r)}}function An(e,t,n=0){const r=Ct(e.map(_=>({archetypeId:_.archetypeId,componentMask:_.componentMask,rowCount:0,enabledCount:0,rowCapacity:_.rowCapacity,columns:_.columns.map(c=>({componentId:c.componentId,fieldId:c.fieldId,typeTag:c.typeTag,byteOff:0,stride:ae[c.typeTag]}))})))+n;let i=t+r;const d=new Array(e.length);for(let _=0;_<e.length;_++){const c=e[_],l=new Array(c.columns.length);for(let m=0;m<c.columns.length;m++){const T=c.columns[m],h=ae[T.typeTag];i=Se(i,h),l[m]={componentId:T.componentId,fieldId:T.fieldId,typeTag:T.typeTag,byteOff:i,stride:h},i+=h*c.rowCapacity}d[_]={archetypeId:c.archetypeId,componentMask:c.componentMask,rowCount:0,enabledCount:0,rowCapacity:c.rowCapacity,columns:l}}if(i>te)throw new ge(i);return{descriptors:d,totalBytes:i,regionBytes:r}}const z=16;function Tn(e){if(!Number.isInteger(e)||e<0)throw new RangeError(`createColumnStore: storeBase must be an integer >= 0, got ${e}`);if(e%z!==0)throw new RangeError(`createColumnStore: storeBase must be a multiple of ${z}, got ${e}`)}function ze(e){let t=0;for(const[,n]of e)t+=he(n.columnsInOrder.length);return t}function In(e){const t=e;return typeof t._regionBytes=="number"&&typeof t._allocator=="function"&&typeof t._reservedDescriptorBytes=="number"}function hn(e,t=H.DEFAULT_SAB_ALLOCATOR,n={}){const o=n.storeBase??0;Tn(o);const r={};let i=Dt;for(let N=0;N<V.length;N++){const R=V[N],F=R.sizeFromOptions(n);r[R.headerOff]=F===0?0:i,i+=F}const d=n.regions??[];cn(d);const _=d.length,c=_>0?i:0;i+=We(_);const l=new Array(_);for(let N=0;N<d.length;N++){const R=d[N];l[N]={regionId:R.id,byteOffset:i,byteLength:R.bytes},i+=R.bytes}const m=n.bindingsRegionBytes??0,T=m===0?0:i;i+=m;const h=i,{descriptors:y,totalBytes:g,regionBytes:a}=An(e,h,n.reservedDescriptorBytes??0),s=t(o+g),u=new DataView(s,o),D={magic:St,simAbiVersion:yt,viewStamp:0,capacity:g,archetypeCount:e.length,layoutDescriptorOff:h,bindingsOff:T,regionTableOff:c,regionTableCount:_,commandRingOff:r.command_ring_off,entityIndexOff:r.entity_index_off,eventRingOff:r.event_ring_off,actionRingOff:r.action_ring_off};bt(u,D),m>0&&new Uint8Array(s,o+T,m).fill(0);for(let N=0;N<V.length;N++){const R=V[N],F=r[R.headerOff];F!==0&&R.init(u,F,n)}c!==0&&dn(u,c,l);for(let N=0;N<d.length;N++)d[N].init(u,l[N].byteOffset);Lt(u,h,y);const S=je(s,o,y);return{buffer:s,view:u,header:D,storeBase:o,archetypes:S,_regionBytes:a,_allocator:t,_reservedDescriptorBytes:n.reservedDescriptorBytes??0,_usedDescriptorBytes:ze(S)}}function je(e,t,n){const o=new Map;for(let r=0;r<n.length;r++){const i=n[r],d=new Array(i.columns.length),_=new Map;for(let c=0;c<i.columns.length;c++){const l=i.columns[c],m={componentId:l.componentId,fieldId:l.fieldId,typeTag:l.typeTag,byteOff:l.byteOff,stride:l.stride,view:mn(e,t,l.typeTag,l.byteOff,i.rowCapacity)};d[c]=m,_.set(Ke(l.componentId,l.fieldId),m)}o.set(i.archetypeId,{archetypeId:i.archetypeId,componentMask:i.componentMask,rowCapacity:i.rowCapacity,columns:_,columnsInOrder:d})}return o}const _e=2147483647,Ce=new WeakMap;function pn(e){const t=new Set,n=new Set,o=new Set,r=new Set,i=new Set,d=new Set,_=new Set,c=new Set,l=new Set,m=new Set;for(let a=0;a<e.writes.length;a++){const s=e.writes[a].id;n.add(s),t.add(s),o.add(s)}for(let a=0;a<e.reads.length;a++)t.add(e.reads[a].id);for(let a=0;a<e.spawns.length;a++){const s=e.spawns[a];for(let u=0;u<s.length;u++)o.add(s[u].id)}for(let a=0;a<e.transitions.length;a++){const s=e.transitions[a];if(s.add)for(let u=0;u<s.add.length;u++)o.add(s.add[u].id);if(s.remove)for(let u=0;u<s.remove.length;u++)r.add(s.remove[u].id)}for(let a=0;a<e.despawns.length;a++)r.add(e.despawns[a].id);for(let a=0;a<e.resourceReads.length;a++)i.add(e.resourceReads[a]);for(let a=0;a<e.resourceWrites.length;a++){const s=e.resourceWrites[a];d.add(s),i.add(s)}const T=e.sparseWrites;if(T!==void 0)for(let a=0;a<T.length;a++){const s=T[a];c.add(s),_.add(s)}const h=e.sparseReads;if(h!==void 0)for(let a=0;a<h.length;a++)_.add(h[a]);const y=e.relationWrites;if(y!==void 0)for(let a=0;a<y.length;a++){const s=y[a];m.add(s),l.add(s)}const g=e.relationReads;if(g!==void 0)for(let a=0;a<g.length;a++)l.add(g[a]);return{reads:t,writes:n,addAllowed:o,removeAllowed:r,hasDespawns:e.despawns.length>0,resourceReads:i,resourceWrites:d,sparseReads:_,sparseWrites:c,relationReads:l,relationWrites:m}}function Nn(e){const t=Ce.get(e);if(t!==void 0)return t;const n=pn(e);return Ce.set(e,n),n}const be=new WeakMap;function gn(e){const t=new Set,n=new Set;if(e.reads!==void 0)for(let o=0;o<e.reads.length;o++)t.add(e.reads[o].id);if(e.resourceReads!==void 0)for(let o=0;o<e.resourceReads.length;o++)n.add(e.resourceReads[o]);return{reads:t,writes:new Set,addAllowed:new Set,removeAllowed:new Set,hasDespawns:!1,resourceReads:n,resourceWrites:new Set,sparseReads:new Set,sparseWrites:new Set,relationReads:new Set,relationWrites:new Set}}function Sn(e){const t=be.get(e);if(t!==void 0)return t;const n=gn(e);return be.set(e,n),n}class yn{_activeSystem=null;_activeSets=null;_activeName=null;_exclusive=!1;enter(t){this._activeSystem=t,this._activeName=t.name??`system_${t.id}`,this._exclusive=t.exclusive===!0,this._activeSets=this._exclusive?null:Nn(t)}enterCondition(t){this._activeSystem=null,this._activeName=t.name,this._activeSets=Sn(t)}leave(){this._activeSystem=null,this._activeName=null,this._activeSets=null,this._exclusive=!1}isActive(){return this._activeSets!==null||this._exclusive}current(){return this._activeSystem}assertRead(t){this._activeSets!==null&&(this._activeSets.reads.has(t.id)||this._failComponent("read",t,"reads"))}assertWrite(t){this._activeSets!==null&&(this._activeSets.writes.has(t.id)||this._failComponent("write",t,"writes"))}assertAdd(t){this._activeSets!==null&&(this._activeSets.addAllowed.has(t.id)||this._failComponent("addComponent",t,"spawns, transitions.add or writes"))}assertRemove(t){this._activeSets!==null&&(this._activeSets.removeAllowed.has(t.id)||this._failComponent("removeComponent",t,"despawns or transitions.remove"))}assertDespawn(){if(this._activeSets===null||this._activeSets.hasDespawns)return;const t=this._activeName;throw new E(f.ACCESS_UNDECLARED,`system '${t}' called despawn but did not declare any despawns. Name the components it removes in 'despawns'`,{system:t,op:"despawn"})}assertResourceRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.resourceReads.has(n)||this._failResource("read",t,"resourceReads")}assertResourceWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.resourceWrites.has(n)||this._failResource("write",t,"resourceWrites")}assertSparseRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.sparseReads.has(n)||this._failSparse("read",n,"sparseReads")}assertSparseWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.sparseWrites.has(n)||this._failSparse("write",n,"sparseWrites")}assertRelationRead(t){if(this._activeSets===null)return;const n=t;this._activeSets.relationReads.has(n)||this._failRelation("read",n,"relationReads")}assertRelationWrite(t){if(this._activeSets===null)return;const n=t;this._activeSets.relationWrites.has(n)||this._failRelation("write",n,"relationWrites")}assertRelationReadAny(){this._activeSets!==null&&(this._activeSets.relationReads.has(_e)||this._failRelation("(*, T) wildcard read",_e,"relationReads (as ANY_RELATION)"))}_optionalScopes=[];enterOptionalScope(t){this._optionalScopes.push(t)}leaveOptionalScope(){this._optionalScopes.pop()}assertOptionalFetch(t){const n=this._optionalScopes.length;if(n===0)return;const o=this._optionalScopes[n-1],r=t.id;for(let i=0;i<o.length;i++)if(o[i]===r)return;throw new E(f.OPTIONAL_TERM_NOT_DECLARED,`getOptionalColumnRead fetched optional component ${r} but the iterating query did not declare it. Add .optional(component) to the query before the fetch`)}_failComponent(t,n,o){const r=this._activeName,i=He(n);throw new E(f.ACCESS_UNDECLARED,`system '${r}' performed ${t} on ${i} but did not declare it. Add it to '${o}'`,{system:r,op:t,component:n.id})}_failSparse(t,n,o){const r=this._activeName;throw new E(f.ACCESS_UNDECLARED,`system '${r}' performed ${t} on sparse component ${n} but did not declare it. Add it to '${o}'`,{system:r,op:t,sparse:n})}_failRelation(t,n,o){const r=this._activeName;throw new E(f.ACCESS_UNDECLARED,`system '${r}' performed ${t} on relation ${n} but did not declare it. Add it to '${o}'`,{system:r,op:t,relation:n})}_failResource(t,n,o){const r=this._activeName,i=n.description??"<unnamed>";throw new E(f.ACCESS_UNDECLARED,`system '${r}' performed resource ${t} on '${i}' but did not declare it. Add the resource key to '${o}'`,{system:r,op:t,resource:i})}}const Dn=new yn;function On(e,t){return new E(f.PLUGIN_NOT_INSTALLED,`${t} needs the ${e} plugin, which this world did not install. Pass it at construction: ECS.create({ plugins: [${e}()] }), imported from @oasys/oecs/${e}`,{plugin:e})}function Rn(e){return new E(f.PLUGIN_ALREADY_INSTALLED,`${e} is already installed on this world. Pass each plugin once to ECS.create`,{plugin:e})}const Pe=["/oecs/src/","/@oasys/oecs/"];function wn(e){for(let t=0;t<Pe.length;t++)if(e.includes(Pe[t]))return!0;return!1}class Ln{_activeCache=null;_repoRootCache=null;_counts=new Map;_callsiteCache=new Map;isActive(){if(this._activeCache!==null)return this._activeCache;const n=globalThis.process?.env?.VISUAL_INTEL_TRACE;return this._activeCache=n==="1"||n==="true"}_repoRoot(){if(this._repoRootCache!==null)return this._repoRootCache;const t=globalThis.process;return this._repoRootCache=t?.cwd?.()??""}_resolveCallsite(){return bn(new Error().stack??null,this._repoRoot(),this._callsiteCache)}_record(t,n,o){const r=this._resolveCallsite();if(!r)return;const i=`${t} ${n} ${o} ${r}`;this._counts.set(i,(this._counts.get(i)??0)+1)}recordEventEmit(t){this._record("ecs-events","emit",t)}recordEventRead(t){this._record("ecs-events","read",t)}recordResourceRead(t){this._record("resources","read",t)}recordResourceWrite(t){this._record("resources","write",t)}recordResourceRegister(t){this._record("resources","register",t)}recordResourceRemove(t){this._record("resources","remove",t)}recordSendAction(t){this._record("actions","send_action",t)}recordHandleAction(t){this._record("actions","handle_action",t)}snapshot(){const t={"ecs-events":{emit:[],read:[]},actions:{send_action:[],handle_action:[]},resources:{read:[],write:[],register:[],remove:[]}};for(const[n,o]of this._counts.entries()){const[r,i,d,_]=n.split(" ");if(!r||!i||_===void 0)continue;const l={key:r==="actions"?Number(d):d,file:_,count:o},T=t[r][i];T&&T.push(l)}for(const n of Object.values(t))for(const o of Object.values(n))o.sort((r,i)=>{if(r.file!==i.file)return r.file<i.file?-1:1;const d=String(r.key),_=String(i.key);return d<_?-1:d>_?1:0});return{schemaVersion:1,capturedAt:new Date().toISOString(),channels:t}}reset(){this._counts.clear(),this._callsiteCache.clear(),this._activeCache=null,this._repoRootCache=null}}function Cn(e){const t=/\(([^)]+):\d+:\d+\)\s*$/.exec(e);if(t)return t[1]??null;const n=/at\s+([^\s][^()]*?):\d+:\d+\s*$/.exec(e);return n&&(n[1]??"").trim()||null}function bn(e,t,n){if(!e)return null;const o=e.split(`
2
+ `);for(let r=0;r<o.length;r++){const i=o[r],d=n?.get(i);if(d!==void 0){if(d===null)continue;return d}const _=Cn(i);if(!_){n?.set(i,null);continue}if(wn(_)){n?.set(i,null);continue}const c=Pn(_,t);return n?.set(i,c),c}return null}function Pn(e,t){let n=e;return n.startsWith("file://")&&(n=n.slice(7)),t&&n.startsWith(t+"/")&&(n=n.slice(t.length+1)),n.replace(/\\/g,"/")}const Mn=new Ln;var j=(e=>(e.PRE_STARTUP="PRE_STARTUP",e.STARTUP="STARTUP",e.POST_STARTUP="POST_STARTUP",e.FIXED_UPDATE="FIXED_UPDATE",e.PRE_UPDATE="PRE_UPDATE",e.UPDATE="UPDATE",e.POST_UPDATE="POST_UPDATE",e))(j||{});function Me(e){if(typeof e!="string")return e.loop;switch(e){case"PRE_STARTUP":case"STARTUP":case"POST_STARTUP":return"startup";case"FIXED_UPDATE":return"fixed";case"PRE_UPDATE":case"UPDATE":case"POST_UPDATE":return"update"}}function ve(e){return typeof e=="string"?e:e.name}const Q=1024,q=1024*Q,B=64*Q,J=B;function vn(e,t=0){if(!Number.isFinite(t)||t<0)throw new E(f.INVALID_MEMORY_OPTIONS,`storeBaseAbove: extraBytes must be a finite number >= 0, got ${String(t)}`);const n=e?.__heap_base,o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;if(typeof o!="number"||!Number.isFinite(o))throw new E(f.INVALID_MEMORY_OPTIONS,`storeBaseAbove: the module exports no numeric '__heap_base', got ${String(o)}. Link with --export=__heap_base, or pass memory.storeBase by hand.`);const r=Math.ceil((o+t)/B)*B;return Math.max(J,r)}const K=256*q,de=3,Qe=64,qe=8,Ue=4*q,Be=e=>2**Math.ceil(Math.log2(Math.max(1,e))),Un=e=>2**Math.floor(Math.log2(Math.max(1,e))),re=(e,t,n)=>Math.min(n,Math.max(t,e)),I=e=>e>=q?`${(e/q).toFixed(1)} MiB`:e>=Q?`${(e/Q).toFixed(0)} KiB`:`${e} B`;function Bn(e,t){if(e===void 0)return t?J:0;if(!Number.isInteger(e)||e<0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.storeBase must be an integer >= 0, got ${e}`);if(e%z!==0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.storeBase must be a multiple of ${z}, got ${e}. The alignment keeps every column on its element boundary.`);if(t&&e===0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.storeBase is 0, and a header at address 0 is unreadable from a safe build of a WASM module. Pass a storeBase of at least one page (${J}), above the module's own data.`);return e}function M(e,t){if(!Number.isInteger(t)||t<=0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.${e} must be a positive integer (got ${t})`)}const $e={budget:"{ budget: { entities: N } } → { entities: N }",heap:'{ heap: { maxBytes: X } } → { maxBytes: X, backing: "heap" }',shared:'{ shared: { maxBytes: X } } → { maxBytes: X, backing: "shared" }',wasm:"{ wasm: W } → { backing: { wasm: W } }",allocator:"{ allocator: A } → { backing: { allocator: A } }",capBytesHint:"{ capBytesHint: X } → { maxBytes: X }"};function $n(e){const t=Object.prototype.hasOwnProperty,n=Object.keys($e).filter(o=>t.call(e,o));if(n.length!==0)throw new E(f.INVALID_MEMORY_OPTIONS,`${n.map(o=>`memory.${o}`).join(" and ")} ${n.length>1?"were":"was"} removed in 0.6. Sizing and backing are now two independent fields, so every combination of them is expressible. Rewrite as: `+n.map(o=>$e[o]).join(". "))}function Yn(e){e!==void 0&&$n(e);const t=e?.entities,n=e?.maxBytes,o=e?.columnCapacity,r=e?.backing??"heap",i=typeof r=="object"&&r.wasm!==void 0,d=Bn(e?.storeBase,i);if(o!==void 0&&M("columnCapacity",o),n!==void 0&&M("maxBytes",n),t===void 0){for(const s of["archetypes","bytesPerEntity"])if(e?.[s]!==void 0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.${s} shapes the sizing derived from memory.entities, which was not given. Add memory.entities, or drop memory.${s}.`)}let _,c,l=null;const m=[];if(t!==void 0){const s=e?.archetypes??qe,u=e?.bytesPerEntity??Qe;if(M("entities",t),M("archetypes",s),M("bytesPerEntity",u),t>1<<20)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.entities=${t} exceeds the EntityID index space (1<<20 = ${1<<20})`);_=o??re(Be(Math.ceil(t/s)),64,1<<20),c=re(Be(t*2),4096,1<<20);const D=c*b,S=t*u*de;l=Se(Math.max(D+S,Ue),B),m.push(`columnCapacity = ${o!==void 0?`${_} (pinned)`:`pow2(${t}/${s} per archetype) = ${_}`}`,`entityIndex = pow2(2 × ${t}) = ${c} slots × ${b} B = ${I(D)}`,`columns = ${t} × ${u} B × ${de} (double+holes headroom) = ${I(S)}`)}else _=o??xe,c=ce,m.push(`columnCapacity = ${_} (${o!==void 0?"pinned":"default"})`);const T=s=>re(Un(s/4/b),4096,ce),h=t!==void 0?n!==void 0?"entities+maxBytes":"entities":n!==void 0?"maxBytes":"default",y=s=>n!==void 0?`${I(s)} (caller-declared maxBytes; the ${I(l??s)} the entity count implies is overridden)`:`align64K(max(index + columns, ${I(Ue)} floor)) = ${I(s)}`,g=(s,u,D,S,L)=>(t===void 0&&(c=T(s)),{source:u,sizing:h,allocator:D,columnCapacity:_,entityIndexCapacity:c,capBytes:s,storeBase:d,intentLabel:S,budgetEntities:t??null,derivation:[...L,...d>0?[`storeBase = ${I(d)}, the store writes nothing below it`]:[],...m,t===void 0?`entityIndex = floor_pow2(cap/4 ÷ ${b} B) = ${c} slots`:`cap = ${y(s)}`],wasmMemory:null});if(typeof r=="object"&&r.wasm!==void 0){const s=r.wasm;if(s.memory!==void 0){if(!(s.memory.buffer instanceof SharedArrayBuffer))throw new E(f.INVALID_MEMORY_OPTIONS,"memory.backing.wasm.memory must be constructed with `shared: true`, the SAB substrate requires a SharedArrayBuffer-backed WebAssembly.Memory");const L=n??K;return t===void 0&&(c=T(Math.max(L-d,0))),{source:"wasm",sizing:h,allocator:H.wasmMemoryAllocator(s.memory),columnCapacity:_,entityIndexCapacity:c,capBytes:L,storeBase:d,intentLabel:`caller-supplied WebAssembly.Memory (declared cap ${I(L)})`,budgetEntities:t??null,derivation:["backing = wasm_memory_allocator(memory), zero-copy with a WASM compute backend (is_in_place ✓)",n!==void 0?`cap = ${I(L)} (caller-declared maxBytes; the Memory's own maximum is not readable from JS)`:`cap = ${I(L)} (default; the Memory's own maximum is not readable from JS)`,`storeBase = ${I(d)}, the module owns every byte below it`,...m,t===void 0?`entityIndex = floor_pow2((cap - storeBase)/4 ÷ ${b} B) = ${c} slots`:"entityIndex sized from the entity count above"],wasmMemory:s.memory}}M("backing.wasm.maximumPages",s.maximumPages);const u=s.initialPages??Math.min(32,s.maximumPages);if(M("backing.wasm.initialPages",u),u>s.maximumPages)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.backing.wasm.initialPages (${u}) exceeds maximumPages (${s.maximumPages})`);if(n!==void 0)throw new E(f.INVALID_MEMORY_OPTIONS,`memory.maxBytes (${I(n)}) cannot be given beside memory.backing.wasm.maximumPages (${s.maximumPages} pages = ${I(s.maximumPages*B)}), the Memory's page maximum IS the ceiling. Declare it once, in pages.`);const D=new WebAssembly.Memory({initial:u,maximum:s.maximumPages,shared:!0}),S=s.maximumPages*B;return t===void 0&&(c=T(Math.max(S-d,0))),{source:"wasm",sizing:h,allocator:H.wasmMemoryAllocator(D),columnCapacity:_,entityIndexCapacity:c,capBytes:S,storeBase:d,intentLabel:`engine-constructed WebAssembly.Memory (max ${s.maximumPages} pages)`,budgetEntities:t??null,derivation:[`cap = ${s.maximumPages} pages × 64 KiB = ${I(S)} (Memory maximum)`,`initial = ${u} pages (${s.initialPages!==void 0?"declared":"default"})`,`storeBase = ${I(d)}, the module owns every byte below it`,...m,t===void 0?`entityIndex = floor_pow2((cap - storeBase)/4 ÷ ${b} B) = ${c} slots`:"entityIndex sized from the entity count above"],wasmMemory:D}}if(typeof r=="object"&&r.allocator!==void 0){if(r.allocator.isInPlace!==!0)throw new E(f.INVALID_MEMORY_OPTIONS,"memory.backing.allocator must declare `isInPlace: true`. A live Store's flush loops hoist entity-index views across grows, so an allocator that is not in-place (DEFAULT_SAB_ALLOCATOR, for example) corrupts the entity→row mapping. Use growableSabAllocator, fixedSabAllocator or wasmMemoryAllocator. An allocator that is not in-place is for snapshot and test sizing only.");const s=n??null;return t===void 0&&s!==null&&(c=T(s)),{source:"allocator",sizing:h,allocator:r.allocator,columnCapacity:_,entityIndexCapacity:c,capBytes:s,storeBase:d,intentLabel:s!==null?`custom in-place allocator (declared cap ${I(s)})`:"custom in-place allocator",budgetEntities:t??null,derivation:["backing = caller allocator (is_in_place ✓ checked at construction)",s!==null?`cap = ${I(s)} (caller-declared; the allocator owns the real ceiling)`:"cap = allocator-owned (no maxBytes declared)",...m,t!==void 0?"entityIndex sized from the entity count above":s!==null?`entityIndex = floor_pow2(cap/4 ÷ ${b} B) = ${c} slots`:`entityIndex = ${c} slots (default, no entity count and no declared cap)`],wasmMemory:null}}if(r==="shared"){const s=n??l??K;return g(s,"shared",H.growableSabAllocator(s),`shared SharedArrayBuffer backing (${I(s)} growable cap, needs COOP and COEP)`,[`backing = growable_sab_allocator(${I(s)}), growable SharedArrayBuffer (is_in_place ✓), needs cross-origin isolation`,"enables worker offload + a WASM compute backend (transferable SharedArrayBuffer)"])}if(r!=="heap")throw new E(f.INVALID_MEMORY_OPTIONS,`memory.backing must be "heap", "shared", { wasm }, or { allocator } (got ${JSON.stringify(r)})`);const a=n??l??K;return g(a,"heap",H.heapArrayBufferAllocator(a),h==="default"?`default sizing (${I(a)} reserved cap)`:t!==void 0?`budget of ${t} entities`:`explicit cap of ${I(a)}`,[`backing = heap_arraybuffer_allocator(${I(a)}), fixed ArrayBuffer reserved at the cap, no SAB and no COOP+COEP (is_in_place ✓)`,"trade-off: no worker offload and no WASM backend (both need a transferable SharedArrayBuffer)"])}function Fn(e,t){return{def:e,values:t}}function Z(e,t){switch(t.kind){case"spawn":{const n=e.commands.spawn();for(const o of t.components)e.commands.add(n,o.def,o.values);return t.onSpawned?.(n),n}case"despawn":e.commands.despawn(t.eid);return;case"add_component":e.commands.add(t.eid,t.def,t.values);return;case"remove_component":e.commands.remove(t.eid,t.def);return;case"set_field":if(!e.hasComponent(t.eid,t.def))throw new E(f.COMPONENT_NOT_REGISTERED,`host set_field on entity ${t.eid} targets a component it does not have. If you added that component via a host command this same frame, the add is deferred to the phase flush while set_field is immediate. Carry the value in add_component or in spawnEntry instead of a separate set_field, or set it next frame. (host write seam)`);e.setField(t.eid,t.def,t.field,t.value);return;case"disable":e.commands.disable(t.eid);return;case"enable":e.commands.enable(t.eid);return;default:return nt(t,"HostCommand kind")}}class Je{_pending=[];spawn(t,n){return this._pending.push({kind:"spawn",components:t,onSpawned:n}),this}despawn(t){return this._pending.push({kind:"despawn",eid:t}),this}add(t,n,o){return this._pending.push({kind:"add_component",eid:t,def:n,values:o}),this}remove(t,n){return this._pending.push({kind:"remove_component",eid:t,def:n}),this}setField(t,n,o,r){return this._pending.push({kind:"set_field",eid:t,def:n,field:o,value:r}),this}disable(t){return this._pending.push({kind:"disable",eid:t}),this}enable(t){return this._pending.push({kind:"enable",eid:t}),this}push(t){return this._pending.push(t),this}get pendingCount(){return this._pending.length}clear(){const t=this._pending.length;return this._pending.length=0,t}drain(t,n){const o=this._pending.length;if(o===0)return 0;if(n===void 0)for(let r=0;r<o;r++)Z(t,this._pending[r]);else for(let r=0;r<o;r++){const i=this._pending[r];n(i),Z(t,i)}return this._pending.splice(0,o),o}}const ye=v-1;function xn(e){if(e===pe)throw new w("cannot bind opCode 0 (reserved as the command-ring empty-slot marker)");if(e<0||e>255||!Number.isInteger(e))throw new w(`command opCode must be a u8 in [1, 255] (got ${e})`)}function ne(e){const t=new Uint8Array(ye);return new DataView(t.buffer).setUint32(0,e,!0),t}function oe(e){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!0)}function Hn(e,t){return{encode(n){if(n.kind!=="set_field")throw new w(`ringSetFieldCodec encodes a "set_field" command (got "${n.kind}")`);const o=new Uint8Array(ye),r=new DataView(o.buffer);return r.setUint32(0,n.eid,!0),r.setFloat64(4,n.value,!0),o},decode(n){const o=new DataView(n.buffer,n.byteOffset,n.byteLength);return{kind:"set_field",eid:o.getUint32(0,!0),def:e,field:t,value:o.getFloat64(4,!0)}}}}function Vn(){return{encode(e){if(e.kind!=="despawn")throw new w(`ringDespawnCodec encodes a "despawn" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"despawn",eid:oe(e)})}}function Gn(){return{encode(e){if(e.kind!=="disable")throw new w(`ringDisableCodec encodes a "disable" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"disable",eid:oe(e)})}}function kn(){return{encode(e){if(e.kind!=="enable")throw new w(`ringEnableCodec encodes an "enable" command (got "${e.kind}")`);return ne(e.eid)},decode:e=>({kind:"enable",eid:oe(e)})}}function Wn(e){return{encode(t){if(t.kind!=="remove_component")throw new w(`ringRemoveComponentCodec encodes a "remove_component" command (got "${t.kind}")`);return ne(t.eid)},decode:t=>({kind:"remove_component",eid:oe(t),def:e})}}class Xn{_appliers=new Map;on(t,n){return xn(t),this._appliers.set(t,n),this}off(t){return this._appliers.delete(t)}onCommand(t,n){return this.on(t,(o,r,i)=>{const d=n.decode(r);i?.(d),Z(o,d)})}drain(t,n,o,r){return Ft(n,o,(i,d)=>{const _=this._appliers.get(i);_!==void 0&&_(t,d,r)})}}const le=new WeakMap;function Kn(e,t){const n=le.get(t);if(n===void 0)return!1;for(const o of n)e.removeSystem(o);return le.delete(t),t.clear(),!0}function zn(e,t){const n=new Je,o=[];le.set(n,o);const r=t?.name??"host_command_apply",i=t?.ring,d=t?.recorder,_=d?.record,c=t?.schedules??[j.PRE_STARTUP,j.PRE_UPDATE];if(d!==void 0){for(const l of c)if(Me(l)==="fixed")throw new E(f.INVALID_RECORDER_SCHEDULE,`installHostCommandSeam: a recorder cannot drain at ${ve(l)}, a phase of the fixed loop. It would log the fixed timestep and not the host update dt, so a replay would diverge. Drain at a phase of the update loop instead.`)}for(const l of c){const m=Me(l)!=="startup",T=e.registerSystem({name:`${r}:${ve(l)}`,reads:[],writes:[],exclusive:!0,fn:(h,y)=>{if(d!==void 0&&m&&d.openTick(h.ecsTick,y),n.drain(h,_),i!==void 0){const g=e.columnStore,a=g.header.commandRingOff;a!==0&&i.drain(h,g.view,a,_)}}});e.addSystems(l,T),o.push(T)}return n}exports.ACTION_RING_DEFAULT_CAPACITY_SLOTS=Zt;exports.ANY_RELATION=_e;exports.ARCHETYPE_DESCRIPTOR_HEADER_BYTES=Ie;exports.ARCHETYPE_DESCRIPTOR_OFFSETS=C;exports.BUDGET_DEFAULT_ARCHETYPES=qe;exports.BUDGET_DEFAULT_BYTES_PER_ENTITY=Qe;exports.BUDGET_GROWTH_HEADROOM=de;exports.COLUMN_DESCRIPTOR_BYTES=Te;exports.COMMAND_RING_DEFAULT_CAPACITY_SLOTS=Pt;exports.COMPONENT_MASK_WORDS=Ae;exports.DEFAULT_COLUMN_CAPACITY=xe;exports.DEFAULT_ECS_CAP_BYTES=K;exports.DEFAULT_FIXED_TIMESTEP=ut;exports.DEFAULT_MAX_FIXED_STEPS=Et;exports.ECSError=E;exports.ECSRestoreError=rt;exports.ECS_ERROR=f;exports.EMPTY_VALUES=at;exports.ENTITY_INDEX_DEFAULT_CAPACITY=ce;exports.ENTITY_INDEX_HEADER_OFFSETS=G;exports.EVENT_RING_DEFAULT_CAPACITY_SLOTS=Kt;exports.HASH_GOLDEN_RATIO=ct;exports.HASH_SECONDARY_PRIME=_t;exports.HOST_COMMAND_PAYLOAD_BYTES=ye;exports.HostCommandDispatcher=Xn;exports.HostCommandQueue=Je;exports.INDEX_BITS=Y;exports.INDEX_MASK=Ee;exports.INITIAL_GENERATION=dt;exports.MAX_ENTITY_ID=It;exports.MAX_GENERATION=k;exports.MAX_INDEX=fe;exports.MAX_LIVE_GENERATION=Tt;exports.NO_SWAP=st;exports.RETIRED_GENERATION=At;exports.SCHEDULE=j;exports.STARTUP_DELTA_TIME=ft;exports.STORE_DESCRIPTOR_COMPONENT_LIMIT=wt;exports.STORE_HEADER_OFFSETS=p;exports.STORE_MAX_BYTE_OFFSET=te;exports.STORE_PREFIX_REGIONS=V;exports.StoreLayoutOverflowError=ge;exports.TYPED_ARRAY_TAG_TO_TYPE_TAG=Ot;exports.TYPE_TAG=A;exports.TYPE_TAG_STRIDE=ae;exports.UNASSIGNED=it;exports.WASM_STORE_BASE_BYTES=J;exports.accessCheck=Dn;exports.alignUp=Se;exports.applyHostCommand=Z;exports.archetypeDescriptorBytes=he;exports.columnKey=Ke;exports.componentDebugName=gt;exports.componentLabel=He;exports.createArchetypeViews=je;exports.createColumnStore=hn;exports.createEntityId=ht;exports.createEntityIndexViews=kt;exports.dispatchTrace=Mn;exports.entityNotAliveError=pt;exports.findRegionEntry=fn;exports.findRegionOffset=En;exports.getEntityGeneration=se;exports.getEntityIndex=ie;exports.installHostCommandSeam=zn;exports.isColumnStoreInternal=In;exports.isEcsError=ot;exports.isNonNegativeInteger=Ze;exports.pluginInstalledTwiceError=Rn;exports.pluginMissingError=On;exports.readHeaderRegionTable=un;exports.resolveECSMemory=Yn;exports.ringDespawnCodec=Vn;exports.ringDisableCodec=Gn;exports.ringEnableCodec=kn;exports.ringRemoveComponentCodec=Wn;exports.ringSetFieldCodec=Hn;exports.setComponentDebugName=Nt;exports.spawnEntry=Fn;exports.storeBaseAbove=vn;exports.uninstallHostCommandSeam=Kn;exports.unsafeCast=tt;exports.usedDescriptorBytes=ze;exports.validateAndCast=et;exports.writeArchetypeDescriptor=Ve;