@adobe/ecs 0.0.0-stage → 0.2.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 (2883) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -2
  3. package/dist/implementation/compiler/access.d.ts +6 -0
  4. package/dist/implementation/compiler/access.js +159 -0
  5. package/dist/implementation/compiler/access.js.map +1 -0
  6. package/dist/implementation/compiler/archetypes.d.ts +17 -0
  7. package/dist/implementation/compiler/archetypes.js +141 -0
  8. package/dist/implementation/compiler/archetypes.js.map +1 -0
  9. package/dist/implementation/compiler/assign.d.ts +7 -0
  10. package/dist/implementation/compiler/assign.js +162 -0
  11. package/dist/implementation/compiler/assign.js.map +1 -0
  12. package/dist/implementation/compiler/augmentations.d.ts +25 -0
  13. package/dist/implementation/compiler/augmentations.js +943 -0
  14. package/dist/implementation/compiler/augmentations.js.map +1 -0
  15. package/dist/implementation/compiler/bind.d.ts +9 -0
  16. package/dist/implementation/compiler/bind.js +83 -0
  17. package/dist/implementation/compiler/bind.js.map +1 -0
  18. package/dist/implementation/compiler/body-access.d.ts +32 -0
  19. package/dist/implementation/compiler/body-access.js +479 -0
  20. package/dist/implementation/compiler/body-access.js.map +1 -0
  21. package/dist/implementation/compiler/booleans.d.ts +8 -0
  22. package/dist/implementation/compiler/booleans.js +35 -0
  23. package/dist/implementation/compiler/booleans.js.map +1 -0
  24. package/dist/implementation/compiler/branches.d.ts +16 -0
  25. package/dist/implementation/compiler/branches.js +38 -0
  26. package/dist/implementation/compiler/branches.js.map +1 -0
  27. package/dist/implementation/compiler/calls.d.ts +6 -0
  28. package/dist/implementation/compiler/calls.js +401 -0
  29. package/dist/implementation/compiler/calls.js.map +1 -0
  30. package/dist/implementation/compiler/columns.d.ts +26 -0
  31. package/dist/implementation/compiler/columns.js +53 -0
  32. package/dist/implementation/compiler/columns.js.map +1 -0
  33. package/dist/implementation/compiler/compile-kernel.d.ts +37 -0
  34. package/dist/implementation/compiler/compile-kernel.js +183 -0
  35. package/dist/implementation/compiler/compile-kernel.js.map +1 -0
  36. package/dist/implementation/compiler/compiler.d.ts +6 -0
  37. package/dist/implementation/compiler/compiler.js +7 -0
  38. package/dist/implementation/compiler/compiler.js.map +1 -0
  39. package/dist/implementation/compiler/data.d.ts +30 -0
  40. package/dist/implementation/compiler/data.js +77 -0
  41. package/dist/implementation/compiler/data.js.map +1 -0
  42. package/dist/implementation/compiler/describe.d.ts +41 -0
  43. package/dist/implementation/compiler/describe.js +510 -0
  44. package/dist/implementation/compiler/describe.js.map +1 -0
  45. package/dist/implementation/compiler/estree.d.ts +18 -0
  46. package/dist/implementation/compiler/estree.js +62 -0
  47. package/dist/implementation/compiler/estree.js.map +1 -0
  48. package/dist/implementation/compiler/expression.d.ts +6 -0
  49. package/dist/implementation/compiler/expression.js +153 -0
  50. package/dist/implementation/compiler/expression.js.map +1 -0
  51. package/dist/implementation/compiler/failure.d.ts +27 -0
  52. package/dist/implementation/compiler/failure.js +24 -0
  53. package/dist/implementation/compiler/failure.js.map +1 -0
  54. package/dist/implementation/compiler/identify.d.ts +43 -0
  55. package/dist/implementation/compiler/identify.js +207 -0
  56. package/dist/implementation/compiler/identify.js.map +1 -0
  57. package/dist/implementation/compiler/index.d.ts +5 -0
  58. package/dist/implementation/compiler/index.js +7 -0
  59. package/dist/implementation/compiler/index.js.map +1 -0
  60. package/dist/implementation/compiler/inferred.d.ts +32 -0
  61. package/dist/implementation/compiler/inferred.js +185 -0
  62. package/dist/implementation/compiler/inferred.js.map +1 -0
  63. package/dist/implementation/compiler/inline-kernels.d.ts +7 -0
  64. package/dist/implementation/compiler/inline-kernels.js +16 -0
  65. package/dist/implementation/compiler/inline-kernels.js.map +1 -0
  66. package/dist/implementation/compiler/input-schemas.d.ts +23 -0
  67. package/dist/implementation/compiler/input-schemas.js +102 -0
  68. package/dist/implementation/compiler/input-schemas.js.map +1 -0
  69. package/dist/implementation/compiler/ir.d.ts +226 -0
  70. package/dist/implementation/compiler/ir.js +28 -0
  71. package/dist/implementation/compiler/ir.js.map +1 -0
  72. package/dist/implementation/compiler/kernel-id.d.ts +17 -0
  73. package/dist/implementation/compiler/kernel-id.js +28 -0
  74. package/dist/implementation/compiler/kernel-id.js.map +1 -0
  75. package/dist/implementation/compiler/key.d.ts +21 -0
  76. package/dist/implementation/compiler/key.js +21 -0
  77. package/dist/implementation/compiler/key.js.map +1 -0
  78. package/dist/implementation/compiler/link.d.ts +83 -0
  79. package/dist/implementation/compiler/link.js +186 -0
  80. package/dist/implementation/compiler/link.js.map +1 -0
  81. package/dist/implementation/compiler/lists.d.ts +50 -0
  82. package/dist/implementation/compiler/lists.js +210 -0
  83. package/dist/implementation/compiler/lists.js.map +1 -0
  84. package/dist/implementation/compiler/lookups.d.ts +24 -0
  85. package/dist/implementation/compiler/lookups.js +118 -0
  86. package/dist/implementation/compiler/lookups.js.map +1 -0
  87. package/dist/implementation/compiler/math.d.ts +3 -0
  88. package/dist/implementation/compiler/math.js +10 -0
  89. package/dist/implementation/compiler/math.js.map +1 -0
  90. package/dist/implementation/compiler/memory-compiler.d.ts +61 -0
  91. package/dist/implementation/compiler/memory-compiler.js +271 -0
  92. package/dist/implementation/compiler/memory-compiler.js.map +1 -0
  93. package/dist/implementation/compiler/module-scope.d.ts +53 -0
  94. package/dist/implementation/compiler/module-scope.js +121 -0
  95. package/dist/implementation/compiler/module-scope.js.map +1 -0
  96. package/dist/implementation/compiler/module-value.d.ts +15 -0
  97. package/dist/implementation/compiler/module-value.js +139 -0
  98. package/dist/implementation/compiler/module-value.js.map +1 -0
  99. package/dist/implementation/compiler/out.d.ts +4 -0
  100. package/dist/implementation/compiler/out.js +2 -0
  101. package/dist/implementation/compiler/out.js.map +1 -0
  102. package/dist/implementation/compiler/oxc.d.ts +41 -0
  103. package/dist/implementation/compiler/oxc.js +80 -0
  104. package/dist/implementation/compiler/oxc.js.map +1 -0
  105. package/dist/implementation/compiler/package-copies.d.ts +60 -0
  106. package/dist/implementation/compiler/package-copies.js +140 -0
  107. package/dist/implementation/compiler/package-copies.js.map +1 -0
  108. package/dist/implementation/compiler/passes.d.ts +25 -0
  109. package/dist/implementation/compiler/passes.js +24 -0
  110. package/dist/implementation/compiler/passes.js.map +1 -0
  111. package/dist/implementation/compiler/paths.d.ts +5 -0
  112. package/dist/implementation/compiler/paths.js +20 -0
  113. package/dist/implementation/compiler/paths.js.map +1 -0
  114. package/dist/implementation/compiler/plugin.d.ts +18 -0
  115. package/dist/implementation/compiler/plugin.js +397 -0
  116. package/dist/implementation/compiler/plugin.js.map +1 -0
  117. package/dist/implementation/compiler/posix.d.ts +8 -0
  118. package/dist/implementation/compiler/posix.js +205 -0
  119. package/dist/implementation/compiler/posix.js.map +1 -0
  120. package/dist/implementation/compiler/predicates.d.ts +11 -0
  121. package/dist/implementation/compiler/predicates.js +281 -0
  122. package/dist/implementation/compiler/predicates.js.map +1 -0
  123. package/dist/implementation/compiler/print.d.ts +12 -0
  124. package/dist/implementation/compiler/print.js +116 -0
  125. package/dist/implementation/compiler/print.js.map +1 -0
  126. package/dist/implementation/compiler/program.d.ts +10 -0
  127. package/dist/implementation/compiler/program.js +258 -0
  128. package/dist/implementation/compiler/program.js.map +1 -0
  129. package/dist/implementation/compiler/public.d.ts +1 -0
  130. package/dist/implementation/compiler/public.js +3 -0
  131. package/dist/implementation/compiler/public.js.map +1 -0
  132. package/dist/implementation/compiler/scalar.d.ts +8 -0
  133. package/dist/implementation/compiler/scalar.js +47 -0
  134. package/dist/implementation/compiler/scalar.js.map +1 -0
  135. package/dist/implementation/compiler/scope.d.ts +24 -0
  136. package/dist/implementation/compiler/scope.js +4 -0
  137. package/dist/implementation/compiler/scope.js.map +1 -0
  138. package/dist/implementation/compiler/serialize.d.ts +2 -0
  139. package/dist/implementation/compiler/serialize.js +15 -0
  140. package/dist/implementation/compiler/serialize.js.map +1 -0
  141. package/dist/implementation/compiler/signature.d.ts +60 -0
  142. package/dist/implementation/compiler/signature.js +188 -0
  143. package/dist/implementation/compiler/signature.js.map +1 -0
  144. package/dist/implementation/compiler/snapshot.d.ts +23 -0
  145. package/dist/implementation/compiler/snapshot.js +18 -0
  146. package/dist/implementation/compiler/snapshot.js.map +1 -0
  147. package/dist/implementation/compiler/source-map.d.ts +34 -0
  148. package/dist/implementation/compiler/source-map.js +131 -0
  149. package/dist/implementation/compiler/source-map.js.map +1 -0
  150. package/dist/implementation/compiler/spawns.d.ts +41 -0
  151. package/dist/implementation/compiler/spawns.js +164 -0
  152. package/dist/implementation/compiler/spawns.js.map +1 -0
  153. package/dist/implementation/compiler/stamps.d.ts +13 -0
  154. package/dist/implementation/compiler/stamps.js +44 -0
  155. package/dist/implementation/compiler/stamps.js.map +1 -0
  156. package/dist/implementation/compiler/statement.d.ts +7 -0
  157. package/dist/implementation/compiler/statement.js +112 -0
  158. package/dist/implementation/compiler/statement.js.map +1 -0
  159. package/dist/implementation/compiler/terminal.d.ts +8 -0
  160. package/dist/implementation/compiler/terminal.js +51 -0
  161. package/dist/implementation/compiler/terminal.js.map +1 -0
  162. package/dist/implementation/compiler/transform.d.ts +81 -0
  163. package/dist/implementation/compiler/transform.js +483 -0
  164. package/dist/implementation/compiler/transform.js.map +1 -0
  165. package/dist/implementation/compiler/type-schemas.d.ts +130 -0
  166. package/dist/implementation/compiler/type-schemas.js +701 -0
  167. package/dist/implementation/compiler/type-schemas.js.map +1 -0
  168. package/dist/implementation/compiler/unit.d.ts +108 -0
  169. package/dist/implementation/compiler/unit.js +39 -0
  170. package/dist/implementation/compiler/unit.js.map +1 -0
  171. package/dist/implementation/compiler/value.d.ts +115 -0
  172. package/dist/implementation/compiler/value.js +9 -0
  173. package/dist/implementation/compiler/value.js.map +1 -0
  174. package/dist/implementation/compiler/wat.d.ts +12 -0
  175. package/dist/implementation/compiler/wat.js +379 -0
  176. package/dist/implementation/compiler/wat.js.map +1 -0
  177. package/dist/implementation/index.d.ts +2 -0
  178. package/dist/implementation/index.js +4 -0
  179. package/dist/implementation/index.js.map +1 -0
  180. package/dist/implementation/world/activate.d.ts +21 -0
  181. package/dist/implementation/world/activate.js +137 -0
  182. package/dist/implementation/world/activate.js.map +1 -0
  183. package/dist/implementation/world/archetype.d.ts +191 -0
  184. package/dist/implementation/world/archetype.js +402 -0
  185. package/dist/implementation/world/archetype.js.map +1 -0
  186. package/dist/implementation/world/arrays.d.ts +29 -0
  187. package/dist/implementation/world/arrays.js +34 -0
  188. package/dist/implementation/world/arrays.js.map +1 -0
  189. package/dist/implementation/world/arrivals.d.ts +52 -0
  190. package/dist/implementation/world/arrivals.js +146 -0
  191. package/dist/implementation/world/arrivals.js.map +1 -0
  192. package/dist/implementation/world/attach-kernel.d.ts +10 -0
  193. package/dist/implementation/world/attach-kernel.js +30 -0
  194. package/dist/implementation/world/attach-kernel.js.map +1 -0
  195. package/dist/implementation/world/batches.d.ts +18 -0
  196. package/dist/implementation/world/batches.js +208 -0
  197. package/dist/implementation/world/batches.js.map +1 -0
  198. package/dist/implementation/world/buffer.d.ts +60 -0
  199. package/dist/implementation/world/buffer.js +138 -0
  200. package/dist/implementation/world/buffer.js.map +1 -0
  201. package/dist/implementation/world/cascade.d.ts +28 -0
  202. package/dist/implementation/world/cascade.js +139 -0
  203. package/dist/implementation/world/cascade.js.map +1 -0
  204. package/dist/implementation/world/cells.d.ts +7 -0
  205. package/dist/implementation/world/cells.js +22 -0
  206. package/dist/implementation/world/cells.js.map +1 -0
  207. package/dist/implementation/world/check-kernel.d.ts +12 -0
  208. package/dist/implementation/world/check-kernel.js +119 -0
  209. package/dist/implementation/world/check-kernel.js.map +1 -0
  210. package/dist/implementation/world/claims.d.ts +13 -0
  211. package/dist/implementation/world/claims.js +51 -0
  212. package/dist/implementation/world/claims.js.map +1 -0
  213. package/dist/implementation/world/closure.d.ts +12 -0
  214. package/dist/implementation/world/closure.js +44 -0
  215. package/dist/implementation/world/closure.js.map +1 -0
  216. package/dist/implementation/world/command-ring.d.ts +97 -0
  217. package/dist/implementation/world/command-ring.js +439 -0
  218. package/dist/implementation/world/command-ring.js.map +1 -0
  219. package/dist/implementation/world/commands.d.ts +25 -0
  220. package/dist/implementation/world/commands.js +96 -0
  221. package/dist/implementation/world/commands.js.map +1 -0
  222. package/dist/implementation/world/create.d.ts +101 -0
  223. package/dist/implementation/world/create.js +1009 -0
  224. package/dist/implementation/world/create.js.map +1 -0
  225. package/dist/implementation/world/directories.d.ts +28 -0
  226. package/dist/implementation/world/directories.js +68 -0
  227. package/dist/implementation/world/directories.js.map +1 -0
  228. package/dist/implementation/world/entities.d.ts +77 -0
  229. package/dist/implementation/world/entities.js +137 -0
  230. package/dist/implementation/world/entities.js.map +1 -0
  231. package/dist/implementation/world/execute.d.ts +30 -0
  232. package/dist/implementation/world/execute.js +757 -0
  233. package/dist/implementation/world/execute.js.map +1 -0
  234. package/dist/implementation/world/failures.d.ts +53 -0
  235. package/dist/implementation/world/failures.js +37 -0
  236. package/dist/implementation/world/failures.js.map +1 -0
  237. package/dist/implementation/world/finalizers.d.ts +65 -0
  238. package/dist/implementation/world/finalizers.js +436 -0
  239. package/dist/implementation/world/finalizers.js.map +1 -0
  240. package/dist/implementation/world/gpu.d.ts +64 -0
  241. package/dist/implementation/world/gpu.js +326 -0
  242. package/dist/implementation/world/gpu.js.map +1 -0
  243. package/dist/implementation/world/holders.d.ts +21 -0
  244. package/dist/implementation/world/holders.js +66 -0
  245. package/dist/implementation/world/holders.js.map +1 -0
  246. package/dist/implementation/world/index-build.d.ts +88 -0
  247. package/dist/implementation/world/index-build.js +405 -0
  248. package/dist/implementation/world/index-build.js.map +1 -0
  249. package/dist/implementation/world/index-hash.d.ts +138 -0
  250. package/dist/implementation/world/index-hash.js +809 -0
  251. package/dist/implementation/world/index-hash.js.map +1 -0
  252. package/dist/implementation/world/index-keys.d.ts +75 -0
  253. package/dist/implementation/world/index-keys.js +252 -0
  254. package/dist/implementation/world/index-keys.js.map +1 -0
  255. package/dist/implementation/world/index-lookups.d.ts +76 -0
  256. package/dist/implementation/world/index-lookups.js +572 -0
  257. package/dist/implementation/world/index-lookups.js.map +1 -0
  258. package/dist/implementation/world/index-order.d.ts +21 -0
  259. package/dist/implementation/world/index-order.js +174 -0
  260. package/dist/implementation/world/index-order.js.map +1 -0
  261. package/dist/implementation/world/index-readers.d.ts +101 -0
  262. package/dist/implementation/world/index-readers.js +341 -0
  263. package/dist/implementation/world/index-readers.js.map +1 -0
  264. package/dist/implementation/world/index-sorted.d.ts +120 -0
  265. package/dist/implementation/world/index-sorted.js +637 -0
  266. package/dist/implementation/world/index-sorted.js.map +1 -0
  267. package/dist/implementation/world/indexes.d.ts +134 -0
  268. package/dist/implementation/world/indexes.js +1116 -0
  269. package/dist/implementation/world/indexes.js.map +1 -0
  270. package/dist/implementation/world/input.d.ts +3 -0
  271. package/dist/implementation/world/input.js +17 -0
  272. package/dist/implementation/world/input.js.map +1 -0
  273. package/dist/implementation/world/intrinsics.d.ts +5 -0
  274. package/dist/implementation/world/intrinsics.js +33 -0
  275. package/dist/implementation/world/intrinsics.js.map +1 -0
  276. package/dist/implementation/world/join.d.ts +26 -0
  277. package/dist/implementation/world/join.js +766 -0
  278. package/dist/implementation/world/join.js.map +1 -0
  279. package/dist/implementation/world/joined-observer.d.ts +208 -0
  280. package/dist/implementation/world/joined-observer.js +810 -0
  281. package/dist/implementation/world/joined-observer.js.map +1 -0
  282. package/dist/implementation/world/joining.d.ts +392 -0
  283. package/dist/implementation/world/joining.js +187 -0
  284. package/dist/implementation/world/joining.js.map +1 -0
  285. package/dist/implementation/world/journal.d.ts +22 -0
  286. package/dist/implementation/world/journal.js +25 -0
  287. package/dist/implementation/world/journal.js.map +1 -0
  288. package/dist/implementation/world/kernel-indexes.d.ts +37 -0
  289. package/dist/implementation/world/kernel-indexes.js +182 -0
  290. package/dist/implementation/world/kernel-indexes.js.map +1 -0
  291. package/dist/implementation/world/kernel.d.ts +392 -0
  292. package/dist/implementation/world/kernel.js +5 -0
  293. package/dist/implementation/world/kernel.js.map +1 -0
  294. package/dist/implementation/world/kernels.d.ts +88 -0
  295. package/dist/implementation/world/kernels.js +356 -0
  296. package/dist/implementation/world/kernels.js.map +1 -0
  297. package/dist/implementation/world/layout-directory.d.ts +123 -0
  298. package/dist/implementation/world/layout-directory.js +273 -0
  299. package/dist/implementation/world/layout-directory.js.map +1 -0
  300. package/dist/implementation/world/lists.d.ts +86 -0
  301. package/dist/implementation/world/lists.js +258 -0
  302. package/dist/implementation/world/lists.js.map +1 -0
  303. package/dist/implementation/world/lookup-keys.d.ts +20 -0
  304. package/dist/implementation/world/lookup-keys.js +48 -0
  305. package/dist/implementation/world/lookup-keys.js.map +1 -0
  306. package/dist/implementation/world/loop.d.ts +73 -0
  307. package/dist/implementation/world/loop.js +252 -0
  308. package/dist/implementation/world/loop.js.map +1 -0
  309. package/dist/implementation/world/memory.d.ts +40 -0
  310. package/dist/implementation/world/memory.js +65 -0
  311. package/dist/implementation/world/memory.js.map +1 -0
  312. package/dist/implementation/world/mirror.d.ts +125 -0
  313. package/dist/implementation/world/mirror.js +570 -0
  314. package/dist/implementation/world/mirror.js.map +1 -0
  315. package/dist/implementation/world/move-log.d.ts +107 -0
  316. package/dist/implementation/world/move-log.js +165 -0
  317. package/dist/implementation/world/move-log.js.map +1 -0
  318. package/dist/implementation/world/observer.d.ts +16 -0
  319. package/dist/implementation/world/observer.js +130 -0
  320. package/dist/implementation/world/observer.js.map +1 -0
  321. package/dist/implementation/world/order.d.ts +38 -0
  322. package/dist/implementation/world/order.js +324 -0
  323. package/dist/implementation/world/order.js.map +1 -0
  324. package/dist/implementation/world/out-of-band.d.ts +28 -0
  325. package/dist/implementation/world/out-of-band.js +66 -0
  326. package/dist/implementation/world/out-of-band.js.map +1 -0
  327. package/dist/implementation/world/plan.d.ts +50 -0
  328. package/dist/implementation/world/plan.js +20 -0
  329. package/dist/implementation/world/plan.js.map +1 -0
  330. package/dist/implementation/world/pool.d.ts +70 -0
  331. package/dist/implementation/world/pool.js +264 -0
  332. package/dist/implementation/world/pool.js.map +1 -0
  333. package/dist/implementation/world/port.d.ts +62 -0
  334. package/dist/implementation/world/port.js +109 -0
  335. package/dist/implementation/world/port.js.map +1 -0
  336. package/dist/implementation/world/prepared-lookup.d.ts +11 -0
  337. package/dist/implementation/world/prepared-lookup.js +99 -0
  338. package/dist/implementation/world/prepared-lookup.js.map +1 -0
  339. package/dist/implementation/world/prepared-spawn.d.ts +39 -0
  340. package/dist/implementation/world/prepared-spawn.js +119 -0
  341. package/dist/implementation/world/prepared-spawn.js.map +1 -0
  342. package/dist/implementation/world/program.d.ts +11 -0
  343. package/dist/implementation/world/program.js +12 -0
  344. package/dist/implementation/world/program.js.map +1 -0
  345. package/dist/implementation/world/protocol.d.ts +192 -0
  346. package/dist/implementation/world/protocol.js +41 -0
  347. package/dist/implementation/world/protocol.js.map +1 -0
  348. package/dist/implementation/world/publish.d.ts +9 -0
  349. package/dist/implementation/world/publish.js +28 -0
  350. package/dist/implementation/world/publish.js.map +1 -0
  351. package/dist/implementation/world/ranges.d.ts +21 -0
  352. package/dist/implementation/world/ranges.js +130 -0
  353. package/dist/implementation/world/ranges.js.map +1 -0
  354. package/dist/implementation/world/reclaim.d.ts +27 -0
  355. package/dist/implementation/world/reclaim.js +176 -0
  356. package/dist/implementation/world/reclaim.js.map +1 -0
  357. package/dist/implementation/world/reductions.d.ts +33 -0
  358. package/dist/implementation/world/reductions.js +92 -0
  359. package/dist/implementation/world/reductions.js.map +1 -0
  360. package/dist/implementation/world/register.d.ts +64 -0
  361. package/dist/implementation/world/register.js +368 -0
  362. package/dist/implementation/world/register.js.map +1 -0
  363. package/dist/implementation/world/remote-systems.d.ts +144 -0
  364. package/dist/implementation/world/remote-systems.js +556 -0
  365. package/dist/implementation/world/remote-systems.js.map +1 -0
  366. package/dist/implementation/world/remote.d.ts +25 -0
  367. package/dist/implementation/world/remote.js +138 -0
  368. package/dist/implementation/world/remote.js.map +1 -0
  369. package/dist/implementation/world/render-order.d.ts +19 -0
  370. package/dist/implementation/world/render-order.js +126 -0
  371. package/dist/implementation/world/render-order.js.map +1 -0
  372. package/dist/implementation/world/required.d.ts +3 -0
  373. package/dist/implementation/world/required.js +9 -0
  374. package/dist/implementation/world/required.js.map +1 -0
  375. package/dist/implementation/world/resources.d.ts +23 -0
  376. package/dist/implementation/world/resources.js +66 -0
  377. package/dist/implementation/world/resources.js.map +1 -0
  378. package/dist/implementation/world/rows.d.ts +111 -0
  379. package/dist/implementation/world/rows.js +549 -0
  380. package/dist/implementation/world/rows.js.map +1 -0
  381. package/dist/implementation/world/runner.d.ts +133 -0
  382. package/dist/implementation/world/runner.js +1334 -0
  383. package/dist/implementation/world/runner.js.map +1 -0
  384. package/dist/implementation/world/shared.d.ts +55 -0
  385. package/dist/implementation/world/shared.js +301 -0
  386. package/dist/implementation/world/shared.js.map +1 -0
  387. package/dist/implementation/world/sharing.d.ts +48 -0
  388. package/dist/implementation/world/sharing.js +611 -0
  389. package/dist/implementation/world/sharing.js.map +1 -0
  390. package/dist/implementation/world/staging.d.ts +83 -0
  391. package/dist/implementation/world/staging.js +195 -0
  392. package/dist/implementation/world/staging.js.map +1 -0
  393. package/dist/implementation/world/state.d.ts +320 -0
  394. package/dist/implementation/world/state.js +459 -0
  395. package/dist/implementation/world/state.js.map +1 -0
  396. package/dist/implementation/world/stop-lists.d.ts +137 -0
  397. package/dist/implementation/world/stop-lists.js +305 -0
  398. package/dist/implementation/world/stop-lists.js.map +1 -0
  399. package/dist/implementation/world/strings.d.ts +48 -0
  400. package/dist/implementation/world/strings.js +214 -0
  401. package/dist/implementation/world/strings.js.map +1 -0
  402. package/dist/implementation/world/structure.d.ts +39 -0
  403. package/dist/implementation/world/structure.js +42 -0
  404. package/dist/implementation/world/structure.js.map +1 -0
  405. package/dist/implementation/world/synchronize.d.ts +32 -0
  406. package/dist/implementation/world/synchronize.js +910 -0
  407. package/dist/implementation/world/synchronize.js.map +1 -0
  408. package/dist/implementation/world/tail-blocks.d.ts +43 -0
  409. package/dist/implementation/world/tail-blocks.js +59 -0
  410. package/dist/implementation/world/tail-blocks.js.map +1 -0
  411. package/dist/implementation/world/tails.d.ts +119 -0
  412. package/dist/implementation/world/tails.js +448 -0
  413. package/dist/implementation/world/tails.js.map +1 -0
  414. package/dist/implementation/world/terminal.d.ts +7 -0
  415. package/dist/implementation/world/terminal.js +13 -0
  416. package/dist/implementation/world/terminal.js.map +1 -0
  417. package/dist/implementation/world/thread-directory.d.ts +72 -0
  418. package/dist/implementation/world/thread-directory.js +243 -0
  419. package/dist/implementation/world/thread-directory.js.map +1 -0
  420. package/dist/implementation/world/thread-finalizers.d.ts +51 -0
  421. package/dist/implementation/world/thread-finalizers.js +376 -0
  422. package/dist/implementation/world/thread-finalizers.js.map +1 -0
  423. package/dist/implementation/world/thread-indexes.d.ts +28 -0
  424. package/dist/implementation/world/thread-indexes.js +72 -0
  425. package/dist/implementation/world/thread-indexes.js.map +1 -0
  426. package/dist/implementation/world/thread-observer.d.ts +43 -0
  427. package/dist/implementation/world/thread-observer.js +223 -0
  428. package/dist/implementation/world/thread-observer.js.map +1 -0
  429. package/dist/implementation/world/thread-systems.d.ts +121 -0
  430. package/dist/implementation/world/thread-systems.js +1487 -0
  431. package/dist/implementation/world/thread-systems.js.map +1 -0
  432. package/dist/implementation/world/thread-tasks.d.ts +65 -0
  433. package/dist/implementation/world/thread-tasks.js +74 -0
  434. package/dist/implementation/world/thread-tasks.js.map +1 -0
  435. package/dist/implementation/world/transfers.d.ts +30 -0
  436. package/dist/implementation/world/transfers.js +101 -0
  437. package/dist/implementation/world/transfers.js.map +1 -0
  438. package/dist/implementation/world/up.d.ts +35 -0
  439. package/dist/implementation/world/up.js +939 -0
  440. package/dist/implementation/world/up.js.map +1 -0
  441. package/dist/implementation/world/wasm.d.ts +143 -0
  442. package/dist/implementation/world/wasm.js +2460 -0
  443. package/dist/implementation/world/wasm.js.map +1 -0
  444. package/dist/implementation/world/wgsl.d.ts +22 -0
  445. package/dist/implementation/world/wgsl.js +497 -0
  446. package/dist/implementation/world/wgsl.js.map +1 -0
  447. package/dist/implementation/world/where.d.ts +74 -0
  448. package/dist/implementation/world/where.js +202 -0
  449. package/dist/implementation/world/where.js.map +1 -0
  450. package/dist/implementation/world/worker-platform.d.ts +37 -0
  451. package/dist/implementation/world/worker-platform.js +80 -0
  452. package/dist/implementation/world/worker-platform.js.map +1 -0
  453. package/dist/implementation/world/worker-window.d.ts +7 -0
  454. package/dist/implementation/world/worker-window.js +47 -0
  455. package/dist/implementation/world/worker-window.js.map +1 -0
  456. package/dist/implementation/world/worker.d.ts +1 -0
  457. package/dist/implementation/world/worker.js +496 -0
  458. package/dist/implementation/world/worker.js.map +1 -0
  459. package/dist/index.d.ts +15 -0
  460. package/dist/index.js +14 -0
  461. package/dist/index.js.map +1 -0
  462. package/dist/interface/component/component.d.ts +2 -0
  463. package/dist/interface/component/component.js +3 -0
  464. package/dist/interface/component/component.js.map +1 -0
  465. package/dist/interface/component/index.d.ts +2 -0
  466. package/dist/interface/component/index.js +2 -0
  467. package/dist/interface/component/index.js.map +1 -0
  468. package/dist/interface/component/key.d.ts +2 -0
  469. package/dist/interface/component/key.js +2 -0
  470. package/dist/interface/component/key.js.map +1 -0
  471. package/dist/interface/component/types.d.ts +6 -0
  472. package/dist/interface/component/types.js +2 -0
  473. package/dist/interface/component/types.js.map +1 -0
  474. package/dist/interface/component/value.d.ts +39 -0
  475. package/dist/interface/component/value.js +2 -0
  476. package/dist/interface/component/value.js.map +1 -0
  477. package/dist/interface/component/values.d.ts +6 -0
  478. package/dist/interface/component/values.js +2 -0
  479. package/dist/interface/component/values.js.map +1 -0
  480. package/dist/interface/entity/entity.d.ts +9 -0
  481. package/dist/interface/entity/entity.js +2 -0
  482. package/dist/interface/entity/entity.js.map +1 -0
  483. package/dist/interface/entity/index.d.ts +10 -0
  484. package/dist/interface/entity/index.js +7 -0
  485. package/dist/interface/entity/index.js.map +1 -0
  486. package/dist/interface/finalizer/body.d.ts +53 -0
  487. package/dist/interface/finalizer/body.js +2 -0
  488. package/dist/interface/finalizer/body.js.map +1 -0
  489. package/dist/interface/finalizer/create.d.ts +43 -0
  490. package/dist/interface/finalizer/create.js +130 -0
  491. package/dist/interface/finalizer/create.js.map +1 -0
  492. package/dist/interface/finalizer/created.d.ts +16 -0
  493. package/dist/interface/finalizer/created.js +2 -0
  494. package/dist/interface/finalizer/created.js.map +1 -0
  495. package/dist/interface/finalizer/declaration.d.ts +58 -0
  496. package/dist/interface/finalizer/declaration.js +2 -0
  497. package/dist/interface/finalizer/declaration.js.map +1 -0
  498. package/dist/interface/finalizer/finalizer.d.ts +8 -0
  499. package/dist/interface/finalizer/finalizer.js +2 -0
  500. package/dist/interface/finalizer/finalizer.js.map +1 -0
  501. package/dist/interface/finalizer/index.d.ts +1 -0
  502. package/dist/interface/finalizer/index.js +3 -0
  503. package/dist/interface/finalizer/index.js.map +1 -0
  504. package/dist/interface/gpu/accessors.d.ts +15 -0
  505. package/dist/interface/gpu/accessors.js +87 -0
  506. package/dist/interface/gpu/accessors.js.map +1 -0
  507. package/dist/interface/gpu/gpu.d.ts +3 -0
  508. package/dist/interface/gpu/gpu.js +2 -0
  509. package/dist/interface/gpu/gpu.js.map +1 -0
  510. package/dist/interface/gpu/index.d.ts +2 -0
  511. package/dist/interface/gpu/index.js +4 -0
  512. package/dist/interface/gpu/index.js.map +1 -0
  513. package/dist/interface/gpu/layout.d.ts +5 -0
  514. package/dist/interface/gpu/layout.js +22 -0
  515. package/dist/interface/gpu/layout.js.map +1 -0
  516. package/dist/interface/gpu/record.d.ts +5 -0
  517. package/dist/interface/gpu/record.js +7 -0
  518. package/dist/interface/gpu/record.js.map +1 -0
  519. package/dist/interface/gpu/wgsl.d.ts +9 -0
  520. package/dist/interface/gpu/wgsl.js +24 -0
  521. package/dist/interface/gpu/wgsl.js.map +1 -0
  522. package/dist/interface/index.d.ts +16 -0
  523. package/dist/interface/index.js +12 -0
  524. package/dist/interface/index.js.map +1 -0
  525. package/dist/interface/indexes/create.d.ts +39 -0
  526. package/dist/interface/indexes/create.js +82 -0
  527. package/dist/interface/indexes/create.js.map +1 -0
  528. package/dist/interface/indexes/created.d.ts +7 -0
  529. package/dist/interface/indexes/created.js +2 -0
  530. package/dist/interface/indexes/created.js.map +1 -0
  531. package/dist/interface/indexes/declaration.d.ts +18 -0
  532. package/dist/interface/indexes/declaration.js +2 -0
  533. package/dist/interface/indexes/declaration.js.map +1 -0
  534. package/dist/interface/indexes/index-type.d.ts +12 -0
  535. package/dist/interface/indexes/index-type.js +2 -0
  536. package/dist/interface/indexes/index-type.js.map +1 -0
  537. package/dist/interface/indexes/index.d.ts +1 -0
  538. package/dist/interface/indexes/index.js +3 -0
  539. package/dist/interface/indexes/index.js.map +1 -0
  540. package/dist/interface/math/f32/default.d.ts +4 -0
  541. package/dist/interface/math/f32/default.js +4 -0
  542. package/dist/interface/math/f32/default.js.map +1 -0
  543. package/dist/interface/math/f32/index.d.ts +4 -0
  544. package/dist/interface/math/f32/index.js +2 -0
  545. package/dist/interface/math/f32/index.js.map +1 -0
  546. package/dist/interface/math/f32/public.d.ts +2 -0
  547. package/dist/interface/math/f32/public.js +4 -0
  548. package/dist/interface/math/f32/public.js.map +1 -0
  549. package/dist/interface/math/f32/round-half-even.d.ts +2 -0
  550. package/dist/interface/math/f32/round-half-even.js +7 -0
  551. package/dist/interface/math/f32/round-half-even.js.map +1 -0
  552. package/dist/interface/math/f32/schema.d.ts +4 -0
  553. package/dist/interface/math/f32/schema.js +2 -0
  554. package/dist/interface/math/f32/schema.js.map +1 -0
  555. package/dist/interface/math/i32/default.d.ts +4 -0
  556. package/dist/interface/math/i32/default.js +4 -0
  557. package/dist/interface/math/i32/default.js.map +1 -0
  558. package/dist/interface/math/i32/index.d.ts +5 -0
  559. package/dist/interface/math/i32/index.js +2 -0
  560. package/dist/interface/math/i32/index.js.map +1 -0
  561. package/dist/interface/math/i32/public.d.ts +3 -0
  562. package/dist/interface/math/i32/public.js +5 -0
  563. package/dist/interface/math/i32/public.js.map +1 -0
  564. package/dist/interface/math/i32/schema.d.ts +5 -0
  565. package/dist/interface/math/i32/schema.js +2 -0
  566. package/dist/interface/math/i32/schema.js.map +1 -0
  567. package/dist/interface/math/i32/shift-right.d.ts +2 -0
  568. package/dist/interface/math/i32/shift-right.js +2 -0
  569. package/dist/interface/math/i32/shift-right.js.map +1 -0
  570. package/dist/interface/math/index.d.ts +8 -0
  571. package/dist/interface/math/index.js +10 -0
  572. package/dist/interface/math/index.js.map +1 -0
  573. package/dist/interface/math/intrinsic.d.ts +13 -0
  574. package/dist/interface/math/intrinsic.js +10 -0
  575. package/dist/interface/math/intrinsic.js.map +1 -0
  576. package/dist/interface/math/mat4x4/add.d.ts +2 -0
  577. package/dist/interface/math/mat4x4/add.js +8 -0
  578. package/dist/interface/math/mat4x4/add.js.map +1 -0
  579. package/dist/interface/math/mat4x4/determinant.d.ts +2 -0
  580. package/dist/interface/math/mat4x4/determinant.js +18 -0
  581. package/dist/interface/math/mat4x4/determinant.js.map +1 -0
  582. package/dist/interface/math/mat4x4/identity.d.ts +2 -0
  583. package/dist/interface/math/mat4x4/identity.js +7 -0
  584. package/dist/interface/math/mat4x4/identity.js.map +1 -0
  585. package/dist/interface/math/mat4x4/index.d.ts +26 -0
  586. package/dist/interface/math/mat4x4/index.js +24 -0
  587. package/dist/interface/math/mat4x4/index.js.map +1 -0
  588. package/dist/interface/math/mat4x4/inverse.d.ts +2 -0
  589. package/dist/interface/math/mat4x4/inverse.js +40 -0
  590. package/dist/interface/math/mat4x4/inverse.js.map +1 -0
  591. package/dist/interface/math/mat4x4/look-at.d.ts +3 -0
  592. package/dist/interface/math/mat4x4/look-at.js +22 -0
  593. package/dist/interface/math/mat4x4/look-at.js.map +1 -0
  594. package/dist/interface/math/mat4x4/multiply-vec3.d.ts +3 -0
  595. package/dist/interface/math/mat4x4/multiply-vec3.js +6 -0
  596. package/dist/interface/math/mat4x4/multiply-vec3.js.map +1 -0
  597. package/dist/interface/math/mat4x4/multiply-vec4.d.ts +3 -0
  598. package/dist/interface/math/mat4x4/multiply-vec4.js +8 -0
  599. package/dist/interface/math/mat4x4/multiply-vec4.js.map +1 -0
  600. package/dist/interface/math/mat4x4/multiply.d.ts +3 -0
  601. package/dist/interface/math/mat4x4/multiply.js +21 -0
  602. package/dist/interface/math/mat4x4/multiply.js.map +1 -0
  603. package/dist/interface/math/mat4x4/orthographic.d.ts +2 -0
  604. package/dist/interface/math/mat4x4/orthographic.js +12 -0
  605. package/dist/interface/math/mat4x4/orthographic.js.map +1 -0
  606. package/dist/interface/math/mat4x4/perspective.d.ts +2 -0
  607. package/dist/interface/math/mat4x4/perspective.js +22 -0
  608. package/dist/interface/math/mat4x4/perspective.js.map +1 -0
  609. package/dist/interface/math/mat4x4/public.d.ts +21 -0
  610. package/dist/interface/math/mat4x4/public.js +23 -0
  611. package/dist/interface/math/mat4x4/public.js.map +1 -0
  612. package/dist/interface/math/mat4x4/rotation-x.d.ts +2 -0
  613. package/dist/interface/math/mat4x4/rotation-x.js +11 -0
  614. package/dist/interface/math/mat4x4/rotation-x.js.map +1 -0
  615. package/dist/interface/math/mat4x4/rotation-y.d.ts +2 -0
  616. package/dist/interface/math/mat4x4/rotation-y.js +11 -0
  617. package/dist/interface/math/mat4x4/rotation-y.js.map +1 -0
  618. package/dist/interface/math/mat4x4/rotation-z.d.ts +2 -0
  619. package/dist/interface/math/mat4x4/rotation-z.js +11 -0
  620. package/dist/interface/math/mat4x4/rotation-z.js.map +1 -0
  621. package/dist/interface/math/mat4x4/scale.d.ts +2 -0
  622. package/dist/interface/math/mat4x4/scale.js +8 -0
  623. package/dist/interface/math/mat4x4/scale.js.map +1 -0
  624. package/dist/interface/math/mat4x4/scaling.d.ts +2 -0
  625. package/dist/interface/math/mat4x4/scaling.js +7 -0
  626. package/dist/interface/math/mat4x4/scaling.js.map +1 -0
  627. package/dist/interface/math/mat4x4/schema.d.ts +9 -0
  628. package/dist/interface/math/mat4x4/schema.js +3 -0
  629. package/dist/interface/math/mat4x4/schema.js.map +1 -0
  630. package/dist/interface/math/mat4x4/subtract.d.ts +2 -0
  631. package/dist/interface/math/mat4x4/subtract.js +8 -0
  632. package/dist/interface/math/mat4x4/subtract.js.map +1 -0
  633. package/dist/interface/math/mat4x4/translation.d.ts +2 -0
  634. package/dist/interface/math/mat4x4/translation.js +7 -0
  635. package/dist/interface/math/mat4x4/translation.js.map +1 -0
  636. package/dist/interface/math/mat4x4/transpose.d.ts +2 -0
  637. package/dist/interface/math/mat4x4/transpose.js +8 -0
  638. package/dist/interface/math/mat4x4/transpose.js.map +1 -0
  639. package/dist/interface/math/mat4x4/zero.d.ts +2 -0
  640. package/dist/interface/math/mat4x4/zero.js +7 -0
  641. package/dist/interface/math/mat4x4/zero.js.map +1 -0
  642. package/dist/interface/math/quat/add.d.ts +2 -0
  643. package/dist/interface/math/quat/add.js +8 -0
  644. package/dist/interface/math/quat/add.js.map +1 -0
  645. package/dist/interface/math/quat/align-to.d.ts +12 -0
  646. package/dist/interface/math/quat/align-to.js +42 -0
  647. package/dist/interface/math/quat/align-to.js.map +1 -0
  648. package/dist/interface/math/quat/conjugate.d.ts +2 -0
  649. package/dist/interface/math/quat/conjugate.js +2 -0
  650. package/dist/interface/math/quat/conjugate.js.map +1 -0
  651. package/dist/interface/math/quat/distance.d.ts +2 -0
  652. package/dist/interface/math/quat/distance.js +4 -0
  653. package/dist/interface/math/quat/distance.js.map +1 -0
  654. package/dist/interface/math/quat/dot.d.ts +2 -0
  655. package/dist/interface/math/quat/dot.js +3 -0
  656. package/dist/interface/math/quat/dot.js.map +1 -0
  657. package/dist/interface/math/quat/from-axis-angle.d.ts +3 -0
  658. package/dist/interface/math/quat/from-axis-angle.js +13 -0
  659. package/dist/interface/math/quat/from-axis-angle.js.map +1 -0
  660. package/dist/interface/math/quat/from-euler.d.ts +2 -0
  661. package/dist/interface/math/quat/from-euler.js +15 -0
  662. package/dist/interface/math/quat/from-euler.js.map +1 -0
  663. package/dist/interface/math/quat/identity.d.ts +2 -0
  664. package/dist/interface/math/quat/identity.js +2 -0
  665. package/dist/interface/math/quat/identity.js.map +1 -0
  666. package/dist/interface/math/quat/index.d.ts +4 -0
  667. package/dist/interface/math/quat/index.js +2 -0
  668. package/dist/interface/math/quat/index.js.map +1 -0
  669. package/dist/interface/math/quat/inverse.d.ts +2 -0
  670. package/dist/interface/math/quat/inverse.js +10 -0
  671. package/dist/interface/math/quat/inverse.js.map +1 -0
  672. package/dist/interface/math/quat/length-squared.d.ts +2 -0
  673. package/dist/interface/math/quat/length-squared.js +2 -0
  674. package/dist/interface/math/quat/length-squared.js.map +1 -0
  675. package/dist/interface/math/quat/length.d.ts +2 -0
  676. package/dist/interface/math/quat/length.js +3 -0
  677. package/dist/interface/math/quat/length.js.map +1 -0
  678. package/dist/interface/math/quat/lerp.d.ts +2 -0
  679. package/dist/interface/math/quat/lerp.js +7 -0
  680. package/dist/interface/math/quat/lerp.js.map +1 -0
  681. package/dist/interface/math/quat/look-at.d.ts +3 -0
  682. package/dist/interface/math/quat/look-at.js +49 -0
  683. package/dist/interface/math/quat/look-at.js.map +1 -0
  684. package/dist/interface/math/quat/multiply.d.ts +2 -0
  685. package/dist/interface/math/quat/multiply.js +7 -0
  686. package/dist/interface/math/quat/multiply.js.map +1 -0
  687. package/dist/interface/math/quat/negate.d.ts +2 -0
  688. package/dist/interface/math/quat/negate.js +3 -0
  689. package/dist/interface/math/quat/negate.js.map +1 -0
  690. package/dist/interface/math/quat/normalize.d.ts +2 -0
  691. package/dist/interface/math/quat/normalize.js +7 -0
  692. package/dist/interface/math/quat/normalize.js.map +1 -0
  693. package/dist/interface/math/quat/public.d.ts +25 -0
  694. package/dist/interface/math/quat/public.js +27 -0
  695. package/dist/interface/math/quat/public.js.map +1 -0
  696. package/dist/interface/math/quat/rotate-vec3.d.ts +3 -0
  697. package/dist/interface/math/quat/rotate-vec3.js +14 -0
  698. package/dist/interface/math/quat/rotate-vec3.js.map +1 -0
  699. package/dist/interface/math/quat/scale.d.ts +2 -0
  700. package/dist/interface/math/quat/scale.js +3 -0
  701. package/dist/interface/math/quat/scale.js.map +1 -0
  702. package/dist/interface/math/quat/schema.d.ts +9 -0
  703. package/dist/interface/math/quat/schema.js +3 -0
  704. package/dist/interface/math/quat/schema.js.map +1 -0
  705. package/dist/interface/math/quat/slerp.d.ts +2 -0
  706. package/dist/interface/math/quat/slerp.js +21 -0
  707. package/dist/interface/math/quat/slerp.js.map +1 -0
  708. package/dist/interface/math/quat/subtract.d.ts +2 -0
  709. package/dist/interface/math/quat/subtract.js +8 -0
  710. package/dist/interface/math/quat/subtract.js.map +1 -0
  711. package/dist/interface/math/quat/to-axis-angle.d.ts +6 -0
  712. package/dist/interface/math/quat/to-axis-angle.js +12 -0
  713. package/dist/interface/math/quat/to-axis-angle.js.map +1 -0
  714. package/dist/interface/math/quat/to-euler.d.ts +3 -0
  715. package/dist/interface/math/quat/to-euler.js +21 -0
  716. package/dist/interface/math/quat/to-euler.js.map +1 -0
  717. package/dist/interface/math/quat/to-mat4.d.ts +8 -0
  718. package/dist/interface/math/quat/to-mat4.js +24 -0
  719. package/dist/interface/math/quat/to-mat4.js.map +1 -0
  720. package/dist/interface/math/u32/count-leading-zeros.d.ts +2 -0
  721. package/dist/interface/math/u32/count-leading-zeros.js +3 -0
  722. package/dist/interface/math/u32/count-leading-zeros.js.map +1 -0
  723. package/dist/interface/math/u32/count-one-bits.d.ts +2 -0
  724. package/dist/interface/math/u32/count-one-bits.js +9 -0
  725. package/dist/interface/math/u32/count-one-bits.js.map +1 -0
  726. package/dist/interface/math/u32/count-trailing-zeros.d.ts +2 -0
  727. package/dist/interface/math/u32/count-trailing-zeros.js +6 -0
  728. package/dist/interface/math/u32/count-trailing-zeros.js.map +1 -0
  729. package/dist/interface/math/u32/default.d.ts +4 -0
  730. package/dist/interface/math/u32/default.js +4 -0
  731. package/dist/interface/math/u32/default.js.map +1 -0
  732. package/dist/interface/math/u32/index.d.ts +5 -0
  733. package/dist/interface/math/u32/index.js +2 -0
  734. package/dist/interface/math/u32/index.js.map +1 -0
  735. package/dist/interface/math/u32/public.d.ts +7 -0
  736. package/dist/interface/math/u32/public.js +9 -0
  737. package/dist/interface/math/u32/public.js.map +1 -0
  738. package/dist/interface/math/u32/reverse-bits.d.ts +2 -0
  739. package/dist/interface/math/u32/reverse-bits.js +10 -0
  740. package/dist/interface/math/u32/reverse-bits.js.map +1 -0
  741. package/dist/interface/math/u32/schema.d.ts +5 -0
  742. package/dist/interface/math/u32/schema.js +2 -0
  743. package/dist/interface/math/u32/schema.js.map +1 -0
  744. package/dist/interface/math/u32/shift-right.d.ts +2 -0
  745. package/dist/interface/math/u32/shift-right.js +2 -0
  746. package/dist/interface/math/u32/shift-right.js.map +1 -0
  747. package/dist/interface/math/vec2/f32/abs.d.ts +2 -0
  748. package/dist/interface/math/vec2/f32/abs.js +3 -0
  749. package/dist/interface/math/vec2/f32/abs.js.map +1 -0
  750. package/dist/interface/math/vec2/f32/acos.d.ts +2 -0
  751. package/dist/interface/math/vec2/f32/acos.js +3 -0
  752. package/dist/interface/math/vec2/f32/acos.js.map +1 -0
  753. package/dist/interface/math/vec2/f32/acosh.d.ts +2 -0
  754. package/dist/interface/math/vec2/f32/acosh.js +3 -0
  755. package/dist/interface/math/vec2/f32/acosh.js.map +1 -0
  756. package/dist/interface/math/vec2/f32/add.d.ts +2 -0
  757. package/dist/interface/math/vec2/f32/add.js +3 -0
  758. package/dist/interface/math/vec2/f32/add.js.map +1 -0
  759. package/dist/interface/math/vec2/f32/asin.d.ts +2 -0
  760. package/dist/interface/math/vec2/f32/asin.js +3 -0
  761. package/dist/interface/math/vec2/f32/asin.js.map +1 -0
  762. package/dist/interface/math/vec2/f32/asinh.d.ts +2 -0
  763. package/dist/interface/math/vec2/f32/asinh.js +3 -0
  764. package/dist/interface/math/vec2/f32/asinh.js.map +1 -0
  765. package/dist/interface/math/vec2/f32/atan.d.ts +2 -0
  766. package/dist/interface/math/vec2/f32/atan.js +3 -0
  767. package/dist/interface/math/vec2/f32/atan.js.map +1 -0
  768. package/dist/interface/math/vec2/f32/atanh.d.ts +2 -0
  769. package/dist/interface/math/vec2/f32/atanh.js +3 -0
  770. package/dist/interface/math/vec2/f32/atanh.js.map +1 -0
  771. package/dist/interface/math/vec2/f32/ceil.d.ts +2 -0
  772. package/dist/interface/math/vec2/f32/ceil.js +3 -0
  773. package/dist/interface/math/vec2/f32/ceil.js.map +1 -0
  774. package/dist/interface/math/vec2/f32/clamp.d.ts +2 -0
  775. package/dist/interface/math/vec2/f32/clamp.js +5 -0
  776. package/dist/interface/math/vec2/f32/clamp.js.map +1 -0
  777. package/dist/interface/math/vec2/f32/cos.d.ts +2 -0
  778. package/dist/interface/math/vec2/f32/cos.js +3 -0
  779. package/dist/interface/math/vec2/f32/cos.js.map +1 -0
  780. package/dist/interface/math/vec2/f32/cosh.d.ts +2 -0
  781. package/dist/interface/math/vec2/f32/cosh.js +3 -0
  782. package/dist/interface/math/vec2/f32/cosh.js.map +1 -0
  783. package/dist/interface/math/vec2/f32/distance.d.ts +2 -0
  784. package/dist/interface/math/vec2/f32/distance.js +5 -0
  785. package/dist/interface/math/vec2/f32/distance.js.map +1 -0
  786. package/dist/interface/math/vec2/f32/dot.d.ts +2 -0
  787. package/dist/interface/math/vec2/f32/dot.js +3 -0
  788. package/dist/interface/math/vec2/f32/dot.js.map +1 -0
  789. package/dist/interface/math/vec2/f32/equals.d.ts +2 -0
  790. package/dist/interface/math/vec2/f32/equals.js +2 -0
  791. package/dist/interface/math/vec2/f32/equals.js.map +1 -0
  792. package/dist/interface/math/vec2/f32/exp.d.ts +2 -0
  793. package/dist/interface/math/vec2/f32/exp.js +3 -0
  794. package/dist/interface/math/vec2/f32/exp.js.map +1 -0
  795. package/dist/interface/math/vec2/f32/exp2.d.ts +2 -0
  796. package/dist/interface/math/vec2/f32/exp2.js +3 -0
  797. package/dist/interface/math/vec2/f32/exp2.js.map +1 -0
  798. package/dist/interface/math/vec2/f32/f32.d.ts +4 -0
  799. package/dist/interface/math/vec2/f32/f32.js +2 -0
  800. package/dist/interface/math/vec2/f32/f32.js.map +1 -0
  801. package/dist/interface/math/vec2/f32/faceforward.d.ts +2 -0
  802. package/dist/interface/math/vec2/f32/faceforward.js +5 -0
  803. package/dist/interface/math/vec2/f32/faceforward.js.map +1 -0
  804. package/dist/interface/math/vec2/f32/floor.d.ts +2 -0
  805. package/dist/interface/math/vec2/f32/floor.js +3 -0
  806. package/dist/interface/math/vec2/f32/floor.js.map +1 -0
  807. package/dist/interface/math/vec2/f32/fract.d.ts +2 -0
  808. package/dist/interface/math/vec2/f32/fract.js +3 -0
  809. package/dist/interface/math/vec2/f32/fract.js.map +1 -0
  810. package/dist/interface/math/vec2/f32/length.d.ts +2 -0
  811. package/dist/interface/math/vec2/f32/length.js +3 -0
  812. package/dist/interface/math/vec2/f32/length.js.map +1 -0
  813. package/dist/interface/math/vec2/f32/log.d.ts +2 -0
  814. package/dist/interface/math/vec2/f32/log.js +3 -0
  815. package/dist/interface/math/vec2/f32/log.js.map +1 -0
  816. package/dist/interface/math/vec2/f32/log2.d.ts +2 -0
  817. package/dist/interface/math/vec2/f32/log2.js +3 -0
  818. package/dist/interface/math/vec2/f32/log2.js.map +1 -0
  819. package/dist/interface/math/vec2/f32/max.d.ts +2 -0
  820. package/dist/interface/math/vec2/f32/max.js +3 -0
  821. package/dist/interface/math/vec2/f32/max.js.map +1 -0
  822. package/dist/interface/math/vec2/f32/min.d.ts +2 -0
  823. package/dist/interface/math/vec2/f32/min.js +3 -0
  824. package/dist/interface/math/vec2/f32/min.js.map +1 -0
  825. package/dist/interface/math/vec2/f32/mix.d.ts +2 -0
  826. package/dist/interface/math/vec2/f32/mix.js +6 -0
  827. package/dist/interface/math/vec2/f32/mix.js.map +1 -0
  828. package/dist/interface/math/vec2/f32/mod.d.ts +2 -0
  829. package/dist/interface/math/vec2/f32/mod.js +2 -0
  830. package/dist/interface/math/vec2/f32/mod.js.map +1 -0
  831. package/dist/interface/math/vec2/f32/modf.d.ts +5 -0
  832. package/dist/interface/math/vec2/f32/modf.js +5 -0
  833. package/dist/interface/math/vec2/f32/modf.js.map +1 -0
  834. package/dist/interface/math/vec2/f32/negate.d.ts +2 -0
  835. package/dist/interface/math/vec2/f32/negate.js +3 -0
  836. package/dist/interface/math/vec2/f32/negate.js.map +1 -0
  837. package/dist/interface/math/vec2/f32/normalize.d.ts +2 -0
  838. package/dist/interface/math/vec2/f32/normalize.js +5 -0
  839. package/dist/interface/math/vec2/f32/normalize.js.map +1 -0
  840. package/dist/interface/math/vec2/f32/pow.d.ts +3 -0
  841. package/dist/interface/math/vec2/f32/pow.js +7 -0
  842. package/dist/interface/math/vec2/f32/pow.js.map +1 -0
  843. package/dist/interface/math/vec2/f32/public.d.ts +48 -0
  844. package/dist/interface/math/vec2/f32/public.js +50 -0
  845. package/dist/interface/math/vec2/f32/public.js.map +1 -0
  846. package/dist/interface/math/vec2/f32/reflect.d.ts +2 -0
  847. package/dist/interface/math/vec2/f32/reflect.js +9 -0
  848. package/dist/interface/math/vec2/f32/reflect.js.map +1 -0
  849. package/dist/interface/math/vec2/f32/refract.d.ts +2 -0
  850. package/dist/interface/math/vec2/f32/refract.js +14 -0
  851. package/dist/interface/math/vec2/f32/refract.js.map +1 -0
  852. package/dist/interface/math/vec2/f32/round.d.ts +2 -0
  853. package/dist/interface/math/vec2/f32/round.js +4 -0
  854. package/dist/interface/math/vec2/f32/round.js.map +1 -0
  855. package/dist/interface/math/vec2/f32/scale.d.ts +2 -0
  856. package/dist/interface/math/vec2/f32/scale.js +3 -0
  857. package/dist/interface/math/vec2/f32/scale.js.map +1 -0
  858. package/dist/interface/math/vec2/f32/schema.d.ts +9 -0
  859. package/dist/interface/math/vec2/f32/schema.js +3 -0
  860. package/dist/interface/math/vec2/f32/schema.js.map +1 -0
  861. package/dist/interface/math/vec2/f32/sign.d.ts +2 -0
  862. package/dist/interface/math/vec2/f32/sign.js +3 -0
  863. package/dist/interface/math/vec2/f32/sign.js.map +1 -0
  864. package/dist/interface/math/vec2/f32/sin.d.ts +2 -0
  865. package/dist/interface/math/vec2/f32/sin.js +3 -0
  866. package/dist/interface/math/vec2/f32/sin.js.map +1 -0
  867. package/dist/interface/math/vec2/f32/sinh.d.ts +2 -0
  868. package/dist/interface/math/vec2/f32/sinh.js +3 -0
  869. package/dist/interface/math/vec2/f32/sinh.js.map +1 -0
  870. package/dist/interface/math/vec2/f32/smoothstep.d.ts +2 -0
  871. package/dist/interface/math/vec2/f32/smoothstep.js +7 -0
  872. package/dist/interface/math/vec2/f32/smoothstep.js.map +1 -0
  873. package/dist/interface/math/vec2/f32/sqrt.d.ts +2 -0
  874. package/dist/interface/math/vec2/f32/sqrt.js +3 -0
  875. package/dist/interface/math/vec2/f32/sqrt.js.map +1 -0
  876. package/dist/interface/math/vec2/f32/step.d.ts +2 -0
  877. package/dist/interface/math/vec2/f32/step.js +6 -0
  878. package/dist/interface/math/vec2/f32/step.js.map +1 -0
  879. package/dist/interface/math/vec2/f32/subtract.d.ts +2 -0
  880. package/dist/interface/math/vec2/f32/subtract.js +3 -0
  881. package/dist/interface/math/vec2/f32/subtract.js.map +1 -0
  882. package/dist/interface/math/vec2/f32/tan.d.ts +2 -0
  883. package/dist/interface/math/vec2/f32/tan.js +3 -0
  884. package/dist/interface/math/vec2/f32/tan.js.map +1 -0
  885. package/dist/interface/math/vec2/f32/tanh.d.ts +2 -0
  886. package/dist/interface/math/vec2/f32/tanh.js +3 -0
  887. package/dist/interface/math/vec2/f32/tanh.js.map +1 -0
  888. package/dist/interface/math/vec2/f32/trunc.d.ts +2 -0
  889. package/dist/interface/math/vec2/f32/trunc.js +3 -0
  890. package/dist/interface/math/vec2/f32/trunc.js.map +1 -0
  891. package/dist/interface/math/vec2/f32/zero.d.ts +2 -0
  892. package/dist/interface/math/vec2/f32/zero.js +2 -0
  893. package/dist/interface/math/vec2/f32/zero.js.map +1 -0
  894. package/dist/interface/math/vec2/i32/abs.d.ts +2 -0
  895. package/dist/interface/math/vec2/i32/abs.js +3 -0
  896. package/dist/interface/math/vec2/i32/abs.js.map +1 -0
  897. package/dist/interface/math/vec2/i32/add.d.ts +2 -0
  898. package/dist/interface/math/vec2/i32/add.js +3 -0
  899. package/dist/interface/math/vec2/i32/add.js.map +1 -0
  900. package/dist/interface/math/vec2/i32/bitwise-and.d.ts +2 -0
  901. package/dist/interface/math/vec2/i32/bitwise-and.js +3 -0
  902. package/dist/interface/math/vec2/i32/bitwise-and.js.map +1 -0
  903. package/dist/interface/math/vec2/i32/bitwise-not.d.ts +2 -0
  904. package/dist/interface/math/vec2/i32/bitwise-not.js +3 -0
  905. package/dist/interface/math/vec2/i32/bitwise-not.js.map +1 -0
  906. package/dist/interface/math/vec2/i32/bitwise-or.d.ts +2 -0
  907. package/dist/interface/math/vec2/i32/bitwise-or.js +3 -0
  908. package/dist/interface/math/vec2/i32/bitwise-or.js.map +1 -0
  909. package/dist/interface/math/vec2/i32/bitwise-xor.d.ts +2 -0
  910. package/dist/interface/math/vec2/i32/bitwise-xor.js +3 -0
  911. package/dist/interface/math/vec2/i32/bitwise-xor.js.map +1 -0
  912. package/dist/interface/math/vec2/i32/clamp.d.ts +2 -0
  913. package/dist/interface/math/vec2/i32/clamp.js +5 -0
  914. package/dist/interface/math/vec2/i32/clamp.js.map +1 -0
  915. package/dist/interface/math/vec2/i32/count-leading-zeros.d.ts +2 -0
  916. package/dist/interface/math/vec2/i32/count-leading-zeros.js +7 -0
  917. package/dist/interface/math/vec2/i32/count-leading-zeros.js.map +1 -0
  918. package/dist/interface/math/vec2/i32/count-one-bits.d.ts +2 -0
  919. package/dist/interface/math/vec2/i32/count-one-bits.js +7 -0
  920. package/dist/interface/math/vec2/i32/count-one-bits.js.map +1 -0
  921. package/dist/interface/math/vec2/i32/count-trailing-zeros.d.ts +2 -0
  922. package/dist/interface/math/vec2/i32/count-trailing-zeros.js +7 -0
  923. package/dist/interface/math/vec2/i32/count-trailing-zeros.js.map +1 -0
  924. package/dist/interface/math/vec2/i32/equals.d.ts +2 -0
  925. package/dist/interface/math/vec2/i32/equals.js +2 -0
  926. package/dist/interface/math/vec2/i32/equals.js.map +1 -0
  927. package/dist/interface/math/vec2/i32/i32.d.ts +5 -0
  928. package/dist/interface/math/vec2/i32/i32.js +2 -0
  929. package/dist/interface/math/vec2/i32/i32.js.map +1 -0
  930. package/dist/interface/math/vec2/i32/max.d.ts +2 -0
  931. package/dist/interface/math/vec2/i32/max.js +3 -0
  932. package/dist/interface/math/vec2/i32/max.js.map +1 -0
  933. package/dist/interface/math/vec2/i32/min.d.ts +2 -0
  934. package/dist/interface/math/vec2/i32/min.js +3 -0
  935. package/dist/interface/math/vec2/i32/min.js.map +1 -0
  936. package/dist/interface/math/vec2/i32/negate.d.ts +2 -0
  937. package/dist/interface/math/vec2/i32/negate.js +3 -0
  938. package/dist/interface/math/vec2/i32/negate.js.map +1 -0
  939. package/dist/interface/math/vec2/i32/public.d.ts +22 -0
  940. package/dist/interface/math/vec2/i32/public.js +24 -0
  941. package/dist/interface/math/vec2/i32/public.js.map +1 -0
  942. package/dist/interface/math/vec2/i32/reverse-bits.d.ts +2 -0
  943. package/dist/interface/math/vec2/i32/reverse-bits.js +4 -0
  944. package/dist/interface/math/vec2/i32/reverse-bits.js.map +1 -0
  945. package/dist/interface/math/vec2/i32/scale.d.ts +3 -0
  946. package/dist/interface/math/vec2/i32/scale.js +3 -0
  947. package/dist/interface/math/vec2/i32/scale.js.map +1 -0
  948. package/dist/interface/math/vec2/i32/schema.d.ts +10 -0
  949. package/dist/interface/math/vec2/i32/schema.js +3 -0
  950. package/dist/interface/math/vec2/i32/schema.js.map +1 -0
  951. package/dist/interface/math/vec2/i32/shift-left.d.ts +2 -0
  952. package/dist/interface/math/vec2/i32/shift-left.js +2 -0
  953. package/dist/interface/math/vec2/i32/shift-left.js.map +1 -0
  954. package/dist/interface/math/vec2/i32/shift-right.d.ts +2 -0
  955. package/dist/interface/math/vec2/i32/shift-right.js +6 -0
  956. package/dist/interface/math/vec2/i32/shift-right.js.map +1 -0
  957. package/dist/interface/math/vec2/i32/subtract.d.ts +2 -0
  958. package/dist/interface/math/vec2/i32/subtract.js +3 -0
  959. package/dist/interface/math/vec2/i32/subtract.js.map +1 -0
  960. package/dist/interface/math/vec2/i32/zero.d.ts +2 -0
  961. package/dist/interface/math/vec2/i32/zero.js +2 -0
  962. package/dist/interface/math/vec2/i32/zero.js.map +1 -0
  963. package/dist/interface/math/vec2/index.d.ts +4 -0
  964. package/dist/interface/math/vec2/index.js +2 -0
  965. package/dist/interface/math/vec2/index.js.map +1 -0
  966. package/dist/interface/math/vec2/public.d.ts +5 -0
  967. package/dist/interface/math/vec2/public.js +7 -0
  968. package/dist/interface/math/vec2/public.js.map +1 -0
  969. package/dist/interface/math/vec2/u32/add.d.ts +2 -0
  970. package/dist/interface/math/vec2/u32/add.js +6 -0
  971. package/dist/interface/math/vec2/u32/add.js.map +1 -0
  972. package/dist/interface/math/vec2/u32/bitwise-and.d.ts +2 -0
  973. package/dist/interface/math/vec2/u32/bitwise-and.js +6 -0
  974. package/dist/interface/math/vec2/u32/bitwise-and.js.map +1 -0
  975. package/dist/interface/math/vec2/u32/bitwise-not.d.ts +2 -0
  976. package/dist/interface/math/vec2/u32/bitwise-not.js +3 -0
  977. package/dist/interface/math/vec2/u32/bitwise-not.js.map +1 -0
  978. package/dist/interface/math/vec2/u32/bitwise-or.d.ts +2 -0
  979. package/dist/interface/math/vec2/u32/bitwise-or.js +6 -0
  980. package/dist/interface/math/vec2/u32/bitwise-or.js.map +1 -0
  981. package/dist/interface/math/vec2/u32/bitwise-xor.d.ts +2 -0
  982. package/dist/interface/math/vec2/u32/bitwise-xor.js +6 -0
  983. package/dist/interface/math/vec2/u32/bitwise-xor.js.map +1 -0
  984. package/dist/interface/math/vec2/u32/clamp.d.ts +2 -0
  985. package/dist/interface/math/vec2/u32/clamp.js +5 -0
  986. package/dist/interface/math/vec2/u32/clamp.js.map +1 -0
  987. package/dist/interface/math/vec2/u32/count-leading-zeros.d.ts +2 -0
  988. package/dist/interface/math/vec2/u32/count-leading-zeros.js +7 -0
  989. package/dist/interface/math/vec2/u32/count-leading-zeros.js.map +1 -0
  990. package/dist/interface/math/vec2/u32/count-one-bits.d.ts +2 -0
  991. package/dist/interface/math/vec2/u32/count-one-bits.js +7 -0
  992. package/dist/interface/math/vec2/u32/count-one-bits.js.map +1 -0
  993. package/dist/interface/math/vec2/u32/count-trailing-zeros.d.ts +2 -0
  994. package/dist/interface/math/vec2/u32/count-trailing-zeros.js +7 -0
  995. package/dist/interface/math/vec2/u32/count-trailing-zeros.js.map +1 -0
  996. package/dist/interface/math/vec2/u32/equals.d.ts +2 -0
  997. package/dist/interface/math/vec2/u32/equals.js +2 -0
  998. package/dist/interface/math/vec2/u32/equals.js.map +1 -0
  999. package/dist/interface/math/vec2/u32/max.d.ts +2 -0
  1000. package/dist/interface/math/vec2/u32/max.js +6 -0
  1001. package/dist/interface/math/vec2/u32/max.js.map +1 -0
  1002. package/dist/interface/math/vec2/u32/min.d.ts +2 -0
  1003. package/dist/interface/math/vec2/u32/min.js +6 -0
  1004. package/dist/interface/math/vec2/u32/min.js.map +1 -0
  1005. package/dist/interface/math/vec2/u32/negate.d.ts +2 -0
  1006. package/dist/interface/math/vec2/u32/negate.js +2 -0
  1007. package/dist/interface/math/vec2/u32/negate.js.map +1 -0
  1008. package/dist/interface/math/vec2/u32/public.d.ts +21 -0
  1009. package/dist/interface/math/vec2/u32/public.js +23 -0
  1010. package/dist/interface/math/vec2/u32/public.js.map +1 -0
  1011. package/dist/interface/math/vec2/u32/reverse-bits.d.ts +2 -0
  1012. package/dist/interface/math/vec2/u32/reverse-bits.js +7 -0
  1013. package/dist/interface/math/vec2/u32/reverse-bits.js.map +1 -0
  1014. package/dist/interface/math/vec2/u32/scale.d.ts +3 -0
  1015. package/dist/interface/math/vec2/u32/scale.js +3 -0
  1016. package/dist/interface/math/vec2/u32/scale.js.map +1 -0
  1017. package/dist/interface/math/vec2/u32/schema.d.ts +10 -0
  1018. package/dist/interface/math/vec2/u32/schema.js +3 -0
  1019. package/dist/interface/math/vec2/u32/schema.js.map +1 -0
  1020. package/dist/interface/math/vec2/u32/shift-left.d.ts +2 -0
  1021. package/dist/interface/math/vec2/u32/shift-left.js +2 -0
  1022. package/dist/interface/math/vec2/u32/shift-left.js.map +1 -0
  1023. package/dist/interface/math/vec2/u32/shift-right.d.ts +2 -0
  1024. package/dist/interface/math/vec2/u32/shift-right.js +6 -0
  1025. package/dist/interface/math/vec2/u32/shift-right.js.map +1 -0
  1026. package/dist/interface/math/vec2/u32/subtract.d.ts +2 -0
  1027. package/dist/interface/math/vec2/u32/subtract.js +6 -0
  1028. package/dist/interface/math/vec2/u32/subtract.js.map +1 -0
  1029. package/dist/interface/math/vec2/u32/u32.d.ts +5 -0
  1030. package/dist/interface/math/vec2/u32/u32.js +2 -0
  1031. package/dist/interface/math/vec2/u32/u32.js.map +1 -0
  1032. package/dist/interface/math/vec2/u32/zero.d.ts +2 -0
  1033. package/dist/interface/math/vec2/u32/zero.js +2 -0
  1034. package/dist/interface/math/vec2/u32/zero.js.map +1 -0
  1035. package/dist/interface/math/vec3/f32/abs.d.ts +2 -0
  1036. package/dist/interface/math/vec3/f32/abs.js +3 -0
  1037. package/dist/interface/math/vec3/f32/abs.js.map +1 -0
  1038. package/dist/interface/math/vec3/f32/acos.d.ts +2 -0
  1039. package/dist/interface/math/vec3/f32/acos.js +3 -0
  1040. package/dist/interface/math/vec3/f32/acos.js.map +1 -0
  1041. package/dist/interface/math/vec3/f32/acosh.d.ts +2 -0
  1042. package/dist/interface/math/vec3/f32/acosh.js +3 -0
  1043. package/dist/interface/math/vec3/f32/acosh.js.map +1 -0
  1044. package/dist/interface/math/vec3/f32/add.d.ts +2 -0
  1045. package/dist/interface/math/vec3/f32/add.js +7 -0
  1046. package/dist/interface/math/vec3/f32/add.js.map +1 -0
  1047. package/dist/interface/math/vec3/f32/asin.d.ts +2 -0
  1048. package/dist/interface/math/vec3/f32/asin.js +3 -0
  1049. package/dist/interface/math/vec3/f32/asin.js.map +1 -0
  1050. package/dist/interface/math/vec3/f32/asinh.d.ts +2 -0
  1051. package/dist/interface/math/vec3/f32/asinh.js +3 -0
  1052. package/dist/interface/math/vec3/f32/asinh.js.map +1 -0
  1053. package/dist/interface/math/vec3/f32/atan.d.ts +2 -0
  1054. package/dist/interface/math/vec3/f32/atan.js +3 -0
  1055. package/dist/interface/math/vec3/f32/atan.js.map +1 -0
  1056. package/dist/interface/math/vec3/f32/atanh.d.ts +2 -0
  1057. package/dist/interface/math/vec3/f32/atanh.js +3 -0
  1058. package/dist/interface/math/vec3/f32/atanh.js.map +1 -0
  1059. package/dist/interface/math/vec3/f32/ceil.d.ts +2 -0
  1060. package/dist/interface/math/vec3/f32/ceil.js +3 -0
  1061. package/dist/interface/math/vec3/f32/ceil.js.map +1 -0
  1062. package/dist/interface/math/vec3/f32/clamp.d.ts +2 -0
  1063. package/dist/interface/math/vec3/f32/clamp.js +5 -0
  1064. package/dist/interface/math/vec3/f32/clamp.js.map +1 -0
  1065. package/dist/interface/math/vec3/f32/cos.d.ts +2 -0
  1066. package/dist/interface/math/vec3/f32/cos.js +3 -0
  1067. package/dist/interface/math/vec3/f32/cos.js.map +1 -0
  1068. package/dist/interface/math/vec3/f32/cosh.d.ts +2 -0
  1069. package/dist/interface/math/vec3/f32/cosh.js +3 -0
  1070. package/dist/interface/math/vec3/f32/cosh.js.map +1 -0
  1071. package/dist/interface/math/vec3/f32/cross.d.ts +2 -0
  1072. package/dist/interface/math/vec3/f32/cross.js +7 -0
  1073. package/dist/interface/math/vec3/f32/cross.js.map +1 -0
  1074. package/dist/interface/math/vec3/f32/distance-squared.d.ts +2 -0
  1075. package/dist/interface/math/vec3/f32/distance-squared.js +7 -0
  1076. package/dist/interface/math/vec3/f32/distance-squared.js.map +1 -0
  1077. package/dist/interface/math/vec3/f32/distance.d.ts +2 -0
  1078. package/dist/interface/math/vec3/f32/distance.js +5 -0
  1079. package/dist/interface/math/vec3/f32/distance.js.map +1 -0
  1080. package/dist/interface/math/vec3/f32/dot.d.ts +2 -0
  1081. package/dist/interface/math/vec3/f32/dot.js +3 -0
  1082. package/dist/interface/math/vec3/f32/dot.js.map +1 -0
  1083. package/dist/interface/math/vec3/f32/equals.d.ts +2 -0
  1084. package/dist/interface/math/vec3/f32/equals.js +2 -0
  1085. package/dist/interface/math/vec3/f32/equals.js.map +1 -0
  1086. package/dist/interface/math/vec3/f32/exp.d.ts +2 -0
  1087. package/dist/interface/math/vec3/f32/exp.js +3 -0
  1088. package/dist/interface/math/vec3/f32/exp.js.map +1 -0
  1089. package/dist/interface/math/vec3/f32/exp2.d.ts +2 -0
  1090. package/dist/interface/math/vec3/f32/exp2.js +3 -0
  1091. package/dist/interface/math/vec3/f32/exp2.js.map +1 -0
  1092. package/dist/interface/math/vec3/f32/f32.d.ts +4 -0
  1093. package/dist/interface/math/vec3/f32/f32.js +2 -0
  1094. package/dist/interface/math/vec3/f32/f32.js.map +1 -0
  1095. package/dist/interface/math/vec3/f32/faceforward.d.ts +2 -0
  1096. package/dist/interface/math/vec3/f32/faceforward.js +5 -0
  1097. package/dist/interface/math/vec3/f32/faceforward.js.map +1 -0
  1098. package/dist/interface/math/vec3/f32/floor.d.ts +2 -0
  1099. package/dist/interface/math/vec3/f32/floor.js +3 -0
  1100. package/dist/interface/math/vec3/f32/floor.js.map +1 -0
  1101. package/dist/interface/math/vec3/f32/fract.d.ts +2 -0
  1102. package/dist/interface/math/vec3/f32/fract.js +7 -0
  1103. package/dist/interface/math/vec3/f32/fract.js.map +1 -0
  1104. package/dist/interface/math/vec3/f32/length-squared.d.ts +2 -0
  1105. package/dist/interface/math/vec3/f32/length-squared.js +3 -0
  1106. package/dist/interface/math/vec3/f32/length-squared.js.map +1 -0
  1107. package/dist/interface/math/vec3/f32/length.d.ts +2 -0
  1108. package/dist/interface/math/vec3/f32/length.js +3 -0
  1109. package/dist/interface/math/vec3/f32/length.js.map +1 -0
  1110. package/dist/interface/math/vec3/f32/log.d.ts +2 -0
  1111. package/dist/interface/math/vec3/f32/log.js +3 -0
  1112. package/dist/interface/math/vec3/f32/log.js.map +1 -0
  1113. package/dist/interface/math/vec3/f32/log2.d.ts +2 -0
  1114. package/dist/interface/math/vec3/f32/log2.js +3 -0
  1115. package/dist/interface/math/vec3/f32/log2.js.map +1 -0
  1116. package/dist/interface/math/vec3/f32/max.d.ts +2 -0
  1117. package/dist/interface/math/vec3/f32/max.js +7 -0
  1118. package/dist/interface/math/vec3/f32/max.js.map +1 -0
  1119. package/dist/interface/math/vec3/f32/min.d.ts +2 -0
  1120. package/dist/interface/math/vec3/f32/min.js +7 -0
  1121. package/dist/interface/math/vec3/f32/min.js.map +1 -0
  1122. package/dist/interface/math/vec3/f32/mix.d.ts +2 -0
  1123. package/dist/interface/math/vec3/f32/mix.js +7 -0
  1124. package/dist/interface/math/vec3/f32/mix.js.map +1 -0
  1125. package/dist/interface/math/vec3/f32/mod.d.ts +2 -0
  1126. package/dist/interface/math/vec3/f32/mod.js +6 -0
  1127. package/dist/interface/math/vec3/f32/mod.js.map +1 -0
  1128. package/dist/interface/math/vec3/f32/modf.d.ts +5 -0
  1129. package/dist/interface/math/vec3/f32/modf.js +5 -0
  1130. package/dist/interface/math/vec3/f32/modf.js.map +1 -0
  1131. package/dist/interface/math/vec3/f32/multiply.d.ts +5 -0
  1132. package/dist/interface/math/vec3/f32/multiply.js +10 -0
  1133. package/dist/interface/math/vec3/f32/multiply.js.map +1 -0
  1134. package/dist/interface/math/vec3/f32/negate.d.ts +2 -0
  1135. package/dist/interface/math/vec3/f32/negate.js +3 -0
  1136. package/dist/interface/math/vec3/f32/negate.js.map +1 -0
  1137. package/dist/interface/math/vec3/f32/normalize.d.ts +2 -0
  1138. package/dist/interface/math/vec3/f32/normalize.js +5 -0
  1139. package/dist/interface/math/vec3/f32/normalize.js.map +1 -0
  1140. package/dist/interface/math/vec3/f32/one.d.ts +2 -0
  1141. package/dist/interface/math/vec3/f32/one.js +2 -0
  1142. package/dist/interface/math/vec3/f32/one.js.map +1 -0
  1143. package/dist/interface/math/vec3/f32/pow.d.ts +3 -0
  1144. package/dist/interface/math/vec3/f32/pow.js +8 -0
  1145. package/dist/interface/math/vec3/f32/pow.js.map +1 -0
  1146. package/dist/interface/math/vec3/f32/public.d.ts +54 -0
  1147. package/dist/interface/math/vec3/f32/public.js +56 -0
  1148. package/dist/interface/math/vec3/f32/public.js.map +1 -0
  1149. package/dist/interface/math/vec3/f32/random.d.ts +2 -0
  1150. package/dist/interface/math/vec3/f32/random.js +4 -0
  1151. package/dist/interface/math/vec3/f32/random.js.map +1 -0
  1152. package/dist/interface/math/vec3/f32/reflect.d.ts +2 -0
  1153. package/dist/interface/math/vec3/f32/reflect.js +9 -0
  1154. package/dist/interface/math/vec3/f32/reflect.js.map +1 -0
  1155. package/dist/interface/math/vec3/f32/refract.d.ts +2 -0
  1156. package/dist/interface/math/vec3/f32/refract.js +14 -0
  1157. package/dist/interface/math/vec3/f32/refract.js.map +1 -0
  1158. package/dist/interface/math/vec3/f32/round.d.ts +2 -0
  1159. package/dist/interface/math/vec3/f32/round.js +8 -0
  1160. package/dist/interface/math/vec3/f32/round.js.map +1 -0
  1161. package/dist/interface/math/vec3/f32/scale.d.ts +2 -0
  1162. package/dist/interface/math/vec3/f32/scale.js +3 -0
  1163. package/dist/interface/math/vec3/f32/scale.js.map +1 -0
  1164. package/dist/interface/math/vec3/f32/schema.d.ts +9 -0
  1165. package/dist/interface/math/vec3/f32/schema.js +3 -0
  1166. package/dist/interface/math/vec3/f32/schema.js.map +1 -0
  1167. package/dist/interface/math/vec3/f32/sign.d.ts +2 -0
  1168. package/dist/interface/math/vec3/f32/sign.js +3 -0
  1169. package/dist/interface/math/vec3/f32/sign.js.map +1 -0
  1170. package/dist/interface/math/vec3/f32/sin.d.ts +2 -0
  1171. package/dist/interface/math/vec3/f32/sin.js +3 -0
  1172. package/dist/interface/math/vec3/f32/sin.js.map +1 -0
  1173. package/dist/interface/math/vec3/f32/sinh.d.ts +2 -0
  1174. package/dist/interface/math/vec3/f32/sinh.js +3 -0
  1175. package/dist/interface/math/vec3/f32/sinh.js.map +1 -0
  1176. package/dist/interface/math/vec3/f32/smoothstep.d.ts +2 -0
  1177. package/dist/interface/math/vec3/f32/smoothstep.js +12 -0
  1178. package/dist/interface/math/vec3/f32/smoothstep.js.map +1 -0
  1179. package/dist/interface/math/vec3/f32/sqrt.d.ts +2 -0
  1180. package/dist/interface/math/vec3/f32/sqrt.js +3 -0
  1181. package/dist/interface/math/vec3/f32/sqrt.js.map +1 -0
  1182. package/dist/interface/math/vec3/f32/step.d.ts +2 -0
  1183. package/dist/interface/math/vec3/f32/step.js +7 -0
  1184. package/dist/interface/math/vec3/f32/step.js.map +1 -0
  1185. package/dist/interface/math/vec3/f32/subtract.d.ts +2 -0
  1186. package/dist/interface/math/vec3/f32/subtract.js +7 -0
  1187. package/dist/interface/math/vec3/f32/subtract.js.map +1 -0
  1188. package/dist/interface/math/vec3/f32/tan.d.ts +2 -0
  1189. package/dist/interface/math/vec3/f32/tan.js +3 -0
  1190. package/dist/interface/math/vec3/f32/tan.js.map +1 -0
  1191. package/dist/interface/math/vec3/f32/tanh.d.ts +2 -0
  1192. package/dist/interface/math/vec3/f32/tanh.js +3 -0
  1193. package/dist/interface/math/vec3/f32/tanh.js.map +1 -0
  1194. package/dist/interface/math/vec3/f32/trunc.d.ts +2 -0
  1195. package/dist/interface/math/vec3/f32/trunc.js +3 -0
  1196. package/dist/interface/math/vec3/f32/trunc.js.map +1 -0
  1197. package/dist/interface/math/vec3/f32/zero.d.ts +2 -0
  1198. package/dist/interface/math/vec3/f32/zero.js +2 -0
  1199. package/dist/interface/math/vec3/f32/zero.js.map +1 -0
  1200. package/dist/interface/math/vec3/i32/abs.d.ts +2 -0
  1201. package/dist/interface/math/vec3/i32/abs.js +7 -0
  1202. package/dist/interface/math/vec3/i32/abs.js.map +1 -0
  1203. package/dist/interface/math/vec3/i32/add.d.ts +2 -0
  1204. package/dist/interface/math/vec3/i32/add.js +7 -0
  1205. package/dist/interface/math/vec3/i32/add.js.map +1 -0
  1206. package/dist/interface/math/vec3/i32/bitwise-and.d.ts +2 -0
  1207. package/dist/interface/math/vec3/i32/bitwise-and.js +7 -0
  1208. package/dist/interface/math/vec3/i32/bitwise-and.js.map +1 -0
  1209. package/dist/interface/math/vec3/i32/bitwise-not.d.ts +2 -0
  1210. package/dist/interface/math/vec3/i32/bitwise-not.js +3 -0
  1211. package/dist/interface/math/vec3/i32/bitwise-not.js.map +1 -0
  1212. package/dist/interface/math/vec3/i32/bitwise-or.d.ts +2 -0
  1213. package/dist/interface/math/vec3/i32/bitwise-or.js +7 -0
  1214. package/dist/interface/math/vec3/i32/bitwise-or.js.map +1 -0
  1215. package/dist/interface/math/vec3/i32/bitwise-xor.d.ts +2 -0
  1216. package/dist/interface/math/vec3/i32/bitwise-xor.js +7 -0
  1217. package/dist/interface/math/vec3/i32/bitwise-xor.js.map +1 -0
  1218. package/dist/interface/math/vec3/i32/clamp.d.ts +2 -0
  1219. package/dist/interface/math/vec3/i32/clamp.js +5 -0
  1220. package/dist/interface/math/vec3/i32/clamp.js.map +1 -0
  1221. package/dist/interface/math/vec3/i32/count-leading-zeros.d.ts +2 -0
  1222. package/dist/interface/math/vec3/i32/count-leading-zeros.js +8 -0
  1223. package/dist/interface/math/vec3/i32/count-leading-zeros.js.map +1 -0
  1224. package/dist/interface/math/vec3/i32/count-one-bits.d.ts +2 -0
  1225. package/dist/interface/math/vec3/i32/count-one-bits.js +8 -0
  1226. package/dist/interface/math/vec3/i32/count-one-bits.js.map +1 -0
  1227. package/dist/interface/math/vec3/i32/count-trailing-zeros.d.ts +2 -0
  1228. package/dist/interface/math/vec3/i32/count-trailing-zeros.js +8 -0
  1229. package/dist/interface/math/vec3/i32/count-trailing-zeros.js.map +1 -0
  1230. package/dist/interface/math/vec3/i32/equals.d.ts +2 -0
  1231. package/dist/interface/math/vec3/i32/equals.js +2 -0
  1232. package/dist/interface/math/vec3/i32/equals.js.map +1 -0
  1233. package/dist/interface/math/vec3/i32/i32.d.ts +5 -0
  1234. package/dist/interface/math/vec3/i32/i32.js +2 -0
  1235. package/dist/interface/math/vec3/i32/i32.js.map +1 -0
  1236. package/dist/interface/math/vec3/i32/max.d.ts +2 -0
  1237. package/dist/interface/math/vec3/i32/max.js +7 -0
  1238. package/dist/interface/math/vec3/i32/max.js.map +1 -0
  1239. package/dist/interface/math/vec3/i32/min.d.ts +2 -0
  1240. package/dist/interface/math/vec3/i32/min.js +7 -0
  1241. package/dist/interface/math/vec3/i32/min.js.map +1 -0
  1242. package/dist/interface/math/vec3/i32/multiply.d.ts +2 -0
  1243. package/dist/interface/math/vec3/i32/multiply.js +7 -0
  1244. package/dist/interface/math/vec3/i32/multiply.js.map +1 -0
  1245. package/dist/interface/math/vec3/i32/negate.d.ts +2 -0
  1246. package/dist/interface/math/vec3/i32/negate.js +7 -0
  1247. package/dist/interface/math/vec3/i32/negate.js.map +1 -0
  1248. package/dist/interface/math/vec3/i32/one.d.ts +2 -0
  1249. package/dist/interface/math/vec3/i32/one.js +2 -0
  1250. package/dist/interface/math/vec3/i32/one.js.map +1 -0
  1251. package/dist/interface/math/vec3/i32/public.d.ts +24 -0
  1252. package/dist/interface/math/vec3/i32/public.js +26 -0
  1253. package/dist/interface/math/vec3/i32/public.js.map +1 -0
  1254. package/dist/interface/math/vec3/i32/reverse-bits.d.ts +2 -0
  1255. package/dist/interface/math/vec3/i32/reverse-bits.js +8 -0
  1256. package/dist/interface/math/vec3/i32/reverse-bits.js.map +1 -0
  1257. package/dist/interface/math/vec3/i32/scale.d.ts +3 -0
  1258. package/dist/interface/math/vec3/i32/scale.js +7 -0
  1259. package/dist/interface/math/vec3/i32/scale.js.map +1 -0
  1260. package/dist/interface/math/vec3/i32/schema.d.ts +10 -0
  1261. package/dist/interface/math/vec3/i32/schema.js +3 -0
  1262. package/dist/interface/math/vec3/i32/schema.js.map +1 -0
  1263. package/dist/interface/math/vec3/i32/shift-left.d.ts +2 -0
  1264. package/dist/interface/math/vec3/i32/shift-left.js +2 -0
  1265. package/dist/interface/math/vec3/i32/shift-left.js.map +1 -0
  1266. package/dist/interface/math/vec3/i32/shift-right.d.ts +2 -0
  1267. package/dist/interface/math/vec3/i32/shift-right.js +7 -0
  1268. package/dist/interface/math/vec3/i32/shift-right.js.map +1 -0
  1269. package/dist/interface/math/vec3/i32/subtract.d.ts +2 -0
  1270. package/dist/interface/math/vec3/i32/subtract.js +7 -0
  1271. package/dist/interface/math/vec3/i32/subtract.js.map +1 -0
  1272. package/dist/interface/math/vec3/i32/zero.d.ts +2 -0
  1273. package/dist/interface/math/vec3/i32/zero.js +2 -0
  1274. package/dist/interface/math/vec3/i32/zero.js.map +1 -0
  1275. package/dist/interface/math/vec3/index.d.ts +4 -0
  1276. package/dist/interface/math/vec3/index.js +2 -0
  1277. package/dist/interface/math/vec3/index.js.map +1 -0
  1278. package/dist/interface/math/vec3/public.d.ts +5 -0
  1279. package/dist/interface/math/vec3/public.js +7 -0
  1280. package/dist/interface/math/vec3/public.js.map +1 -0
  1281. package/dist/interface/math/vec3/u32/add.d.ts +2 -0
  1282. package/dist/interface/math/vec3/u32/add.js +7 -0
  1283. package/dist/interface/math/vec3/u32/add.js.map +1 -0
  1284. package/dist/interface/math/vec3/u32/bitwise-and.d.ts +2 -0
  1285. package/dist/interface/math/vec3/u32/bitwise-and.js +7 -0
  1286. package/dist/interface/math/vec3/u32/bitwise-and.js.map +1 -0
  1287. package/dist/interface/math/vec3/u32/bitwise-not.d.ts +2 -0
  1288. package/dist/interface/math/vec3/u32/bitwise-not.js +3 -0
  1289. package/dist/interface/math/vec3/u32/bitwise-not.js.map +1 -0
  1290. package/dist/interface/math/vec3/u32/bitwise-or.d.ts +2 -0
  1291. package/dist/interface/math/vec3/u32/bitwise-or.js +7 -0
  1292. package/dist/interface/math/vec3/u32/bitwise-or.js.map +1 -0
  1293. package/dist/interface/math/vec3/u32/bitwise-xor.d.ts +2 -0
  1294. package/dist/interface/math/vec3/u32/bitwise-xor.js +7 -0
  1295. package/dist/interface/math/vec3/u32/bitwise-xor.js.map +1 -0
  1296. package/dist/interface/math/vec3/u32/clamp.d.ts +2 -0
  1297. package/dist/interface/math/vec3/u32/clamp.js +5 -0
  1298. package/dist/interface/math/vec3/u32/clamp.js.map +1 -0
  1299. package/dist/interface/math/vec3/u32/count-leading-zeros.d.ts +2 -0
  1300. package/dist/interface/math/vec3/u32/count-leading-zeros.js +8 -0
  1301. package/dist/interface/math/vec3/u32/count-leading-zeros.js.map +1 -0
  1302. package/dist/interface/math/vec3/u32/count-one-bits.d.ts +2 -0
  1303. package/dist/interface/math/vec3/u32/count-one-bits.js +8 -0
  1304. package/dist/interface/math/vec3/u32/count-one-bits.js.map +1 -0
  1305. package/dist/interface/math/vec3/u32/count-trailing-zeros.d.ts +2 -0
  1306. package/dist/interface/math/vec3/u32/count-trailing-zeros.js +8 -0
  1307. package/dist/interface/math/vec3/u32/count-trailing-zeros.js.map +1 -0
  1308. package/dist/interface/math/vec3/u32/equals.d.ts +2 -0
  1309. package/dist/interface/math/vec3/u32/equals.js +2 -0
  1310. package/dist/interface/math/vec3/u32/equals.js.map +1 -0
  1311. package/dist/interface/math/vec3/u32/max.d.ts +2 -0
  1312. package/dist/interface/math/vec3/u32/max.js +7 -0
  1313. package/dist/interface/math/vec3/u32/max.js.map +1 -0
  1314. package/dist/interface/math/vec3/u32/min.d.ts +2 -0
  1315. package/dist/interface/math/vec3/u32/min.js +7 -0
  1316. package/dist/interface/math/vec3/u32/min.js.map +1 -0
  1317. package/dist/interface/math/vec3/u32/multiply.d.ts +2 -0
  1318. package/dist/interface/math/vec3/u32/multiply.js +7 -0
  1319. package/dist/interface/math/vec3/u32/multiply.js.map +1 -0
  1320. package/dist/interface/math/vec3/u32/negate.d.ts +2 -0
  1321. package/dist/interface/math/vec3/u32/negate.js +2 -0
  1322. package/dist/interface/math/vec3/u32/negate.js.map +1 -0
  1323. package/dist/interface/math/vec3/u32/one.d.ts +2 -0
  1324. package/dist/interface/math/vec3/u32/one.js +2 -0
  1325. package/dist/interface/math/vec3/u32/one.js.map +1 -0
  1326. package/dist/interface/math/vec3/u32/public.d.ts +24 -0
  1327. package/dist/interface/math/vec3/u32/public.js +26 -0
  1328. package/dist/interface/math/vec3/u32/public.js.map +1 -0
  1329. package/dist/interface/math/vec3/u32/reverse-bits.d.ts +2 -0
  1330. package/dist/interface/math/vec3/u32/reverse-bits.js +8 -0
  1331. package/dist/interface/math/vec3/u32/reverse-bits.js.map +1 -0
  1332. package/dist/interface/math/vec3/u32/scale.d.ts +3 -0
  1333. package/dist/interface/math/vec3/u32/scale.js +7 -0
  1334. package/dist/interface/math/vec3/u32/scale.js.map +1 -0
  1335. package/dist/interface/math/vec3/u32/schema.d.ts +10 -0
  1336. package/dist/interface/math/vec3/u32/schema.js +3 -0
  1337. package/dist/interface/math/vec3/u32/schema.js.map +1 -0
  1338. package/dist/interface/math/vec3/u32/shift-left.d.ts +2 -0
  1339. package/dist/interface/math/vec3/u32/shift-left.js +6 -0
  1340. package/dist/interface/math/vec3/u32/shift-left.js.map +1 -0
  1341. package/dist/interface/math/vec3/u32/shift-right.d.ts +2 -0
  1342. package/dist/interface/math/vec3/u32/shift-right.js +7 -0
  1343. package/dist/interface/math/vec3/u32/shift-right.js.map +1 -0
  1344. package/dist/interface/math/vec3/u32/subtract.d.ts +2 -0
  1345. package/dist/interface/math/vec3/u32/subtract.js +7 -0
  1346. package/dist/interface/math/vec3/u32/subtract.js.map +1 -0
  1347. package/dist/interface/math/vec3/u32/u32.d.ts +5 -0
  1348. package/dist/interface/math/vec3/u32/u32.js +2 -0
  1349. package/dist/interface/math/vec3/u32/u32.js.map +1 -0
  1350. package/dist/interface/math/vec3/u32/volume.d.ts +2 -0
  1351. package/dist/interface/math/vec3/u32/volume.js +2 -0
  1352. package/dist/interface/math/vec3/u32/volume.js.map +1 -0
  1353. package/dist/interface/math/vec3/u32/zero.d.ts +2 -0
  1354. package/dist/interface/math/vec3/u32/zero.js +2 -0
  1355. package/dist/interface/math/vec3/u32/zero.js.map +1 -0
  1356. package/dist/interface/math/vec4/f32/abs.d.ts +2 -0
  1357. package/dist/interface/math/vec4/f32/abs.js +3 -0
  1358. package/dist/interface/math/vec4/f32/abs.js.map +1 -0
  1359. package/dist/interface/math/vec4/f32/acos.d.ts +2 -0
  1360. package/dist/interface/math/vec4/f32/acos.js +3 -0
  1361. package/dist/interface/math/vec4/f32/acos.js.map +1 -0
  1362. package/dist/interface/math/vec4/f32/acosh.d.ts +2 -0
  1363. package/dist/interface/math/vec4/f32/acosh.js +3 -0
  1364. package/dist/interface/math/vec4/f32/acosh.js.map +1 -0
  1365. package/dist/interface/math/vec4/f32/add.d.ts +2 -0
  1366. package/dist/interface/math/vec4/f32/add.js +8 -0
  1367. package/dist/interface/math/vec4/f32/add.js.map +1 -0
  1368. package/dist/interface/math/vec4/f32/asin.d.ts +2 -0
  1369. package/dist/interface/math/vec4/f32/asin.js +3 -0
  1370. package/dist/interface/math/vec4/f32/asin.js.map +1 -0
  1371. package/dist/interface/math/vec4/f32/asinh.d.ts +2 -0
  1372. package/dist/interface/math/vec4/f32/asinh.js +3 -0
  1373. package/dist/interface/math/vec4/f32/asinh.js.map +1 -0
  1374. package/dist/interface/math/vec4/f32/atan.d.ts +2 -0
  1375. package/dist/interface/math/vec4/f32/atan.js +3 -0
  1376. package/dist/interface/math/vec4/f32/atan.js.map +1 -0
  1377. package/dist/interface/math/vec4/f32/atanh.d.ts +2 -0
  1378. package/dist/interface/math/vec4/f32/atanh.js +3 -0
  1379. package/dist/interface/math/vec4/f32/atanh.js.map +1 -0
  1380. package/dist/interface/math/vec4/f32/ceil.d.ts +2 -0
  1381. package/dist/interface/math/vec4/f32/ceil.js +3 -0
  1382. package/dist/interface/math/vec4/f32/ceil.js.map +1 -0
  1383. package/dist/interface/math/vec4/f32/clamp.d.ts +2 -0
  1384. package/dist/interface/math/vec4/f32/clamp.js +5 -0
  1385. package/dist/interface/math/vec4/f32/clamp.js.map +1 -0
  1386. package/dist/interface/math/vec4/f32/cos.d.ts +2 -0
  1387. package/dist/interface/math/vec4/f32/cos.js +3 -0
  1388. package/dist/interface/math/vec4/f32/cos.js.map +1 -0
  1389. package/dist/interface/math/vec4/f32/cosh.d.ts +2 -0
  1390. package/dist/interface/math/vec4/f32/cosh.js +3 -0
  1391. package/dist/interface/math/vec4/f32/cosh.js.map +1 -0
  1392. package/dist/interface/math/vec4/f32/default.d.ts +4 -0
  1393. package/dist/interface/math/vec4/f32/default.js +4 -0
  1394. package/dist/interface/math/vec4/f32/default.js.map +1 -0
  1395. package/dist/interface/math/vec4/f32/distance.d.ts +2 -0
  1396. package/dist/interface/math/vec4/f32/distance.js +5 -0
  1397. package/dist/interface/math/vec4/f32/distance.js.map +1 -0
  1398. package/dist/interface/math/vec4/f32/dot.d.ts +2 -0
  1399. package/dist/interface/math/vec4/f32/dot.js +3 -0
  1400. package/dist/interface/math/vec4/f32/dot.js.map +1 -0
  1401. package/dist/interface/math/vec4/f32/exp.d.ts +2 -0
  1402. package/dist/interface/math/vec4/f32/exp.js +3 -0
  1403. package/dist/interface/math/vec4/f32/exp.js.map +1 -0
  1404. package/dist/interface/math/vec4/f32/exp2.d.ts +2 -0
  1405. package/dist/interface/math/vec4/f32/exp2.js +3 -0
  1406. package/dist/interface/math/vec4/f32/exp2.js.map +1 -0
  1407. package/dist/interface/math/vec4/f32/f32.d.ts +4 -0
  1408. package/dist/interface/math/vec4/f32/f32.js +2 -0
  1409. package/dist/interface/math/vec4/f32/f32.js.map +1 -0
  1410. package/dist/interface/math/vec4/f32/faceforward.d.ts +2 -0
  1411. package/dist/interface/math/vec4/f32/faceforward.js +5 -0
  1412. package/dist/interface/math/vec4/f32/faceforward.js.map +1 -0
  1413. package/dist/interface/math/vec4/f32/floor.d.ts +2 -0
  1414. package/dist/interface/math/vec4/f32/floor.js +3 -0
  1415. package/dist/interface/math/vec4/f32/floor.js.map +1 -0
  1416. package/dist/interface/math/vec4/f32/fract.d.ts +2 -0
  1417. package/dist/interface/math/vec4/f32/fract.js +8 -0
  1418. package/dist/interface/math/vec4/f32/fract.js.map +1 -0
  1419. package/dist/interface/math/vec4/f32/length.d.ts +2 -0
  1420. package/dist/interface/math/vec4/f32/length.js +3 -0
  1421. package/dist/interface/math/vec4/f32/length.js.map +1 -0
  1422. package/dist/interface/math/vec4/f32/log.d.ts +2 -0
  1423. package/dist/interface/math/vec4/f32/log.js +3 -0
  1424. package/dist/interface/math/vec4/f32/log.js.map +1 -0
  1425. package/dist/interface/math/vec4/f32/log2.d.ts +2 -0
  1426. package/dist/interface/math/vec4/f32/log2.js +3 -0
  1427. package/dist/interface/math/vec4/f32/log2.js.map +1 -0
  1428. package/dist/interface/math/vec4/f32/max.d.ts +2 -0
  1429. package/dist/interface/math/vec4/f32/max.js +8 -0
  1430. package/dist/interface/math/vec4/f32/max.js.map +1 -0
  1431. package/dist/interface/math/vec4/f32/min.d.ts +2 -0
  1432. package/dist/interface/math/vec4/f32/min.js +8 -0
  1433. package/dist/interface/math/vec4/f32/min.js.map +1 -0
  1434. package/dist/interface/math/vec4/f32/mix.d.ts +2 -0
  1435. package/dist/interface/math/vec4/f32/mix.js +8 -0
  1436. package/dist/interface/math/vec4/f32/mix.js.map +1 -0
  1437. package/dist/interface/math/vec4/f32/mod.d.ts +2 -0
  1438. package/dist/interface/math/vec4/f32/mod.js +7 -0
  1439. package/dist/interface/math/vec4/f32/mod.js.map +1 -0
  1440. package/dist/interface/math/vec4/f32/modf.d.ts +5 -0
  1441. package/dist/interface/math/vec4/f32/modf.js +5 -0
  1442. package/dist/interface/math/vec4/f32/modf.js.map +1 -0
  1443. package/dist/interface/math/vec4/f32/multiply.d.ts +2 -0
  1444. package/dist/interface/math/vec4/f32/multiply.js +8 -0
  1445. package/dist/interface/math/vec4/f32/multiply.js.map +1 -0
  1446. package/dist/interface/math/vec4/f32/negate.d.ts +2 -0
  1447. package/dist/interface/math/vec4/f32/negate.js +3 -0
  1448. package/dist/interface/math/vec4/f32/negate.js.map +1 -0
  1449. package/dist/interface/math/vec4/f32/normalize.d.ts +2 -0
  1450. package/dist/interface/math/vec4/f32/normalize.js +5 -0
  1451. package/dist/interface/math/vec4/f32/normalize.js.map +1 -0
  1452. package/dist/interface/math/vec4/f32/pow.d.ts +3 -0
  1453. package/dist/interface/math/vec4/f32/pow.js +9 -0
  1454. package/dist/interface/math/vec4/f32/pow.js.map +1 -0
  1455. package/dist/interface/math/vec4/f32/public.d.ts +47 -0
  1456. package/dist/interface/math/vec4/f32/public.js +49 -0
  1457. package/dist/interface/math/vec4/f32/public.js.map +1 -0
  1458. package/dist/interface/math/vec4/f32/reflect.d.ts +2 -0
  1459. package/dist/interface/math/vec4/f32/reflect.js +9 -0
  1460. package/dist/interface/math/vec4/f32/reflect.js.map +1 -0
  1461. package/dist/interface/math/vec4/f32/refract.d.ts +2 -0
  1462. package/dist/interface/math/vec4/f32/refract.js +14 -0
  1463. package/dist/interface/math/vec4/f32/refract.js.map +1 -0
  1464. package/dist/interface/math/vec4/f32/round.d.ts +2 -0
  1465. package/dist/interface/math/vec4/f32/round.js +9 -0
  1466. package/dist/interface/math/vec4/f32/round.js.map +1 -0
  1467. package/dist/interface/math/vec4/f32/scale.d.ts +2 -0
  1468. package/dist/interface/math/vec4/f32/scale.js +3 -0
  1469. package/dist/interface/math/vec4/f32/scale.js.map +1 -0
  1470. package/dist/interface/math/vec4/f32/schema.d.ts +9 -0
  1471. package/dist/interface/math/vec4/f32/schema.js +3 -0
  1472. package/dist/interface/math/vec4/f32/schema.js.map +1 -0
  1473. package/dist/interface/math/vec4/f32/sign.d.ts +2 -0
  1474. package/dist/interface/math/vec4/f32/sign.js +3 -0
  1475. package/dist/interface/math/vec4/f32/sign.js.map +1 -0
  1476. package/dist/interface/math/vec4/f32/sin.d.ts +2 -0
  1477. package/dist/interface/math/vec4/f32/sin.js +3 -0
  1478. package/dist/interface/math/vec4/f32/sin.js.map +1 -0
  1479. package/dist/interface/math/vec4/f32/sinh.d.ts +2 -0
  1480. package/dist/interface/math/vec4/f32/sinh.js +3 -0
  1481. package/dist/interface/math/vec4/f32/sinh.js.map +1 -0
  1482. package/dist/interface/math/vec4/f32/smoothstep.d.ts +2 -0
  1483. package/dist/interface/math/vec4/f32/smoothstep.js +14 -0
  1484. package/dist/interface/math/vec4/f32/smoothstep.js.map +1 -0
  1485. package/dist/interface/math/vec4/f32/sqrt.d.ts +2 -0
  1486. package/dist/interface/math/vec4/f32/sqrt.js +3 -0
  1487. package/dist/interface/math/vec4/f32/sqrt.js.map +1 -0
  1488. package/dist/interface/math/vec4/f32/step.d.ts +2 -0
  1489. package/dist/interface/math/vec4/f32/step.js +8 -0
  1490. package/dist/interface/math/vec4/f32/step.js.map +1 -0
  1491. package/dist/interface/math/vec4/f32/subtract.d.ts +2 -0
  1492. package/dist/interface/math/vec4/f32/subtract.js +8 -0
  1493. package/dist/interface/math/vec4/f32/subtract.js.map +1 -0
  1494. package/dist/interface/math/vec4/f32/tan.d.ts +2 -0
  1495. package/dist/interface/math/vec4/f32/tan.js +3 -0
  1496. package/dist/interface/math/vec4/f32/tan.js.map +1 -0
  1497. package/dist/interface/math/vec4/f32/tanh.d.ts +2 -0
  1498. package/dist/interface/math/vec4/f32/tanh.js +3 -0
  1499. package/dist/interface/math/vec4/f32/tanh.js.map +1 -0
  1500. package/dist/interface/math/vec4/f32/trunc.d.ts +2 -0
  1501. package/dist/interface/math/vec4/f32/trunc.js +3 -0
  1502. package/dist/interface/math/vec4/f32/trunc.js.map +1 -0
  1503. package/dist/interface/math/vec4/i32/abs.d.ts +2 -0
  1504. package/dist/interface/math/vec4/i32/abs.js +8 -0
  1505. package/dist/interface/math/vec4/i32/abs.js.map +1 -0
  1506. package/dist/interface/math/vec4/i32/add.d.ts +2 -0
  1507. package/dist/interface/math/vec4/i32/add.js +8 -0
  1508. package/dist/interface/math/vec4/i32/add.js.map +1 -0
  1509. package/dist/interface/math/vec4/i32/bitwise-and.d.ts +2 -0
  1510. package/dist/interface/math/vec4/i32/bitwise-and.js +8 -0
  1511. package/dist/interface/math/vec4/i32/bitwise-and.js.map +1 -0
  1512. package/dist/interface/math/vec4/i32/bitwise-not.d.ts +2 -0
  1513. package/dist/interface/math/vec4/i32/bitwise-not.js +3 -0
  1514. package/dist/interface/math/vec4/i32/bitwise-not.js.map +1 -0
  1515. package/dist/interface/math/vec4/i32/bitwise-or.d.ts +2 -0
  1516. package/dist/interface/math/vec4/i32/bitwise-or.js +8 -0
  1517. package/dist/interface/math/vec4/i32/bitwise-or.js.map +1 -0
  1518. package/dist/interface/math/vec4/i32/bitwise-xor.d.ts +2 -0
  1519. package/dist/interface/math/vec4/i32/bitwise-xor.js +8 -0
  1520. package/dist/interface/math/vec4/i32/bitwise-xor.js.map +1 -0
  1521. package/dist/interface/math/vec4/i32/clamp.d.ts +2 -0
  1522. package/dist/interface/math/vec4/i32/clamp.js +5 -0
  1523. package/dist/interface/math/vec4/i32/clamp.js.map +1 -0
  1524. package/dist/interface/math/vec4/i32/count-leading-zeros.d.ts +2 -0
  1525. package/dist/interface/math/vec4/i32/count-leading-zeros.js +9 -0
  1526. package/dist/interface/math/vec4/i32/count-leading-zeros.js.map +1 -0
  1527. package/dist/interface/math/vec4/i32/count-one-bits.d.ts +2 -0
  1528. package/dist/interface/math/vec4/i32/count-one-bits.js +9 -0
  1529. package/dist/interface/math/vec4/i32/count-one-bits.js.map +1 -0
  1530. package/dist/interface/math/vec4/i32/count-trailing-zeros.d.ts +2 -0
  1531. package/dist/interface/math/vec4/i32/count-trailing-zeros.js +9 -0
  1532. package/dist/interface/math/vec4/i32/count-trailing-zeros.js.map +1 -0
  1533. package/dist/interface/math/vec4/i32/equals.d.ts +2 -0
  1534. package/dist/interface/math/vec4/i32/equals.js +2 -0
  1535. package/dist/interface/math/vec4/i32/equals.js.map +1 -0
  1536. package/dist/interface/math/vec4/i32/i32.d.ts +5 -0
  1537. package/dist/interface/math/vec4/i32/i32.js +2 -0
  1538. package/dist/interface/math/vec4/i32/i32.js.map +1 -0
  1539. package/dist/interface/math/vec4/i32/max.d.ts +2 -0
  1540. package/dist/interface/math/vec4/i32/max.js +8 -0
  1541. package/dist/interface/math/vec4/i32/max.js.map +1 -0
  1542. package/dist/interface/math/vec4/i32/min.d.ts +2 -0
  1543. package/dist/interface/math/vec4/i32/min.js +8 -0
  1544. package/dist/interface/math/vec4/i32/min.js.map +1 -0
  1545. package/dist/interface/math/vec4/i32/multiply.d.ts +2 -0
  1546. package/dist/interface/math/vec4/i32/multiply.js +8 -0
  1547. package/dist/interface/math/vec4/i32/multiply.js.map +1 -0
  1548. package/dist/interface/math/vec4/i32/negate.d.ts +2 -0
  1549. package/dist/interface/math/vec4/i32/negate.js +8 -0
  1550. package/dist/interface/math/vec4/i32/negate.js.map +1 -0
  1551. package/dist/interface/math/vec4/i32/one.d.ts +2 -0
  1552. package/dist/interface/math/vec4/i32/one.js +2 -0
  1553. package/dist/interface/math/vec4/i32/one.js.map +1 -0
  1554. package/dist/interface/math/vec4/i32/public.d.ts +24 -0
  1555. package/dist/interface/math/vec4/i32/public.js +26 -0
  1556. package/dist/interface/math/vec4/i32/public.js.map +1 -0
  1557. package/dist/interface/math/vec4/i32/reverse-bits.d.ts +2 -0
  1558. package/dist/interface/math/vec4/i32/reverse-bits.js +9 -0
  1559. package/dist/interface/math/vec4/i32/reverse-bits.js.map +1 -0
  1560. package/dist/interface/math/vec4/i32/scale.d.ts +3 -0
  1561. package/dist/interface/math/vec4/i32/scale.js +8 -0
  1562. package/dist/interface/math/vec4/i32/scale.js.map +1 -0
  1563. package/dist/interface/math/vec4/i32/schema.d.ts +10 -0
  1564. package/dist/interface/math/vec4/i32/schema.js +3 -0
  1565. package/dist/interface/math/vec4/i32/schema.js.map +1 -0
  1566. package/dist/interface/math/vec4/i32/shift-left.d.ts +2 -0
  1567. package/dist/interface/math/vec4/i32/shift-left.js +2 -0
  1568. package/dist/interface/math/vec4/i32/shift-left.js.map +1 -0
  1569. package/dist/interface/math/vec4/i32/shift-right.d.ts +2 -0
  1570. package/dist/interface/math/vec4/i32/shift-right.js +8 -0
  1571. package/dist/interface/math/vec4/i32/shift-right.js.map +1 -0
  1572. package/dist/interface/math/vec4/i32/subtract.d.ts +2 -0
  1573. package/dist/interface/math/vec4/i32/subtract.js +8 -0
  1574. package/dist/interface/math/vec4/i32/subtract.js.map +1 -0
  1575. package/dist/interface/math/vec4/i32/zero.d.ts +2 -0
  1576. package/dist/interface/math/vec4/i32/zero.js +2 -0
  1577. package/dist/interface/math/vec4/i32/zero.js.map +1 -0
  1578. package/dist/interface/math/vec4/index.d.ts +4 -0
  1579. package/dist/interface/math/vec4/index.js +2 -0
  1580. package/dist/interface/math/vec4/index.js.map +1 -0
  1581. package/dist/interface/math/vec4/public.d.ts +5 -0
  1582. package/dist/interface/math/vec4/public.js +7 -0
  1583. package/dist/interface/math/vec4/public.js.map +1 -0
  1584. package/dist/interface/math/vec4/u32/add.d.ts +2 -0
  1585. package/dist/interface/math/vec4/u32/add.js +8 -0
  1586. package/dist/interface/math/vec4/u32/add.js.map +1 -0
  1587. package/dist/interface/math/vec4/u32/bitwise-and.d.ts +2 -0
  1588. package/dist/interface/math/vec4/u32/bitwise-and.js +8 -0
  1589. package/dist/interface/math/vec4/u32/bitwise-and.js.map +1 -0
  1590. package/dist/interface/math/vec4/u32/bitwise-not.d.ts +2 -0
  1591. package/dist/interface/math/vec4/u32/bitwise-not.js +3 -0
  1592. package/dist/interface/math/vec4/u32/bitwise-not.js.map +1 -0
  1593. package/dist/interface/math/vec4/u32/bitwise-or.d.ts +2 -0
  1594. package/dist/interface/math/vec4/u32/bitwise-or.js +8 -0
  1595. package/dist/interface/math/vec4/u32/bitwise-or.js.map +1 -0
  1596. package/dist/interface/math/vec4/u32/bitwise-xor.d.ts +2 -0
  1597. package/dist/interface/math/vec4/u32/bitwise-xor.js +8 -0
  1598. package/dist/interface/math/vec4/u32/bitwise-xor.js.map +1 -0
  1599. package/dist/interface/math/vec4/u32/clamp.d.ts +2 -0
  1600. package/dist/interface/math/vec4/u32/clamp.js +5 -0
  1601. package/dist/interface/math/vec4/u32/clamp.js.map +1 -0
  1602. package/dist/interface/math/vec4/u32/count-leading-zeros.d.ts +2 -0
  1603. package/dist/interface/math/vec4/u32/count-leading-zeros.js +9 -0
  1604. package/dist/interface/math/vec4/u32/count-leading-zeros.js.map +1 -0
  1605. package/dist/interface/math/vec4/u32/count-one-bits.d.ts +2 -0
  1606. package/dist/interface/math/vec4/u32/count-one-bits.js +9 -0
  1607. package/dist/interface/math/vec4/u32/count-one-bits.js.map +1 -0
  1608. package/dist/interface/math/vec4/u32/count-trailing-zeros.d.ts +2 -0
  1609. package/dist/interface/math/vec4/u32/count-trailing-zeros.js +9 -0
  1610. package/dist/interface/math/vec4/u32/count-trailing-zeros.js.map +1 -0
  1611. package/dist/interface/math/vec4/u32/equals.d.ts +2 -0
  1612. package/dist/interface/math/vec4/u32/equals.js +2 -0
  1613. package/dist/interface/math/vec4/u32/equals.js.map +1 -0
  1614. package/dist/interface/math/vec4/u32/max.d.ts +2 -0
  1615. package/dist/interface/math/vec4/u32/max.js +8 -0
  1616. package/dist/interface/math/vec4/u32/max.js.map +1 -0
  1617. package/dist/interface/math/vec4/u32/min.d.ts +2 -0
  1618. package/dist/interface/math/vec4/u32/min.js +8 -0
  1619. package/dist/interface/math/vec4/u32/min.js.map +1 -0
  1620. package/dist/interface/math/vec4/u32/multiply.d.ts +2 -0
  1621. package/dist/interface/math/vec4/u32/multiply.js +8 -0
  1622. package/dist/interface/math/vec4/u32/multiply.js.map +1 -0
  1623. package/dist/interface/math/vec4/u32/negate.d.ts +2 -0
  1624. package/dist/interface/math/vec4/u32/negate.js +2 -0
  1625. package/dist/interface/math/vec4/u32/negate.js.map +1 -0
  1626. package/dist/interface/math/vec4/u32/one.d.ts +2 -0
  1627. package/dist/interface/math/vec4/u32/one.js +2 -0
  1628. package/dist/interface/math/vec4/u32/one.js.map +1 -0
  1629. package/dist/interface/math/vec4/u32/public.d.ts +23 -0
  1630. package/dist/interface/math/vec4/u32/public.js +25 -0
  1631. package/dist/interface/math/vec4/u32/public.js.map +1 -0
  1632. package/dist/interface/math/vec4/u32/reverse-bits.d.ts +2 -0
  1633. package/dist/interface/math/vec4/u32/reverse-bits.js +9 -0
  1634. package/dist/interface/math/vec4/u32/reverse-bits.js.map +1 -0
  1635. package/dist/interface/math/vec4/u32/scale.d.ts +3 -0
  1636. package/dist/interface/math/vec4/u32/scale.js +8 -0
  1637. package/dist/interface/math/vec4/u32/scale.js.map +1 -0
  1638. package/dist/interface/math/vec4/u32/schema.d.ts +10 -0
  1639. package/dist/interface/math/vec4/u32/schema.js +3 -0
  1640. package/dist/interface/math/vec4/u32/schema.js.map +1 -0
  1641. package/dist/interface/math/vec4/u32/shift-left.d.ts +2 -0
  1642. package/dist/interface/math/vec4/u32/shift-left.js +7 -0
  1643. package/dist/interface/math/vec4/u32/shift-left.js.map +1 -0
  1644. package/dist/interface/math/vec4/u32/shift-right.d.ts +2 -0
  1645. package/dist/interface/math/vec4/u32/shift-right.js +8 -0
  1646. package/dist/interface/math/vec4/u32/shift-right.js.map +1 -0
  1647. package/dist/interface/math/vec4/u32/subtract.d.ts +2 -0
  1648. package/dist/interface/math/vec4/u32/subtract.js +8 -0
  1649. package/dist/interface/math/vec4/u32/subtract.js.map +1 -0
  1650. package/dist/interface/math/vec4/u32/u32.d.ts +5 -0
  1651. package/dist/interface/math/vec4/u32/u32.js +2 -0
  1652. package/dist/interface/math/vec4/u32/u32.js.map +1 -0
  1653. package/dist/interface/math/vec4/u32/zero.d.ts +2 -0
  1654. package/dist/interface/math/vec4/u32/zero.js +2 -0
  1655. package/dist/interface/math/vec4/u32/zero.js.map +1 -0
  1656. package/dist/interface/platform/platform.d.ts +28 -0
  1657. package/dist/interface/platform/platform.js +2 -0
  1658. package/dist/interface/platform/platform.js.map +1 -0
  1659. package/dist/interface/registry/archetypes.d.ts +29 -0
  1660. package/dist/interface/registry/archetypes.js +52 -0
  1661. package/dist/interface/registry/archetypes.js.map +1 -0
  1662. package/dist/interface/registry/declarations.d.ts +25 -0
  1663. package/dist/interface/registry/declarations.js +217 -0
  1664. package/dist/interface/registry/declarations.js.map +1 -0
  1665. package/dist/interface/registry/finalizer-order.d.ts +6 -0
  1666. package/dist/interface/registry/finalizer-order.js +66 -0
  1667. package/dist/interface/registry/finalizer-order.js.map +1 -0
  1668. package/dist/interface/registry/ids.d.ts +35 -0
  1669. package/dist/interface/registry/ids.js +70 -0
  1670. package/dist/interface/registry/ids.js.map +1 -0
  1671. package/dist/interface/registry/index.d.ts +29 -0
  1672. package/dist/interface/registry/index.js +16 -0
  1673. package/dist/interface/registry/index.js.map +1 -0
  1674. package/dist/interface/registry/indexes.d.ts +38 -0
  1675. package/dist/interface/registry/indexes.js +63 -0
  1676. package/dist/interface/registry/indexes.js.map +1 -0
  1677. package/dist/interface/registry/items.d.ts +38 -0
  1678. package/dist/interface/registry/items.js +79 -0
  1679. package/dist/interface/registry/items.js.map +1 -0
  1680. package/dist/interface/registry/layout.d.ts +61 -0
  1681. package/dist/interface/registry/layout.js +318 -0
  1682. package/dist/interface/registry/layout.js.map +1 -0
  1683. package/dist/interface/registry/names.d.ts +46 -0
  1684. package/dist/interface/registry/names.js +153 -0
  1685. package/dist/interface/registry/names.js.map +1 -0
  1686. package/dist/interface/registry/program.d.ts +36 -0
  1687. package/dist/interface/registry/program.js +96 -0
  1688. package/dist/interface/registry/program.js.map +1 -0
  1689. package/dist/interface/registry/reduction.d.ts +5 -0
  1690. package/dist/interface/registry/reduction.js +5 -0
  1691. package/dist/interface/registry/reduction.js.map +1 -0
  1692. package/dist/interface/registry/schedule.d.ts +36 -0
  1693. package/dist/interface/registry/schedule.js +202 -0
  1694. package/dist/interface/registry/schedule.js.map +1 -0
  1695. package/dist/interface/registry/schemas.d.ts +22 -0
  1696. package/dist/interface/registry/schemas.js +122 -0
  1697. package/dist/interface/registry/schemas.js.map +1 -0
  1698. package/dist/interface/registry/strata.d.ts +29 -0
  1699. package/dist/interface/registry/strata.js +95 -0
  1700. package/dist/interface/registry/strata.js.map +1 -0
  1701. package/dist/interface/registry/threads.d.ts +34 -0
  1702. package/dist/interface/registry/threads.js +53 -0
  1703. package/dist/interface/registry/threads.js.map +1 -0
  1704. package/dist/interface/registry/traits.d.ts +4 -0
  1705. package/dist/interface/registry/traits.js +11 -0
  1706. package/dist/interface/registry/traits.js.map +1 -0
  1707. package/dist/interface/registry/written.d.ts +4 -0
  1708. package/dist/interface/registry/written.js +14 -0
  1709. package/dist/interface/registry/written.js.map +1 -0
  1710. package/dist/interface/resource/condition.d.ts +8 -0
  1711. package/dist/interface/resource/condition.js +2 -0
  1712. package/dist/interface/resource/condition.js.map +1 -0
  1713. package/dist/interface/resource/index.d.ts +2 -0
  1714. package/dist/interface/resource/index.js +2 -0
  1715. package/dist/interface/resource/index.js.map +1 -0
  1716. package/dist/interface/resource/key.d.ts +2 -0
  1717. package/dist/interface/resource/key.js +2 -0
  1718. package/dist/interface/resource/key.js.map +1 -0
  1719. package/dist/interface/resource/reduction.d.ts +14 -0
  1720. package/dist/interface/resource/reduction.js +2 -0
  1721. package/dist/interface/resource/reduction.js.map +1 -0
  1722. package/dist/interface/resource/resource.d.ts +2 -0
  1723. package/dist/interface/resource/resource.js +3 -0
  1724. package/dist/interface/resource/resource.js.map +1 -0
  1725. package/dist/interface/resource/types.d.ts +6 -0
  1726. package/dist/interface/resource/types.js +2 -0
  1727. package/dist/interface/resource/types.js.map +1 -0
  1728. package/dist/interface/resource/value.d.ts +21 -0
  1729. package/dist/interface/resource/value.js +2 -0
  1730. package/dist/interface/resource/value.js.map +1 -0
  1731. package/dist/interface/resource/written.d.ts +3 -0
  1732. package/dist/interface/resource/written.js +2 -0
  1733. package/dist/interface/resource/written.js.map +1 -0
  1734. package/dist/interface/resources/always.d.ts +9 -0
  1735. package/dist/interface/resources/always.js +6 -0
  1736. package/dist/interface/resources/always.js.map +1 -0
  1737. package/dist/interface/resources/cadence.d.ts +21 -0
  1738. package/dist/interface/resources/cadence.js +18 -0
  1739. package/dist/interface/resources/cadence.js.map +1 -0
  1740. package/dist/interface/resources/clock.d.ts +16 -0
  1741. package/dist/interface/resources/clock.js +12 -0
  1742. package/dist/interface/resources/clock.js.map +1 -0
  1743. package/dist/interface/resources/gpu-device.d.ts +13 -0
  1744. package/dist/interface/resources/gpu-device.js +10 -0
  1745. package/dist/interface/resources/gpu-device.js.map +1 -0
  1746. package/dist/interface/resources/index.d.ts +6 -0
  1747. package/dist/interface/resources/index.js +8 -0
  1748. package/dist/interface/resources/index.js.map +1 -0
  1749. package/dist/interface/resources/wake.d.ts +13 -0
  1750. package/dist/interface/resources/wake.js +9 -0
  1751. package/dist/interface/resources/wake.js.map +1 -0
  1752. package/dist/interface/resources/workers.d.ts +9 -0
  1753. package/dist/interface/resources/workers.js +6 -0
  1754. package/dist/interface/resources/workers.js.map +1 -0
  1755. package/dist/interface/rule/create.d.ts +13 -0
  1756. package/dist/interface/rule/create.js +27 -0
  1757. package/dist/interface/rule/create.js.map +1 -0
  1758. package/dist/interface/rule/created.d.ts +7 -0
  1759. package/dist/interface/rule/created.js +2 -0
  1760. package/dist/interface/rule/created.js.map +1 -0
  1761. package/dist/interface/rule/declaration.d.ts +18 -0
  1762. package/dist/interface/rule/declaration.js +2 -0
  1763. package/dist/interface/rule/declaration.js.map +1 -0
  1764. package/dist/interface/rule/index.d.ts +1 -0
  1765. package/dist/interface/rule/index.js +3 -0
  1766. package/dist/interface/rule/index.js.map +1 -0
  1767. package/dist/interface/rule/rule.d.ts +2 -0
  1768. package/dist/interface/rule/rule.js +2 -0
  1769. package/dist/interface/rule/rule.js.map +1 -0
  1770. package/dist/interface/schema/is-struct.d.ts +43 -0
  1771. package/dist/interface/schema/is-struct.js +2 -0
  1772. package/dist/interface/schema/is-struct.js.map +1 -0
  1773. package/dist/interface/schema/schema.d.ts +171 -0
  1774. package/dist/interface/schema/schema.js +2 -0
  1775. package/dist/interface/schema/schema.js.map +1 -0
  1776. package/dist/interface/system/access.d.ts +132 -0
  1777. package/dist/interface/system/access.js +2 -0
  1778. package/dist/interface/system/access.js.map +1 -0
  1779. package/dist/interface/system/body.d.ts +83 -0
  1780. package/dist/interface/system/body.js +2 -0
  1781. package/dist/interface/system/body.js.map +1 -0
  1782. package/dist/interface/system/check.d.ts +24 -0
  1783. package/dist/interface/system/check.js +296 -0
  1784. package/dist/interface/system/check.js.map +1 -0
  1785. package/dist/interface/system/commands.d.ts +74 -0
  1786. package/dist/interface/system/commands.js +2 -0
  1787. package/dist/interface/system/commands.js.map +1 -0
  1788. package/dist/interface/system/composite-declaration.d.ts +11 -0
  1789. package/dist/interface/system/composite-declaration.js +2 -0
  1790. package/dist/interface/system/composite-declaration.js.map +1 -0
  1791. package/dist/interface/system/composite.d.ts +8 -0
  1792. package/dist/interface/system/composite.js +2 -0
  1793. package/dist/interface/system/composite.js.map +1 -0
  1794. package/dist/interface/system/create-resolved.d.ts +9 -0
  1795. package/dist/interface/system/create-resolved.js +18 -0
  1796. package/dist/interface/system/create-resolved.js.map +1 -0
  1797. package/dist/interface/system/create.d.ts +218 -0
  1798. package/dist/interface/system/create.js +55 -0
  1799. package/dist/interface/system/create.js.map +1 -0
  1800. package/dist/interface/system/declaration.d.ts +75 -0
  1801. package/dist/interface/system/declaration.js +2 -0
  1802. package/dist/interface/system/declaration.js.map +1 -0
  1803. package/dist/interface/system/definition.d.ts +4 -0
  1804. package/dist/interface/system/definition.js +2 -0
  1805. package/dist/interface/system/definition.js.map +1 -0
  1806. package/dist/interface/system/index.d.ts +3 -0
  1807. package/dist/interface/system/index.js +3 -0
  1808. package/dist/interface/system/index.js.map +1 -0
  1809. package/dist/interface/system/input.d.ts +59 -0
  1810. package/dist/interface/system/input.js +2 -0
  1811. package/dist/interface/system/input.js.map +1 -0
  1812. package/dist/interface/system/leaf.d.ts +19 -0
  1813. package/dist/interface/system/leaf.js +2 -0
  1814. package/dist/interface/system/leaf.js.map +1 -0
  1815. package/dist/interface/system/name.d.ts +6 -0
  1816. package/dist/interface/system/name.js +2 -0
  1817. package/dist/interface/system/name.js.map +1 -0
  1818. package/dist/interface/system/property.d.ts +4 -0
  1819. package/dist/interface/system/property.js +3 -0
  1820. package/dist/interface/system/property.js.map +1 -0
  1821. package/dist/interface/system/render.d.ts +84 -0
  1822. package/dist/interface/system/render.js +46 -0
  1823. package/dist/interface/system/render.js.map +1 -0
  1824. package/dist/interface/system/resolve.d.ts +68 -0
  1825. package/dist/interface/system/resolve.js +138 -0
  1826. package/dist/interface/system/resolve.js.map +1 -0
  1827. package/dist/interface/system/struct.d.ts +11 -0
  1828. package/dist/interface/system/struct.js +2 -0
  1829. package/dist/interface/system/struct.js.map +1 -0
  1830. package/dist/interface/system/system.d.ts +12 -0
  1831. package/dist/interface/system/system.js +2 -0
  1832. package/dist/interface/system/system.js.map +1 -0
  1833. package/dist/interface/system/threads.d.ts +47 -0
  1834. package/dist/interface/system/threads.js +2 -0
  1835. package/dist/interface/system/threads.js.map +1 -0
  1836. package/dist/interface/system/values-of.d.ts +17 -0
  1837. package/dist/interface/system/values-of.js +2 -0
  1838. package/dist/interface/system/values-of.js.map +1 -0
  1839. package/dist/interface/system/values.d.ts +73 -0
  1840. package/dist/interface/system/values.js +2 -0
  1841. package/dist/interface/system/values.js.map +1 -0
  1842. package/dist/interface/thread/of.d.ts +11 -0
  1843. package/dist/interface/thread/of.js +2 -0
  1844. package/dist/interface/thread/of.js.map +1 -0
  1845. package/dist/interface/thread/thread.d.ts +12 -0
  1846. package/dist/interface/thread/thread.js +2 -0
  1847. package/dist/interface/thread/thread.js.map +1 -0
  1848. package/dist/interface/trait/key.d.ts +4 -0
  1849. package/dist/interface/trait/key.js +2 -0
  1850. package/dist/interface/trait/key.js.map +1 -0
  1851. package/dist/interface/trait/types.d.ts +74 -0
  1852. package/dist/interface/trait/types.js +2 -0
  1853. package/dist/interface/trait/types.js.map +1 -0
  1854. package/dist/interface/world/create.d.ts +21 -0
  1855. package/dist/interface/world/create.js +2 -0
  1856. package/dist/interface/world/create.js.map +1 -0
  1857. package/dist/interface/world/declarations.d.ts +37 -0
  1858. package/dist/interface/world/declarations.js +2 -0
  1859. package/dist/interface/world/declarations.js.map +1 -0
  1860. package/dist/interface/world/filter.d.ts +8 -0
  1861. package/dist/interface/world/filter.js +3 -0
  1862. package/dist/interface/world/filter.js.map +1 -0
  1863. package/dist/interface/world/index.d.ts +1 -0
  1864. package/dist/interface/world/index.js +2 -0
  1865. package/dist/interface/world/index.js.map +1 -0
  1866. package/dist/interface/world/join.d.ts +17 -0
  1867. package/dist/interface/world/join.js +2 -0
  1868. package/dist/interface/world/join.js.map +1 -0
  1869. package/dist/interface/world/world.d.ts +73 -0
  1870. package/dist/interface/world/world.js +2 -0
  1871. package/dist/interface/world/world.js.map +1 -0
  1872. package/package.json +79 -3
  1873. package/src/exports.test.ts +276 -0
  1874. package/src/guide/00-keys.md +34 -0
  1875. package/src/guide/00-keys.out +1 -0
  1876. package/src/guide/00-keys.ts +35 -0
  1877. package/src/guide/00-setup.md +24 -0
  1878. package/src/guide/01-resources.md +22 -0
  1879. package/src/guide/01-resources.out +2 -0
  1880. package/src/guide/01-resources.ts +33 -0
  1881. package/src/guide/02-entities.md +19 -0
  1882. package/src/guide/02-entities.out +2 -0
  1883. package/src/guide/02-entities.ts +43 -0
  1884. package/src/guide/03-systems.md +22 -0
  1885. package/src/guide/03-systems.out +5 -0
  1886. package/src/guide/03-systems.ts +68 -0
  1887. package/src/guide/04-ticks.md +18 -0
  1888. package/src/guide/04-ticks.out +3 -0
  1889. package/src/guide/04-ticks.ts +53 -0
  1890. package/src/guide/05-scheduling.md +14 -0
  1891. package/src/guide/05-scheduling.out +2 -0
  1892. package/src/guide/05-scheduling.ts +46 -0
  1893. package/src/guide/06-sync-points.md +14 -0
  1894. package/src/guide/06-sync-points.out +3 -0
  1895. package/src/guide/06-sync-points.ts +42 -0
  1896. package/src/guide/07-change-filters.md +14 -0
  1897. package/src/guide/07-change-filters.out +6 -0
  1898. package/src/guide/07-change-filters.ts +70 -0
  1899. package/src/guide/08-input.md +12 -0
  1900. package/src/guide/08-input.out +1 -0
  1901. package/src/guide/08-input.ts +45 -0
  1902. package/src/guide/09-rules.md +12 -0
  1903. package/src/guide/09-rules.out +2 -0
  1904. package/src/guide/09-rules.ts +50 -0
  1905. package/src/guide/10-finalizers.md +13 -0
  1906. package/src/guide/10-finalizers.out +4 -0
  1907. package/src/guide/10-finalizers.ts +48 -0
  1908. package/src/guide/11-traits.md +16 -0
  1909. package/src/guide/11-traits.out +2 -0
  1910. package/src/guide/11-traits.ts +51 -0
  1911. package/src/guide/11-traits.type-test.ts +25 -0
  1912. package/src/guide/12-lookups.md +14 -0
  1913. package/src/guide/12-lookups.out +3 -0
  1914. package/src/guide/12-lookups.ts +59 -0
  1915. package/src/guide/13-indexes.md +21 -0
  1916. package/src/guide/13-indexes.out +8 -0
  1917. package/src/guide/13-indexes.ts +73 -0
  1918. package/src/guide/14-kernels.md +15 -0
  1919. package/src/guide/14-kernels.out +1 -0
  1920. package/src/guide/14-kernels.ts +48 -0
  1921. package/src/guide/15-reductions.md +12 -0
  1922. package/src/guide/15-reductions.out +1 -0
  1923. package/src/guide/15-reductions.ts +38 -0
  1924. package/src/guide/16-gpu.md +18 -0
  1925. package/src/guide/16-gpu.out +3 -0
  1926. package/src/guide/16-gpu.ts +51 -0
  1927. package/src/guide/17-hierarchies.md +11 -0
  1928. package/src/guide/17-hierarchies.out +1 -0
  1929. package/src/guide/17-hierarchies.ts +40 -0
  1930. package/src/guide/18-identity.md +10 -0
  1931. package/src/guide/18-identity.out +1 -0
  1932. package/src/guide/18-identity.ts +11 -0
  1933. package/src/guide/19-threads.md +16 -0
  1934. package/src/guide/19-threads.out +2 -0
  1935. package/src/guide/19-threads.ts +65 -0
  1936. package/src/guide/20-shared.md +29 -0
  1937. package/src/guide/20-shared.out +4 -0
  1938. package/src/guide/20-shared.ts +118 -0
  1939. package/src/guide/21-dom.md +22 -0
  1940. package/src/guide/21-dom.out +5 -0
  1941. package/src/guide/21-dom.ts +117 -0
  1942. package/src/guide/22-canvas.md +15 -0
  1943. package/src/guide/22-canvas.out +3 -0
  1944. package/src/guide/22-canvas.ts +119 -0
  1945. package/src/guide/CLAUDE.md +49 -0
  1946. package/src/guide/README.md +42 -0
  1947. package/src/guide/guide.test.ts +215 -0
  1948. package/src/implementation/compiler/access.ts +149 -0
  1949. package/src/implementation/compiler/archetypes.test.ts +64 -0
  1950. package/src/implementation/compiler/archetypes.ts +134 -0
  1951. package/src/implementation/compiler/assign.ts +168 -0
  1952. package/src/implementation/compiler/augmentations.test.ts +418 -0
  1953. package/src/implementation/compiler/augmentations.ts +871 -0
  1954. package/src/implementation/compiler/bind.ts +89 -0
  1955. package/src/implementation/compiler/body-access.ts +434 -0
  1956. package/src/implementation/compiler/booleans.ts +39 -0
  1957. package/src/implementation/compiler/branches.ts +46 -0
  1958. package/src/implementation/compiler/calls.ts +395 -0
  1959. package/src/implementation/compiler/columns.ts +62 -0
  1960. package/src/implementation/compiler/compile-kernel.ts +204 -0
  1961. package/src/implementation/compiler/compiler.ts +9 -0
  1962. package/src/implementation/compiler/data.ts +95 -0
  1963. package/src/implementation/compiler/describe.test-helper.ts +97 -0
  1964. package/src/implementation/compiler/describe.test.ts +168 -0
  1965. package/src/implementation/compiler/describe.ts +489 -0
  1966. package/src/implementation/compiler/estree.ts +64 -0
  1967. package/src/implementation/compiler/expression.ts +146 -0
  1968. package/src/implementation/compiler/failure.ts +38 -0
  1969. package/src/implementation/compiler/hygiene.test.ts +66 -0
  1970. package/src/implementation/compiler/identify.test.ts +209 -0
  1971. package/src/implementation/compiler/identify.ts +212 -0
  1972. package/src/implementation/compiler/index.ts +6 -0
  1973. package/src/implementation/compiler/inferred.test.ts +32 -0
  1974. package/src/implementation/compiler/inferred.ts +197 -0
  1975. package/src/implementation/compiler/inline-kernels.test.ts +10 -0
  1976. package/src/implementation/compiler/inline-kernels.ts +21 -0
  1977. package/src/implementation/compiler/input-schemas.test.ts +182 -0
  1978. package/src/implementation/compiler/input-schemas.ts +107 -0
  1979. package/src/implementation/compiler/ir.ts +106 -0
  1980. package/src/implementation/compiler/kernel-id.ts +34 -0
  1981. package/src/implementation/compiler/key.ts +33 -0
  1982. package/src/implementation/compiler/link.test.ts +73 -0
  1983. package/src/implementation/compiler/link.ts +231 -0
  1984. package/src/implementation/compiler/lists.ts +230 -0
  1985. package/src/implementation/compiler/lookups.ts +121 -0
  1986. package/src/implementation/compiler/math.ts +10 -0
  1987. package/src/implementation/compiler/memory-compiler.browser.test.ts +85 -0
  1988. package/src/implementation/compiler/memory-compiler.test.ts +147 -0
  1989. package/src/implementation/compiler/memory-compiler.ts +307 -0
  1990. package/src/implementation/compiler/module-scope.ts +141 -0
  1991. package/src/implementation/compiler/module-value.ts +136 -0
  1992. package/src/implementation/compiler/out.ts +7 -0
  1993. package/src/implementation/compiler/oxc.test-helper.ts +20 -0
  1994. package/src/implementation/compiler/oxc.test.ts +69 -0
  1995. package/src/implementation/compiler/oxc.ts +90 -0
  1996. package/src/implementation/compiler/package-copies.ts +208 -0
  1997. package/src/implementation/compiler/passes.ts +34 -0
  1998. package/src/implementation/compiler/paths.ts +24 -0
  1999. package/src/implementation/compiler/plugin.test.ts +686 -0
  2000. package/src/implementation/compiler/plugin.ts +384 -0
  2001. package/src/implementation/compiler/posix.test.ts +34 -0
  2002. package/src/implementation/compiler/posix.ts +183 -0
  2003. package/src/implementation/compiler/predicates.test.ts +90 -0
  2004. package/src/implementation/compiler/predicates.ts +250 -0
  2005. package/src/implementation/compiler/print.ts +124 -0
  2006. package/src/implementation/compiler/program.ts +235 -0
  2007. package/src/implementation/compiler/public.ts +2 -0
  2008. package/src/implementation/compiler/scalar.ts +47 -0
  2009. package/src/implementation/compiler/scope.ts +28 -0
  2010. package/src/implementation/compiler/serialize.ts +11 -0
  2011. package/src/implementation/compiler/shared-kernels.test.ts +57 -0
  2012. package/src/implementation/compiler/signature.ts +210 -0
  2013. package/src/implementation/compiler/snapshot.ts +37 -0
  2014. package/src/implementation/compiler/source-map.test.ts +41 -0
  2015. package/src/implementation/compiler/source-map.ts +135 -0
  2016. package/src/implementation/compiler/spawns.ts +171 -0
  2017. package/src/implementation/compiler/stamps.ts +46 -0
  2018. package/src/implementation/compiler/statement.ts +103 -0
  2019. package/src/implementation/compiler/subset.md +83 -0
  2020. package/src/implementation/compiler/terminal.ts +50 -0
  2021. package/src/implementation/compiler/transform.test.ts +1534 -0
  2022. package/src/implementation/compiler/transform.ts +498 -0
  2023. package/src/implementation/compiler/type-host.test-helper.ts +27 -0
  2024. package/src/implementation/compiler/type-schemas.ts +714 -0
  2025. package/src/implementation/compiler/unit.ts +132 -0
  2026. package/src/implementation/compiler/value.ts +61 -0
  2027. package/src/implementation/compiler/wat.test.ts +135 -0
  2028. package/src/implementation/compiler/wat.ts +365 -0
  2029. package/src/implementation/index.ts +3 -0
  2030. package/src/implementation/world/activate.ts +134 -0
  2031. package/src/implementation/world/archetype.ts +501 -0
  2032. package/src/implementation/world/arrays.test.ts +25 -0
  2033. package/src/implementation/world/arrays.ts +48 -0
  2034. package/src/implementation/world/arrivals.test.ts +89 -0
  2035. package/src/implementation/world/arrivals.ts +165 -0
  2036. package/src/implementation/world/async-loading.test.ts +86 -0
  2037. package/src/implementation/world/attach-kernel.test.ts +17 -0
  2038. package/src/implementation/world/attach-kernel.ts +31 -0
  2039. package/src/implementation/world/batches.test.ts +126 -0
  2040. package/src/implementation/world/batches.ts +185 -0
  2041. package/src/implementation/world/buffer.ts +176 -0
  2042. package/src/implementation/world/builtins.test.ts +87 -0
  2043. package/src/implementation/world/cascade.ts +145 -0
  2044. package/src/implementation/world/cells.ts +25 -0
  2045. package/src/implementation/world/change-blocks.browser.test.ts +76 -0
  2046. package/src/implementation/world/change-blocks.cases.ts +14 -0
  2047. package/src/implementation/world/change-blocks.fixture.ts +70 -0
  2048. package/src/implementation/world/change-blocks.test.ts +264 -0
  2049. package/src/implementation/world/changes-finalizers.test.ts +38 -0
  2050. package/src/implementation/world/check-kernel.ts +100 -0
  2051. package/src/implementation/world/claims.test.ts +42 -0
  2052. package/src/implementation/world/claims.ts +51 -0
  2053. package/src/implementation/world/closure.test.ts +40 -0
  2054. package/src/implementation/world/closure.ts +41 -0
  2055. package/src/implementation/world/command-ring.ts +475 -0
  2056. package/src/implementation/world/command-rings.cases.ts +48 -0
  2057. package/src/implementation/world/command-rings.fixture.ts +180 -0
  2058. package/src/implementation/world/commands.test.ts +385 -0
  2059. package/src/implementation/world/commands.ts +100 -0
  2060. package/src/implementation/world/composite-input.test.ts +39 -0
  2061. package/src/implementation/world/conditions.test.ts +113 -0
  2062. package/src/implementation/world/constant-unions.test.ts +43 -0
  2063. package/src/implementation/world/create.test.ts +362 -0
  2064. package/src/implementation/world/create.ts +1061 -0
  2065. package/src/implementation/world/defaults.test.ts +86 -0
  2066. package/src/implementation/world/directories.ts +87 -0
  2067. package/src/implementation/world/directory.test.ts +53 -0
  2068. package/src/implementation/world/dispatch.cases.ts +33 -0
  2069. package/src/implementation/world/dispatch.fixture.ts +163 -0
  2070. package/src/implementation/world/entities.ts +190 -0
  2071. package/src/implementation/world/entity-lookup-workers.cases.ts +19 -0
  2072. package/src/implementation/world/entity-lookup-workers.fixture.ts +102 -0
  2073. package/src/implementation/world/entity-lookups.browser.test.ts +51 -0
  2074. package/src/implementation/world/entity-lookups.test-helper.ts +195 -0
  2075. package/src/implementation/world/entity-lookups.test.ts +105 -0
  2076. package/src/implementation/world/execute.ts +745 -0
  2077. package/src/implementation/world/failing-worker.fixture.ts +3 -0
  2078. package/src/implementation/world/failures.ts +71 -0
  2079. package/src/implementation/world/finalizers.test.ts +302 -0
  2080. package/src/implementation/world/finalizers.ts +451 -0
  2081. package/src/implementation/world/fixtures.test-helper.ts +20 -0
  2082. package/src/implementation/world/generated-code.md +144 -0
  2083. package/src/implementation/world/gpu.browser.test.ts +701 -0
  2084. package/src/implementation/world/gpu.test-helper.ts +12 -0
  2085. package/src/implementation/world/gpu.ts +405 -0
  2086. package/src/implementation/world/holders.ts +69 -0
  2087. package/src/implementation/world/ids-changes.test-helper.ts +4 -0
  2088. package/src/implementation/world/ids-keys.test-helper.ts +21 -0
  2089. package/src/implementation/world/ids.test.ts +31 -0
  2090. package/src/implementation/world/imported-lists.test-helper.ts +18 -0
  2091. package/src/implementation/world/imported-lists.test.ts +44 -0
  2092. package/src/implementation/world/index-buckets.test.ts +276 -0
  2093. package/src/implementation/world/index-build-csp.test.ts +58 -0
  2094. package/src/implementation/world/index-build.cases.ts +21 -0
  2095. package/src/implementation/world/index-build.fixture.ts +122 -0
  2096. package/src/implementation/world/index-build.ts +459 -0
  2097. package/src/implementation/world/index-changed.test.ts +235 -0
  2098. package/src/implementation/world/index-hash.test.ts +34 -0
  2099. package/src/implementation/world/index-hash.ts +858 -0
  2100. package/src/implementation/world/index-joined.test.ts +451 -0
  2101. package/src/implementation/world/index-kernels.test.ts +195 -0
  2102. package/src/implementation/world/index-keyless.test.ts +271 -0
  2103. package/src/implementation/world/index-keys.ts +272 -0
  2104. package/src/implementation/world/index-lookups-csp.test.ts +43 -0
  2105. package/src/implementation/world/index-lookups.ts +629 -0
  2106. package/src/implementation/world/index-order.test.ts +150 -0
  2107. package/src/implementation/world/index-order.ts +183 -0
  2108. package/src/implementation/world/index-readers.ts +325 -0
  2109. package/src/implementation/world/index-sorted.test.ts +76 -0
  2110. package/src/implementation/world/index-sorted.ts +656 -0
  2111. package/src/implementation/world/index-workers.cases.ts +27 -0
  2112. package/src/implementation/world/index-workers.fixture.ts +250 -0
  2113. package/src/implementation/world/indexes.test.ts +719 -0
  2114. package/src/implementation/world/indexes.ts +1163 -0
  2115. package/src/implementation/world/input.ts +15 -0
  2116. package/src/implementation/world/intrinsics-coverage.test.ts +26 -0
  2117. package/src/implementation/world/intrinsics.browser.test.ts +544 -0
  2118. package/src/implementation/world/intrinsics.ts +41 -0
  2119. package/src/implementation/world/join.test.ts +309 -0
  2120. package/src/implementation/world/join.ts +729 -0
  2121. package/src/implementation/world/join.type-test.ts +29 -0
  2122. package/src/implementation/world/joined-observer.test.ts +58 -0
  2123. package/src/implementation/world/joined-observer.ts +875 -0
  2124. package/src/implementation/world/joining-worker.fixture.ts +109 -0
  2125. package/src/implementation/world/joining.cases.ts +88 -0
  2126. package/src/implementation/world/joining.fixture.ts +238 -0
  2127. package/src/implementation/world/joining.test-helper.ts +90 -0
  2128. package/src/implementation/world/joining.ts +387 -0
  2129. package/src/implementation/world/journal.ts +40 -0
  2130. package/src/implementation/world/kernel-imports-sparks.test-helper.ts +16 -0
  2131. package/src/implementation/world/kernel-imports-steer.test-helper.ts +10 -0
  2132. package/src/implementation/world/kernel-imports.test.ts +71 -0
  2133. package/src/implementation/world/kernel-indexes.ts +174 -0
  2134. package/src/implementation/world/kernel-lookup.test-helper.ts +26 -0
  2135. package/src/implementation/world/kernel-path.test-helper.ts +18 -0
  2136. package/src/implementation/world/kernel-spawns.test.ts +148 -0
  2137. package/src/implementation/world/kernel-tried.test-helper.ts +31 -0
  2138. package/src/implementation/world/kernel.ts +268 -0
  2139. package/src/implementation/world/kernels-csp.test.ts +42 -0
  2140. package/src/implementation/world/kernels.test.ts +82 -0
  2141. package/src/implementation/world/kernels.ts +398 -0
  2142. package/src/implementation/world/layout-directory.browser.test.ts +195 -0
  2143. package/src/implementation/world/layout-directory.cases.ts +38 -0
  2144. package/src/implementation/world/layout-directory.fixture.ts +176 -0
  2145. package/src/implementation/world/layout-directory.ts +282 -0
  2146. package/src/implementation/world/lifetime.cases.ts +19 -0
  2147. package/src/implementation/world/lifetime.fixture.ts +68 -0
  2148. package/src/implementation/world/lifetime.test-helper.ts +79 -0
  2149. package/src/implementation/world/lifetime.test.ts +80 -0
  2150. package/src/implementation/world/lists.ts +303 -0
  2151. package/src/implementation/world/lookup-keys.ts +49 -0
  2152. package/src/implementation/world/loop.test.ts +193 -0
  2153. package/src/implementation/world/loop.ts +295 -0
  2154. package/src/implementation/world/memory.test.ts +42 -0
  2155. package/src/implementation/world/memory.ts +90 -0
  2156. package/src/implementation/world/mirror.ts +638 -0
  2157. package/src/implementation/world/move-log.test.ts +429 -0
  2158. package/src/implementation/world/move-log.ts +216 -0
  2159. package/src/implementation/world/names.test.ts +80 -0
  2160. package/src/implementation/world/observe-cases.browser.test.ts +97 -0
  2161. package/src/implementation/world/observe-cases.test.ts +752 -0
  2162. package/src/implementation/world/observe-factories.test.ts +301 -0
  2163. package/src/implementation/world/observe-joined-cases.test.ts +221 -0
  2164. package/src/implementation/world/observe-ticks-cases.test.ts +211 -0
  2165. package/src/implementation/world/observe.test-helper.ts +14 -0
  2166. package/src/implementation/world/observed-workers.cases.ts +13 -0
  2167. package/src/implementation/world/observed-workers.fixture.ts +54 -0
  2168. package/src/implementation/world/observer-contained-worker.fixture.ts +41 -0
  2169. package/src/implementation/world/observer-contained.browser.test.ts +5 -0
  2170. package/src/implementation/world/observer-contained.cases.ts +17 -0
  2171. package/src/implementation/world/observer-contained.fixture.ts +121 -0
  2172. package/src/implementation/world/observer-contained.test-helper.ts +42 -0
  2173. package/src/implementation/world/observer-contained.test.ts +88 -0
  2174. package/src/implementation/world/observer-joined-worker.fixture.ts +81 -0
  2175. package/src/implementation/world/observer-joined.cases.ts +29 -0
  2176. package/src/implementation/world/observer-joined.fixture.ts +288 -0
  2177. package/src/implementation/world/observer-joined.test-helper.ts +171 -0
  2178. package/src/implementation/world/observer-joined.test.ts +366 -0
  2179. package/src/implementation/world/observer.browser.test.ts +73 -0
  2180. package/src/implementation/world/observer.test.ts +291 -0
  2181. package/src/implementation/world/observer.ts +139 -0
  2182. package/src/implementation/world/optional-workers.cases.ts +19 -0
  2183. package/src/implementation/world/optional-workers.fixture.ts +55 -0
  2184. package/src/implementation/world/optional.test.ts +351 -0
  2185. package/src/implementation/world/order.ts +352 -0
  2186. package/src/implementation/world/out-of-band.ts +61 -0
  2187. package/src/implementation/world/outcomes.test-helper.ts +138 -0
  2188. package/src/implementation/world/package-id.test-helper.ts +9 -0
  2189. package/src/implementation/world/perf.md +476 -0
  2190. package/src/implementation/world/plan.md +81 -0
  2191. package/src/implementation/world/plan.ts +72 -0
  2192. package/src/implementation/world/platforms.test-helper.ts +68 -0
  2193. package/src/implementation/world/pool-size.cases.ts +41 -0
  2194. package/src/implementation/world/pool-size.fixture.ts +158 -0
  2195. package/src/implementation/world/pool.cases.ts +31 -0
  2196. package/src/implementation/world/pool.fixture.ts +55 -0
  2197. package/src/implementation/world/pool.ts +324 -0
  2198. package/src/implementation/world/port.test.ts +45 -0
  2199. package/src/implementation/world/port.ts +148 -0
  2200. package/src/implementation/world/ports.cases.ts +37 -0
  2201. package/src/implementation/world/ports.fixture.ts +106 -0
  2202. package/src/implementation/world/ports.type-test.ts +15 -0
  2203. package/src/implementation/world/precision.test.ts +174 -0
  2204. package/src/implementation/world/prepared-lookup.ts +96 -0
  2205. package/src/implementation/world/prepared-spawn.ts +165 -0
  2206. package/src/implementation/world/program.ts +14 -0
  2207. package/src/implementation/world/protocol.ts +134 -0
  2208. package/src/implementation/world/publish.ts +29 -0
  2209. package/src/implementation/world/ranges.test.ts +66 -0
  2210. package/src/implementation/world/ranges.ts +110 -0
  2211. package/src/implementation/world/reads.test-helper.ts +30 -0
  2212. package/src/implementation/world/reclaim.test.ts +214 -0
  2213. package/src/implementation/world/reclaim.ts +170 -0
  2214. package/src/implementation/world/reductions.cases.ts +23 -0
  2215. package/src/implementation/world/reductions.fixture.ts +60 -0
  2216. package/src/implementation/world/reductions.test.ts +266 -0
  2217. package/src/implementation/world/reductions.ts +107 -0
  2218. package/src/implementation/world/reevaluation.test-helper.ts +16 -0
  2219. package/src/implementation/world/reevaluation.test.ts +33 -0
  2220. package/src/implementation/world/register.ts +413 -0
  2221. package/src/implementation/world/remote-finalizers-worker.fixture.ts +59 -0
  2222. package/src/implementation/world/remote-finalizers.cases.ts +42 -0
  2223. package/src/implementation/world/remote-finalizers.fixture.ts +215 -0
  2224. package/src/implementation/world/remote-finalizers.test-helper.ts +252 -0
  2225. package/src/implementation/world/remote-finalizers.test.ts +254 -0
  2226. package/src/implementation/world/remote-objects-worker.fixture.ts +21 -0
  2227. package/src/implementation/world/remote-objects.cases.ts +17 -0
  2228. package/src/implementation/world/remote-objects.fixture.ts +61 -0
  2229. package/src/implementation/world/remote-objects.test-helper.ts +106 -0
  2230. package/src/implementation/world/remote-systems.ts +641 -0
  2231. package/src/implementation/world/remote.test.ts +184 -0
  2232. package/src/implementation/world/remote.ts +126 -0
  2233. package/src/implementation/world/removal-worker.fixture.ts +21 -0
  2234. package/src/implementation/world/removal.cases.ts +17 -0
  2235. package/src/implementation/world/removal.fixture.ts +96 -0
  2236. package/src/implementation/world/remove-joined.test.ts +182 -0
  2237. package/src/implementation/world/remove.test-helper.ts +82 -0
  2238. package/src/implementation/world/remove.test.ts +191 -0
  2239. package/src/implementation/world/render-order.browser.test.ts +209 -0
  2240. package/src/implementation/world/render-order.ts +150 -0
  2241. package/src/implementation/world/required.ts +10 -0
  2242. package/src/implementation/world/resources.ts +71 -0
  2243. package/src/implementation/world/rows.test.ts +75 -0
  2244. package/src/implementation/world/rows.ts +584 -0
  2245. package/src/implementation/world/rules.test.ts +242 -0
  2246. package/src/implementation/world/run-results.test.ts +374 -0
  2247. package/src/implementation/world/runner.ts +1379 -0
  2248. package/src/implementation/world/schedule.test.ts +122 -0
  2249. package/src/implementation/world/semantics.test.ts +95 -0
  2250. package/src/implementation/world/share.test.ts +18 -0
  2251. package/src/implementation/world/shared-gpu.browser.test.ts +109 -0
  2252. package/src/implementation/world/shared-kernels.test.ts +117 -0
  2253. package/src/implementation/world/shared-workers.cases.ts +20 -0
  2254. package/src/implementation/world/shared-workers.fixture.ts +74 -0
  2255. package/src/implementation/world/shared.test.ts +348 -0
  2256. package/src/implementation/world/shared.ts +316 -0
  2257. package/src/implementation/world/sharing.ts +652 -0
  2258. package/src/implementation/world/staging.ts +239 -0
  2259. package/src/implementation/world/state.ts +678 -0
  2260. package/src/implementation/world/stop-lists.ts +377 -0
  2261. package/src/implementation/world/strings.test.ts +189 -0
  2262. package/src/implementation/world/strings.ts +247 -0
  2263. package/src/implementation/world/structure.ts +74 -0
  2264. package/src/implementation/world/synchronize.test.ts +55 -0
  2265. package/src/implementation/world/synchronize.ts +805 -0
  2266. package/src/implementation/world/tail-blocks.ts +79 -0
  2267. package/src/implementation/world/tails-worker.fixture.ts +62 -0
  2268. package/src/implementation/world/tails.cases.ts +45 -0
  2269. package/src/implementation/world/tails.fixture.ts +257 -0
  2270. package/src/implementation/world/tails.test-helper.ts +173 -0
  2271. package/src/implementation/world/tails.test.ts +109 -0
  2272. package/src/implementation/world/tails.ts +490 -0
  2273. package/src/implementation/world/target.test.ts +70 -0
  2274. package/src/implementation/world/terminal.ts +14 -0
  2275. package/src/implementation/world/thread-directory.ts +279 -0
  2276. package/src/implementation/world/thread-finalizers.ts +424 -0
  2277. package/src/implementation/world/thread-indexes.ts +92 -0
  2278. package/src/implementation/world/thread-observer.ts +281 -0
  2279. package/src/implementation/world/thread-systems-worker.fixture.ts +69 -0
  2280. package/src/implementation/world/thread-systems.cases.ts +54 -0
  2281. package/src/implementation/world/thread-systems.fixture.ts +234 -0
  2282. package/src/implementation/world/thread-systems.test-helper.ts +330 -0
  2283. package/src/implementation/world/thread-systems.test.ts +145 -0
  2284. package/src/implementation/world/thread-systems.ts +1514 -0
  2285. package/src/implementation/world/thread-tasks.ts +80 -0
  2286. package/src/implementation/world/threads.browser.test.ts +51 -0
  2287. package/src/implementation/world/threads.test.ts +83 -0
  2288. package/src/implementation/world/ticks.browser.test.ts +43 -0
  2289. package/src/implementation/world/ticks.test.ts +34 -0
  2290. package/src/implementation/world/traits.test.ts +62 -0
  2291. package/src/implementation/world/transfers-worker.fixture.ts +119 -0
  2292. package/src/implementation/world/transfers.cases.ts +31 -0
  2293. package/src/implementation/world/transfers.fixture.ts +140 -0
  2294. package/src/implementation/world/transfers.test-helper.ts +101 -0
  2295. package/src/implementation/world/transfers.test.ts +153 -0
  2296. package/src/implementation/world/transfers.ts +105 -0
  2297. package/src/implementation/world/unidentified-finalizers.test.ts +58 -0
  2298. package/src/implementation/world/up-tree.test.ts +312 -0
  2299. package/src/implementation/world/up-workers.cases.ts +14 -0
  2300. package/src/implementation/world/up-workers.fixture.ts +63 -0
  2301. package/src/implementation/world/up.browser.test.ts +75 -0
  2302. package/src/implementation/world/up.test.ts +298 -0
  2303. package/src/implementation/world/up.ts +912 -0
  2304. package/src/implementation/world/wasm-kernels.test.ts +275 -0
  2305. package/src/implementation/world/wasm.test.ts +559 -0
  2306. package/src/implementation/world/wasm.ts +2365 -0
  2307. package/src/implementation/world/wgsl.test.ts +42 -0
  2308. package/src/implementation/world/wgsl.ts +481 -0
  2309. package/src/implementation/world/where.test.ts +342 -0
  2310. package/src/implementation/world/where.ts +236 -0
  2311. package/src/implementation/world/worker-platform.ts +106 -0
  2312. package/src/implementation/world/worker-window.test.ts +43 -0
  2313. package/src/implementation/world/worker-window.ts +43 -0
  2314. package/src/implementation/world/worker.ts +548 -0
  2315. package/src/implementation/world/workers-follow.test.ts +51 -0
  2316. package/src/implementation/world/workers.cases.ts +60 -0
  2317. package/src/implementation/world/workers.fixture.ts +238 -0
  2318. package/src/implementation/world/world-host.fixture.ts +11 -0
  2319. package/src/index.ts +21 -0
  2320. package/src/interface/CLAUDE.md +33 -0
  2321. package/src/interface/component/component.ts +5 -0
  2322. package/src/interface/component/index.ts +3 -0
  2323. package/src/interface/component/key.ts +4 -0
  2324. package/src/interface/component/key.type-test.ts +30 -0
  2325. package/src/interface/component/register.test.ts +117 -0
  2326. package/src/interface/component/types.ts +7 -0
  2327. package/src/interface/component/value.ts +41 -0
  2328. package/src/interface/component/values.ts +6 -0
  2329. package/src/interface/entity/entity.ts +10 -0
  2330. package/src/interface/entity/index.ts +12 -0
  2331. package/src/interface/finalizer/body.ts +52 -0
  2332. package/src/interface/finalizer/create.test.ts +143 -0
  2333. package/src/interface/finalizer/create.ts +158 -0
  2334. package/src/interface/finalizer/created.ts +22 -0
  2335. package/src/interface/finalizer/declaration.ts +48 -0
  2336. package/src/interface/finalizer/finalizer.ts +8 -0
  2337. package/src/interface/finalizer/index.ts +2 -0
  2338. package/src/interface/gpu/accessors.ts +90 -0
  2339. package/src/interface/gpu/gpu.ts +5 -0
  2340. package/src/interface/gpu/gpu.type-test.ts +27 -0
  2341. package/src/interface/gpu/index.ts +3 -0
  2342. package/src/interface/gpu/layout.ts +23 -0
  2343. package/src/interface/gpu/record.ts +6 -0
  2344. package/src/interface/gpu/wgsl.ts +23 -0
  2345. package/src/interface/index.ts +17 -0
  2346. package/src/interface/index.type-test.ts +52 -0
  2347. package/src/interface/indexes/create.test.ts +146 -0
  2348. package/src/interface/indexes/create.ts +88 -0
  2349. package/src/interface/indexes/created.ts +5 -0
  2350. package/src/interface/indexes/declaration.ts +15 -0
  2351. package/src/interface/indexes/index-type.ts +13 -0
  2352. package/src/interface/indexes/index.ts +2 -0
  2353. package/src/interface/indexes/index.type-test.ts +244 -0
  2354. package/src/interface/math/f32/default.ts +6 -0
  2355. package/src/interface/math/f32/index.ts +7 -0
  2356. package/src/interface/math/f32/public.ts +3 -0
  2357. package/src/interface/math/f32/round-half-even.ts +6 -0
  2358. package/src/interface/math/f32/schema.ts +4 -0
  2359. package/src/interface/math/i32/default.ts +6 -0
  2360. package/src/interface/math/i32/index.ts +8 -0
  2361. package/src/interface/math/i32/public.ts +4 -0
  2362. package/src/interface/math/i32/schema.ts +4 -0
  2363. package/src/interface/math/i32/shift-right.ts +4 -0
  2364. package/src/interface/math/index.ts +9 -0
  2365. package/src/interface/math/intrinsic.ts +19 -0
  2366. package/src/interface/math/mat4x4/add.ts +10 -0
  2367. package/src/interface/math/mat4x4/determinant.ts +27 -0
  2368. package/src/interface/math/mat4x4/identity.ts +9 -0
  2369. package/src/interface/math/mat4x4/index.ts +29 -0
  2370. package/src/interface/math/mat4x4/inverse.ts +50 -0
  2371. package/src/interface/math/mat4x4/look-at.test.ts +14 -0
  2372. package/src/interface/math/mat4x4/look-at.ts +27 -0
  2373. package/src/interface/math/mat4x4/multiply-vec3.ts +9 -0
  2374. package/src/interface/math/mat4x4/multiply-vec4.ts +11 -0
  2375. package/src/interface/math/mat4x4/multiply.ts +23 -0
  2376. package/src/interface/math/mat4x4/orthographic.ts +21 -0
  2377. package/src/interface/math/mat4x4/perspective.ts +21 -0
  2378. package/src/interface/math/mat4x4/public.ts +22 -0
  2379. package/src/interface/math/mat4x4/rotation-x.ts +13 -0
  2380. package/src/interface/math/mat4x4/rotation-y.ts +13 -0
  2381. package/src/interface/math/mat4x4/rotation-z.ts +13 -0
  2382. package/src/interface/math/mat4x4/rotation.test.ts +17 -0
  2383. package/src/interface/math/mat4x4/scale.ts +10 -0
  2384. package/src/interface/math/mat4x4/scaling.ts +9 -0
  2385. package/src/interface/math/mat4x4/schema.ts +5 -0
  2386. package/src/interface/math/mat4x4/subtract.ts +10 -0
  2387. package/src/interface/math/mat4x4/translation.ts +9 -0
  2388. package/src/interface/math/mat4x4/transpose.ts +10 -0
  2389. package/src/interface/math/mat4x4/zero.ts +9 -0
  2390. package/src/interface/math/math.type-test.ts +43 -0
  2391. package/src/interface/math/quat/add.ts +10 -0
  2392. package/src/interface/math/quat/align-to.ts +45 -0
  2393. package/src/interface/math/quat/conjugate.ts +4 -0
  2394. package/src/interface/math/quat/distance.ts +6 -0
  2395. package/src/interface/math/quat/dot.ts +6 -0
  2396. package/src/interface/math/quat/from-axis-angle.ts +15 -0
  2397. package/src/interface/math/quat/from-euler.ts +18 -0
  2398. package/src/interface/math/quat/identity.ts +4 -0
  2399. package/src/interface/math/quat/index.ts +7 -0
  2400. package/src/interface/math/quat/inverse.ts +11 -0
  2401. package/src/interface/math/quat/length-squared.ts +4 -0
  2402. package/src/interface/math/quat/length.ts +5 -0
  2403. package/src/interface/math/quat/lerp.ts +9 -0
  2404. package/src/interface/math/quat/look-at.ts +53 -0
  2405. package/src/interface/math/quat/multiply.ts +9 -0
  2406. package/src/interface/math/quat/negate.ts +5 -0
  2407. package/src/interface/math/quat/normalize.ts +9 -0
  2408. package/src/interface/math/quat/public.ts +26 -0
  2409. package/src/interface/math/quat/rotate-vec3.ts +17 -0
  2410. package/src/interface/math/quat/scale.ts +5 -0
  2411. package/src/interface/math/quat/schema.ts +5 -0
  2412. package/src/interface/math/quat/slerp.ts +27 -0
  2413. package/src/interface/math/quat/subtract.ts +10 -0
  2414. package/src/interface/math/quat/to-axis-angle.ts +15 -0
  2415. package/src/interface/math/quat/to-euler.ts +26 -0
  2416. package/src/interface/math/quat/to-mat4.ts +28 -0
  2417. package/src/interface/math/semantics.test.ts +51 -0
  2418. package/src/interface/math/u32/count-leading-zeros.ts +5 -0
  2419. package/src/interface/math/u32/count-one-bits.ts +11 -0
  2420. package/src/interface/math/u32/count-trailing-zeros.ts +8 -0
  2421. package/src/interface/math/u32/default.ts +6 -0
  2422. package/src/interface/math/u32/index.ts +8 -0
  2423. package/src/interface/math/u32/public.ts +8 -0
  2424. package/src/interface/math/u32/reverse-bits.ts +12 -0
  2425. package/src/interface/math/u32/schema.ts +4 -0
  2426. package/src/interface/math/u32/shift-right.ts +4 -0
  2427. package/src/interface/math/vec2/f32/abs.ts +5 -0
  2428. package/src/interface/math/vec2/f32/acos.ts +5 -0
  2429. package/src/interface/math/vec2/f32/acosh.ts +5 -0
  2430. package/src/interface/math/vec2/f32/add.ts +5 -0
  2431. package/src/interface/math/vec2/f32/asin.ts +5 -0
  2432. package/src/interface/math/vec2/f32/asinh.ts +5 -0
  2433. package/src/interface/math/vec2/f32/atan.ts +5 -0
  2434. package/src/interface/math/vec2/f32/atanh.ts +5 -0
  2435. package/src/interface/math/vec2/f32/ceil.ts +5 -0
  2436. package/src/interface/math/vec2/f32/clamp.ts +7 -0
  2437. package/src/interface/math/vec2/f32/cos.ts +5 -0
  2438. package/src/interface/math/vec2/f32/cosh.ts +5 -0
  2439. package/src/interface/math/vec2/f32/distance.ts +7 -0
  2440. package/src/interface/math/vec2/f32/dot.ts +5 -0
  2441. package/src/interface/math/vec2/f32/equals.ts +4 -0
  2442. package/src/interface/math/vec2/f32/exp.ts +5 -0
  2443. package/src/interface/math/vec2/f32/exp2.ts +5 -0
  2444. package/src/interface/math/vec2/f32/f32.ts +7 -0
  2445. package/src/interface/math/vec2/f32/faceforward.ts +8 -0
  2446. package/src/interface/math/vec2/f32/floor.ts +5 -0
  2447. package/src/interface/math/vec2/f32/fract.ts +5 -0
  2448. package/src/interface/math/vec2/f32/length.ts +5 -0
  2449. package/src/interface/math/vec2/f32/log.ts +5 -0
  2450. package/src/interface/math/vec2/f32/log2.ts +5 -0
  2451. package/src/interface/math/vec2/f32/max.ts +5 -0
  2452. package/src/interface/math/vec2/f32/min.ts +5 -0
  2453. package/src/interface/math/vec2/f32/mix.ts +8 -0
  2454. package/src/interface/math/vec2/f32/mod.ts +4 -0
  2455. package/src/interface/math/vec2/f32/modf.ts +8 -0
  2456. package/src/interface/math/vec2/f32/negate.ts +5 -0
  2457. package/src/interface/math/vec2/f32/normalize.ts +7 -0
  2458. package/src/interface/math/vec2/f32/pow.ts +9 -0
  2459. package/src/interface/math/vec2/f32/public.ts +49 -0
  2460. package/src/interface/math/vec2/f32/reflect.ts +11 -0
  2461. package/src/interface/math/vec2/f32/refract.ts +16 -0
  2462. package/src/interface/math/vec2/f32/round.ts +6 -0
  2463. package/src/interface/math/vec2/f32/scale.ts +5 -0
  2464. package/src/interface/math/vec2/f32/schema.ts +5 -0
  2465. package/src/interface/math/vec2/f32/sign.ts +5 -0
  2466. package/src/interface/math/vec2/f32/sin.ts +5 -0
  2467. package/src/interface/math/vec2/f32/sinh.ts +5 -0
  2468. package/src/interface/math/vec2/f32/smoothstep.ts +9 -0
  2469. package/src/interface/math/vec2/f32/sqrt.ts +5 -0
  2470. package/src/interface/math/vec2/f32/step.ts +8 -0
  2471. package/src/interface/math/vec2/f32/subtract.ts +5 -0
  2472. package/src/interface/math/vec2/f32/tan.ts +5 -0
  2473. package/src/interface/math/vec2/f32/tanh.ts +5 -0
  2474. package/src/interface/math/vec2/f32/trunc.ts +5 -0
  2475. package/src/interface/math/vec2/f32/zero.ts +4 -0
  2476. package/src/interface/math/vec2/i32/abs.ts +5 -0
  2477. package/src/interface/math/vec2/i32/add.ts +5 -0
  2478. package/src/interface/math/vec2/i32/bitwise-and.ts +5 -0
  2479. package/src/interface/math/vec2/i32/bitwise-not.ts +5 -0
  2480. package/src/interface/math/vec2/i32/bitwise-or.ts +5 -0
  2481. package/src/interface/math/vec2/i32/bitwise-xor.ts +5 -0
  2482. package/src/interface/math/vec2/i32/clamp.ts +7 -0
  2483. package/src/interface/math/vec2/i32/count-leading-zeros.ts +9 -0
  2484. package/src/interface/math/vec2/i32/count-one-bits.ts +9 -0
  2485. package/src/interface/math/vec2/i32/count-trailing-zeros.ts +9 -0
  2486. package/src/interface/math/vec2/i32/equals.ts +4 -0
  2487. package/src/interface/math/vec2/i32/i32.ts +8 -0
  2488. package/src/interface/math/vec2/i32/max.ts +5 -0
  2489. package/src/interface/math/vec2/i32/min.ts +5 -0
  2490. package/src/interface/math/vec2/i32/negate.ts +5 -0
  2491. package/src/interface/math/vec2/i32/public.ts +23 -0
  2492. package/src/interface/math/vec2/i32/reverse-bits.ts +6 -0
  2493. package/src/interface/math/vec2/i32/scale.ts +6 -0
  2494. package/src/interface/math/vec2/i32/schema.ts +5 -0
  2495. package/src/interface/math/vec2/i32/shift-left.ts +4 -0
  2496. package/src/interface/math/vec2/i32/shift-right.ts +8 -0
  2497. package/src/interface/math/vec2/i32/subtract.ts +5 -0
  2498. package/src/interface/math/vec2/i32/zero.ts +4 -0
  2499. package/src/interface/math/vec2/index.ts +7 -0
  2500. package/src/interface/math/vec2/public.ts +6 -0
  2501. package/src/interface/math/vec2/u32/add.ts +8 -0
  2502. package/src/interface/math/vec2/u32/bitwise-and.ts +8 -0
  2503. package/src/interface/math/vec2/u32/bitwise-not.ts +5 -0
  2504. package/src/interface/math/vec2/u32/bitwise-or.ts +8 -0
  2505. package/src/interface/math/vec2/u32/bitwise-xor.ts +8 -0
  2506. package/src/interface/math/vec2/u32/clamp.ts +7 -0
  2507. package/src/interface/math/vec2/u32/count-leading-zeros.ts +9 -0
  2508. package/src/interface/math/vec2/u32/count-one-bits.ts +9 -0
  2509. package/src/interface/math/vec2/u32/count-trailing-zeros.ts +9 -0
  2510. package/src/interface/math/vec2/u32/equals.ts +4 -0
  2511. package/src/interface/math/vec2/u32/max.ts +8 -0
  2512. package/src/interface/math/vec2/u32/min.ts +8 -0
  2513. package/src/interface/math/vec2/u32/negate.ts +4 -0
  2514. package/src/interface/math/vec2/u32/public.ts +22 -0
  2515. package/src/interface/math/vec2/u32/reverse-bits.ts +9 -0
  2516. package/src/interface/math/vec2/u32/scale.ts +6 -0
  2517. package/src/interface/math/vec2/u32/schema.ts +5 -0
  2518. package/src/interface/math/vec2/u32/shift-left.ts +4 -0
  2519. package/src/interface/math/vec2/u32/shift-right.ts +8 -0
  2520. package/src/interface/math/vec2/u32/subtract.ts +8 -0
  2521. package/src/interface/math/vec2/u32/u32.ts +8 -0
  2522. package/src/interface/math/vec2/u32/zero.ts +4 -0
  2523. package/src/interface/math/vec3/f32/abs.ts +5 -0
  2524. package/src/interface/math/vec3/f32/acos.ts +5 -0
  2525. package/src/interface/math/vec3/f32/acosh.ts +5 -0
  2526. package/src/interface/math/vec3/f32/add.ts +9 -0
  2527. package/src/interface/math/vec3/f32/asin.ts +5 -0
  2528. package/src/interface/math/vec3/f32/asinh.ts +5 -0
  2529. package/src/interface/math/vec3/f32/atan.ts +5 -0
  2530. package/src/interface/math/vec3/f32/atanh.ts +5 -0
  2531. package/src/interface/math/vec3/f32/ceil.ts +5 -0
  2532. package/src/interface/math/vec3/f32/clamp.ts +7 -0
  2533. package/src/interface/math/vec3/f32/cos.ts +5 -0
  2534. package/src/interface/math/vec3/f32/cosh.ts +5 -0
  2535. package/src/interface/math/vec3/f32/cross.ts +9 -0
  2536. package/src/interface/math/vec3/f32/distance-squared.ts +9 -0
  2537. package/src/interface/math/vec3/f32/distance.ts +7 -0
  2538. package/src/interface/math/vec3/f32/dot.ts +6 -0
  2539. package/src/interface/math/vec3/f32/equals.ts +4 -0
  2540. package/src/interface/math/vec3/f32/exp.ts +5 -0
  2541. package/src/interface/math/vec3/f32/exp2.ts +5 -0
  2542. package/src/interface/math/vec3/f32/f32.ts +7 -0
  2543. package/src/interface/math/vec3/f32/faceforward.ts +8 -0
  2544. package/src/interface/math/vec3/f32/floor.ts +5 -0
  2545. package/src/interface/math/vec3/f32/fract.ts +9 -0
  2546. package/src/interface/math/vec3/f32/length-squared.ts +5 -0
  2547. package/src/interface/math/vec3/f32/length.ts +5 -0
  2548. package/src/interface/math/vec3/f32/log.ts +5 -0
  2549. package/src/interface/math/vec3/f32/log2.ts +5 -0
  2550. package/src/interface/math/vec3/f32/max.ts +9 -0
  2551. package/src/interface/math/vec3/f32/min.ts +9 -0
  2552. package/src/interface/math/vec3/f32/mix.ts +9 -0
  2553. package/src/interface/math/vec3/f32/mod.ts +8 -0
  2554. package/src/interface/math/vec3/f32/modf.ts +8 -0
  2555. package/src/interface/math/vec3/f32/multiply.ts +12 -0
  2556. package/src/interface/math/vec3/f32/negate.ts +5 -0
  2557. package/src/interface/math/vec3/f32/normalize.ts +7 -0
  2558. package/src/interface/math/vec3/f32/one.ts +4 -0
  2559. package/src/interface/math/vec3/f32/pow.ts +10 -0
  2560. package/src/interface/math/vec3/f32/public.ts +55 -0
  2561. package/src/interface/math/vec3/f32/random.ts +6 -0
  2562. package/src/interface/math/vec3/f32/reflect.ts +11 -0
  2563. package/src/interface/math/vec3/f32/refract.ts +16 -0
  2564. package/src/interface/math/vec3/f32/round.ts +10 -0
  2565. package/src/interface/math/vec3/f32/scale.ts +5 -0
  2566. package/src/interface/math/vec3/f32/schema.ts +5 -0
  2567. package/src/interface/math/vec3/f32/sign.ts +5 -0
  2568. package/src/interface/math/vec3/f32/sin.ts +5 -0
  2569. package/src/interface/math/vec3/f32/sinh.ts +5 -0
  2570. package/src/interface/math/vec3/f32/smoothstep.ts +14 -0
  2571. package/src/interface/math/vec3/f32/sqrt.ts +5 -0
  2572. package/src/interface/math/vec3/f32/step.ts +9 -0
  2573. package/src/interface/math/vec3/f32/subtract.ts +9 -0
  2574. package/src/interface/math/vec3/f32/tan.ts +5 -0
  2575. package/src/interface/math/vec3/f32/tanh.ts +5 -0
  2576. package/src/interface/math/vec3/f32/trunc.ts +5 -0
  2577. package/src/interface/math/vec3/f32/zero.ts +4 -0
  2578. package/src/interface/math/vec3/i32/abs.ts +9 -0
  2579. package/src/interface/math/vec3/i32/add.ts +9 -0
  2580. package/src/interface/math/vec3/i32/bitwise-and.ts +9 -0
  2581. package/src/interface/math/vec3/i32/bitwise-not.ts +5 -0
  2582. package/src/interface/math/vec3/i32/bitwise-or.ts +9 -0
  2583. package/src/interface/math/vec3/i32/bitwise-xor.ts +9 -0
  2584. package/src/interface/math/vec3/i32/clamp.ts +7 -0
  2585. package/src/interface/math/vec3/i32/count-leading-zeros.ts +10 -0
  2586. package/src/interface/math/vec3/i32/count-one-bits.ts +10 -0
  2587. package/src/interface/math/vec3/i32/count-trailing-zeros.ts +10 -0
  2588. package/src/interface/math/vec3/i32/equals.ts +4 -0
  2589. package/src/interface/math/vec3/i32/i32.ts +8 -0
  2590. package/src/interface/math/vec3/i32/max.ts +9 -0
  2591. package/src/interface/math/vec3/i32/min.ts +9 -0
  2592. package/src/interface/math/vec3/i32/multiply.ts +9 -0
  2593. package/src/interface/math/vec3/i32/negate.ts +9 -0
  2594. package/src/interface/math/vec3/i32/one.ts +4 -0
  2595. package/src/interface/math/vec3/i32/public.ts +25 -0
  2596. package/src/interface/math/vec3/i32/reverse-bits.ts +10 -0
  2597. package/src/interface/math/vec3/i32/scale.ts +10 -0
  2598. package/src/interface/math/vec3/i32/schema.ts +5 -0
  2599. package/src/interface/math/vec3/i32/shift-left.ts +4 -0
  2600. package/src/interface/math/vec3/i32/shift-right.ts +9 -0
  2601. package/src/interface/math/vec3/i32/subtract.ts +9 -0
  2602. package/src/interface/math/vec3/i32/zero.ts +4 -0
  2603. package/src/interface/math/vec3/index.ts +7 -0
  2604. package/src/interface/math/vec3/public.ts +6 -0
  2605. package/src/interface/math/vec3/u32/add.ts +9 -0
  2606. package/src/interface/math/vec3/u32/bitwise-and.ts +9 -0
  2607. package/src/interface/math/vec3/u32/bitwise-not.ts +5 -0
  2608. package/src/interface/math/vec3/u32/bitwise-or.ts +9 -0
  2609. package/src/interface/math/vec3/u32/bitwise-xor.ts +9 -0
  2610. package/src/interface/math/vec3/u32/clamp.ts +7 -0
  2611. package/src/interface/math/vec3/u32/count-leading-zeros.ts +10 -0
  2612. package/src/interface/math/vec3/u32/count-one-bits.ts +10 -0
  2613. package/src/interface/math/vec3/u32/count-trailing-zeros.ts +10 -0
  2614. package/src/interface/math/vec3/u32/equals.ts +4 -0
  2615. package/src/interface/math/vec3/u32/max.ts +9 -0
  2616. package/src/interface/math/vec3/u32/min.ts +9 -0
  2617. package/src/interface/math/vec3/u32/multiply.ts +9 -0
  2618. package/src/interface/math/vec3/u32/negate.ts +4 -0
  2619. package/src/interface/math/vec3/u32/one.ts +4 -0
  2620. package/src/interface/math/vec3/u32/public.ts +25 -0
  2621. package/src/interface/math/vec3/u32/reverse-bits.ts +10 -0
  2622. package/src/interface/math/vec3/u32/scale.ts +10 -0
  2623. package/src/interface/math/vec3/u32/schema.ts +5 -0
  2624. package/src/interface/math/vec3/u32/shift-left.ts +8 -0
  2625. package/src/interface/math/vec3/u32/shift-right.ts +9 -0
  2626. package/src/interface/math/vec3/u32/subtract.ts +9 -0
  2627. package/src/interface/math/vec3/u32/u32.ts +8 -0
  2628. package/src/interface/math/vec3/u32/volume.ts +4 -0
  2629. package/src/interface/math/vec3/u32/zero.ts +4 -0
  2630. package/src/interface/math/vec4/f32/abs.ts +5 -0
  2631. package/src/interface/math/vec4/f32/acos.ts +5 -0
  2632. package/src/interface/math/vec4/f32/acosh.ts +5 -0
  2633. package/src/interface/math/vec4/f32/add.ts +10 -0
  2634. package/src/interface/math/vec4/f32/asin.ts +5 -0
  2635. package/src/interface/math/vec4/f32/asinh.ts +5 -0
  2636. package/src/interface/math/vec4/f32/atan.ts +5 -0
  2637. package/src/interface/math/vec4/f32/atanh.ts +5 -0
  2638. package/src/interface/math/vec4/f32/ceil.ts +5 -0
  2639. package/src/interface/math/vec4/f32/clamp.ts +7 -0
  2640. package/src/interface/math/vec4/f32/cos.ts +5 -0
  2641. package/src/interface/math/vec4/f32/cosh.ts +5 -0
  2642. package/src/interface/math/vec4/f32/default.ts +6 -0
  2643. package/src/interface/math/vec4/f32/distance.ts +7 -0
  2644. package/src/interface/math/vec4/f32/dot.ts +6 -0
  2645. package/src/interface/math/vec4/f32/exp.ts +5 -0
  2646. package/src/interface/math/vec4/f32/exp2.ts +5 -0
  2647. package/src/interface/math/vec4/f32/f32.ts +7 -0
  2648. package/src/interface/math/vec4/f32/faceforward.ts +8 -0
  2649. package/src/interface/math/vec4/f32/floor.ts +5 -0
  2650. package/src/interface/math/vec4/f32/fract.ts +10 -0
  2651. package/src/interface/math/vec4/f32/length.ts +5 -0
  2652. package/src/interface/math/vec4/f32/log.ts +5 -0
  2653. package/src/interface/math/vec4/f32/log2.ts +5 -0
  2654. package/src/interface/math/vec4/f32/max.ts +10 -0
  2655. package/src/interface/math/vec4/f32/min.ts +10 -0
  2656. package/src/interface/math/vec4/f32/mix.ts +10 -0
  2657. package/src/interface/math/vec4/f32/mod.ts +9 -0
  2658. package/src/interface/math/vec4/f32/modf.ts +8 -0
  2659. package/src/interface/math/vec4/f32/multiply.ts +10 -0
  2660. package/src/interface/math/vec4/f32/negate.ts +5 -0
  2661. package/src/interface/math/vec4/f32/normalize.ts +7 -0
  2662. package/src/interface/math/vec4/f32/pow.ts +11 -0
  2663. package/src/interface/math/vec4/f32/public.ts +48 -0
  2664. package/src/interface/math/vec4/f32/reflect.ts +11 -0
  2665. package/src/interface/math/vec4/f32/refract.ts +16 -0
  2666. package/src/interface/math/vec4/f32/round.ts +11 -0
  2667. package/src/interface/math/vec4/f32/scale.ts +5 -0
  2668. package/src/interface/math/vec4/f32/schema.ts +5 -0
  2669. package/src/interface/math/vec4/f32/sign.ts +5 -0
  2670. package/src/interface/math/vec4/f32/sin.ts +5 -0
  2671. package/src/interface/math/vec4/f32/sinh.ts +5 -0
  2672. package/src/interface/math/vec4/f32/smoothstep.ts +16 -0
  2673. package/src/interface/math/vec4/f32/sqrt.ts +5 -0
  2674. package/src/interface/math/vec4/f32/step.ts +10 -0
  2675. package/src/interface/math/vec4/f32/subtract.ts +10 -0
  2676. package/src/interface/math/vec4/f32/tan.ts +5 -0
  2677. package/src/interface/math/vec4/f32/tanh.ts +5 -0
  2678. package/src/interface/math/vec4/f32/trunc.ts +5 -0
  2679. package/src/interface/math/vec4/i32/abs.ts +10 -0
  2680. package/src/interface/math/vec4/i32/add.ts +10 -0
  2681. package/src/interface/math/vec4/i32/bitwise-and.ts +10 -0
  2682. package/src/interface/math/vec4/i32/bitwise-not.ts +5 -0
  2683. package/src/interface/math/vec4/i32/bitwise-or.ts +10 -0
  2684. package/src/interface/math/vec4/i32/bitwise-xor.ts +10 -0
  2685. package/src/interface/math/vec4/i32/clamp.ts +7 -0
  2686. package/src/interface/math/vec4/i32/count-leading-zeros.ts +11 -0
  2687. package/src/interface/math/vec4/i32/count-one-bits.ts +11 -0
  2688. package/src/interface/math/vec4/i32/count-trailing-zeros.ts +11 -0
  2689. package/src/interface/math/vec4/i32/equals.ts +5 -0
  2690. package/src/interface/math/vec4/i32/i32.ts +8 -0
  2691. package/src/interface/math/vec4/i32/max.ts +10 -0
  2692. package/src/interface/math/vec4/i32/min.ts +10 -0
  2693. package/src/interface/math/vec4/i32/multiply.ts +10 -0
  2694. package/src/interface/math/vec4/i32/negate.ts +10 -0
  2695. package/src/interface/math/vec4/i32/one.ts +4 -0
  2696. package/src/interface/math/vec4/i32/public.ts +25 -0
  2697. package/src/interface/math/vec4/i32/reverse-bits.ts +11 -0
  2698. package/src/interface/math/vec4/i32/scale.ts +11 -0
  2699. package/src/interface/math/vec4/i32/schema.ts +5 -0
  2700. package/src/interface/math/vec4/i32/shift-left.ts +4 -0
  2701. package/src/interface/math/vec4/i32/shift-right.ts +10 -0
  2702. package/src/interface/math/vec4/i32/subtract.ts +10 -0
  2703. package/src/interface/math/vec4/i32/zero.ts +4 -0
  2704. package/src/interface/math/vec4/index.ts +7 -0
  2705. package/src/interface/math/vec4/public.ts +6 -0
  2706. package/src/interface/math/vec4/u32/add.ts +10 -0
  2707. package/src/interface/math/vec4/u32/bitwise-and.ts +10 -0
  2708. package/src/interface/math/vec4/u32/bitwise-not.ts +5 -0
  2709. package/src/interface/math/vec4/u32/bitwise-or.ts +10 -0
  2710. package/src/interface/math/vec4/u32/bitwise-xor.ts +10 -0
  2711. package/src/interface/math/vec4/u32/clamp.ts +7 -0
  2712. package/src/interface/math/vec4/u32/count-leading-zeros.ts +11 -0
  2713. package/src/interface/math/vec4/u32/count-one-bits.ts +11 -0
  2714. package/src/interface/math/vec4/u32/count-trailing-zeros.ts +11 -0
  2715. package/src/interface/math/vec4/u32/equals.ts +5 -0
  2716. package/src/interface/math/vec4/u32/max.ts +10 -0
  2717. package/src/interface/math/vec4/u32/min.ts +10 -0
  2718. package/src/interface/math/vec4/u32/multiply.ts +10 -0
  2719. package/src/interface/math/vec4/u32/negate.ts +4 -0
  2720. package/src/interface/math/vec4/u32/one.ts +4 -0
  2721. package/src/interface/math/vec4/u32/public.ts +24 -0
  2722. package/src/interface/math/vec4/u32/reverse-bits.ts +11 -0
  2723. package/src/interface/math/vec4/u32/scale.ts +11 -0
  2724. package/src/interface/math/vec4/u32/schema.ts +5 -0
  2725. package/src/interface/math/vec4/u32/shift-left.ts +9 -0
  2726. package/src/interface/math/vec4/u32/shift-right.ts +10 -0
  2727. package/src/interface/math/vec4/u32/subtract.ts +10 -0
  2728. package/src/interface/math/vec4/u32/u32.ts +8 -0
  2729. package/src/interface/math/vec4/u32/zero.ts +4 -0
  2730. package/src/interface/platform/platform.ts +36 -0
  2731. package/src/interface/registry/archetypes.test.ts +50 -0
  2732. package/src/interface/registry/archetypes.ts +59 -0
  2733. package/src/interface/registry/declarations.ts +196 -0
  2734. package/src/interface/registry/declared.test.ts +40 -0
  2735. package/src/interface/registry/finalizer-order.ts +53 -0
  2736. package/src/interface/registry/ids.test-helper.ts +48 -0
  2737. package/src/interface/registry/ids.test.ts +111 -0
  2738. package/src/interface/registry/ids.ts +76 -0
  2739. package/src/interface/registry/index.ts +30 -0
  2740. package/src/interface/registry/indexes.ts +74 -0
  2741. package/src/interface/registry/items.ts +95 -0
  2742. package/src/interface/registry/layout.test.ts +106 -0
  2743. package/src/interface/registry/layout.ts +372 -0
  2744. package/src/interface/registry/names.test.ts +73 -0
  2745. package/src/interface/registry/names.ts +174 -0
  2746. package/src/interface/registry/program.ts +112 -0
  2747. package/src/interface/registry/reduction.ts +8 -0
  2748. package/src/interface/registry/schedule.ts +211 -0
  2749. package/src/interface/registry/schemas.ts +119 -0
  2750. package/src/interface/registry/strata.ts +94 -0
  2751. package/src/interface/registry/threads.ts +74 -0
  2752. package/src/interface/registry/traits.ts +13 -0
  2753. package/src/interface/registry/written.ts +15 -0
  2754. package/src/interface/resource/condition.ts +9 -0
  2755. package/src/interface/resource/index.ts +3 -0
  2756. package/src/interface/resource/key.ts +4 -0
  2757. package/src/interface/resource/reduction.ts +12 -0
  2758. package/src/interface/resource/register.test.ts +93 -0
  2759. package/src/interface/resource/resource.ts +5 -0
  2760. package/src/interface/resource/types.ts +7 -0
  2761. package/src/interface/resource/value.ts +21 -0
  2762. package/src/interface/resource/written.ts +5 -0
  2763. package/src/interface/resources/always.ts +13 -0
  2764. package/src/interface/resources/cadence.ts +28 -0
  2765. package/src/interface/resources/clock.ts +19 -0
  2766. package/src/interface/resources/gpu-device.ts +17 -0
  2767. package/src/interface/resources/index.ts +7 -0
  2768. package/src/interface/resources/wake.ts +16 -0
  2769. package/src/interface/resources/workers.ts +13 -0
  2770. package/src/interface/rule/create.ts +27 -0
  2771. package/src/interface/rule/created.ts +5 -0
  2772. package/src/interface/rule/declaration.ts +15 -0
  2773. package/src/interface/rule/index.ts +2 -0
  2774. package/src/interface/rule/rule.ts +4 -0
  2775. package/src/interface/rule/rule.type-test.ts +107 -0
  2776. package/src/interface/schema/is-struct.ts +36 -0
  2777. package/src/interface/schema/schema.ts +190 -0
  2778. package/src/interface/schema/schema.type-test.ts +155 -0
  2779. package/src/interface/schema/schemas.type-test.ts +13 -0
  2780. package/src/interface/system/access.ts +107 -0
  2781. package/src/interface/system/body.ts +79 -0
  2782. package/src/interface/system/check.ts +265 -0
  2783. package/src/interface/system/commands.ts +71 -0
  2784. package/src/interface/system/commands.type-test.ts +87 -0
  2785. package/src/interface/system/composite-declaration.ts +13 -0
  2786. package/src/interface/system/composite-input.type-test.ts +47 -0
  2787. package/src/interface/system/composite.ts +6 -0
  2788. package/src/interface/system/conditions.type-test.ts +57 -0
  2789. package/src/interface/system/create-resolved.ts +21 -0
  2790. package/src/interface/system/create.test.ts +210 -0
  2791. package/src/interface/system/create.ts +208 -0
  2792. package/src/interface/system/declaration.ts +73 -0
  2793. package/src/interface/system/definition.ts +6 -0
  2794. package/src/interface/system/index.ts +4 -0
  2795. package/src/interface/system/input.ts +59 -0
  2796. package/src/interface/system/leaf.ts +20 -0
  2797. package/src/interface/system/lists.type-test.ts +53 -0
  2798. package/src/interface/system/name.ts +7 -0
  2799. package/src/interface/system/optional.type-test.ts +51 -0
  2800. package/src/interface/system/property.ts +5 -0
  2801. package/src/interface/system/render.ts +106 -0
  2802. package/src/interface/system/resolve.test.ts +49 -0
  2803. package/src/interface/system/resolve.ts +165 -0
  2804. package/src/interface/system/shared.type-test.ts +205 -0
  2805. package/src/interface/system/struct.ts +10 -0
  2806. package/src/interface/system/system.ts +11 -0
  2807. package/src/interface/system/system.type-test.ts +423 -0
  2808. package/src/interface/system/threads.ts +47 -0
  2809. package/src/interface/system/threads.type-test.ts +83 -0
  2810. package/src/interface/system/up.type-test.ts +67 -0
  2811. package/src/interface/system/values-of.ts +17 -0
  2812. package/src/interface/system/values.ts +73 -0
  2813. package/src/interface/thread/of.ts +9 -0
  2814. package/src/interface/thread/thread.ts +14 -0
  2815. package/src/interface/thread/thread.type-test.ts +75 -0
  2816. package/src/interface/trait/key.ts +7 -0
  2817. package/src/interface/trait/trait.type-test.ts +85 -0
  2818. package/src/interface/trait/types.ts +69 -0
  2819. package/src/interface/tsconfig.json +28 -0
  2820. package/src/interface/world/create.ts +22 -0
  2821. package/src/interface/world/declarations.ts +34 -0
  2822. package/src/interface/world/filter.ts +10 -0
  2823. package/src/interface/world/index.ts +3 -0
  2824. package/src/interface/world/join.ts +17 -0
  2825. package/src/interface/world/loop.type-test.ts +72 -0
  2826. package/src/interface/world/run.type-test.ts +87 -0
  2827. package/src/interface/world/share.type-test.ts +31 -0
  2828. package/src/interface/world/world.ts +73 -0
  2829. package/src/interface/world/world.type-test.ts +77 -0
  2830. package/src/observe/compare.ts +87 -0
  2831. package/src/observe/entity.ts +232 -0
  2832. package/src/observe/index.ts +2 -0
  2833. package/src/observe/members.ts +43 -0
  2834. package/src/observe/observe.ts +25 -0
  2835. package/src/observe/observe.type-test.ts +85 -0
  2836. package/src/observe/plans.ts +273 -0
  2837. package/src/observe/query.ts +27 -0
  2838. package/src/observe/resource.ts +81 -0
  2839. package/src/observe/select.ts +649 -0
  2840. package/src/observe/to-promise.ts +23 -0
  2841. package/src/observe/tsconfig.json +31 -0
  2842. package/src/observe/values.ts +10 -0
  2843. package/src/observe/world-state.ts +421 -0
  2844. package/src/observe-imports.test.ts +49 -0
  2845. package/src/perftest/benchmark.ts +107 -0
  2846. package/src/perftest/benchmarks.ts +708 -0
  2847. package/src/perftest/editor.ts +126 -0
  2848. package/src/perftest/filters.ts +124 -0
  2849. package/src/perftest/finalized.ts +170 -0
  2850. package/src/perftest/flat.ts +57 -0
  2851. package/src/perftest/growth.ts +47 -0
  2852. package/src/perftest/handoff.ts +147 -0
  2853. package/src/perftest/hierarchy.ts +115 -0
  2854. package/src/perftest/indexes.ts +759 -0
  2855. package/src/perftest/invariants.ts +63 -0
  2856. package/src/perftest/joined.ts +103 -0
  2857. package/src/perftest/journal.ts +55 -0
  2858. package/src/perftest/keys.ts +101 -0
  2859. package/src/perftest/log.ts +126 -0
  2860. package/src/perftest/loop.ts +50 -0
  2861. package/src/perftest/observed-gpu.ts +57 -0
  2862. package/src/perftest/observed.ts +292 -0
  2863. package/src/perftest/observer.ts +58 -0
  2864. package/src/perftest/optional.ts +102 -0
  2865. package/src/perftest/particles.ts +69 -0
  2866. package/src/perftest/placed.ts +178 -0
  2867. package/src/perftest/reads.ts +205 -0
  2868. package/src/perftest/remote.ts +362 -0
  2869. package/src/perftest/render-order.ts +86 -0
  2870. package/src/perftest/run.ts +44 -0
  2871. package/src/perftest/shared.ts +416 -0
  2872. package/src/perftest/strings.ts +135 -0
  2873. package/src/perftest/structural.ts +150 -0
  2874. package/src/perftest/suite.perf-browser-test.ts +136 -0
  2875. package/src/perftest/suite.perf-test.ts +8 -0
  2876. package/src/perftest/suite.ts +214 -0
  2877. package/src/perftest/systems.ts +132 -0
  2878. package/src/perftest/tails.ts +298 -0
  2879. package/src/perftest/transfers.ts +98 -0
  2880. package/src/perftest/uploads.ts +80 -0
  2881. package/src/perftest/values.ts +107 -0
  2882. package/src/perftest/wake.ts +41 -0
  2883. package/src/world.test.ts +46 -0
@@ -0,0 +1,2460 @@
1
+ // © 2026 Adobe. MIT License. See /LICENSE for details.
2
+ import { blockShift, chunkShift } from './kernel.js';
3
+ import { withoutIntrinsics } from './intrinsics.js';
4
+ /** The scalar parameter a resource's, the input's or a shared value's leaf is read from. */
5
+ export const scalarOfExpression = (expression) => expression.kind === "args" ? { source: "args", path: expression.path } : { source: expression.kind, index: expression.index, path: expression.path };
6
+ /** The parameters each lookup through an index takes, after the lookup parameters, all as f64. */
7
+ export const indexParameterCount = (lookup) => lookup.kind === "hash" ? 7 + lookup.watched : 11 + lookup.watched;
8
+ /** Math functions with exact native equivalents; the rest are imported from JS so results match bit for bit. */
9
+ const native = new Set(["abs", "sqrt", "floor", "ceil", "trunc", "min", "max", "fround", "imul", "clz32"]);
10
+ /** Imported operations that aren't `Math` functions. */
11
+ const operations = {
12
+ remainder: (a, b) => a % b,
13
+ power: (a, b) => a ** b,
14
+ };
15
+ /** No shared values: a call of a kernel reading none, or before its archetype is known. */
16
+ export const noSharedValues = [];
17
+ /**
18
+ * Reads a scalar parameter's value from the resources and args of a run, and the shared values of the call's
19
+ * archetype; booleans become 0 or 1.
20
+ */
21
+ export const scalarValue = (scalar, resources, args, shared = noSharedValues) => {
22
+ let value = scalar.source === "args" ? args : scalar.source === "shared" ? shared[scalar.index] : resources[scalar.index];
23
+ for (const key of scalar.path)
24
+ value = typeof value === "object" && value !== null ? Reflect.get(value, key) : undefined;
25
+ return Number(value);
26
+ };
27
+ /** Reads each scalar parameter's value from the resources and args of a run, and a call's shared values. */
28
+ export const scalarValues = (scalars, resources, args, shared = noSharedValues) => scalars.map(scalar => scalarValue(scalar, resources, args, shared));
29
+ export const instantiateWasm = async (module, memory, imports) => {
30
+ const instance = await WebAssembly.instantiate(module, { env: { memory }, math: importsOf(imports) });
31
+ const run = instance.exports.run;
32
+ if (typeof run !== "function")
33
+ throw new Error("A WASM kernel has no run export.");
34
+ // The generator always exports `run` with this signature.
35
+ return run;
36
+ };
37
+ /** The JS functions a kernel's imports name. */
38
+ export const importsOf = (names) => {
39
+ const functions = {};
40
+ for (const name of names) {
41
+ const operation = operations[name];
42
+ const math = Reflect.get(Math, name);
43
+ if (operation !== undefined)
44
+ functions[name] = operation;
45
+ else if (typeof math === "function")
46
+ functions[name] = (...values) => Number(Reflect.apply(math, Math, values));
47
+ }
48
+ return functions;
49
+ };
50
+ // Opcodes.
51
+ const op = {
52
+ block: 0x02, loop: 0x03, if: 0x04, else: 0x05, end: 0x0b, br: 0x0c, brIf: 0x0d, call: 0x10, drop: 0x1a, select: 0x1b,
53
+ localGet: 0x20, localSet: 0x21, localTee: 0x22,
54
+ i32Load: 0x28, f32Load: 0x2a, f64Load: 0x2b, i32Load8u: 0x2d, i32Store: 0x36, f32Store: 0x38, f64Store: 0x39, i32Store8: 0x3a,
55
+ i32Const: 0x41, f64Const: 0x44, i32ReinterpretF32: 0xbc, i64ReinterpretF64: 0xbd, i32LtU: 0x49, i32GtU: 0x4b, i32LeU: 0x4d, i32GtS: 0x4a, f64Load2: 0x2b,
56
+ i32Eqz: 0x45, i32GeS: 0x4e,
57
+ f64Eq: 0x61, f64Ne: 0x62, f64Lt: 0x63, f64Gt: 0x64, f64Le: 0x65, f64Ge: 0x66,
58
+ i32Eq: 0x46, i32LtS: 0x48, i32LeS: 0x4c, i32Clz: 0x67, i32Ctz: 0x68, i32Popcnt: 0x69, i32Add: 0x6a, i32Sub: 0x6b, i32Mul: 0x6c, i32And: 0x71, i32Or: 0x72, i32Xor: 0x73, i32Shl: 0x74, i32ShrS: 0x75, i32ShrU: 0x76,
59
+ f64Abs: 0x99, f64Neg: 0x9a, f64Ceil: 0x9b, f64Floor: 0x9c, f64Trunc: 0x9d, f64Sqrt: 0x9f,
60
+ f64Add: 0xa0, f64Sub: 0xa1, f64Mul: 0xa2, f64Div: 0xa3, f64Min: 0xa4, f64Max: 0xa5,
61
+ i32WrapI64: 0xa7, i32GeU: 0x4f, i32Ne: 0x47, i64Const: 0x42, i64ShrU: 0x88, i64RemS: 0x81, f64ConvertI64S: 0xb9, f64Copysign: 0xa6, f32DemoteF64: 0xb6, f64ConvertI32S: 0xb7, f64ConvertI32U: 0xb8, f64PromoteF32: 0xbb,
62
+ };
63
+ const f64Type = 0x7c;
64
+ const i32Type = 0x7f;
65
+ /** Saturating truncations, 0xfc-prefixed opcodes. */
66
+ const i64TruncSatF64S = [0xfc, 0x06];
67
+ const truncations = { i32TruncSatF64U: [0xfc, 0x03], i64TruncSatF64U: [0xfc, 0x07] };
68
+ const unsigned = (value) => {
69
+ const bytes = [];
70
+ do {
71
+ let byte = value & 0x7f;
72
+ value = Math.floor(value / 128);
73
+ if (value !== 0)
74
+ byte |= 0x80;
75
+ bytes.push(byte);
76
+ } while (value !== 0);
77
+ return bytes;
78
+ };
79
+ const signed = (value) => {
80
+ const bytes = [];
81
+ for (;;) {
82
+ const byte = value & 0x7f;
83
+ value >>= 7;
84
+ if ((value === 0 && (byte & 0x40) === 0) || (value === -1 && (byte & 0x40) !== 0))
85
+ return [...bytes, byte];
86
+ bytes.push(byte | 0x80);
87
+ }
88
+ };
89
+ const float64 = (value) => [...new Uint8Array(new Float64Array([value]).buffer)];
90
+ const name = (text) => {
91
+ const bytes = [...new TextEncoder().encode(text)];
92
+ return [...unsigned(bytes.length), ...bytes];
93
+ };
94
+ const vector = (items) => [...unsigned(items.length), ...items.flat()];
95
+ const section = (id, content) => [id, ...unsigned(content.length), ...content];
96
+ /**
97
+ * Thrown inside generation when a program needs something WASM can't match exactly, saying what; the JS kernel is used
98
+ * instead. Only failing generation makes one.
99
+ */
100
+ const reasons = new WeakMap();
101
+ const unsupported = (reason) => {
102
+ const error = new Error(reason);
103
+ reasons.set(error, reason);
104
+ return error;
105
+ };
106
+ /** Thrown when a program can't run four rows at a time; the scalar loop handles every row instead. */
107
+ const notVectorizable = Symbol("notVectorizable");
108
+ const join = (a, b) => a === b ? a : "mixed";
109
+ /** The operators whose folds rotate through lanes: each one's identity, -0 for sums so a sum of -0 stays -0, and its instruction. */
110
+ const rotated = {
111
+ "+": { value: -0, combine: op.f64Add },
112
+ "*": { value: 1, combine: op.f64Mul },
113
+ "min": { value: Infinity, combine: op.f64Min },
114
+ "max": { value: -Infinity, combine: op.f64Max },
115
+ };
116
+ /**
117
+ * Generates a WASM module for a kernel program, with JS semantics: every value is an f64, and stores
118
+ * convert as typed arrays do. Returns `null` when exact equivalence can't be guaranteed.
119
+ *
120
+ * The exported `run(start, end, tick, ...columnAddresses, ...scalars)` processes rows `start` to `end`.
121
+ */
122
+ export const generateWasm = (...parameters) => {
123
+ const generated = generateWasmOrReason(...parameters);
124
+ return typeof generated === "string" ? null : generated;
125
+ };
126
+ /** A WAT identifier's characters: a name's others become `_`. */
127
+ const identifierOf = (text) => text.replace(/[^A-Za-z0-9_.]/g, "_");
128
+ /**
129
+ * As `generateWasm`, or why exact equivalence can't be guaranteed. `named` appends a name section naming the function,
130
+ * its imports, parameters and locals, for printing it as text; the world never asks for one.
131
+ */
132
+ export const generateWasmOrReason = (source, columns, scalarTypes, simdEnabled = true, filters = 0, lookups = [],
133
+ /** For a program reading `up`: the columns of the parent's components it reads. */
134
+ upColumns = [],
135
+ /** Each accumulator's operator, in `reductions` order. */
136
+ operators = [],
137
+ /** By lookup, for those through an index, how it reads its index; null for a lookup by entity. */
138
+ indexLookups = [],
139
+ /** By probe, its lookup: `KernelDescription.probes[k].lookup`. */
140
+ probeLookups = [],
141
+ /**
142
+ * Whether SIMD lanes may compute at storage precision, as only an explicit kernel's may: f32 rounds each step.
143
+ * Without it lanes are f64, two values a vector, promoted from f32 and demoted only on store, as the body computes.
144
+ */
145
+ storagePrecision = true, named = false) => {
146
+ const program = withoutIntrinsics(source);
147
+ const scalars = [];
148
+ const scalarIndex = new Map();
149
+ const imports = [];
150
+ const scalarOf = (scalar) => {
151
+ const key = JSON.stringify(scalar);
152
+ let index = scalarIndex.get(key);
153
+ if (index === undefined) {
154
+ if (scalarTypes(scalar) === null)
155
+ throw unsupported("it reads a resource or input value that isn't a number or boolean");
156
+ index = scalars.length;
157
+ scalars.push(scalar);
158
+ scalarIndex.set(key, index);
159
+ }
160
+ return index;
161
+ };
162
+ const importOf = (functionName) => {
163
+ let index = imports.indexOf(functionName);
164
+ if (index < 0) {
165
+ index = imports.length;
166
+ imports.push(functionName);
167
+ }
168
+ return index;
169
+ };
170
+ /** Whether read `read` of lookup `lookup` is its `changed`, after what it reads. */
171
+ const isChanged = (lookup, read) => (lookups[lookup]?.watched ?? 0) > 0 && read === lookups[lookup]?.reads;
172
+ /** Whether any lookup watches, which then takes its `lastRun` after the other lookup parameters. */
173
+ const watching = lookups.some(lookup => (lookup.watched ?? 0) > 0);
174
+ /** Each handle's lookup, from the `find`s into it; a handle used by two lookups isn't supported. */
175
+ const lookupOfHandle = new Map();
176
+ const claim = (handle, lookup) => {
177
+ const existing = lookupOfHandle.get(handle);
178
+ if ((existing !== undefined && existing !== lookup) || lookup >= lookups.length)
179
+ throw unsupported("it reads one lookup's result through another lookup");
180
+ lookupOfHandle.set(handle, lookup);
181
+ };
182
+ /** Each probe's lookup, by the probe's index. */
183
+ const lookupOfProbe = new Map(probeLookups.map((lookup, probe) => [probe, lookup]));
184
+ const collectFinds = (statements) => {
185
+ for (const statement of statements) {
186
+ if (statement.kind === "find")
187
+ claim(statement.handle, statement.lookup);
188
+ else if (statement.kind === "probe") {
189
+ const lookup = lookupOfProbe.get(statement.probe);
190
+ if (lookup === undefined || indexLookups[lookup] === null || indexLookups[lookup] === undefined)
191
+ throw unsupported("it probes a lookup that isn't through an index");
192
+ claim(statement.list, lookup);
193
+ claim(statement.first, lookup);
194
+ }
195
+ else if (statement.kind === "listRow") {
196
+ const lookup = lookupOfHandle.get(statement.list);
197
+ if (lookup === undefined)
198
+ throw unsupported("it reads a row of a list no lookup gave");
199
+ claim(statement.row, lookup);
200
+ }
201
+ else if (statement.kind === "if") {
202
+ collectFinds(statement.consequent);
203
+ collectFinds(statement.alternate);
204
+ }
205
+ else if (statement.kind === "block" || statement.kind === "loop")
206
+ collectFinds(statement.body);
207
+ }
208
+ };
209
+ // Local types, to a fixed point over assignments.
210
+ const localTypes = new Array(program.locals);
211
+ const typeOf = (expression) => {
212
+ switch (expression.kind) {
213
+ case "number": return "number";
214
+ case "boolean": return "boolean";
215
+ case "column": return columns[expression.column].boolean ? "boolean" : "number";
216
+ case "resource":
217
+ case "args":
218
+ case "shared": return scalarTypes(scalarOfExpression(expression)) ?? "mixed";
219
+ case "local": return localTypes[expression.local] ?? "number";
220
+ case "unary": return expression.operator === "!" ? "boolean" : "number";
221
+ case "binary": return ["<", ">", "<=", ">=", "==", "!=", "===", "!=="].includes(expression.operator) ? "boolean" : "number";
222
+ case "logical": return join(typeOf(expression.left), typeOf(expression.right));
223
+ case "conditional": return join(typeOf(expression.consequent), typeOf(expression.alternate));
224
+ case "math": return "number";
225
+ case "found":
226
+ case "upFound": return "boolean";
227
+ case "upLeaf": return upColumns[expression.column]?.boolean === true ? "boolean" : "number";
228
+ case "lookupLeaf": {
229
+ const lookup = lookupOfHandle.get(expression.handle);
230
+ if (lookup !== undefined && isChanged(lookup, expression.read))
231
+ return "boolean";
232
+ const leaf = lookup === undefined ? null : lookups[lookup]?.leaf(expression.read, expression.path);
233
+ return leaf?.boolean === true ? "boolean" : "number";
234
+ }
235
+ case "listLength":
236
+ case "rowEntity": return "number";
237
+ case "listChanged": return "boolean";
238
+ case "rowLeaf": {
239
+ const lookup = lookupOfHandle.get(expression.handle);
240
+ const leaf = lookup === undefined ? null : indexLookups[lookup]?.rowLeaf(expression.leaf);
241
+ return leaf?.column.boolean === true ? "boolean" : "number";
242
+ }
243
+ // Regions are inlined before generating.
244
+ case "lane": throw unsupported("it reads a GPU builtin's lane");
245
+ }
246
+ };
247
+ const inferLocals = (statements) => {
248
+ let changed = false;
249
+ for (const statement of statements) {
250
+ if (statement.kind === "set") {
251
+ const type = typeOf(statement.value);
252
+ const current = localTypes[statement.local];
253
+ const next = current === undefined ? type : join(current, type);
254
+ if (next !== current) {
255
+ localTypes[statement.local] = next;
256
+ changed = true;
257
+ }
258
+ }
259
+ else if (statement.kind === "if")
260
+ changed = inferLocals(statement.consequent) || inferLocals(statement.alternate) || changed;
261
+ else if (statement.kind === "block" || statement.kind === "loop")
262
+ changed = inferLocals(statement.body) || changed;
263
+ }
264
+ return changed;
265
+ };
266
+ for (let pass = 0; pass < program.locals + 2 && inferLocals(program.body); pass++)
267
+ ;
268
+ /** Whether a value is an integer below 2^32 in magnitude: integer column reads, small integer literals, and locals of only those. */
269
+ const accumulators = program.reductions ?? [];
270
+ // Accumulators start at their partials, which needn't be integers.
271
+ const integralLocals = new Array(program.locals).fill(true).map((integral, index) => integral && !accumulators.includes(index));
272
+ const integral = (expression) => {
273
+ switch (expression.kind) {
274
+ case "column": {
275
+ const { view, boolean } = columns[expression.column];
276
+ return !boolean && (view === "i32" || view === "u32" || view === "u8");
277
+ }
278
+ case "upLeaf": {
279
+ const column = upColumns[expression.column];
280
+ return column !== undefined && !column.boolean && (column.view === "i32" || column.view === "u32" || column.view === "u8");
281
+ }
282
+ case "number": return Number.isInteger(expression.value) && Math.abs(expression.value) <= 0x7FFFFFFF;
283
+ case "local": return integralLocals[expression.local];
284
+ default: return false;
285
+ }
286
+ };
287
+ const inferIntegral = (statements) => {
288
+ let changed = false;
289
+ for (const statement of statements) {
290
+ if (statement.kind === "set" && integralLocals[statement.local] && !integral(statement.value)) {
291
+ integralLocals[statement.local] = false;
292
+ changed = true;
293
+ }
294
+ else if (statement.kind === "if")
295
+ changed = inferIntegral(statement.consequent) || inferIntegral(statement.alternate) || changed;
296
+ else if (statement.kind === "block" || statement.kind === "loop")
297
+ changed = inferIntegral(statement.body) || changed;
298
+ }
299
+ return changed;
300
+ };
301
+ while (inferIntegral(program.body))
302
+ ;
303
+ // Parameters: start, end, tick, lastRun, column addresses, filter row, chunk and block tick addresses, scalars, and with reductions the partials address.
304
+ const columnParameter = (column) => 4 + column;
305
+ const filterRowParameter = (filter) => 4 + columns.length + filter;
306
+ const filterChunkParameter = (filter) => 4 + columns.length + filters + filter;
307
+ const filterBlockParameter = (filter) => 4 + columns.length + 2 * filters + filter;
308
+ /** Parameters before the lookups': the fixed four, the columns' and the filters'. */
309
+ const beforeLookups = 4 + columns.length + 3 * filters;
310
+ /**
311
+ * With lookups: the entity table (archetype, row and generation addresses, then its length), then each lookup's
312
+ * directory address and record count, all as f64 so workers pass them like scalars.
313
+ */
314
+ const lookupParameters = lookups.length === 0 ? 0 : 4 + 2 * lookups.length + (watching ? 1 : 0);
315
+ const lookupParameter = (index) => beforeLookups + index;
316
+ /** For `up`: the rows' and their parents' rows' addresses, whether there's a parent, then each parent column's address. */
317
+ const upMode = program.up === true;
318
+ // Its runner passes an `up` kernel only the rows that pass, and the filter loops step the row, not its list slot.
319
+ if (upMode && filters > 0)
320
+ throw new Error("A WASM kernel reading `up` takes no change filters: its runner lists only the rows that pass.");
321
+ const upParameters = upMode ? 3 + upColumns.length : 0;
322
+ /** Each lookup through an index's parameters, after the lookup parameters: `indexParameterCount` of them, as f64. */
323
+ const indexOffsets = [];
324
+ let indexParameters = 0;
325
+ for (let lookup = 0; lookup < lookups.length; lookup++) {
326
+ indexOffsets.push(indexParameters);
327
+ const index = indexLookups[lookup];
328
+ if (index !== null && index !== undefined)
329
+ indexParameters += indexParameterCount(index);
330
+ }
331
+ const indexParameter = (lookup, index) => beforeLookups + lookupParameters + indexOffsets[lookup] + index;
332
+ const upParameter = (index) => beforeLookups + lookupParameters + indexParameters + index;
333
+ const scalarParameter = (index) => beforeLookups + lookupParameters + indexParameters + upParameters + index;
334
+ const code = [];
335
+ const extraLocals = [];
336
+ /**
337
+ * Values the same for every row that call an import, by the expression: each computed once per call, before the
338
+ * rows, into the local it maps to. They're pure, so computing one a branch skips changes nothing.
339
+ */
340
+ const hoisted = new Map();
341
+ let localBase = 0;
342
+ const local = (index) => localBase + index;
343
+ const scratch = (type) => {
344
+ extraLocals.push(type);
345
+ return localBase + program.locals + extraLocals.length - 1;
346
+ };
347
+ let rowLocal = 0;
348
+ /** For `up`: the current row's parent row. */
349
+ let parentLocal = 0;
350
+ const address = (column) => {
351
+ code.push(op.localGet, ...unsigned(columnParameter(column)), op.localGet, ...unsigned(rowLocal), op.i32Const, ...signed(columns[column].stride), op.i32Mul, op.i32Add);
352
+ };
353
+ /** Leaves the JS `ToInt32` of the f64 on the stack as an i32: exact for every finite value; NaN and infinities give 0. */
354
+ const emitToInt32 = () => {
355
+ const value = scratch(f64Type);
356
+ code.push(op.localTee, ...unsigned(value));
357
+ code.push(op.localGet, ...unsigned(value), op.f64Const, ...float64(2 ** -32), op.f64Mul, op.f64Trunc, op.f64Const, ...float64(2 ** 32), op.f64Mul, op.f64Sub);
358
+ code.push(...i64TruncSatF64S, op.i32WrapI64);
359
+ };
360
+ /** Leaves 1 (i32) if the f64 on the stack is truthy: not 0, -0 or NaN. */
361
+ const emitTruthy = (type) => {
362
+ if (type === "boolean") {
363
+ code.push(op.f64Const, ...float64(0), op.f64Ne);
364
+ return;
365
+ }
366
+ const value = scratch(f64Type);
367
+ code.push(op.localTee, ...unsigned(value), op.f64Const, ...float64(0), op.f64Ne, op.localGet, ...unsigned(value), op.localGet, ...unsigned(value), op.f64Eq, op.i32And);
368
+ };
369
+ const emitCall = (functionName) => {
370
+ code.push(op.call, ...unsigned(importOf(functionName)));
371
+ };
372
+ const emit = (expression) => {
373
+ const hoistedLocal = hoisted.get(expression);
374
+ if (hoistedLocal !== undefined) {
375
+ code.push(op.localGet, ...unsigned(hoistedLocal));
376
+ return;
377
+ }
378
+ switch (expression.kind) {
379
+ case "number":
380
+ code.push(op.f64Const, ...float64(expression.value));
381
+ return;
382
+ case "boolean":
383
+ code.push(op.f64Const, ...float64(expression.value ? 1 : 0));
384
+ return;
385
+ case "local":
386
+ code.push(op.localGet, ...unsigned(local(expression.local)));
387
+ return;
388
+ case "resource":
389
+ case "args":
390
+ case "shared": {
391
+ code.push(op.localGet, ...unsigned(scalarParameter(scalarOf(scalarOfExpression(expression)))));
392
+ return;
393
+ }
394
+ case "upFound":
395
+ code.push(op.localGet, ...unsigned(upParameter(2)), op.f64ConvertI32U);
396
+ return;
397
+ case "upLeaf":
398
+ case "column": {
399
+ const { view, offset, boolean } = expression.kind === "upLeaf" ? upColumns[expression.column] : columns[expression.column];
400
+ if (expression.kind === "upLeaf") {
401
+ code.push(op.localGet, ...unsigned(upParameter(3 + expression.column)), op.localGet, ...unsigned(parentLocal), op.i32Const, ...signed(upColumns[expression.column].stride), op.i32Mul, op.i32Add);
402
+ }
403
+ else
404
+ address(expression.column);
405
+ const memory = (align) => [align, ...unsigned(offset)];
406
+ if (boolean) {
407
+ code.push(view === "u8" ? op.i32Load8u : op.i32Load, ...memory(view === "u8" ? 0 : 2), op.i32Const, 0, 0x47 /* i32.ne */, op.f64ConvertI32U);
408
+ return;
409
+ }
410
+ switch (view) {
411
+ case "f32":
412
+ code.push(op.f32Load, ...memory(2), op.f64PromoteF32);
413
+ return;
414
+ case "i32":
415
+ code.push(op.i32Load, ...memory(2), op.f64ConvertI32S);
416
+ return;
417
+ case "u32":
418
+ code.push(op.i32Load, ...memory(2), op.f64ConvertI32U);
419
+ return;
420
+ case "u8":
421
+ code.push(op.i32Load8u, ...memory(0), op.f64ConvertI32U);
422
+ return;
423
+ default:
424
+ code.push(op.f64Load, ...memory(3));
425
+ return;
426
+ }
427
+ }
428
+ case "unary":
429
+ emit(expression.operand);
430
+ if (expression.operator === "-")
431
+ code.push(op.f64Neg);
432
+ else if (expression.operator === "!") {
433
+ emitTruthy(typeOf(expression.operand));
434
+ code.push(op.i32Eqz, op.f64ConvertI32U);
435
+ }
436
+ else if (expression.operator === "~") {
437
+ emitToInt32();
438
+ code.push(op.i32Const, ...signed(-1), op.i32Xor, op.f64ConvertI32S);
439
+ }
440
+ return;
441
+ case "binary": return emitBinary(expression);
442
+ case "logical": {
443
+ const type = typeOf(expression.left);
444
+ const value = scratch(f64Type);
445
+ emit(expression.left);
446
+ code.push(op.localTee, ...unsigned(value));
447
+ emitTruthy(type);
448
+ code.push(op.if, f64Type);
449
+ if (expression.operator === "&&")
450
+ emit(expression.right);
451
+ else
452
+ code.push(op.localGet, ...unsigned(value));
453
+ code.push(op.else);
454
+ if (expression.operator === "&&")
455
+ code.push(op.localGet, ...unsigned(value));
456
+ else
457
+ emit(expression.right);
458
+ code.push(op.end);
459
+ return;
460
+ }
461
+ case "conditional":
462
+ emit(expression.test);
463
+ emitTruthy(typeOf(expression.test));
464
+ code.push(op.if, f64Type);
465
+ emit(expression.consequent);
466
+ code.push(op.else);
467
+ emit(expression.alternate);
468
+ code.push(op.end);
469
+ return;
470
+ case "math": return emitMath(expression.name, expression.arguments);
471
+ case "found":
472
+ code.push(op.localGet, ...unsigned(handleLocal(expression.handle, "found")), op.f64ConvertI32U);
473
+ return;
474
+ case "lookupLeaf": return emitLookupLeaf(expression.handle, expression.read, expression.path);
475
+ case "listLength": return emitListLength(expression.handle);
476
+ case "listChanged": return emitListChanged(expression.handle);
477
+ case "rowLeaf": return emitRowLeaf(expression.handle, expression.leaf);
478
+ case "rowEntity": return emitRowEntity(expression.handle);
479
+ }
480
+ };
481
+ const emitMath = (functionName, parameters) => {
482
+ if (!native.has(functionName)) {
483
+ // Imported functions take two f64s; unary ones ignore the second.
484
+ if (parameters.length > 2)
485
+ throw unsupported(`it calls Math.${functionName} with more than two arguments, and WASM imports it taking two`);
486
+ for (const parameter of parameters)
487
+ emit(parameter);
488
+ for (let i = parameters.length; i < 2; i++)
489
+ code.push(op.f64Const, ...float64(NaN));
490
+ emitCall(functionName);
491
+ return;
492
+ }
493
+ switch (functionName) {
494
+ case "min":
495
+ case "max": {
496
+ if (parameters.length === 0) {
497
+ code.push(op.f64Const, ...float64(functionName === "min" ? Infinity : -Infinity));
498
+ return;
499
+ }
500
+ emit(parameters[0]);
501
+ // JS converts every argument, so `Math.max(x)` is `+x`.
502
+ for (const parameter of parameters.slice(1)) {
503
+ emit(parameter);
504
+ code.push(functionName === "min" ? op.f64Min : op.f64Max);
505
+ }
506
+ return;
507
+ }
508
+ case "imul":
509
+ emit(parameters[0] ?? { kind: "number", value: 0 });
510
+ emitToInt32();
511
+ emit(parameters[1] ?? { kind: "number", value: 0 });
512
+ emitToInt32();
513
+ code.push(op.i32Mul, op.f64ConvertI32S);
514
+ return;
515
+ case "clz32":
516
+ emit(parameters[0] ?? { kind: "number", value: 0 });
517
+ emitToInt32();
518
+ code.push(op.i32Clz, op.f64ConvertI32U);
519
+ return;
520
+ case "fround":
521
+ emit(parameters[0] ?? { kind: "number", value: NaN });
522
+ code.push(op.f32DemoteF64, op.f64PromoteF32);
523
+ return;
524
+ default: {
525
+ emit(parameters[0] ?? { kind: "number", value: NaN });
526
+ const unary = { abs: op.f64Abs, sqrt: op.f64Sqrt, floor: op.f64Floor, ceil: op.f64Ceil, trunc: op.f64Trunc }[functionName];
527
+ if (unary === undefined)
528
+ throw unsupported(`it calls Math.${functionName}, which WASM has no instruction for`);
529
+ code.push(unary);
530
+ }
531
+ }
532
+ };
533
+ const comparisons = { "<": op.f64Lt, ">": op.f64Gt, "<=": op.f64Le, ">=": op.f64Ge, "==": op.f64Eq, "!=": op.f64Ne, "===": op.f64Eq, "!==": op.f64Ne };
534
+ const arithmetic = { "+": op.f64Add, "-": op.f64Sub, "*": op.f64Mul, "/": op.f64Div };
535
+ const bitwise = { "&": op.i32And, "|": op.i32Or, "^": op.i32Xor, "<<": op.i32Shl, ">>": op.i32ShrS, ">>>": op.i32ShrU };
536
+ const emitBinary = (expression) => {
537
+ const { operator, left, right } = expression;
538
+ if (operator === "===" || operator === "!==") {
539
+ const leftType = typeOf(left);
540
+ const rightType = typeOf(right);
541
+ if (leftType === "mixed" || rightType === "mixed")
542
+ throw unsupported("it compares with === or !== a value that may be a boolean or a number");
543
+ // A boolean never strictly equals a number. Operands are pure, so they needn't be evaluated.
544
+ if (leftType !== rightType) {
545
+ code.push(op.f64Const, ...float64(operator === "===" ? 0 : 1));
546
+ return;
547
+ }
548
+ }
549
+ // Integers by a nonzero literal: i64 remainder is exact, and copysign gives JS's -0 for a negative dividend.
550
+ if (operator === "%" && integral(left) && right.kind === "number" && right.value !== 0 && integral(right)) {
551
+ const dividend = scratch(f64Type);
552
+ emit(left);
553
+ code.push(op.localTee, ...unsigned(dividend), ...i64TruncSatF64S, op.i64Const, ...signed(right.value), op.i64RemS, op.f64ConvertI64S, op.localGet, ...unsigned(dividend), op.f64Copysign);
554
+ return;
555
+ }
556
+ // Any dividend by a nonzero integer literal: exactly as above while the dividend is an integer below 2^53 in
557
+ // magnitude, which the row checks, and through the import otherwise.
558
+ if (operator === "%" && right.kind === "number" && right.value !== 0 && integral(right)) {
559
+ const dividend = scratch(f64Type);
560
+ emit(left);
561
+ code.push(op.localTee, ...unsigned(dividend), op.f64Trunc, op.localGet, ...unsigned(dividend), op.f64Eq);
562
+ code.push(op.localGet, ...unsigned(dividend), op.f64Abs, op.f64Const, ...float64(2 ** 53), op.f64Lt, op.i32And);
563
+ code.push(op.if, f64Type, op.localGet, ...unsigned(dividend), ...i64TruncSatF64S, op.i64Const, ...signed(right.value), op.i64RemS, op.f64ConvertI64S, op.localGet, ...unsigned(dividend), op.f64Copysign);
564
+ code.push(op.else, op.localGet, ...unsigned(dividend), op.f64Const, ...float64(right.value));
565
+ emitCall("remainder");
566
+ code.push(op.end);
567
+ return;
568
+ }
569
+ if (operator === "%" || operator === "**") {
570
+ emit(left);
571
+ emit(right);
572
+ emitCall(operator === "%" ? "remainder" : "power");
573
+ return;
574
+ }
575
+ emit(left);
576
+ if (operator in bitwise) {
577
+ emitToInt32();
578
+ emit(right);
579
+ emitToInt32();
580
+ code.push(bitwise[operator]);
581
+ code.push(operator === ">>>" ? op.f64ConvertI32U : op.f64ConvertI32S);
582
+ return;
583
+ }
584
+ emit(right);
585
+ if (operator in arithmetic) {
586
+ code.push(arithmetic[operator]);
587
+ return;
588
+ }
589
+ code.push(comparisons[operator], op.f64ConvertI32U);
590
+ };
591
+ /** Labels from innermost: program blocks and loops count toward IR depths; `if`s and the row block don't. */
592
+ const labels = [];
593
+ const wasmDepth = (depth) => {
594
+ let seen = -1;
595
+ for (let i = labels.length - 1; i >= 0; i--) {
596
+ if (labels[i] === "program" && ++seen === depth)
597
+ return labels.length - 1 - i;
598
+ }
599
+ throw unsupported("it branches to a block that isn't there");
600
+ };
601
+ const store = (column, value) => {
602
+ const { view, offset } = columns[column];
603
+ address(column);
604
+ if (value === "tick")
605
+ code.push(op.localGet, 2);
606
+ else
607
+ emit(value);
608
+ const memory = (align) => [align, ...unsigned(offset)];
609
+ switch (view) {
610
+ case "f32":
611
+ code.push(op.f32DemoteF64, op.f32Store, ...memory(2));
612
+ return;
613
+ case "i32":
614
+ case "u32":
615
+ emitToInt32();
616
+ code.push(op.i32Store, ...memory(2));
617
+ return;
618
+ case "u8":
619
+ emitToInt32();
620
+ code.push(op.i32Store8, ...memory(0));
621
+ return;
622
+ default:
623
+ code.push(op.f64Store, ...memory(3));
624
+ return;
625
+ }
626
+ };
627
+ /**
628
+ * Chunk and block columns stamped by every row, by the shift from a row to its element: top-level stamps with no
629
+ * `next` before them, in an unfiltered kernel. Their chunks and blocks are stamped once per call, for the whole
630
+ * range, instead of on each row.
631
+ */
632
+ const everyRow = new Map();
633
+ // Listed rows needn't be consecutive, so each stamps its own chunk and block.
634
+ if (filters === 0 && !upMode) {
635
+ const ends = (statement) => statement.kind === "next" || (statement.kind === "if" && (statement.consequent.some(ends) || statement.alternate.some(ends)))
636
+ || ((statement.kind === "block" || statement.kind === "loop") && statement.body.some(ends));
637
+ for (const statement of program.body) {
638
+ if (ends(statement))
639
+ break;
640
+ if (statement.kind !== "stamp")
641
+ continue;
642
+ if (columns[statement.blocks].muted !== true)
643
+ everyRow.set(statement.blocks, blockShift);
644
+ if (columns[statement.chunks].muted !== true)
645
+ everyRow.set(statement.chunks, chunkShift);
646
+ }
647
+ }
648
+ /** Stamps every chunk or block from `start`'s to `end - 1`'s, for the chunk and block columns every row stamps. */
649
+ const stampRangeChunks = () => {
650
+ for (const [dense, shift] of everyRow) {
651
+ const chunk = scratch(i32Type);
652
+ const last = scratch(i32Type);
653
+ // if (start < end) for (chunk = start >> shift; chunk <= (end - 1) >> shift; chunk++) dense[chunk] = tick
654
+ code.push(op.localGet, 0, op.localGet, 1, op.i32LtS, op.if, 0x40);
655
+ code.push(op.localGet, 0, op.i32Const, ...signed(shift), op.i32ShrU, op.localSet, ...unsigned(chunk));
656
+ code.push(op.localGet, 1, op.i32Const, 1, op.i32Sub, op.i32Const, ...signed(shift), op.i32ShrU, op.localSet, ...unsigned(last));
657
+ code.push(op.loop, 0x40);
658
+ code.push(op.localGet, ...unsigned(columnParameter(dense)), op.localGet, ...unsigned(chunk), op.i32Const, 3, op.i32Shl, op.i32Add, op.localGet, 2, op.f64Store, 3, 0);
659
+ code.push(op.localGet, ...unsigned(chunk), op.i32Const, 1, op.i32Add, op.localTee, ...unsigned(chunk), op.localGet, ...unsigned(last), op.i32LeS, op.brIf, 0);
660
+ code.push(op.end, op.end);
661
+ }
662
+ };
663
+ // ---- Lookups: a find checks the entity table and the lookup's directory record; leaves read through the record. ----
664
+ /** i32 locals holding the lookup parameters, converted once per call. */
665
+ let lookupLocals = [];
666
+ const convertLookupParameters = () => {
667
+ lookupLocals = [];
668
+ // The `lastRun` lookups watching compare with stays an f64 parameter.
669
+ for (let index = 0; index < lookupParameters - (watching ? 1 : 0); index++) {
670
+ const target = scratch(i32Type);
671
+ code.push(op.localGet, ...unsigned(lookupParameter(index)), ...truncations.i32TruncSatF64U, op.localSet, ...unsigned(target));
672
+ lookupLocals.push(target);
673
+ }
674
+ };
675
+ const entityArchetypes = () => lookupLocals[0];
676
+ const entityRows = () => lookupLocals[1];
677
+ const entityGenerations = () => lookupLocals[2];
678
+ const entityCount = () => lookupLocals[3];
679
+ const directory = (lookup) => lookupLocals[4 + 2 * lookup];
680
+ const directoryCount = (lookup) => lookupLocals[5 + 2 * lookup];
681
+ /** Per handle: whether found, the row, and the address of its directory record. */
682
+ const handleLocals = new Map();
683
+ const handleLocal = (handle, part) => {
684
+ const key = `${handle}:${part}`;
685
+ let index = handleLocals.get(key);
686
+ if (index === undefined)
687
+ handleLocals.set(key, index = scratch(i32Type));
688
+ return index;
689
+ };
690
+ const emitFind = (handle, lookup, entity) => {
691
+ const found = handleLocal(handle, "found");
692
+ const row = handleLocal(handle, "row");
693
+ const record = handleLocal(handle, "record");
694
+ const value = scratch(f64Type);
695
+ const wide = scratch(0x7e);
696
+ const generation = scratch(f64Type);
697
+ const index = scratch(i32Type);
698
+ const archetype = scratch(i32Type);
699
+ const words = 1 + lookups[lookup].reads + (lookups[lookup].watched ?? 0);
700
+ code.push(op.i32Const, 0, op.localSet, ...unsigned(found));
701
+ // As JS `locate`: the index is ToUint32 of the entity and the generation is floor(entity / 2^32), compared as
702
+ // numbers, so negative, fractional and NaN entities behave exactly as they do there.
703
+ emit(entity);
704
+ code.push(op.localTee, ...unsigned(value));
705
+ // Real entities are non-negative integers: one i64 gives both parts. Anything else takes the general path.
706
+ code.push(...i64TruncSatF64S, op.localTee, ...unsigned(wide), op.f64ConvertI64S, op.localGet, ...unsigned(value), op.f64Eq);
707
+ code.push(op.localGet, ...unsigned(value), op.f64Const, ...float64(0), op.f64Ge, op.i32And);
708
+ code.push(op.if, 0x40);
709
+ code.push(op.localGet, ...unsigned(wide), op.i32WrapI64, op.localSet, ...unsigned(index));
710
+ code.push(op.localGet, ...unsigned(wide), op.i64Const, 32, op.i64ShrU, op.f64ConvertI64S, op.localSet, ...unsigned(generation));
711
+ code.push(op.else);
712
+ code.push(op.localGet, ...unsigned(value));
713
+ emitToInt32();
714
+ code.push(op.localSet, ...unsigned(index));
715
+ code.push(op.localGet, ...unsigned(value), op.f64Const, ...float64(2 ** -32), op.f64Mul, op.f64Floor, op.localSet, ...unsigned(generation));
716
+ code.push(op.end);
717
+ code.push(op.block, 0x40);
718
+ labels.push("if");
719
+ code.push(op.localGet, ...unsigned(index), op.localGet, ...unsigned(entityCount()), op.i32GeU, op.brIf, 0);
720
+ code.push(op.localGet, ...unsigned(entityGenerations()), op.localGet, ...unsigned(index), op.i32Const, 2, op.i32Shl, op.i32Add, op.i32Load, 2, 0, op.f64ConvertI32U);
721
+ code.push(op.localGet, ...unsigned(generation), op.f64Ne, op.brIf, 0);
722
+ code.push(op.localGet, ...unsigned(entityArchetypes()), op.localGet, ...unsigned(index), op.i32Const, 2, op.i32Shl, op.i32Add, op.i32Load, 2, 0, op.localTee, ...unsigned(archetype));
723
+ code.push(op.i32Const, 0, op.i32LtS, op.brIf, 0);
724
+ code.push(op.localGet, ...unsigned(archetype), op.localGet, ...unsigned(directoryCount(lookup)), op.i32GeS, op.brIf, 0);
725
+ code.push(op.localGet, ...unsigned(directory(lookup)), op.localGet, ...unsigned(archetype), op.i32Const, ...signed(4 * words), op.i32Mul, op.i32Add, op.localTee, ...unsigned(record));
726
+ code.push(op.i32Load, 2, 0, op.i32Eqz, op.brIf, 0);
727
+ code.push(op.localGet, ...unsigned(entityRows()), op.localGet, ...unsigned(index), op.i32Const, 2, op.i32Shl, op.i32Add, op.i32Load, 2, 0, op.localSet, ...unsigned(row));
728
+ code.push(op.i32Const, 1, op.localSet, ...unsigned(found));
729
+ labels.pop();
730
+ code.push(op.end);
731
+ };
732
+ /**
733
+ * A found entity's `changed`: whether a watched component's tick at its row is newer than the lookups' `lastRun`,
734
+ * or one keeps no ticks, as 0 or 1; NaN if nothing was found.
735
+ */
736
+ const emitChanged = (handle, lookup) => {
737
+ const { reads, watched = 0 } = lookups[lookup];
738
+ const since = lookupParameter(lookupParameters - 1);
739
+ const changed = scratch(i32Type);
740
+ const address = scratch(i32Type);
741
+ code.push(op.localGet, ...unsigned(handleLocal(handle, "found")), op.if, f64Type);
742
+ labels.push("if");
743
+ code.push(op.i32Const, 0, op.localSet, ...unsigned(changed));
744
+ for (let w = 0; w < watched; w++) {
745
+ code.push(op.localGet, ...unsigned(handleLocal(handle, "record")), op.i32Load, 2, ...unsigned(4 * (1 + reads + w)), op.localTee, ...unsigned(address));
746
+ code.push(op.i32Eqz, op.if, i32Type);
747
+ labels.push("if");
748
+ code.push(op.i32Const, 1);
749
+ code.push(op.else);
750
+ code.push(op.localGet, ...unsigned(address), op.localGet, ...unsigned(handleLocal(handle, "row")), op.i32Const, 3, op.i32Shl, op.i32Add, op.f64Load, 3, 0);
751
+ code.push(op.localGet, ...unsigned(since), op.f64Gt);
752
+ code.push(op.end);
753
+ labels.pop();
754
+ code.push(op.localGet, ...unsigned(changed), op.i32Or, op.localSet, ...unsigned(changed));
755
+ }
756
+ code.push(op.localGet, ...unsigned(changed), op.f64ConvertI32U);
757
+ code.push(op.else, op.f64Const, ...float64(NaN), op.end);
758
+ labels.pop();
759
+ };
760
+ const emitLookupLeaf = (handle, read, path) => {
761
+ const lookup = lookupOfHandle.get(handle);
762
+ if (lookup !== undefined && isChanged(lookup, read)) {
763
+ if (path.length > 0)
764
+ throw unsupported("it reads a field of a lookup's changed flag");
765
+ emitChanged(handle, lookup);
766
+ return;
767
+ }
768
+ const leaf = lookup === undefined ? null : lookups[lookup].leaf(read, path);
769
+ if (leaf === null)
770
+ throw unsupported("it reads a value of a lookup that isn't a number or boolean in linear memory");
771
+ const { view, stride, offset, boolean } = leaf;
772
+ code.push(op.localGet, ...unsigned(handleLocal(handle, "found")), op.if, f64Type);
773
+ labels.push("if");
774
+ // The column's address from the record, then the row's element.
775
+ code.push(op.localGet, ...unsigned(handleLocal(handle, "record")), op.i32Load, 2, ...unsigned(4 * (1 + read)));
776
+ code.push(op.localGet, ...unsigned(handleLocal(handle, "row")), op.i32Const, ...signed(stride), op.i32Mul, op.i32Add);
777
+ const memory = (align) => [align, ...unsigned(offset)];
778
+ if (boolean)
779
+ code.push(view === "u8" ? op.i32Load8u : op.i32Load, ...memory(view === "u8" ? 0 : 2), op.i32Const, 0, op.i32Ne, op.f64ConvertI32U);
780
+ else if (view === "f32")
781
+ code.push(op.f32Load, ...memory(2), op.f64PromoteF32);
782
+ else if (view === "i32")
783
+ code.push(op.i32Load, ...memory(2), op.f64ConvertI32S);
784
+ else if (view === "u32")
785
+ code.push(op.i32Load, ...memory(2), op.f64ConvertI32U);
786
+ else if (view === "u8")
787
+ code.push(op.i32Load8u, ...memory(0), op.f64ConvertI32U);
788
+ else
789
+ code.push(op.f64Load, ...memory(3));
790
+ code.push(op.else, op.f64Const, ...float64(NaN), op.end);
791
+ labels.pop();
792
+ };
793
+ // ---- Lookups through indexes: probes of a hash table or searches of a sorted index's blocks, and their lists' rows. ----
794
+ const get = (index) => [op.localGet, ...unsigned(index)];
795
+ const put = (index) => [op.localSet, ...unsigned(index)];
796
+ const tee = (index) => [op.localTee, ...unsigned(index)];
797
+ const constant = (value) => [op.i32Const, ...signed(value | 0)];
798
+ const load = (offset) => [op.i32Load, 2, ...unsigned(offset)];
799
+ /** By lookup through an index, its parameters as locals: addresses and counts as i32, ticks as f64. */
800
+ let indexLocals = [];
801
+ /** Which of a hash index's and a sorted index's parameters are f64. */
802
+ const hashTicks = new Set([5, 6]);
803
+ const sortedTicks = new Set([9, 10]);
804
+ const convertIndexParameters = () => {
805
+ indexLocals = [];
806
+ for (let lookup = 0; lookup < lookups.length; lookup++) {
807
+ const index = indexLookups[lookup];
808
+ const locals = [];
809
+ indexLocals.push(locals);
810
+ if (index === null || index === undefined)
811
+ continue;
812
+ const ticks = index.kind === "hash" ? hashTicks : sortedTicks;
813
+ for (let k = 0; k < indexParameterCount(index); k++) {
814
+ const f64 = ticks.has(k);
815
+ const target = scratch(f64 ? f64Type : i32Type);
816
+ code.push(...get(indexParameter(lookup, k)));
817
+ if (!f64)
818
+ code.push(...truncations.i32TruncSatF64U);
819
+ code.push(...put(target));
820
+ locals.push(target);
821
+ }
822
+ }
823
+ };
824
+ const indexLocal = (lookup, k) => indexLocals[lookup][k];
825
+ /** The lookup a handle is of, and its index's description. */
826
+ const indexOf = (handle) => {
827
+ const lookup = lookupOfHandle.get(handle);
828
+ const index = lookup === undefined ? undefined : indexLookups[lookup];
829
+ if (lookup === undefined || index === null || index === undefined)
830
+ throw unsupported("it reads a list of a lookup that isn't through an index");
831
+ return { lookup, index };
832
+ };
833
+ /** A list handle's i32 locals: a hash list's start, length and bucket; a sorted list's runs and cursor. */
834
+ const listLocal = (handle, part) => {
835
+ const key = `${handle}:list:${part}`;
836
+ let index = handleLocals.get(key);
837
+ if (index === undefined)
838
+ handleLocals.set(key, index = scratch(i32Type));
839
+ return index;
840
+ };
841
+ /** The key's words of a lookup's probes, as i32 locals. */
842
+ const keyLocals = new Map();
843
+ const keyLocal = (lookup, word) => {
844
+ const key = `${lookup}:${word}`;
845
+ let index = keyLocals.get(key);
846
+ if (index === undefined)
847
+ keyLocals.set(key, index = scratch(i32Type));
848
+ return index;
849
+ };
850
+ /** Encodes the f64 on the stack, converted to `value`'s stored type as a store converts it, into the key's words where it goes. */
851
+ const encodeKey = (lookup, value) => {
852
+ const word = keyLocal(lookup, value.word);
853
+ switch (value.scalar) {
854
+ case "i32":
855
+ emitToInt32();
856
+ code.push(...constant(0x80000000), op.i32Xor, ...put(word));
857
+ return;
858
+ case "u32":
859
+ emitToInt32();
860
+ code.push(...put(word));
861
+ return;
862
+ case "boolean":
863
+ emitToInt32();
864
+ code.push(...constant(0xFF), op.i32And, ...constant(0), op.i32Ne, ...put(word));
865
+ return;
866
+ case "f32": {
867
+ const bits = scratch(i32Type);
868
+ code.push(op.f32DemoteF64, op.i32ReinterpretF32, ...tee(bits));
869
+ // NaN last, -0 as +0, a negative's bits flipped, a positive's sign set.
870
+ code.push(...constant(0x7F800000), op.i32And, ...constant(0x7F800000), op.i32Eq);
871
+ code.push(...get(bits), ...constant(0x7FFFFF), op.i32And, ...constant(0), op.i32Ne, op.i32And);
872
+ code.push(op.if, i32Type, ...constant(-1), op.else);
873
+ code.push(...get(bits), ...constant(0x80000000), op.i32Eq, op.if, i32Type, ...constant(0x80000000), op.else);
874
+ code.push(...get(bits), ...constant(31), op.i32ShrU, op.if, i32Type, ...get(bits), ...constant(-1), op.i32Xor, op.else, ...get(bits), ...constant(0x80000000), op.i32Or, op.end);
875
+ code.push(op.end, op.end, ...put(word));
876
+ return;
877
+ }
878
+ default: {
879
+ const wide = scratch(0x7e);
880
+ const high = scratch(i32Type);
881
+ const low = scratch(i32Type);
882
+ const next = keyLocal(lookup, value.word + 1);
883
+ code.push(op.i64ReinterpretF64, ...tee(wide), op.i64Const, 32, op.i64ShrU, op.i32WrapI64, ...put(high));
884
+ code.push(...get(wide), op.i32WrapI64, ...put(low));
885
+ code.push(...get(high), ...constant(0x7FF00000), op.i32And, ...constant(0x7FF00000), op.i32Eq);
886
+ code.push(...get(high), ...constant(0xFFFFF), op.i32And, ...get(low), op.i32Or, ...constant(0), op.i32Ne, op.i32And);
887
+ code.push(op.if, 0x40, ...constant(-1), ...put(word), ...constant(-1), ...put(next), op.else);
888
+ code.push(...get(high), ...constant(0x80000000), op.i32Eq, ...get(low), op.i32Eqz, op.i32And);
889
+ code.push(op.if, 0x40, ...constant(0x80000000), ...put(word), ...constant(0), ...put(next), op.else);
890
+ code.push(...get(high), ...constant(31), op.i32ShrU);
891
+ code.push(op.if, 0x40, ...get(high), ...constant(-1), op.i32Xor, ...put(word), ...get(low), ...constant(-1), op.i32Xor, ...put(next));
892
+ code.push(op.else, ...get(high), ...constant(0x80000000), op.i32Or, ...put(word), ...get(low), ...put(next), op.end);
893
+ code.push(op.end, op.end);
894
+ return;
895
+ }
896
+ }
897
+ };
898
+ /** Points row handle `row` at an entry's archetype and row, found when its archetype holds what the lookup reads. */
899
+ const bindRow = (row, lookup, archetype, entryRow) => {
900
+ const found = handleLocal(row, "found");
901
+ const record = handleLocal(row, "record");
902
+ const words = 1 + lookups[lookup].reads;
903
+ code.push(...constant(0), ...put(found));
904
+ code.push(op.block, 0x40);
905
+ code.push(...get(archetype), ...get(directoryCount(lookup)), op.i32GeU, op.brIf, 0);
906
+ code.push(...get(directory(lookup)), ...get(archetype), ...constant(4 * words), op.i32Mul, op.i32Add, ...tee(record));
907
+ code.push(...load(0), op.i32Eqz, op.brIf, 0);
908
+ code.push(...get(entryRow), ...put(handleLocal(row, "row")), ...constant(1), ...put(found));
909
+ code.push(op.end);
910
+ };
911
+ /** Fenwick tree sum of the lengths of the blocks before position `k` (an i32 local), left on the stack. */
912
+ const emitPrefix = (lookup, k) => {
913
+ const node = scratch(i32Type);
914
+ const sum = scratch(i32Type);
915
+ const counts = indexLocal(lookup, 5);
916
+ code.push(...constant(0), ...put(sum), ...get(k), ...put(node));
917
+ code.push(op.block, 0x40, op.loop, 0x40);
918
+ code.push(...get(node), op.i32Eqz, op.brIf, 1);
919
+ code.push(...get(sum), ...get(counts), ...get(node), ...constant(2), op.i32Shl, op.i32Add, ...load(0), op.i32Add, ...put(sum));
920
+ code.push(...get(node), ...get(node), ...constant(0), ...get(node), op.i32Sub, op.i32And, op.i32Sub, ...put(node), op.br, 0);
921
+ code.push(op.end, op.end, ...get(sum));
922
+ };
923
+ /** The position in `order` of the block holding entry position `position` (an i32 local), into `k`. */
924
+ const emitBlockAt = (lookup, position, k) => {
925
+ const remaining = scratch(i32Type);
926
+ const step = scratch(i32Type);
927
+ const next = scratch(i32Type);
928
+ const blocks = indexLocal(lookup, 1);
929
+ const counts = indexLocal(lookup, 5);
930
+ code.push(...constant(0), ...put(k), ...get(position), ...put(remaining));
931
+ // The largest power of two at most `blocks`, or 0 without blocks.
932
+ code.push(...get(blocks), op.i32Eqz, op.if, i32Type, ...constant(0), op.else, ...constant(1), ...constant(31), ...get(blocks), op.i32Clz, op.i32Sub, op.i32Shl, op.end, ...put(step));
933
+ code.push(op.block, 0x40, op.loop, 0x40);
934
+ code.push(...get(step), op.i32Eqz, op.brIf, 1);
935
+ code.push(...get(k), ...get(step), op.i32Add, ...tee(next), ...get(blocks), op.i32LeU);
936
+ code.push(op.if, 0x40);
937
+ code.push(...get(counts), ...get(next), ...constant(2), op.i32Shl, op.i32Add, ...load(0), ...get(remaining), op.i32LeU);
938
+ code.push(op.if, 0x40, ...get(next), ...put(k), ...get(remaining), ...get(counts), ...get(next), ...constant(2), op.i32Shl, op.i32Add, ...load(0), op.i32Sub, ...put(remaining), op.end);
939
+ code.push(op.end);
940
+ code.push(...get(step), ...constant(1), op.i32ShrU, ...put(step), op.br, 0);
941
+ code.push(op.end, op.end);
942
+ };
943
+ /**
944
+ * Leaves 1 when the key at `address` (an i32 local) passes against the key's first `count` words: after them, or
945
+ * with `after` false, not before them, comparing unsigned words in order.
946
+ */
947
+ const emitPasses = (lookup, address, count, after) => {
948
+ const passes = scratch(i32Type);
949
+ const word = scratch(i32Type);
950
+ code.push(...constant(after ? 0 : 1), ...put(passes));
951
+ code.push(op.block, 0x40);
952
+ for (let w = 0; w < count; w++) {
953
+ code.push(...get(address), ...load(4 * w), ...tee(word), ...get(keyLocal(lookup, w)), op.i32Ne);
954
+ code.push(op.if, 0x40, ...get(word), ...get(keyLocal(lookup, w)), op.i32GtU, ...put(passes), op.br, 1, op.end);
955
+ }
956
+ code.push(op.end, ...get(passes));
957
+ };
958
+ /**
959
+ * The first entry position whose key's first `count` words pass, into `result`: a search over the blocks' fences,
960
+ * then within a block. A lower bound leaves the list's cursor at its block.
961
+ */
962
+ const emitBound = (lookup, index, count, after, result, list) => {
963
+ if (count === 0) {
964
+ code.push(...(after ? get(indexLocal(lookup, 6)) : constant(0)), ...put(result));
965
+ return;
966
+ }
967
+ const low = scratch(i32Type);
968
+ const high = scratch(i32Type);
969
+ const middle = scratch(i32Type);
970
+ const address = scratch(i32Type);
971
+ const block = scratch(i32Type);
972
+ const base = scratch(i32Type);
973
+ const fences = indexLocal(lookup, 0);
974
+ const blocks = indexLocal(lookup, 1);
975
+ const fenceBytes = 4 * (index.words + 1);
976
+ const entryBytes = 4 * index.stride;
977
+ const search = (from, length, at) => {
978
+ code.push(...constant(0), ...put(low));
979
+ length();
980
+ code.push(...put(high));
981
+ code.push(op.block, 0x40, op.loop, 0x40);
982
+ code.push(...get(low), ...get(high), op.i32GeU, op.brIf, 1);
983
+ code.push(...get(low), ...get(high), op.i32Add, ...constant(1), op.i32ShrU, ...put(middle));
984
+ at();
985
+ code.push(...put(address));
986
+ emitPasses(lookup, address, count, after);
987
+ code.push(op.if, 0x40, ...get(middle), ...put(high), op.else, ...get(middle), ...constant(1), op.i32Add, ...put(low), op.end);
988
+ code.push(op.br, 0, op.end, op.end);
989
+ void from;
990
+ };
991
+ search(() => { }, () => code.push(...get(blocks)), () => code.push(...get(fences), ...get(middle), ...constant(fenceBytes), op.i32Mul, op.i32Add));
992
+ // Past the last block: the size.
993
+ code.push(...get(low), ...get(blocks), op.i32GeU, op.if, 0x40, ...get(indexLocal(lookup, 6)), ...put(result), op.else);
994
+ const k = scratch(i32Type);
995
+ code.push(...get(low), ...put(k));
996
+ code.push(...get(indexLocal(lookup, 2)), ...get(k), ...constant(2), op.i32Shl, op.i32Add, ...load(0), ...put(block));
997
+ code.push(...get(indexLocal(lookup, 4)), ...get(block), ...constant(entryBytes * 128), op.i32Mul, op.i32Add, ...put(base));
998
+ search(() => { }, () => code.push(...get(indexLocal(lookup, 3)), ...get(block), ...constant(2), op.i32Shl, op.i32Add, ...load(0)), () => code.push(...get(base), ...get(middle), ...constant(entryBytes), op.i32Mul, op.i32Add));
999
+ emitPrefix(lookup, k);
1000
+ if (!after) {
1001
+ const first = scratch(i32Type);
1002
+ code.push(...tee(first), ...get(low), op.i32Add, ...put(result));
1003
+ code.push(...get(k), ...put(listLocal(list, "k")), ...get(first), ...put(listLocal(list, "first")));
1004
+ code.push(...get(indexLocal(lookup, 3)), ...get(block), ...constant(2), op.i32Shl, op.i32Add, ...load(0), ...put(listLocal(list, "count")));
1005
+ }
1006
+ else
1007
+ code.push(...get(low), op.i32Add, ...put(result));
1008
+ code.push(op.end);
1009
+ };
1010
+ /** Looks a key up, into list handle `list`, and its first row into `first`. */
1011
+ const emitProbe = (list, first, probe, values) => {
1012
+ const { lookup, index } = indexOf(list);
1013
+ const plan = index.probe(probe);
1014
+ if (plan === null)
1015
+ throw unsupported("it looks up an index by a key WASM can't encode");
1016
+ let next = 0;
1017
+ const encode = (targets) => {
1018
+ for (const target of targets) {
1019
+ const value = values[next++];
1020
+ if (value === undefined)
1021
+ throw unsupported("it looks up an index with fewer values than its key has");
1022
+ emit(value);
1023
+ encodeKey(lookup, target);
1024
+ }
1025
+ };
1026
+ encode(plan.values);
1027
+ if (index.kind === "hash") {
1028
+ const hash = scratch(i32Type);
1029
+ const slot = scratch(i32Type);
1030
+ const address = scratch(i32Type);
1031
+ const filled = scratch(i32Type);
1032
+ const base = scratch(i32Type);
1033
+ const bucket = listLocal(list, "bucket");
1034
+ const slots = indexLocal(lookup, 0);
1035
+ const mask = indexLocal(lookup, 1);
1036
+ const records = indexLocal(lookup, 2);
1037
+ const recordBytes = 4 * index.stride;
1038
+ code.push(...constant(0x811C9DC5), ...put(hash));
1039
+ for (let w = 0; w < index.words; w++) {
1040
+ code.push(...get(hash), ...get(keyLocal(lookup, w)), op.i32Xor, ...constant(0x9E3779B1), op.i32Mul, ...tee(hash), ...get(hash), ...constant(15), op.i32ShrU, op.i32Xor, ...put(hash));
1041
+ }
1042
+ code.push(...get(hash), ...get(hash), ...constant(16), op.i32ShrU, op.i32Xor, ...constant(0x85EBCA6B), op.i32Mul, ...put(hash));
1043
+ code.push(...get(hash), ...get(hash), ...constant(13), op.i32ShrU, op.i32Xor, ...constant(0xC2B2AE35), op.i32Mul, ...put(hash));
1044
+ code.push(...get(hash), ...get(hash), ...constant(16), op.i32ShrU, op.i32Xor, ...put(hash));
1045
+ code.push(...get(hash), ...get(mask), op.i32And, ...put(slot), ...constant(-1), ...put(bucket));
1046
+ code.push(op.block, 0x40, op.loop, 0x40);
1047
+ code.push(...get(slots), ...get(slot), ...constant(8), op.i32Mul, op.i32Add, ...tee(address), ...load(4), ...tee(filled), op.i32Eqz, op.brIf, 1);
1048
+ code.push(...get(address), ...load(0), ...get(hash), op.i32Eq, op.if, 0x40);
1049
+ code.push(...get(records), ...get(filled), ...constant(1), op.i32Sub, ...constant(recordBytes), op.i32Mul, op.i32Add, ...put(base));
1050
+ code.push(...constant(1));
1051
+ for (let w = 0; w < index.words; w++)
1052
+ code.push(...get(base), ...load(16 + 4 * w), ...get(keyLocal(lookup, w)), op.i32Eq, op.i32And);
1053
+ code.push(op.if, 0x40, ...get(filled), ...constant(1), op.i32Sub, ...put(bucket), op.br, 3, op.end);
1054
+ code.push(op.end);
1055
+ code.push(...get(slot), ...constant(1), op.i32Add, ...get(mask), op.i32And, ...put(slot), op.br, 0);
1056
+ code.push(op.end, op.end);
1057
+ code.push(...get(bucket), ...constant(0), op.i32LtS, op.if, 0x40, ...constant(0), ...put(listLocal(list, "start")), ...constant(0), ...put(listLocal(list, "length")));
1058
+ code.push(op.else);
1059
+ code.push(...get(records), ...get(bucket), ...constant(recordBytes), op.i32Mul, op.i32Add, ...tee(base), ...load(4), ...put(listLocal(list, "start")));
1060
+ code.push(...get(base), ...load(8), ...put(listLocal(list, "length")));
1061
+ code.push(op.end);
1062
+ }
1063
+ else {
1064
+ const low = listLocal(list, "low");
1065
+ const high = listLocal(list, "high");
1066
+ const second = listLocal(list, "second");
1067
+ const end = listLocal(list, "end");
1068
+ code.push(...constant(0), ...put(second), ...constant(0), ...put(end), ...constant(0), ...put(listLocal(list, "count")));
1069
+ if (plan.comparisons === null) {
1070
+ emitBound(lookup, index, plan.prefixWords, false, low, list);
1071
+ emitBound(lookup, index, plan.prefixWords, true, high, list);
1072
+ }
1073
+ else {
1074
+ emitBound(lookup, index, plan.prefixWords, false, low, list);
1075
+ emitBound(lookup, index, plan.prefixWords, true, high, list);
1076
+ const bound = scratch(i32Type);
1077
+ const unequalLow = scratch(i32Type);
1078
+ const unequalHigh = scratch(i32Type);
1079
+ code.push(...constant(-1), ...put(unequalLow));
1080
+ const raise = () => { code.push(...get(bound), ...get(low), ...get(bound), ...get(low), op.i32GtS, op.select, ...put(low)); };
1081
+ const lower = () => { code.push(...get(bound), ...get(high), ...get(bound), ...get(high), op.i32LtS, op.select, ...put(high)); };
1082
+ for (const comparison of plan.comparisons) {
1083
+ encode(comparison.values);
1084
+ switch (comparison.operator) {
1085
+ case ">=":
1086
+ emitBound(lookup, index, comparison.words, false, bound, list);
1087
+ raise();
1088
+ break;
1089
+ case ">":
1090
+ emitBound(lookup, index, comparison.words, true, bound, list);
1091
+ raise();
1092
+ break;
1093
+ case "<":
1094
+ emitBound(lookup, index, comparison.words, false, bound, list);
1095
+ lower();
1096
+ break;
1097
+ case "<=":
1098
+ emitBound(lookup, index, comparison.words, true, bound, list);
1099
+ lower();
1100
+ break;
1101
+ case "==":
1102
+ emitBound(lookup, index, comparison.words, false, bound, list);
1103
+ raise();
1104
+ emitBound(lookup, index, comparison.words, true, bound, list);
1105
+ lower();
1106
+ break;
1107
+ case "!=":
1108
+ emitBound(lookup, index, comparison.words, false, unequalLow, list);
1109
+ emitBound(lookup, index, comparison.words, true, unequalHigh, list);
1110
+ break;
1111
+ default: throw unsupported(`it compares an index's key with ${comparison.operator}, which WASM's lookups don't`);
1112
+ }
1113
+ }
1114
+ // An empty range, and without `!=`'s, one run; with it, the rows before and after the value.
1115
+ code.push(...get(high), ...get(low), op.i32LtS, op.if, 0x40, ...get(low), ...put(high), op.end);
1116
+ code.push(...get(unequalLow), ...constant(0), op.i32GeS, op.if, 0x40);
1117
+ // second = max(low, min(high, unequalHigh)); end = high; high = min(high, max(low, unequalLow))
1118
+ code.push(...get(unequalHigh), ...get(high), ...get(unequalHigh), ...get(high), op.i32LtS, op.select, ...put(second));
1119
+ code.push(...get(second), ...get(low), ...get(second), ...get(low), op.i32GtS, op.select, ...put(second));
1120
+ code.push(...get(high), ...put(end));
1121
+ code.push(...get(unequalLow), ...get(low), ...get(unequalLow), ...get(low), op.i32GtS, op.select, ...put(bound));
1122
+ code.push(...get(bound), ...get(high), ...get(bound), ...get(high), op.i32LtS, op.select, ...put(high));
1123
+ code.push(...get(second), ...get(end), op.i32GeS, op.if, 0x40, ...constant(0), ...put(second), ...constant(0), ...put(end), op.end);
1124
+ code.push(op.end);
1125
+ }
1126
+ // The cursor holds the block of the last lower bound, which needn't be the first row's: `count` 0 marks it unknown.
1127
+ code.push(...constant(0), ...put(listLocal(list, "count")));
1128
+ }
1129
+ emitListRowAt(first, list, () => code.push(op.f64Const, ...float64(0)));
1130
+ };
1131
+ /** How many rows a list holds, as an i32 on the stack. */
1132
+ const emitListCount = (list) => {
1133
+ const { index } = indexOf(list);
1134
+ if (index.kind === "hash")
1135
+ code.push(...get(listLocal(list, "length")));
1136
+ else
1137
+ code.push(...get(listLocal(list, "high")), ...get(listLocal(list, "low")), op.i32Sub, ...get(listLocal(list, "end")), ...get(listLocal(list, "second")), op.i32Sub, op.i32Add);
1138
+ };
1139
+ const emitListLength = (list) => {
1140
+ emitListCount(list);
1141
+ code.push(op.f64ConvertI32U);
1142
+ };
1143
+ /** Points row handle `row` at row `index` (an f64 the callback leaves) of list handle `list`, or at none outside it. */
1144
+ const emitListRowAt = (row, list, index) => {
1145
+ const { lookup, index: structure } = indexOf(list);
1146
+ const value = scratch(f64Type);
1147
+ const position = scratch(i32Type);
1148
+ const archetype = scratch(i32Type);
1149
+ const entryRow = scratch(i32Type);
1150
+ const entry = scratch(i32Type);
1151
+ code.push(...constant(0), ...put(handleLocal(row, "found")));
1152
+ index();
1153
+ code.push(...tee(value), op.f64Const, ...float64(0), op.f64Ge, ...get(value));
1154
+ emitListCount(list);
1155
+ code.push(op.f64ConvertI32U, op.f64Lt, op.i32And, op.if, 0x40);
1156
+ code.push(...get(value), ...truncations.i32TruncSatF64U, ...put(position));
1157
+ if (structure.kind === "hash") {
1158
+ code.push(...get(indexLocal(lookup, 3)), ...get(listLocal(list, "start")), ...get(position), op.i32Add, ...constant(12), op.i32Mul, op.i32Add, ...put(entry));
1159
+ code.push(...get(entry), ...load(4), ...put(archetype), ...get(entry), ...load(8), ...put(entryRow));
1160
+ }
1161
+ else {
1162
+ const runLength = scratch(i32Type);
1163
+ const k = listLocal(list, "k");
1164
+ const first = listLocal(list, "first");
1165
+ const count = listLocal(list, "count");
1166
+ // The position among the entries: in the first run, or the second.
1167
+ code.push(...get(listLocal(list, "high")), ...get(listLocal(list, "low")), op.i32Sub, ...tee(runLength), ...get(position), op.i32GtU);
1168
+ code.push(op.if, i32Type, ...get(listLocal(list, "low")), ...get(position), op.i32Add, op.else, ...get(listLocal(list, "second")), ...get(position), op.i32Add, ...get(runLength), op.i32Sub, op.end, ...put(position));
1169
+ // Outside the cursor's block: find it.
1170
+ code.push(...get(position), ...get(first), op.i32Sub, ...get(count), op.i32GeU, op.if, 0x40);
1171
+ emitBlockAt(lookup, position, k);
1172
+ emitPrefix(lookup, k);
1173
+ code.push(...put(first));
1174
+ code.push(...get(indexLocal(lookup, 3)), ...get(indexLocal(lookup, 2)), ...get(k), ...constant(2), op.i32Shl, op.i32Add, ...load(0), ...constant(2), op.i32Shl, op.i32Add, ...load(0), ...put(count));
1175
+ code.push(op.end);
1176
+ const entryBytes = 4 * structure.stride;
1177
+ code.push(...get(indexLocal(lookup, 4)), ...get(indexLocal(lookup, 2)), ...get(k), ...constant(2), op.i32Shl, op.i32Add, ...load(0), ...constant(entryBytes * 128), op.i32Mul, op.i32Add);
1178
+ code.push(...get(position), ...get(first), op.i32Sub, ...constant(entryBytes), op.i32Mul, op.i32Add, ...put(entry));
1179
+ code.push(...get(entry), ...load(4 * (structure.words + 1)), ...put(archetype), ...get(entry), ...load(4 * (structure.words + 2)), ...put(entryRow));
1180
+ }
1181
+ bindRow(row, lookup, archetype, entryRow);
1182
+ code.push(op.end);
1183
+ };
1184
+ const emitListRow = (row, list, index) => emitListRowAt(row, list, () => emit(index));
1185
+ /** Leaves 1 when a segment tree's ticks over the blocks around entry positions `low` to `high` (i32 locals) are newer than `since`. */
1186
+ const emitRunChanged = (lookup, tree, low, high) => {
1187
+ const from = scratch(i32Type);
1188
+ const to = scratch(i32Type);
1189
+ const position = scratch(i32Type);
1190
+ const node = scratch(i32Type);
1191
+ const limit = scratch(i32Type);
1192
+ const maximum = scratch(f64Type);
1193
+ const size = indexLocal(lookup, 6);
1194
+ const leaves = indexLocal(lookup, 8);
1195
+ // Clamped to the entries: max(low - 1, 0) and min(high, size - 1), then their blocks.
1196
+ code.push(...get(low), ...constant(1), op.i32Sub, ...tee(position), ...constant(0), ...get(position), ...constant(0), op.i32GtS, op.select, ...tee(position));
1197
+ code.push(...get(size), ...constant(1), op.i32Sub, ...get(position), ...get(size), ...constant(1), op.i32Sub, op.i32LtS, op.select, ...put(position));
1198
+ emitBlockAt(lookup, position, from);
1199
+ code.push(...get(high), ...get(size), ...constant(1), op.i32Sub, ...get(high), ...get(size), ...constant(1), op.i32Sub, op.i32LtS, op.select, ...put(position));
1200
+ emitBlockAt(lookup, position, to);
1201
+ code.push(op.f64Const, ...float64(0), ...put(maximum));
1202
+ code.push(...get(from), ...get(leaves), op.i32Add, ...put(node), ...get(to), ...get(leaves), op.i32Add, ...constant(1), op.i32Add, ...put(limit));
1203
+ code.push(op.block, 0x40, op.loop, 0x40);
1204
+ code.push(...get(node), ...get(limit), op.i32GeU, op.brIf, 1);
1205
+ code.push(...get(node), ...constant(1), op.i32And, op.if, 0x40);
1206
+ code.push(...get(maximum), ...get(tree), ...get(node), ...constant(3), op.i32Shl, op.i32Add, op.f64Load, 3, 0, op.f64Max, ...put(maximum), ...get(node), ...constant(1), op.i32Add, ...put(node));
1207
+ code.push(op.end);
1208
+ code.push(...get(limit), ...constant(1), op.i32And, op.if, 0x40);
1209
+ code.push(...get(limit), ...constant(1), op.i32Sub, ...tee(limit), ...constant(3), op.i32Shl, ...get(tree), op.i32Add, op.f64Load, 3, 0, ...get(maximum), op.f64Max, ...put(maximum));
1210
+ code.push(op.end);
1211
+ code.push(...get(node), ...constant(1), op.i32ShrU, ...put(node), ...get(limit), ...constant(1), op.i32ShrU, ...put(limit), op.br, 0);
1212
+ code.push(op.end, op.end);
1213
+ code.push(...get(maximum), ...get(indexLocal(lookup, 10)), op.f64Gt);
1214
+ };
1215
+ /** Whether a list changed since its system last ran, as an f64 of 0 or 1. */
1216
+ const emitListChanged = (list) => {
1217
+ const { lookup, index } = indexOf(list);
1218
+ if (index.kind === "hash") {
1219
+ const bucket = listLocal(list, "bucket");
1220
+ const since = indexLocal(lookup, 6);
1221
+ code.push(...get(bucket), ...constant(0), op.i32LtS, op.if, i32Type, ...get(indexLocal(lookup, 5)), ...get(since), op.f64Gt, op.else);
1222
+ code.push(...get(indexLocal(lookup, 4)), ...get(bucket), ...constant(3), op.i32Shl, op.i32Add, op.f64Load, 3, 0, ...get(since), op.f64Gt);
1223
+ for (let k = 0; k < index.watched; k++)
1224
+ code.push(...get(indexLocal(lookup, 7 + k)), ...get(bucket), ...constant(3), op.i32Shl, op.i32Add, op.f64Load, 3, 0, ...get(since), op.f64Gt, op.i32Or);
1225
+ code.push(op.end, op.f64ConvertI32U);
1226
+ return;
1227
+ }
1228
+ const trees = [indexLocal(lookup, 7), ...Array.from({ length: index.watched }, (_, k) => indexLocal(lookup, 11 + k))];
1229
+ code.push(...get(indexLocal(lookup, 1)), op.i32Eqz, op.if, i32Type, ...get(indexLocal(lookup, 9)), ...get(indexLocal(lookup, 10)), op.f64Gt, op.else);
1230
+ code.push(...constant(0));
1231
+ for (const tree of trees) {
1232
+ emitRunChanged(lookup, tree, listLocal(list, "low"), listLocal(list, "high"));
1233
+ code.push(op.i32Or);
1234
+ code.push(...get(listLocal(list, "end")), ...get(listLocal(list, "second")), op.i32GtS, op.if, i32Type);
1235
+ emitRunChanged(lookup, tree, listLocal(list, "second"), listLocal(list, "end"));
1236
+ code.push(op.else, ...constant(0), op.end, op.i32Or);
1237
+ }
1238
+ code.push(op.end, op.f64ConvertI32U);
1239
+ };
1240
+ /** A leaf of a row handle's row, through its directory record's column `word`, or NaN without a row. */
1241
+ const emitRecordLeaf = (handle, word, column) => {
1242
+ const { view, stride, offset, boolean } = column;
1243
+ code.push(...get(handleLocal(handle, "found")), op.if, f64Type);
1244
+ code.push(...get(handleLocal(handle, "record")), op.i32Load, 2, ...unsigned(4 * word));
1245
+ code.push(...get(handleLocal(handle, "row")), ...constant(stride), op.i32Mul, op.i32Add);
1246
+ const memory = (align) => [align, ...unsigned(offset)];
1247
+ if (boolean)
1248
+ code.push(view === "u8" ? op.i32Load8u : op.i32Load, ...memory(view === "u8" ? 0 : 2), op.i32Const, 0, op.i32Ne, op.f64ConvertI32U);
1249
+ else if (view === "f32")
1250
+ code.push(op.f32Load, ...memory(2), op.f64PromoteF32);
1251
+ else if (view === "i32")
1252
+ code.push(op.i32Load, ...memory(2), op.f64ConvertI32S);
1253
+ else if (view === "u32")
1254
+ code.push(op.i32Load, ...memory(2), op.f64ConvertI32U);
1255
+ else if (view === "u8")
1256
+ code.push(op.i32Load8u, ...memory(0), op.f64ConvertI32U);
1257
+ else
1258
+ code.push(op.f64Load, ...memory(3));
1259
+ code.push(op.else, op.f64Const, ...float64(NaN), op.end);
1260
+ };
1261
+ const emitRowLeaf = (row, leaf) => {
1262
+ const { index } = indexOf(row);
1263
+ const found = index.rowLeaf(leaf);
1264
+ if (found === null)
1265
+ throw unsupported("it reads a value of an index's row that isn't stored in linear memory");
1266
+ // Word 1 is the archetype's entities, so a read's column is at 2 + read.
1267
+ emitRecordLeaf(row, 2 + found.read, found.column);
1268
+ };
1269
+ const emitRowEntity = (row) => {
1270
+ indexOf(row);
1271
+ emitRecordLeaf(row, 1, { view: "f64", stride: 8, offset: 0, boolean: false });
1272
+ };
1273
+ /**
1274
+ * Sets the chunk or block tick, by `shift`, of the row `rowOffset` rows past the current one, unless it's muted
1275
+ * or every row's is stamped up front.
1276
+ */
1277
+ const stampDense = (dense, shift, rowOffset) => {
1278
+ if (columns[dense].muted === true || everyRow.has(dense))
1279
+ return;
1280
+ code.push(op.localGet, ...unsigned(columnParameter(dense)), op.localGet, ...unsigned(rowLocal));
1281
+ if (rowOffset !== 0)
1282
+ code.push(op.i32Const, ...signed(rowOffset), op.i32Add);
1283
+ code.push(op.i32Const, ...signed(shift), op.i32ShrU, op.i32Const, 3, op.i32Shl, op.i32Add, op.localGet, 2, op.f64Store, 3, 0);
1284
+ };
1285
+ const statement = (current) => {
1286
+ switch (current.kind) {
1287
+ case "set":
1288
+ emit(current.value);
1289
+ code.push(op.localSet, ...unsigned(local(current.local)));
1290
+ return;
1291
+ case "store": return store(current.column, current.value);
1292
+ // A chunk column stays when its row column is muted, for a component held on the GPU.
1293
+ case "stamp":
1294
+ if (columns[current.column].muted !== true)
1295
+ store(current.column, "tick");
1296
+ stampDense(current.blocks, blockShift, 0);
1297
+ stampDense(current.chunks, chunkShift, 0);
1298
+ return;
1299
+ case "if":
1300
+ emit(current.test);
1301
+ emitTruthy(typeOf(current.test));
1302
+ code.push(op.if, 0x40);
1303
+ labels.push("if");
1304
+ for (const inner of current.consequent)
1305
+ statement(inner);
1306
+ if (current.alternate.length > 0) {
1307
+ code.push(op.else);
1308
+ for (const inner of current.alternate)
1309
+ statement(inner);
1310
+ }
1311
+ labels.pop();
1312
+ code.push(op.end);
1313
+ return;
1314
+ case "block":
1315
+ case "loop":
1316
+ code.push(current.kind === "block" ? op.block : op.loop, 0x40);
1317
+ labels.push("program");
1318
+ for (const inner of current.body)
1319
+ statement(inner);
1320
+ labels.pop();
1321
+ code.push(op.end);
1322
+ return;
1323
+ case "branch":
1324
+ code.push(op.br, ...unsigned(wasmDepth(current.depth)));
1325
+ return;
1326
+ case "branchIf":
1327
+ emit(current.test);
1328
+ emitTruthy(typeOf(current.test));
1329
+ code.push(op.brIf, ...unsigned(wasmDepth(current.depth)));
1330
+ return;
1331
+ case "next":
1332
+ code.push(op.br, ...unsigned(labels.length - 1 - labels.lastIndexOf("next")));
1333
+ return;
1334
+ case "find": return emitFind(current.handle, current.lookup, current.entity);
1335
+ case "probe": return emitProbe(current.list, current.first, current.probe, current.values);
1336
+ case "listRow": return emitListRow(current.row, current.list, current.index);
1337
+ }
1338
+ };
1339
+ // ---- SIMD. f32 lanes compute at storage precision, so results may differ from the scalar path; f64 lanes don't. ----
1340
+ const v128Type = 0x7b;
1341
+ const simd = (operation) => [0xfd, ...unsigned(operation)];
1342
+ const vop = {
1343
+ load: 0, store: 11, const: 12, f32Splat: 19, f64Splat: 20,
1344
+ f32Eq: 65, f32Ne: 66, f32Lt: 67, f32Gt: 68, f32Le: 69, f32Ge: 70,
1345
+ f64Gt: 74, not: 77, and: 78, andNot: 79, or: 80, bitselect: 82, anyTrue: 83,
1346
+ store32Lane: 90, store64Lane: 91, load32Zero: 92, load64Zero: 93,
1347
+ f64Eq: 71, f64Ne: 72, f64Lt: 73, f64Le: 75, f64Ge: 76, f32DemoteF64Zero: 94, f64PromoteLowF32: 95,
1348
+ f32Ceil: 103, f32Floor: 104, f32Trunc: 105, f64Ceil: 116, f64Floor: 117, f64Trunc: 122, i64ExtendLowS: 199, i64ExtendHighS: 200,
1349
+ f32Abs: 224, f32Neg: 225, f32Sqrt: 227, f32Add: 228, f32Sub: 229, f32Mul: 230, f32Div: 231, f32Min: 232, f32Max: 233,
1350
+ f64Abs: 236, f64Neg: 237, f64Sqrt: 239, f64Add: 240, f64Sub: 241, f64Mul: 242, f64Div: 243, f64Min: 244, f64Max: 245,
1351
+ };
1352
+ /** f64 lanes: each vector holds two values, each operation the f64 one, so lanes compute as the scalar path does. */
1353
+ const wide = !storagePrecision;
1354
+ /** Bytes of f32 storage one vector covers: four lanes, or two promoted to f64. */
1355
+ const laneBytes = wide ? 8 : 16;
1356
+ const float32 = (value) => [...new Uint8Array(new Float32Array([value]).buffer)];
1357
+ const vectorConstant = (values) => wide
1358
+ ? [...simd(vop.const), ...[0, 1].flatMap(lane => float64(values[lane] ?? 0))]
1359
+ : [...simd(vop.const), ...[0, 1, 2, 3].flatMap(lane => float32(values[lane] ?? 0))];
1360
+ const splatConstant = (value) => vectorConstant([value, value, value, value]);
1361
+ const arithmeticVector = wide
1362
+ ? { "+": vop.f64Add, "-": vop.f64Sub, "*": vop.f64Mul, "/": vop.f64Div }
1363
+ : { "+": vop.f32Add, "-": vop.f32Sub, "*": vop.f32Mul, "/": vop.f32Div };
1364
+ const unaryVector = wide
1365
+ ? { abs: vop.f64Abs, sqrt: vop.f64Sqrt, floor: vop.f64Floor, ceil: vop.f64Ceil, trunc: vop.f64Trunc }
1366
+ : { abs: vop.f32Abs, sqrt: vop.f32Sqrt, floor: vop.f32Floor, ceil: vop.f32Ceil, trunc: vop.f32Trunc };
1367
+ const negateVector = wide ? vop.f64Neg : vop.f32Neg;
1368
+ const comparisonVector = wide
1369
+ ? { "<": vop.f64Lt, ">": vop.f64Gt, "<=": vop.f64Le, ">=": vop.f64Ge, "==": vop.f64Eq, "!=": vop.f64Ne, "===": vop.f64Eq, "!==": vop.f64Ne }
1370
+ : { "<": vop.f32Lt, ">": vop.f32Gt, "<=": vop.f32Le, ">=": vop.f32Ge, "==": vop.f32Eq, "!=": vop.f32Ne, "===": vop.f32Eq, "!==": vop.f32Ne };
1371
+ /** Loads the vector of f32 storage at the address on the stack plus `offset`, as lanes. */
1372
+ const loadLanes = (offset) => {
1373
+ if (wide)
1374
+ code.push(...simd(vop.load64Zero), 2, ...unsigned(offset), ...simd(vop.f64PromoteLowF32));
1375
+ else
1376
+ code.push(...simd(vop.load), 2, ...unsigned(offset));
1377
+ };
1378
+ /** Stores lanes, on the stack after the address, to f32 storage at that address plus `offset`. */
1379
+ const storeLanes = (offset) => {
1380
+ if (wide)
1381
+ code.push(...simd(vop.f32DemoteF64Zero), ...simd(vop.store64Lane), 2, ...unsigned(offset), 0);
1382
+ else
1383
+ code.push(...simd(vop.store), 2, ...unsigned(offset));
1384
+ };
1385
+ const isArithmetic = (operator) => operator in arithmeticVector;
1386
+ /** A value that's the same for every lane, splatted: demoted to f32 for f32 lanes, as a lane computes. */
1387
+ const emitSplat = (expression) => {
1388
+ emit(expression);
1389
+ if (wide)
1390
+ code.push(...simd(vop.f64Splat));
1391
+ else
1392
+ code.push(op.f32DemoteF64, ...simd(vop.f32Splat));
1393
+ };
1394
+ /** `Math` functions with a vector equivalent; `fround` is the identity in f32 and a demotion and promotion in f64. */
1395
+ const emitVectorMath = (functionName, count) => {
1396
+ if (functionName === "min" || functionName === "max") {
1397
+ const operation = functionName === "min" ? (wide ? vop.f64Min : vop.f32Min) : (wide ? vop.f64Max : vop.f32Max);
1398
+ for (let i = 1; i < count; i++)
1399
+ code.push(...simd(operation));
1400
+ return;
1401
+ }
1402
+ if (functionName === "fround" && wide)
1403
+ return void code.push(...simd(vop.f32DemoteF64Zero), ...simd(vop.f64PromoteLowF32));
1404
+ const unary = unaryVector[functionName];
1405
+ if (unary !== undefined)
1406
+ code.push(...simd(unary));
1407
+ };
1408
+ const vectorMath = (functionName, count) => ((functionName === "min" || functionName === "max") && count > 0) || ((unaryVector[functionName] !== undefined || functionName === "fround") && count === 1);
1409
+ // ---- Across rows: four rows at a time in f32 lanes, two in f64, for programs whose columns are all dense f32. ----
1410
+ /** The mask of the enclosing `if`s, or null outside any. */
1411
+ let mask = null;
1412
+ const rowsLocals = [];
1413
+ const rowsLocal = (index) => rowsLocals[index] ??= scratch(v128Type);
1414
+ /** Rows a pass of the across-rows loops runs at once, which stamps cover. */
1415
+ let groupRows = 4;
1416
+ const denseAddress = (column) => {
1417
+ const { view, stride, boolean, component } = columns[column];
1418
+ if (view !== "f32" || stride !== 4 || boolean || component < 0)
1419
+ throw notVectorizable;
1420
+ code.push(op.localGet, ...unsigned(columnParameter(column)), op.localGet, ...unsigned(rowLocal), op.i32Const, 4, op.i32Mul, op.i32Add);
1421
+ };
1422
+ const vectorTruthy = (type) => {
1423
+ if (type === "boolean") {
1424
+ code.push(...splatConstant(0), ...simd(comparisonVector["!="] ?? vop.f32Ne));
1425
+ return;
1426
+ }
1427
+ const value = scratch(v128Type);
1428
+ code.push(op.localTee, ...unsigned(value), ...splatConstant(0), ...simd(comparisonVector["!="] ?? vop.f32Ne));
1429
+ code.push(op.localGet, ...unsigned(value), op.localGet, ...unsigned(value), ...simd(comparisonVector["=="] ?? vop.f32Eq), ...simd(vop.and));
1430
+ };
1431
+ /** A lane mask as a value: 1 where set, 0 elsewhere. */
1432
+ const maskValue = () => {
1433
+ code.push(...splatConstant(1), ...simd(vop.and));
1434
+ };
1435
+ const rowsEmit = (expression) => {
1436
+ switch (expression.kind) {
1437
+ case "number":
1438
+ code.push(...splatConstant(expression.value));
1439
+ return;
1440
+ case "boolean":
1441
+ code.push(...splatConstant(expression.value ? 1 : 0));
1442
+ return;
1443
+ case "local":
1444
+ code.push(op.localGet, ...unsigned(rowsLocal(expression.local)));
1445
+ return;
1446
+ case "resource":
1447
+ case "args":
1448
+ case "shared": return emitSplat(expression);
1449
+ case "column":
1450
+ denseAddress(expression.column);
1451
+ loadLanes(columns[expression.column].offset);
1452
+ return;
1453
+ case "unary":
1454
+ rowsEmit(expression.operand);
1455
+ if (expression.operator === "-")
1456
+ code.push(...simd(negateVector));
1457
+ else if (expression.operator === "!") {
1458
+ vectorTruthy(typeOf(expression.operand));
1459
+ code.push(...simd(vop.not));
1460
+ maskValue();
1461
+ }
1462
+ else if (expression.operator === "~")
1463
+ throw notVectorizable;
1464
+ return;
1465
+ case "binary": {
1466
+ const { operator, left, right } = expression;
1467
+ if (operator === "===" || operator === "!==") {
1468
+ const leftType = typeOf(left);
1469
+ const rightType = typeOf(right);
1470
+ if (leftType === "mixed" || rightType === "mixed")
1471
+ throw unsupported("it compares with === or !== a value that may be a boolean or a number");
1472
+ if (leftType !== rightType) {
1473
+ code.push(...splatConstant(operator === "===" ? 0 : 1));
1474
+ return;
1475
+ }
1476
+ }
1477
+ const comparison = comparisonVector[operator];
1478
+ if (!isArithmetic(operator) && comparison === undefined)
1479
+ throw notVectorizable;
1480
+ rowsEmit(left);
1481
+ rowsEmit(right);
1482
+ if (isArithmetic(operator))
1483
+ code.push(...simd(arithmeticVector[operator]));
1484
+ else if (comparison !== undefined) {
1485
+ code.push(...simd(comparison));
1486
+ maskValue();
1487
+ }
1488
+ return;
1489
+ }
1490
+ case "logical": {
1491
+ const value = scratch(v128Type);
1492
+ rowsEmit(expression.left);
1493
+ code.push(op.localSet, ...unsigned(value));
1494
+ // bitselect(a, b, m) takes a where m is set.
1495
+ if (expression.operator === "&&") {
1496
+ rowsEmit(expression.right);
1497
+ code.push(op.localGet, ...unsigned(value));
1498
+ }
1499
+ else {
1500
+ code.push(op.localGet, ...unsigned(value));
1501
+ rowsEmit(expression.right);
1502
+ }
1503
+ code.push(op.localGet, ...unsigned(value));
1504
+ vectorTruthy(typeOf(expression.left));
1505
+ code.push(...simd(vop.bitselect));
1506
+ return;
1507
+ }
1508
+ case "conditional":
1509
+ rowsEmit(expression.consequent);
1510
+ rowsEmit(expression.alternate);
1511
+ rowsEmit(expression.test);
1512
+ vectorTruthy(typeOf(expression.test));
1513
+ code.push(...simd(vop.bitselect));
1514
+ return;
1515
+ case "math":
1516
+ if (!vectorMath(expression.name, expression.arguments.length))
1517
+ throw notVectorizable;
1518
+ for (const parameter of expression.arguments)
1519
+ rowsEmit(parameter);
1520
+ emitVectorMath(expression.name, expression.arguments.length);
1521
+ return;
1522
+ case "found":
1523
+ case "lookupLeaf":
1524
+ case "upFound":
1525
+ case "upLeaf":
1526
+ case "listLength":
1527
+ case "listChanged":
1528
+ case "rowLeaf":
1529
+ case "rowEntity": throw notVectorizable;
1530
+ }
1531
+ };
1532
+ /** Under a mask, keeps the old value (left on the stack below the new one) where the mask is clear. */
1533
+ const blend = () => {
1534
+ if (mask === null)
1535
+ return;
1536
+ code.push(op.localGet, ...unsigned(mask), ...simd(vop.bitselect));
1537
+ };
1538
+ const rowsStatement = (current) => {
1539
+ switch (current.kind) {
1540
+ case "set": {
1541
+ const target = rowsLocal(current.local);
1542
+ rowsEmit(current.value);
1543
+ if (mask !== null) {
1544
+ code.push(op.localGet, ...unsigned(target));
1545
+ blend();
1546
+ }
1547
+ code.push(op.localSet, ...unsigned(target));
1548
+ return;
1549
+ }
1550
+ case "store": {
1551
+ const value = scratch(v128Type);
1552
+ rowsEmit(current.value);
1553
+ if (mask !== null) {
1554
+ rowsEmit({ kind: "column", column: current.column });
1555
+ blend();
1556
+ }
1557
+ code.push(op.localSet, ...unsigned(value));
1558
+ denseAddress(current.column);
1559
+ code.push(op.localGet, ...unsigned(value));
1560
+ storeLanes(columns[current.column].offset);
1561
+ return;
1562
+ }
1563
+ case "stamp": {
1564
+ // Ticks are dense f64: each two rows are an f64x2 store; a chunk column stays when its row column is muted.
1565
+ // f64 lanes' masks are already a lane per row; f32 lanes' are extended, two rows a store.
1566
+ if (columns[current.column].muted !== true) {
1567
+ for (let half = 0; half < groupRows / 2; half++) {
1568
+ const address = () => { code.push(op.localGet, ...unsigned(columnParameter(current.column)), op.localGet, ...unsigned(rowLocal), op.i32Const, 3, op.i32Shl, op.i32Add); };
1569
+ address();
1570
+ code.push(op.localGet, 2, ...simd(vop.f64Splat));
1571
+ if (mask !== null) {
1572
+ address();
1573
+ code.push(...simd(vop.load), 3, ...unsigned(16 * half));
1574
+ code.push(op.localGet, ...unsigned(mask));
1575
+ if (!wide)
1576
+ code.push(...simd(half === 0 ? vop.i64ExtendLowS : vop.i64ExtendHighS));
1577
+ code.push(...simd(vop.bitselect));
1578
+ }
1579
+ code.push(...simd(vop.store), 3, ...unsigned(16 * half));
1580
+ }
1581
+ }
1582
+ // The group may straddle two chunks or blocks. Under a mask this can stamp one no lane changed, which only costs a scan.
1583
+ stampDense(current.blocks, blockShift, 0);
1584
+ stampDense(current.blocks, blockShift, groupRows - 1);
1585
+ stampDense(current.chunks, chunkShift, 0);
1586
+ stampDense(current.chunks, chunkShift, groupRows - 1);
1587
+ return;
1588
+ }
1589
+ case "if": {
1590
+ const test = scratch(v128Type);
1591
+ rowsEmit(current.test);
1592
+ vectorTruthy(typeOf(current.test));
1593
+ code.push(op.localSet, ...unsigned(test));
1594
+ const outer = mask;
1595
+ const branch = (statements, negate) => {
1596
+ if (statements.length === 0)
1597
+ return;
1598
+ const inner = scratch(v128Type);
1599
+ if (outer === null) {
1600
+ code.push(op.localGet, ...unsigned(test));
1601
+ if (negate)
1602
+ code.push(...simd(vop.not));
1603
+ }
1604
+ else {
1605
+ code.push(op.localGet, ...unsigned(outer), op.localGet, ...unsigned(test), ...simd(negate ? vop.andNot : vop.and));
1606
+ }
1607
+ code.push(op.localSet, ...unsigned(inner));
1608
+ mask = inner;
1609
+ for (const statement of statements)
1610
+ rowsStatement(statement);
1611
+ mask = outer;
1612
+ };
1613
+ branch(current.consequent, false);
1614
+ branch(current.alternate, true);
1615
+ return;
1616
+ }
1617
+ default: throw notVectorizable;
1618
+ }
1619
+ };
1620
+ /** Rows from `start` in groups of a vector's lanes, up to the last whole group; leaves the row local at the first row not done. */
1621
+ const rowsLoop = () => {
1622
+ groupRows = laneBytes / 4;
1623
+ const vectorEnd = scratch(i32Type);
1624
+ code.push(op.localGet, 1, op.localGet, 0, op.i32Sub, op.i32Const, ...signed(-groupRows), op.i32And, op.localGet, 0, op.i32Add, op.localSet, ...unsigned(vectorEnd));
1625
+ code.push(op.block, 0x40, op.loop, 0x40);
1626
+ code.push(op.localGet, ...unsigned(rowLocal), op.localGet, ...unsigned(vectorEnd), op.i32GeS, op.brIf, 1);
1627
+ mask = null;
1628
+ for (const current of program.body)
1629
+ rowsStatement(current);
1630
+ code.push(op.localGet, ...unsigned(rowLocal), op.i32Const, ...signed(groupRows), op.i32Add, op.localSet, ...unsigned(rowLocal), op.br, 0);
1631
+ code.push(op.end, op.end);
1632
+ };
1633
+ /** f32 leaves of one component, as consecutive lanes from the lowest offset; null if they can't be. */
1634
+ const windowOf = (laneColumns) => {
1635
+ const infos = laneColumns.map(column => columns[column]);
1636
+ const first = infos[0];
1637
+ if (first === undefined || infos.some(info => info.view !== "f32" || info.boolean || info.component !== first.component || info.component < 0))
1638
+ return null;
1639
+ const base = Math.min(...infos.map(info => info.offset));
1640
+ const lanes = infos.map(info => (info.offset - base) / 4);
1641
+ if (lanes.some(lane => lane > 3) || new Set(lanes).size !== lanes.length)
1642
+ return null;
1643
+ return { component: first.component, base, lanes: Math.max(...lanes) + 1 };
1644
+ };
1645
+ const laneIn = (window, column) => (columns[column].offset - window.base) / 4;
1646
+ const elementAddress = (column) => {
1647
+ code.push(op.localGet, ...unsigned(columnParameter(column)), op.localGet, ...unsigned(rowLocal), op.i32Const, ...signed(columns[column].stride), op.i32Mul, op.i32Add);
1648
+ };
1649
+ /**
1650
+ * Loads a window's lanes. Three or four lanes load 16 bytes, which can read up to 12 past the element:
1651
+ * columns keep `columnSlack` bytes after their last row for that. Two or one load only their lanes.
1652
+ */
1653
+ const loadWindow = (column, { base, lanes }) => {
1654
+ elementAddress(column);
1655
+ if (lanes >= 3)
1656
+ return void code.push(...simd(vop.load), 2, ...unsigned(base));
1657
+ code.push(...simd(lanes === 1 ? vop.load32Zero : vop.load64Zero), 2, ...unsigned(base));
1658
+ };
1659
+ /** Stores a window's lanes from a v128 local, without touching the rest of the element. */
1660
+ const storeWindow = (column, { base, lanes }, value) => {
1661
+ elementAddress(column);
1662
+ code.push(op.localGet, ...unsigned(value));
1663
+ if (lanes === 4)
1664
+ return void code.push(...simd(vop.store), 2, ...unsigned(base));
1665
+ code.push(...simd(vop.store64Lane), 2, ...unsigned(base), 0);
1666
+ if (lanes !== 3)
1667
+ return;
1668
+ elementAddress(column);
1669
+ code.push(op.localGet, ...unsigned(value), ...simd(vop.store32Lane), 2, ...unsigned(base + 8), 2);
1670
+ };
1671
+ /** Plans the fusion of top-level statements. Statement index to group, and which `set`s only feed groups. */
1672
+ const planLanes = () => {
1673
+ const body = program.body;
1674
+ const assignments = new Map();
1675
+ const uses = new Map();
1676
+ const countExpression = (expression) => {
1677
+ switch (expression.kind) {
1678
+ case "local":
1679
+ uses.set(expression.local, (uses.get(expression.local) ?? 0) + 1);
1680
+ return;
1681
+ case "unary": return countExpression(expression.operand);
1682
+ case "binary":
1683
+ case "logical":
1684
+ countExpression(expression.left);
1685
+ return countExpression(expression.right);
1686
+ case "conditional":
1687
+ countExpression(expression.test);
1688
+ countExpression(expression.consequent);
1689
+ return countExpression(expression.alternate);
1690
+ case "math":
1691
+ for (const parameter of expression.arguments)
1692
+ countExpression(parameter);
1693
+ return;
1694
+ default: return;
1695
+ }
1696
+ };
1697
+ const countStatements = (statements) => {
1698
+ for (const statement of statements) {
1699
+ switch (statement.kind) {
1700
+ case "set":
1701
+ assignments.set(statement.local, (assignments.get(statement.local) ?? 0) + 1);
1702
+ countExpression(statement.value);
1703
+ break;
1704
+ case "store":
1705
+ countExpression(statement.value);
1706
+ break;
1707
+ case "branchIf":
1708
+ countExpression(statement.test);
1709
+ break;
1710
+ case "find":
1711
+ countExpression(statement.entity);
1712
+ break;
1713
+ case "if":
1714
+ countExpression(statement.test);
1715
+ countStatements(statement.consequent);
1716
+ countStatements(statement.alternate);
1717
+ break;
1718
+ case "block":
1719
+ case "loop":
1720
+ countStatements(statement.body);
1721
+ break;
1722
+ default: break;
1723
+ }
1724
+ }
1725
+ };
1726
+ countStatements(body);
1727
+ // Packs: single-assignment snapshot locals of one component's leaves, with no store to it between their sets.
1728
+ const packOfLocal = new Map();
1729
+ const open = new Map();
1730
+ const packs = new Map();
1731
+ const close = (component) => {
1732
+ const pending = open.get(component);
1733
+ open.delete(component);
1734
+ if (pending === undefined || pending.columns.length < 2)
1735
+ return;
1736
+ const window = windowOf(pending.columns);
1737
+ if (window === null)
1738
+ return;
1739
+ const pack = { first: pending.first, column: pending.columns[0], window, lanes: new Map(), used: false, local: -1 };
1740
+ pending.locals.forEach((local, i) => {
1741
+ pack.lanes.set(local, laneIn(window, pending.columns[i]));
1742
+ packOfLocal.set(local, pack);
1743
+ });
1744
+ packs.set(pending.first, pack);
1745
+ };
1746
+ body.forEach((statement, index) => {
1747
+ if (statement.kind === "set" && statement.value.kind === "column" && assignments.get(statement.local) === 1) {
1748
+ const info = columns[statement.value.column];
1749
+ if (info.view === "f32" && !info.boolean && info.component >= 0) {
1750
+ const pending = open.get(info.component) ?? { first: index, columns: [], locals: [] };
1751
+ open.set(info.component, pending);
1752
+ pending.columns.push(statement.value.column);
1753
+ pending.locals.push(statement.local);
1754
+ return;
1755
+ }
1756
+ }
1757
+ if (statement.kind === "store")
1758
+ close(columns[statement.column].component);
1759
+ if (statement.kind !== "set")
1760
+ for (const component of [...open.keys()])
1761
+ close(component);
1762
+ });
1763
+ for (const component of [...open.keys()])
1764
+ close(component);
1765
+ /** Whether an expression reads a leaf (by component and offset) in `written`. */
1766
+ const reads = (expression, written) => {
1767
+ switch (expression.kind) {
1768
+ case "column": return written.has(`${columns[expression.column].component}:${columns[expression.column].offset}`);
1769
+ case "unary": return reads(expression.operand, written);
1770
+ case "binary":
1771
+ case "logical": return reads(expression.left, written) || reads(expression.right, written);
1772
+ case "conditional": return reads(expression.test, written) || reads(expression.consequent, written) || reads(expression.alternate, written);
1773
+ case "math": return expression.arguments.some(parameter => reads(parameter, written));
1774
+ default: return false;
1775
+ }
1776
+ };
1777
+ /** Fused stores read everything before writing, so no store may read a leaf an earlier one in the group wrote. */
1778
+ const readsEarlierStore = (stores) => {
1779
+ const written = new Set();
1780
+ for (const store of stores) {
1781
+ if (reads(store.value, written))
1782
+ return true;
1783
+ written.add(`${columns[store.column].component}:${columns[store.column].offset}`);
1784
+ }
1785
+ return false;
1786
+ };
1787
+ const groupUses = new Map();
1788
+ /** Matches one expression per lane; null if they don't line up. */
1789
+ const match = (lanes) => {
1790
+ const first = lanes[0];
1791
+ if (lanes.every(lane => JSON.stringify(lane) === JSON.stringify(first)))
1792
+ return { kind: "splat", expression: first };
1793
+ if (lanes.every(lane => lane.kind === "number"))
1794
+ return { kind: "constant", values: lanes.map(lane => lane.kind === "number" ? lane.value : 0) };
1795
+ if (first.kind === "local") {
1796
+ const pack = packOfLocal.get(first.local);
1797
+ if (pack !== undefined && lanes.every((lane, i) => lane.kind === "local" && packOfLocal.get(lane.local) === pack && pack.lanes.get(lane.local) === i)) {
1798
+ for (const lane of lanes)
1799
+ if (lane.kind === "local")
1800
+ groupUses.set(lane.local, (groupUses.get(lane.local) ?? 0) + 1);
1801
+ return { kind: "pack", pack };
1802
+ }
1803
+ return null;
1804
+ }
1805
+ if (first.kind === "column") {
1806
+ const laneColumns = lanes.flatMap(lane => lane.kind === "column" ? [lane.column] : []);
1807
+ const window = laneColumns.length === lanes.length ? windowOf(laneColumns) : null;
1808
+ return window !== null && laneColumns.every((column, i) => laneIn(window, column) === i) ? { kind: "load", column: laneColumns[0], window } : null;
1809
+ }
1810
+ if (first.kind === "binary" && isArithmetic(first.operator)) {
1811
+ const { operator } = first;
1812
+ const pairs = lanes.flatMap(lane => lane.kind === "binary" && lane.operator === operator ? [lane] : []);
1813
+ if (pairs.length !== lanes.length)
1814
+ return null;
1815
+ const left = match(pairs.map(pair => pair.left));
1816
+ const right = left === null ? null : match(pairs.map(pair => pair.right));
1817
+ return left === null || right === null ? null : { kind: "binary", operator, left, right };
1818
+ }
1819
+ if (first.kind === "unary" && (first.operator === "-" || first.operator === "+")) {
1820
+ const operator = first.operator;
1821
+ const operands = lanes.flatMap(lane => lane.kind === "unary" && lane.operator === operator ? [lane.operand] : []);
1822
+ if (operands.length !== lanes.length)
1823
+ return null;
1824
+ const operand = match(operands);
1825
+ return operand === null ? null : operator === "-" ? { kind: "negate", operand } : operand;
1826
+ }
1827
+ if (first.kind === "math" && vectorMath(first.name, first.arguments.length)) {
1828
+ const calls = lanes.flatMap(lane => lane.kind === "math" && lane.name === first.name && lane.arguments.length === first.arguments.length ? [lane] : []);
1829
+ if (calls.length !== lanes.length)
1830
+ return null;
1831
+ const parameters = [];
1832
+ for (let i = 0; i < first.arguments.length; i++) {
1833
+ const parameter = match(calls.map(call => call.arguments[i]));
1834
+ if (parameter === null)
1835
+ return null;
1836
+ parameters.push(parameter);
1837
+ }
1838
+ return { kind: "math", name: first.name, arguments: parameters };
1839
+ }
1840
+ return null;
1841
+ };
1842
+ // Groups: consecutive stores to two or more leaves of one component whose values match lane for lane.
1843
+ const groups = new Map();
1844
+ for (let index = 0; index < body.length;) {
1845
+ const statement = body[index];
1846
+ if (statement.kind !== "store") {
1847
+ index++;
1848
+ continue;
1849
+ }
1850
+ const component = columns[statement.column].component;
1851
+ let end = index;
1852
+ while (end < body.length) {
1853
+ const next = body[end];
1854
+ if (next.kind !== "store" || columns[next.column].component !== component)
1855
+ break;
1856
+ end++;
1857
+ }
1858
+ const stores = body.slice(index, end).flatMap(store => store.kind === "store" ? [store] : []);
1859
+ const window = stores.length >= 2 ? windowOf(stores.map(store => store.column)) : null;
1860
+ const lanes = [];
1861
+ if (window !== null && window.lanes === stores.length)
1862
+ for (const store of stores)
1863
+ lanes[laneIn(window, store.column)] = store.value;
1864
+ const before = new Map(groupUses);
1865
+ const value = window !== null && window.lanes === stores.length && !readsEarlierStore(stores) ? match(lanes) : null;
1866
+ if (window !== null && value !== null) {
1867
+ groups.set(index, { length: stores.length, column: stores[0].column, window, value });
1868
+ const markUsed = (expression) => {
1869
+ if (expression.kind === "pack")
1870
+ expression.pack.used = true;
1871
+ else if (expression.kind === "binary") {
1872
+ markUsed(expression.left);
1873
+ markUsed(expression.right);
1874
+ }
1875
+ else if (expression.kind === "negate")
1876
+ markUsed(expression.operand);
1877
+ else if (expression.kind === "math")
1878
+ expression.arguments.forEach(markUsed);
1879
+ };
1880
+ markUsed(value);
1881
+ }
1882
+ else {
1883
+ groupUses.clear();
1884
+ for (const [local, count] of before)
1885
+ groupUses.set(local, count);
1886
+ }
1887
+ index = end;
1888
+ }
1889
+ // A snapshot `set` whose local is only read through vectors needn't run as a scalar.
1890
+ const skipped = new Set();
1891
+ body.forEach((statement, index) => {
1892
+ if (statement.kind === "set" && packOfLocal.get(statement.local)?.used === true && (uses.get(statement.local) ?? 0) === (groupUses.get(statement.local) ?? 0))
1893
+ skipped.add(index);
1894
+ });
1895
+ return { groups, packs, skipped };
1896
+ };
1897
+ const emitVectorExpression = (expression) => {
1898
+ switch (expression.kind) {
1899
+ case "pack":
1900
+ code.push(op.localGet, ...unsigned(expression.pack.local));
1901
+ return;
1902
+ case "load": return loadWindow(expression.column, expression.window);
1903
+ case "constant":
1904
+ code.push(...vectorConstant(expression.values));
1905
+ return;
1906
+ case "splat": return emitSplat(expression.expression);
1907
+ case "binary":
1908
+ emitVectorExpression(expression.left);
1909
+ emitVectorExpression(expression.right);
1910
+ code.push(...simd(arithmeticVector[expression.operator]));
1911
+ return;
1912
+ case "negate":
1913
+ emitVectorExpression(expression.operand);
1914
+ code.push(...simd(negateVector));
1915
+ return;
1916
+ case "math":
1917
+ for (const parameter of expression.arguments)
1918
+ emitVectorExpression(parameter);
1919
+ emitVectorMath(expression.name, expression.arguments.length);
1920
+ return;
1921
+ }
1922
+ };
1923
+ /** The row body, with planned groups fused; returns whether anything was. */
1924
+ const emitLaneBody = () => {
1925
+ const { groups, packs, skipped } = planLanes();
1926
+ const body = program.body;
1927
+ for (let index = 0; index < body.length; index++) {
1928
+ const pack = packs.get(index);
1929
+ if (pack?.used === true) {
1930
+ pack.local = scratch(v128Type);
1931
+ loadWindow(pack.column, pack.window);
1932
+ code.push(op.localSet, ...unsigned(pack.local));
1933
+ }
1934
+ const group = groups.get(index);
1935
+ if (group !== undefined) {
1936
+ const value = scratch(v128Type);
1937
+ emitVectorExpression(group.value);
1938
+ code.push(op.localSet, ...unsigned(value));
1939
+ storeWindow(group.column, group.window, value);
1940
+ index += group.length - 1;
1941
+ continue;
1942
+ }
1943
+ if (!skipped.has(index))
1944
+ statement(body[index]);
1945
+ }
1946
+ return groups.size > 0;
1947
+ };
1948
+ /** Whether a value calls an import: `%` and `**`, which only integers by a literal skip, and most `Math` functions. */
1949
+ const callsImport = (expression) => {
1950
+ switch (expression.kind) {
1951
+ case "unary": return callsImport(expression.operand);
1952
+ case "binary": return expression.operator === "%" || expression.operator === "**" || callsImport(expression.left) || callsImport(expression.right);
1953
+ case "logical": return callsImport(expression.left) || callsImport(expression.right);
1954
+ case "conditional": return callsImport(expression.test) || callsImport(expression.consequent) || callsImport(expression.alternate);
1955
+ case "math": return !native.has(expression.name) || expression.arguments.some(callsImport);
1956
+ default: return false;
1957
+ }
1958
+ };
1959
+ /** Computes each largest row-independent value calling an import within `statements` into a local of its own. */
1960
+ const hoist = (statements) => {
1961
+ const visit = (expression) => {
1962
+ if (hoisted.has(expression))
1963
+ return;
1964
+ if (rowIndependent(expression) && callsImport(expression)) {
1965
+ emit(expression);
1966
+ const value = scratch(f64Type);
1967
+ code.push(op.localSet, ...unsigned(value));
1968
+ hoisted.set(expression, value);
1969
+ return;
1970
+ }
1971
+ switch (expression.kind) {
1972
+ case "unary": return visit(expression.operand);
1973
+ case "binary":
1974
+ case "logical":
1975
+ visit(expression.left);
1976
+ visit(expression.right);
1977
+ return;
1978
+ case "conditional":
1979
+ visit(expression.test);
1980
+ visit(expression.consequent);
1981
+ visit(expression.alternate);
1982
+ return;
1983
+ case "math": return expression.arguments.forEach(visit);
1984
+ default: return;
1985
+ }
1986
+ };
1987
+ for (const current of statements) {
1988
+ switch (current.kind) {
1989
+ case "set":
1990
+ case "store":
1991
+ visit(current.value);
1992
+ break;
1993
+ case "if":
1994
+ visit(current.test);
1995
+ hoist(current.consequent);
1996
+ hoist(current.alternate);
1997
+ break;
1998
+ case "block":
1999
+ case "loop":
2000
+ hoist(current.body);
2001
+ break;
2002
+ case "branchIf":
2003
+ visit(current.test);
2004
+ break;
2005
+ case "find":
2006
+ visit(current.entity);
2007
+ break;
2008
+ case "probe":
2009
+ current.values.forEach(visit);
2010
+ break;
2011
+ case "listRow":
2012
+ visit(current.index);
2013
+ break;
2014
+ case "intrinsic":
2015
+ for (const operand of current.operands)
2016
+ operand.forEach(visit);
2017
+ hoist(current.body);
2018
+ break;
2019
+ default: break;
2020
+ }
2021
+ }
2022
+ };
2023
+ /** Whether a value is the same for every row. */
2024
+ const rowIndependent = (expression) => {
2025
+ switch (expression.kind) {
2026
+ case "number":
2027
+ case "boolean":
2028
+ case "resource":
2029
+ case "args":
2030
+ case "shared": return true;
2031
+ case "unary": return rowIndependent(expression.operand);
2032
+ case "binary":
2033
+ case "logical": return rowIndependent(expression.left) && rowIndependent(expression.right);
2034
+ case "conditional": return rowIndependent(expression.test) && rowIndependent(expression.consequent) && rowIndependent(expression.alternate);
2035
+ case "math": return expression.arguments.every(rowIndependent);
2036
+ default: return false;
2037
+ }
2038
+ };
2039
+ /**
2040
+ * Whether the planned groups are the whole body and run unchanged on flat vectors of four rows: each group stores
2041
+ * whole elements and reads windows from byte 0 of components with the same stride, so lane `l` of vector `j` is the
2042
+ * same leaf in every operand. Snapshot sets must be skipped, and stamps run as in the across-rows loop.
2043
+ */
2044
+ const acrossElements = ({ groups, skipped }) => {
2045
+ if (filters > 0 || groups.size === 0)
2046
+ return false;
2047
+ const whole = (column, window, stride) => window.base === 0 && columns[column].stride === stride;
2048
+ const fits = (expression, stride) => {
2049
+ switch (expression.kind) {
2050
+ case "pack": return whole(expression.pack.column, expression.pack.window, stride);
2051
+ case "load": return whole(expression.column, expression.window, stride);
2052
+ case "constant": return true;
2053
+ case "splat": return rowIndependent(expression.expression);
2054
+ case "binary": return fits(expression.left, stride) && fits(expression.right, stride);
2055
+ case "negate": return fits(expression.operand, stride);
2056
+ case "math": return expression.arguments.every(parameter => fits(parameter, stride));
2057
+ }
2058
+ };
2059
+ const body = program.body;
2060
+ for (let index = 0; index < body.length; index++) {
2061
+ const group = groups.get(index);
2062
+ if (group !== undefined) {
2063
+ const { stride } = columns[group.column];
2064
+ if (group.window.base !== 0 || group.window.lanes * 4 !== stride || !fits(group.value, stride))
2065
+ return false;
2066
+ index += group.length - 1;
2067
+ }
2068
+ else if (!skipped.has(index) && body[index].kind !== "stamp")
2069
+ return false;
2070
+ }
2071
+ return true;
2072
+ };
2073
+ /** Vector `vector` of an expression over four rows of `stride`-byte elements; packs are in `packVectors`. */
2074
+ const emitElementExpression = (expression, vector, stride, packVectors) => {
2075
+ switch (expression.kind) {
2076
+ case "pack": {
2077
+ // Every pack a group uses is loaded at its first set, before the group.
2078
+ const local = packVectors.get(expression.pack)?.[vector];
2079
+ if (local === undefined)
2080
+ throw new Error("A pack is used before it's loaded.");
2081
+ code.push(op.localGet, ...unsigned(local));
2082
+ return;
2083
+ }
2084
+ case "load":
2085
+ elementAddress(expression.column);
2086
+ loadLanes(laneBytes * vector);
2087
+ return;
2088
+ case "constant":
2089
+ code.push(...vectorConstant([0, 1, 2, 3].map(lane => expression.values[((laneBytes * vector + 4 * lane) % stride) / 4] ?? 0)));
2090
+ return;
2091
+ case "splat": return emitSplat(expression.expression);
2092
+ case "binary":
2093
+ emitElementExpression(expression.left, vector, stride, packVectors);
2094
+ emitElementExpression(expression.right, vector, stride, packVectors);
2095
+ code.push(...simd(arithmeticVector[expression.operator]));
2096
+ return;
2097
+ case "negate":
2098
+ emitElementExpression(expression.operand, vector, stride, packVectors);
2099
+ code.push(...simd(negateVector));
2100
+ return;
2101
+ case "math":
2102
+ for (const parameter of expression.arguments)
2103
+ emitElementExpression(parameter, vector, stride, packVectors);
2104
+ emitVectorMath(expression.name, expression.arguments.length);
2105
+ return;
2106
+ }
2107
+ };
2108
+ /**
2109
+ * Rows from `start` in groups of four, up to the last whole group, with every group as `stride / 4` full-vector loads,
2110
+ * operations and stores; leaves the row local at the first row not done. Vectors stay inside the four rows' elements,
2111
+ * and each vector's store only touches bytes no other vector reads.
2112
+ */
2113
+ const elementsLoop = ({ groups, packs }) => {
2114
+ groupRows = 4;
2115
+ const vectors = (stride) => 4 * stride / laneBytes;
2116
+ const vectorEnd = scratch(i32Type);
2117
+ code.push(op.localGet, 1, op.localGet, 0, op.i32Sub, op.i32Const, ...signed(-4), op.i32And, op.localGet, 0, op.i32Add, op.localSet, ...unsigned(vectorEnd));
2118
+ code.push(op.block, 0x40, op.loop, 0x40);
2119
+ code.push(op.localGet, ...unsigned(rowLocal), op.localGet, ...unsigned(vectorEnd), op.i32GeS, op.brIf, 1);
2120
+ mask = null;
2121
+ const packVectors = new Map();
2122
+ const body = program.body;
2123
+ for (let index = 0; index < body.length; index++) {
2124
+ const pack = packs.get(index);
2125
+ if (pack?.used === true) {
2126
+ const locals = Array.from({ length: vectors(columns[pack.column].stride) }, (_, vector) => {
2127
+ const local = scratch(v128Type);
2128
+ elementAddress(pack.column);
2129
+ loadLanes(laneBytes * vector);
2130
+ code.push(op.localSet, ...unsigned(local));
2131
+ return local;
2132
+ });
2133
+ packVectors.set(pack, locals);
2134
+ }
2135
+ const group = groups.get(index);
2136
+ if (group !== undefined) {
2137
+ const { stride } = columns[group.column];
2138
+ for (let vector = 0; vector < vectors(stride); vector++) {
2139
+ const value = scratch(v128Type);
2140
+ emitElementExpression(group.value, vector, stride, packVectors);
2141
+ code.push(op.localSet, ...unsigned(value));
2142
+ elementAddress(group.column);
2143
+ code.push(op.localGet, ...unsigned(value));
2144
+ storeLanes(laneBytes * vector);
2145
+ }
2146
+ index += group.length - 1;
2147
+ }
2148
+ else if (body[index].kind === "stamp")
2149
+ rowsStatement(body[index]);
2150
+ }
2151
+ code.push(op.localGet, ...unsigned(rowLocal), op.i32Const, 4, op.i32Add, op.localSet, ...unsigned(rowLocal), op.br, 0);
2152
+ code.push(op.end, op.end);
2153
+ };
2154
+ try {
2155
+ const parameterCount = beforeLookups + lookupParameters + indexParameters + upParameters;
2156
+ collectFinds(program.body);
2157
+ /** Leaves 1 if any filter's tick at `(row >> shift) * 8` in its `parameter` array is newer than `lastRun`. */
2158
+ const anyNewer = (parameter, shift) => {
2159
+ for (let filter = 0; filter < filters; filter++) {
2160
+ code.push(op.localGet, ...unsigned(parameter(filter)), op.localGet, ...unsigned(rowLocal));
2161
+ if (shift > 0)
2162
+ code.push(op.i32Const, ...signed(shift), op.i32ShrU);
2163
+ code.push(op.i32Const, 3, op.i32Shl, op.i32Add, op.f64Load, 3, 0, op.localGet, 3, op.f64Gt);
2164
+ if (filter > 0)
2165
+ code.push(op.i32Or);
2166
+ }
2167
+ };
2168
+ /**
2169
+ * i32 locals: the row after the current chunk; the row after the current run of passing blocks, both `start`
2170
+ * before the first; the current chunk's blocks that pass, a bit each; and two temporaries.
2171
+ */
2172
+ let chunkEnd = 0;
2173
+ let blockEnd = 0;
2174
+ let passingBlocks = 0;
2175
+ let ahead = 0;
2176
+ let skipped = 0;
2177
+ const startChunksAndBlocks = () => {
2178
+ chunkEnd = scratch(i32Type);
2179
+ blockEnd = scratch(i32Type);
2180
+ passingBlocks = scratch(i32Type);
2181
+ ahead = scratch(i32Type);
2182
+ skipped = scratch(i32Type);
2183
+ code.push(op.localGet, 0, op.localTee, ...unsigned(chunkEnd), op.localSet, ...unsigned(blockEnd));
2184
+ };
2185
+ const get = (local) => [op.localGet, ...unsigned(local)];
2186
+ const set = (local) => [op.localSet, ...unsigned(local)];
2187
+ /** Leaves `min(end, ((row >> shift) + count) << shift)`, with `count` on the stack first. */
2188
+ const runEnd = (shift, target) => {
2189
+ code.push(...get(rowLocal), op.i32Const, ...signed(shift), op.i32ShrU, op.i32Add, op.i32Const, ...signed(shift), op.i32Shl, ...set(target));
2190
+ code.push(...get(target), op.localGet, 1, ...get(target), op.localGet, 1, op.i32LtS, op.select, ...set(target));
2191
+ };
2192
+ const blocksPerChunk = 2 ** (chunkShift - blockShift);
2193
+ /**
2194
+ * In the outer row loop, at `row`, the first row after the last run of passing blocks: past the current chunk,
2195
+ * skips chunks no filter's chunk tick says changed, and notes which blocks of the next one pass, a bit each;
2196
+ * then skips the blocks that don't pass, and sets `blockEnd` to the end of the run of blocks that do, which the
2197
+ * inner loop runs. A chunk with more than half its blocks passing is one run: ending a run costs more than the
2198
+ * eight-row checks spend on a block between runs.
2199
+ */
2200
+ const findRun = () => {
2201
+ code.push(...get(rowLocal), ...get(chunkEnd), op.i32GeS, op.if, 0x40);
2202
+ code.push(op.i32Const, 1);
2203
+ runEnd(chunkShift, chunkEnd);
2204
+ anyNewer(filterChunkParameter, chunkShift);
2205
+ code.push(op.i32Eqz, op.if, 0x40, ...get(chunkEnd), ...set(rowLocal), op.br, 2, op.end);
2206
+ // The chunk's blocks that pass, from its first block, `(row >> chunkShift) << (chunkShift - blockShift)`.
2207
+ for (let block = 0; block < blocksPerChunk; block++) {
2208
+ for (let filter = 0; filter < filters; filter++) {
2209
+ code.push(...get(filterBlockParameter(filter)), ...get(rowLocal), op.i32Const, ...signed(chunkShift), op.i32ShrU, op.i32Const, ...signed(chunkShift - blockShift), op.i32Shl);
2210
+ code.push(op.i32Const, ...signed(block), op.i32Add, op.i32Const, 3, op.i32Shl, op.i32Add, op.f64Load, 3, 0, op.localGet, 3, op.f64Gt);
2211
+ if (filter > 0)
2212
+ code.push(op.i32Or);
2213
+ }
2214
+ if (block > 0)
2215
+ code.push(op.i32Const, ...signed(block), op.i32Shl, ...get(passingBlocks), op.i32Or);
2216
+ code.push(...set(passingBlocks));
2217
+ }
2218
+ code.push(...get(passingBlocks), op.i32Popcnt, op.i32Const, ...signed(blocksPerChunk / 2), op.i32GtS, op.if, 0x40);
2219
+ code.push(op.i32Const, ...signed((2 ** blocksPerChunk - 1) | 0), ...set(passingBlocks), op.end);
2220
+ code.push(op.end);
2221
+ // ahead = passingBlocks >> (row's block in its chunk); none ahead skips the rest of the chunk.
2222
+ code.push(...get(passingBlocks), ...get(rowLocal), op.i32Const, ...signed(blockShift), op.i32ShrU, op.i32Const, ...signed(blocksPerChunk - 1), op.i32And, op.i32ShrU, op.localTee, ...unsigned(ahead));
2223
+ code.push(op.i32Eqz, op.if, 0x40, ...get(chunkEnd), ...set(rowLocal), op.br, 1, op.end);
2224
+ // Skips to the next passing block, then runs to the end of the passing blocks after it.
2225
+ code.push(...get(ahead), op.i32Ctz, op.localTee, ...unsigned(skipped), op.if, 0x40);
2226
+ code.push(...get(skipped), ...get(rowLocal), op.i32Const, ...signed(blockShift), op.i32ShrU, op.i32Add, op.i32Const, ...signed(blockShift), op.i32Shl, ...set(rowLocal));
2227
+ code.push(op.end);
2228
+ code.push(...get(ahead), ...get(skipped), op.i32ShrU, op.i32Const, ...signed(-1), op.i32Xor, op.i32Ctz);
2229
+ runEnd(blockShift, blockEnd);
2230
+ code.push(...get(blockEnd), ...get(chunkEnd), ...get(blockEnd), ...get(chunkEnd), op.i32LtS, op.select, ...set(blockEnd));
2231
+ // A row moved to a later block goes round the outer loop, which checks it against `end`.
2232
+ code.push(...get(skipped), op.brIf, 0);
2233
+ };
2234
+ /** Rows an eight-row skip checks at once: four f64x2 loads of each filter's row ticks. */
2235
+ const eightRows = 8;
2236
+ /**
2237
+ * With SIMD, at a row that's a multiple of `eightRows`, skips that many rows when none passes a filter, testing
2238
+ * two ticks per comparison. Only aligned rows check, so rows that do pass pay one check per eight.
2239
+ */
2240
+ const skipEights = () => {
2241
+ code.push(op.localGet, ...unsigned(rowLocal), op.i32Const, eightRows - 1, op.i32And, op.i32Eqz);
2242
+ code.push(op.localGet, ...unsigned(rowLocal), op.i32Const, eightRows, op.i32Add, op.localGet, 1, op.i32LeS, op.i32And, op.if, 0x40);
2243
+ for (let filter = 0; filter < filters; filter++) {
2244
+ for (let pair = 0; pair < eightRows / 2; pair++) {
2245
+ code.push(op.localGet, ...unsigned(filterRowParameter(filter)), op.localGet, ...unsigned(rowLocal), op.i32Const, 3, op.i32Shl, op.i32Add);
2246
+ code.push(...simd(vop.load), 3, ...unsigned(16 * pair), op.localGet, 3, ...simd(vop.f64Splat), ...simd(vop.f64Gt));
2247
+ if (filter > 0 || pair > 0)
2248
+ code.push(...simd(vop.or));
2249
+ }
2250
+ }
2251
+ code.push(...simd(vop.anyTrue), op.i32Eqz, op.if, 0x40);
2252
+ code.push(op.localGet, ...unsigned(rowLocal), op.i32Const, eightRows, op.i32Add, op.localSet, ...unsigned(rowLocal));
2253
+ code.push(op.br, 2, op.end, op.end);
2254
+ };
2255
+ // Scalars are discovered while generating, so code is generated first with locals placed after a provisional scalar count.
2256
+ /** `rows`: four rows at a time where every column is dense; `lanes`: fuse statements within each row. */
2257
+ let fused = false;
2258
+ const generate = (scalarCount, mode) => {
2259
+ code.length = 0;
2260
+ extraLocals.length = 0;
2261
+ rowsLocals.length = 0;
2262
+ // With reductions, the partials' address follows the scalars.
2263
+ const partialsParameter = parameterCount + scalarCount;
2264
+ localBase = partialsParameter + (accumulators.length > 0 ? 1 : 0);
2265
+ rowLocal = scratch(i32Type);
2266
+ code.push(op.localGet, 0, op.localSet, ...unsigned(rowLocal));
2267
+ hoisted.clear();
2268
+ hoist(program.body);
2269
+ accumulators.forEach((accumulator, k) => {
2270
+ code.push(op.localGet, ...unsigned(partialsParameter), op.f64Load, 3, ...unsigned(8 * k), op.localSet, ...unsigned(local(accumulator)));
2271
+ });
2272
+ // Floating-point folds wait on the one before, so consecutive rows fold into one of four lanes in turn:
2273
+ // the accumulator, rotated with three more starting at the identity, then combined in a fixed order.
2274
+ const lanes = accumulators.map((_, k) => {
2275
+ const operator = operators[k];
2276
+ const identity = rotated[operator];
2277
+ if (identity === undefined)
2278
+ return null;
2279
+ return [0, 1, 2].map(() => {
2280
+ const lane = scratch(f64Type);
2281
+ code.push(op.f64Const, ...float64(identity.value), op.localSet, ...unsigned(lane));
2282
+ return lane;
2283
+ });
2284
+ });
2285
+ handleLocals.clear();
2286
+ keyLocals.clear();
2287
+ if (lookupParameters > 0)
2288
+ convertLookupParameters();
2289
+ if (indexParameters > 0)
2290
+ convertIndexParameters();
2291
+ stampRangeChunks();
2292
+ if (filters > 0)
2293
+ startChunksAndBlocks();
2294
+ if (mode === "rows")
2295
+ rowsLoop();
2296
+ let across = false;
2297
+ if (mode === "lanes") {
2298
+ const plan = planLanes();
2299
+ across = acrossElements(plan);
2300
+ if (across)
2301
+ elementsLoop(plan);
2302
+ }
2303
+ // for (; row < end; row++) { block next { body } }, where with `up` the row and its parent's are rows[n] and parents[n].
2304
+ const slot = rowLocal;
2305
+ if (upMode) {
2306
+ rowLocal = scratch(i32Type);
2307
+ parentLocal = scratch(i32Type);
2308
+ }
2309
+ code.push(op.block, 0x40, op.loop, 0x40);
2310
+ code.push(op.localGet, ...unsigned(slot), op.localGet, 1, op.i32GeS, op.brIf, 1);
2311
+ // With change filters, an outer loop finds each run of passing blocks and an inner one runs its rows.
2312
+ if (filters > 0) {
2313
+ findRun();
2314
+ code.push(op.block, 0x40, op.loop, 0x40, ...get(rowLocal), ...get(blockEnd), op.i32GeS, op.brIf, 1);
2315
+ }
2316
+ if (upMode) {
2317
+ code.push(op.localGet, ...unsigned(upParameter(0)), op.localGet, ...unsigned(slot), op.i32Const, 2, op.i32Shl, op.i32Add, op.i32Load, 2, 0, op.localSet, ...unsigned(rowLocal));
2318
+ code.push(op.localGet, ...unsigned(upParameter(1)), op.localGet, ...unsigned(slot), op.i32Const, 2, op.i32Shl, op.i32Add, op.i32Load, 2, 0, op.localSet, ...unsigned(parentLocal));
2319
+ }
2320
+ if (filters > 0 && simdEnabled && !upMode)
2321
+ skipEights();
2322
+ code.push(op.block, 0x40);
2323
+ // A row that no filter passes goes to the next.
2324
+ if (filters > 0) {
2325
+ anyNewer(filterRowParameter, 0);
2326
+ code.push(op.i32Eqz, op.brIf, 0);
2327
+ }
2328
+ labels.length = 0;
2329
+ labels.push("next");
2330
+ // f64 lanes fuse only across rows: within a row the rest run as scalars, as the body computes.
2331
+ if (mode === "lanes" && !wide)
2332
+ fused = emitLaneBody();
2333
+ else {
2334
+ if (mode === "lanes")
2335
+ fused = across;
2336
+ for (const current of program.body)
2337
+ statement(current);
2338
+ }
2339
+ labels.pop();
2340
+ code.push(op.end);
2341
+ accumulators.forEach((accumulator, k) => {
2342
+ const extra = lanes[k];
2343
+ if (extra === null)
2344
+ return;
2345
+ const [first, second, third] = extra;
2346
+ const own = unsigned(local(accumulator));
2347
+ code.push(op.localGet, ...own, op.localGet, ...unsigned(first), op.localSet, ...own);
2348
+ code.push(op.localGet, ...unsigned(second), op.localSet, ...unsigned(first), op.localGet, ...unsigned(third), op.localSet, ...unsigned(second));
2349
+ code.push(op.localSet, ...unsigned(third));
2350
+ });
2351
+ code.push(op.localGet, ...unsigned(slot), op.i32Const, 1, op.i32Add, op.localSet, ...unsigned(slot), op.br, 0);
2352
+ code.push(op.end, op.end);
2353
+ if (filters > 0)
2354
+ code.push(op.br, 0, op.end, op.end);
2355
+ rowLocal = slot;
2356
+ accumulators.forEach((accumulator, k) => {
2357
+ const extra = lanes[k];
2358
+ if (extra === null)
2359
+ return;
2360
+ const combine = rotated[operators[k]].combine;
2361
+ const [first, second, third] = extra;
2362
+ const own = unsigned(local(accumulator));
2363
+ code.push(op.localGet, ...own, op.localGet, ...unsigned(first), combine, op.localGet, ...unsigned(second), op.localGet, ...unsigned(third), combine, combine, op.localSet, ...own);
2364
+ });
2365
+ accumulators.forEach((accumulator, k) => {
2366
+ code.push(op.localGet, ...unsigned(partialsParameter), op.localGet, ...unsigned(local(accumulator)), op.f64Store, 3, ...unsigned(8 * k));
2367
+ });
2368
+ // The function's end.
2369
+ code.push(op.end);
2370
+ };
2371
+ // Across-rows mode doesn't filter rows, so filtered kernels fuse within rows instead.
2372
+ // Accumulators carry from row to row, which neither SIMD mode keeps.
2373
+ // Listed rows aren't consecutive, so `up` programs run one row at a time.
2374
+ // Within a row, f64 lanes would split a component's leaves across vectors, so filtered kernels at the body's
2375
+ // precision run one row at a time.
2376
+ let mode = !simdEnabled || accumulators.length > 0 || upMode || (wide && filters > 0) ? "scalar" : filters > 0 ? "lanes" : "rows";
2377
+ try {
2378
+ generate(0, mode);
2379
+ }
2380
+ catch (error) {
2381
+ if (error !== notVectorizable)
2382
+ throw error;
2383
+ mode = "lanes";
2384
+ generate(0, mode);
2385
+ }
2386
+ if (mode === "lanes" && !fused) {
2387
+ mode = "scalar";
2388
+ generate(0, mode);
2389
+ }
2390
+ const discovered = scalars.length;
2391
+ generate(discovered, mode);
2392
+ if (scalars.length !== discovered)
2393
+ throw unsupported("its resource and input values differ between passes");
2394
+ const vectorized = mode !== "scalar";
2395
+ /** The custom section naming the function, its imports, and each parameter and local the generator knows the role of. */
2396
+ const nameSection = () => {
2397
+ const parameterNames = ["start", "end", "tick", "lastRun", ...columns.map((_, k) => `c${k}`)];
2398
+ for (const part of ["Rows", "Chunks", "Blocks"])
2399
+ for (let filter = 0; filter < filters; filter++)
2400
+ parameterNames.push(`filter${filter}${part}`);
2401
+ if (lookupParameters > 0) {
2402
+ parameterNames.push("entityArchetypes", "entityRows", "entityGenerations", "entityCount");
2403
+ lookups.forEach((_, k) => parameterNames.push(`l${k}Directory`, `l${k}Records`));
2404
+ if (watching)
2405
+ parameterNames.push("lookupsSince");
2406
+ }
2407
+ for (let lookup = 0; lookup < lookups.length; lookup++) {
2408
+ const index = indexLookups[lookup];
2409
+ if (index !== null && index !== undefined)
2410
+ for (let k = 0; k < indexParameterCount(index); k++)
2411
+ parameterNames.push(`l${lookup}Index${k}`);
2412
+ }
2413
+ if (upMode)
2414
+ parameterNames.push("rows", "parents", "found", ...upColumns.map((_, k) => `u${k}`));
2415
+ for (const scalar of scalars)
2416
+ parameterNames.push(identifierOf(scalar.source === "args" ? ["input", ...scalar.path].join("_") : [`${scalar.source === "shared" ? "shared" : "r"}${scalar.index}`, ...scalar.path].join("_")));
2417
+ if (accumulators.length > 0)
2418
+ parameterNames.push("partials");
2419
+ const localNames = [
2420
+ ...parameterNames,
2421
+ ...Array.from({ length: program.locals }, (_, k) => identifierOf(program.names?.[k] ?? `t_${k}`)),
2422
+ ...extraLocals.map((_, k) => k === 0 ? "row" : `s${k}`),
2423
+ ];
2424
+ const functions = [...imports.map((functionName, k) => [...unsigned(k), ...name(functionName)]), [...unsigned(imports.length), ...name("run")]];
2425
+ const locals = [[...unsigned(imports.length), ...vector(localNames.map((localName, k) => [...unsigned(k), ...name(localName)]))]];
2426
+ // Subsections have a section's form: function names (1), then local names (2).
2427
+ return section(0, [...name("name"), ...section(1, vector(functions)), ...section(2, vector(locals))]);
2428
+ };
2429
+ const parameterTypes = [i32Type, i32Type, f64Type, f64Type, ...columns.map(() => i32Type), ...new Array(3 * filters).fill(i32Type), ...new Array(lookupParameters).fill(f64Type), ...new Array(indexParameters).fill(f64Type), ...new Array(upParameters).fill(i32Type), ...scalars.map(() => f64Type), ...accumulators.length > 0 ? [i32Type] : []];
2430
+ const localTypesList = [...new Array(program.locals).fill(f64Type)];
2431
+ // Locals in order: program locals, then extras in creation order; the row index was the first extra.
2432
+ const declared = [...localTypesList.map(type => [1, type]), ...extraLocals.map(type => [1, type])];
2433
+ const body = [...vector(declared.map(([count, type]) => [...unsigned(count), type])), ...code];
2434
+ const types = [
2435
+ [0x60, ...vector(parameterTypes.map(type => [type])), ...vector([])],
2436
+ [0x60, ...vector([[f64Type], [f64Type]]), ...vector([[f64Type]])],
2437
+ ];
2438
+ const importEntries = [
2439
+ [...name("env"), ...name("memory"), 0x02, 0x03, ...unsigned(1), ...unsigned(65536)],
2440
+ ...imports.map(functionName => [...name("math"), ...name(functionName), 0x00, ...unsigned(1)]),
2441
+ ];
2442
+ const bytes = new Uint8Array([
2443
+ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00,
2444
+ ...section(1, vector(types)),
2445
+ ...section(2, vector(importEntries)),
2446
+ ...section(3, vector([unsigned(0)])),
2447
+ ...section(7, vector([[...name("run"), 0x00, ...unsigned(imports.length)]])),
2448
+ ...section(10, vector([[...unsigned(body.length), ...body]])),
2449
+ ...named ? nameSection() : [],
2450
+ ]);
2451
+ return { bytes, scalars, imports, vectorized };
2452
+ }
2453
+ catch (error) {
2454
+ const reason = typeof error === "object" && error !== null ? reasons.get(error) : undefined;
2455
+ if (reason !== undefined)
2456
+ return reason;
2457
+ throw error;
2458
+ }
2459
+ };
2460
+ //# sourceMappingURL=wasm.js.map