@descix/frqtl-node 0.0.0-stage → 0.6.0-p0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/CLAUDE.md +87 -0
  2. package/LICENSE.md +664 -0
  3. package/README.md +84 -2
  4. package/dist/dist-manifest.json +218 -0
  5. package/dist/eyes/index.js +109 -0
  6. package/dist/fat/pkg-node/egpt_wasm.js +1277 -0
  7. package/dist/fat/pkg-node/egpt_wasm_bg.wasm +0 -0
  8. package/dist/fat/pkg-node/package.json +12 -0
  9. package/dist/frqtl/assets/vendor/chroma.mjs +64 -0
  10. package/dist/frqtl/compat/boot-node.js +34 -0
  11. package/dist/frqtl/compat/engine.js +127 -0
  12. package/dist/frqtl/compat/package-root.js +24 -0
  13. package/dist/frqtl/compat/providers/wasm-engine.js +2499 -0
  14. package/dist/frqtl/compat/providers/wasm-load-browser.js +134 -0
  15. package/dist/frqtl/compat/providers/wasm-load-node.js +59 -0
  16. package/dist/frqtl/compat/renderer/FieldBuilder.js +145 -0
  17. package/dist/frqtl/compat/renderer/Filters.js +163 -0
  18. package/dist/frqtl/compat/renderer/RenderFamily.js +84 -0
  19. package/dist/frqtl/compat/renderer/RenderMesh.js +99 -0
  20. package/dist/frqtl/compat/renderer/RenderShape.js +154 -0
  21. package/dist/frqtl/compat/renderer/camera2d-geometry.js +183 -0
  22. package/dist/frqtl/compat/renderer/captureStill-common.js +258 -0
  23. package/dist/frqtl/compat/renderer/display-slot.js +96 -0
  24. package/dist/frqtl/compat/renderer/lo-drawn-center.js +231 -0
  25. package/dist/frqtl/compat/renderer/orbit-bag.js +216 -0
  26. package/dist/frqtl/compat/renderer/providers/godrays-layer.js +213 -0
  27. package/dist/frqtl/compat/renderer/providers/index.js +22 -0
  28. package/dist/frqtl/compat/renderer/providers/p5-provider.js +861 -0
  29. package/dist/frqtl/compat/renderer/providers/three-camera-contract.js +160 -0
  30. package/dist/frqtl/compat/renderer/providers/three-camera-geometry.js +571 -0
  31. package/dist/frqtl/compat/renderer/providers/three-provider.js +2470 -0
  32. package/dist/frqtl/compat/renderer/renderCapabilities-common.js +186 -0
  33. package/dist/frqtl/compat/renderer/renderer-provider-contract.js +238 -0
  34. package/dist/frqtl/compat/renderer/unprojectStill.js +172 -0
  35. package/dist/frqtl/compat/vendor.js +196 -0
  36. package/dist/frqtl/node-entry.js +17 -0
  37. package/dist/frqtl/objects/FrqtlApp.js +2920 -0
  38. package/dist/frqtl/objects/ObjectFactory.js +296 -0
  39. package/dist/frqtl/objects/RecipeContext.js +322 -0
  40. package/dist/frqtl/objects/collectors/DataCollector.js +116 -0
  41. package/dist/frqtl/objects/constants/WallBehaviors.js +178 -0
  42. package/dist/frqtl/objects/geometry/SlabFace.js +258 -0
  43. package/dist/frqtl/objects/instruments/capture-host.js +453 -0
  44. package/dist/frqtl/objects/instruments/capture.js +710 -0
  45. package/dist/frqtl/objects/instruments/hosted-eyes.js +984 -0
  46. package/dist/frqtl/objects/kinds-entry.js +14 -0
  47. package/dist/frqtl/objects/kinds.js +190 -0
  48. package/dist/frqtl/objects/objects/Box.js +273 -0
  49. package/dist/frqtl/objects/objects/Bullet.js +155 -0
  50. package/dist/frqtl/objects/objects/CircuitGate.js +380 -0
  51. package/dist/frqtl/objects/objects/CircuitProbe.js +214 -0
  52. package/dist/frqtl/objects/objects/DirectedTunnel.js +411 -0
  53. package/dist/frqtl/objects/objects/EgptFractal.js +164 -0
  54. package/dist/frqtl/objects/objects/LightSource.js +351 -0
  55. package/dist/frqtl/objects/objects/QuantumEmitter.js +760 -0
  56. package/dist/frqtl/objects/objects/Tube.js +471 -0
  57. package/dist/frqtl/objects/objects/absorbRadiation.js +309 -0
  58. package/dist/frqtl/objects/objects/actionCompiler.js +1747 -0
  59. package/dist/frqtl/objects/objects/controlAction.js +89 -0
  60. package/dist/frqtl/objects/objects/controlBind.js +278 -0
  61. package/dist/frqtl/objects/objects/directedRedirectProgram.js +120 -0
  62. package/dist/frqtl/objects/objects/emitterProgram.js +209 -0
  63. package/dist/frqtl/objects/objects/frqtl-control-slider.js +197 -0
  64. package/dist/frqtl/objects/objects/frqtl-control-sync.js +272 -0
  65. package/dist/frqtl/objects/objects/frqtl-control-widgets.js +219 -0
  66. package/dist/frqtl/objects/objects/frqtl-control-write-queue.js +174 -0
  67. package/dist/frqtl/objects/objects/makeControlsForObject.js +820 -0
  68. package/dist/frqtl/objects/objects/makeControlsForRenderSurface.js +161 -0
  69. package/dist/frqtl/objects/objects/slitLinerScatter.js +261 -0
  70. package/dist/frqtl/objects/objects/sustainedSource.js +298 -0
  71. package/dist/frqtl/objects/objects/tagger.js +228 -0
  72. package/dist/frqtl/objects/schema/engine-scopes.js +468 -0
  73. package/dist/frqtl/objects/schema/index.js +256 -0
  74. package/dist/frqtl/objects/schema/scopes.js +457 -0
  75. package/dist/frqtl/objects/schema/validate-descriptor.js +49 -0
  76. package/dist/frqtl/objects/schema/valueNormalizer.js +366 -0
  77. package/dist/frqtl/objects/setup/_collisionMatrixLanes.js +66 -0
  78. package/dist/frqtl/objects/setup/_setupOptions.js +118 -0
  79. package/dist/frqtl/objects/setup/_worldInit.js +162 -0
  80. package/dist/frqtl/objects/setup/setupBlackbodySubstrate.js +242 -0
  81. package/dist/frqtl/objects/setup/setupCircuitBasic.js +447 -0
  82. package/dist/frqtl/objects/setup/setupCollisionMatrix.js +188 -0
  83. package/dist/frqtl/objects/setup/setupConeEmitter3D.js +250 -0
  84. package/dist/frqtl/objects/setup/setupDoubleSlit.js +326 -0
  85. package/dist/frqtl/objects/setup/setupDoubleSlit_Laser.js +229 -0
  86. package/dist/frqtl/objects/setup/setupEmpty.js +59 -0
  87. package/dist/frqtl/objects/setup/setupFxSmoke.js +209 -0
  88. package/dist/frqtl/objects/setup/setupG1Race.js +80 -0
  89. package/dist/frqtl/objects/setup/setupG2Sweep.js +89 -0
  90. package/dist/frqtl/objects/setup/setupG3Collide.js +177 -0
  91. package/dist/frqtl/objects/setup/setupLightSourceLab.js +277 -0
  92. package/dist/frqtl/objects/setup/setupOscillator.js +68 -0
  93. package/dist/frqtl/objects/setup/setupParticleWalk.js +93 -0
  94. package/dist/frqtl/objects/setup/setupParticleWalk3D.js +133 -0
  95. package/dist/frqtl/objects/setup/setupSphereEmitter3D.js +1258 -0
  96. package/dist/frqtl/objects/setup/setupTraceCircuit.js +239 -0
  97. package/dist/frqtl/objects/setup/setupTunnelLab.js +240 -0
  98. package/dist/frqtl/objects/setup/setupTunnelPointExit.js +306 -0
  99. package/dist/frqtl/objects/setup/setupWaveInterference.js +177 -0
  100. package/dist/frqtl/objects/v1-replacements.js +29 -0
  101. package/dist/frqtl/package-core.js +23 -0
  102. package/dist/frqtl/parts/CameraControls.js +643 -0
  103. package/dist/frqtl/parts/CameraPath.js +575 -0
  104. package/dist/frqtl/parts/CollisionActions.js +34 -0
  105. package/dist/frqtl/parts/CollisionTypes.js +30 -0
  106. package/dist/frqtl/parts/DetectorWall.js +496 -0
  107. package/dist/frqtl/parts/FrqtlControlOverlay.js +227 -0
  108. package/dist/frqtl/parts/FrqtlControlsPanel.js +415 -0
  109. package/dist/frqtl/parts/FrqtlVision.js +818 -0
  110. package/dist/frqtl/parts/GraphingDetectorWall.js +489 -0
  111. package/dist/frqtl/parts/LargeObject.js +405 -0
  112. package/dist/frqtl/parts/LightColor.js +255 -0
  113. package/dist/frqtl/parts/LiveChart.js +285 -0
  114. package/dist/frqtl/parts/LogicGate.js +717 -0
  115. package/dist/frqtl/parts/OvenBox.js +611 -0
  116. package/dist/frqtl/parts/PointSource.js +762 -0
  117. package/dist/frqtl/parts/Rectangle.js +200 -0
  118. package/dist/frqtl/parts/SlitLightSource.js +234 -0
  119. package/dist/frqtl/parts/SlitScreen.js +628 -0
  120. package/dist/frqtl/parts/SphereEmitter.js +946 -0
  121. package/dist/frqtl/parts/Trace.js +508 -0
  122. package/dist/frqtl/parts/Tunnel.js +1057 -0
  123. package/dist/frqtl/parts/Wall.js +1211 -0
  124. package/dist/frqtl/parts/index.js +33 -0
  125. package/dist/frqtl/scenes/absorbing-wall-3d.js +33 -0
  126. package/dist/frqtl/scenes/absorbing-wall.js +32 -0
  127. package/dist/frqtl/scenes/atomic-model.js +88 -0
  128. package/dist/frqtl/scenes/big-bang.js +46 -0
  129. package/dist/frqtl/scenes/blackbody.js +81 -0
  130. package/dist/frqtl/scenes/circuit-sat.js +127 -0
  131. package/dist/frqtl/scenes/collision-matrix-3d.js +107 -0
  132. package/dist/frqtl/scenes/counting-wall-3d.js +36 -0
  133. package/dist/frqtl/scenes/counting-wall.js +38 -0
  134. package/dist/frqtl/scenes/double-slit.js +31 -0
  135. package/dist/frqtl/scenes/dse-one-emitter.js +196 -0
  136. package/dist/frqtl/scenes/dse-one-slit.js +114 -0
  137. package/dist/frqtl/scenes/dse-photoelectric.js +70 -0
  138. package/dist/frqtl/scenes/dse-tunnel-rebuild.js +243 -0
  139. package/dist/frqtl/scenes/dse-two-emitters.js +196 -0
  140. package/dist/frqtl/scenes/dse-two-slits.js +132 -0
  141. package/dist/frqtl/scenes/empty.js +14 -0
  142. package/dist/frqtl/scenes/laser-buildup.js +49 -0
  143. package/dist/frqtl/scenes/mirror-3d.js +56 -0
  144. package/dist/frqtl/scenes/mirror-route.js +140 -0
  145. package/dist/frqtl/scenes/mirror.js +38 -0
  146. package/dist/frqtl/scenes/omni-3d.js +27 -0
  147. package/dist/frqtl/scenes/omni-source.js +22 -0
  148. package/dist/frqtl/scenes/self-interference.js +39 -0
  149. package/dist/frqtl/scenes/smoking-gun.js +122 -0
  150. package/dist/frqtl/scenes/straight-walk.js +22 -0
  151. package/dist/frqtl/scenes/sun.js +39 -0
  152. package/dist/frqtl/scenes/two-source.js +37 -0
  153. package/dist/frqtl/scenes/wave.js +26 -0
  154. package/dist/shim/bundle/frqnb.js +112 -0
  155. package/dist/shim/bundle/index.js +121 -0
  156. package/dist/shim/bundle/indexHtml.js +107 -0
  157. package/dist/shim/bundle/manifest.js +95 -0
  158. package/dist/shim/bundle/zip.js +243 -0
  159. package/dist/shim/bus.js +67 -0
  160. package/dist/shim/controls/index.js +627 -0
  161. package/dist/shim/controls/registry.js +274 -0
  162. package/dist/shim/engine/artifact-shell.js +211 -0
  163. package/dist/shim/engine/boot-phases.js +44 -0
  164. package/dist/shim/engine/engine-stack-boot.js +59 -0
  165. package/dist/shim/engine/router.js +690 -0
  166. package/dist/shim/experiment-frame/index.js +296 -0
  167. package/dist/shim/expr/ast-schema.js +369 -0
  168. package/dist/shim/field-descriptor/index.js +325 -0
  169. package/dist/shim/frame-data/index.js +224 -0
  170. package/dist/shim/index.js +67 -0
  171. package/dist/shim/notebook/canvas-guard.js +82 -0
  172. package/dist/shim/notebook/catalog.js +35 -0
  173. package/dist/shim/notebook/format.js +736 -0
  174. package/dist/shim/notebook/frqtl-setups-importmap.js +81 -0
  175. package/dist/shim/notebook/kernel.js +671 -0
  176. package/dist/shim/notebook/knob.js +150 -0
  177. package/dist/shim/notebook/module-resolver.js +260 -0
  178. package/dist/shim/notebook/notebook-knobs.js +65 -0
  179. package/dist/shim/notebook/produced-bindings.js +67 -0
  180. package/dist/shim/notebook/realm-registry.js +121 -0
  181. package/dist/shim/notebook/realm-transport.js +73 -0
  182. package/dist/shim/notebook/setup-builder.js +507 -0
  183. package/dist/shim/notebook/store.js +159 -0
  184. package/dist/shim/notebook/vendor-importmap.js +134 -0
  185. package/dist/shim/notebook/view-builder.js +189 -0
  186. package/dist/shim/notebook/view-ctx.js +100 -0
  187. package/dist/shim/notebook/view-handle.js +202 -0
  188. package/dist/shim/notebook/warmup.js +102 -0
  189. package/dist/shim/package.json +4 -0
  190. package/dist/shim/page-params/index.js +213 -0
  191. package/dist/shim/project/identity.js +112 -0
  192. package/dist/shim/project/index.js +19 -0
  193. package/dist/shim/project/link.js +402 -0
  194. package/dist/shim/project/node-specifier-hook.mjs +35 -0
  195. package/dist/shim/project/register-node.mjs +17 -0
  196. package/dist/shim/project/specifiers.js +106 -0
  197. package/dist/shim/registry/copy-gate.js +110 -0
  198. package/dist/shim/registry/exhibits.js +455 -0
  199. package/dist/shim/registry/experiments.js +215 -0
  200. package/dist/shim/registry/index.js +19 -0
  201. package/dist/shim/registry/scene-source.js +157 -0
  202. package/dist/shim/registry/walkthrough.js +804 -0
  203. package/dist/shim/render/capture-envelope.js +279 -0
  204. package/dist/shim/render/heat-colormap.js +92 -0
  205. package/dist/shim/render/render-stages.js +855 -0
  206. package/dist/shim/render/sun-look.js +33 -0
  207. package/dist/shim/render-state/apply.js +262 -0
  208. package/dist/shim/render-state/index.js +74 -0
  209. package/dist/shim/rpc/index.js +207 -0
  210. package/dist/shim/runtime/index.js +1023 -0
  211. package/dist/shim/storage/boot.js +69 -0
  212. package/dist/shim/storage/index.js +169 -0
  213. package/dist/shim/storage/local-storage-provider.js +230 -0
  214. package/dist/shim/storage/make-namespace-store.js +132 -0
  215. package/dist/shim/storage/modules.js +249 -0
  216. package/dist/shim/storage/projects.js +150 -0
  217. package/llms.txt +12 -0
  218. package/package.json +63 -4
@@ -0,0 +1,1277 @@
1
+ /* @ts-self-types="./egpt_wasm.d.ts" */
2
+
3
+ /**
4
+ * WASM-exposed universe handle.
5
+ */
6
+ class WasmUniverse {
7
+ __destroy_into_raw() {
8
+ const ptr = this.__wbg_ptr;
9
+ this.__wbg_ptr = 0;
10
+ WasmUniverseFinalization.unregister(this);
11
+ return ptr;
12
+ }
13
+ free() {
14
+ const ptr = this.__destroy_into_raw();
15
+ wasm.__wbg_wasmuniverse_free(ptr, 0);
16
+ }
17
+ /**
18
+ * Number of alive leaf quanta.
19
+ * @returns {number}
20
+ */
21
+ active_quanta() {
22
+ const ret = wasm.wasmuniverse_active_quanta(this.__wbg_ptr);
23
+ return ret >>> 0;
24
+ }
25
+ /**
26
+ * Add a new dimension at the given scale layer.
27
+ * @param {number} layer
28
+ */
29
+ add_dimension(layer) {
30
+ wasm.wasmuniverse_add_dimension(this.__wbg_ptr, layer);
31
+ }
32
+ /**
33
+ * Add a frame to a dimension's frame list (mirrors JS Dimension.addFrame).
34
+ *
35
+ * Returns true if added; false if size mismatch or dimension not found.
36
+ * @param {number} layer
37
+ * @param {number} frame_handle
38
+ * @returns {boolean}
39
+ */
40
+ add_frame_to_dimension(layer, frame_handle) {
41
+ const ret = wasm.wasmuniverse_add_frame_to_dimension(this.__wbg_ptr, layer, frame_handle);
42
+ return ret !== 0;
43
+ }
44
+ /**
45
+ * The LIVE brownian-motion mode of the running universe.
46
+ *
47
+ * The engine — not the host — RESOLVES this: `EGPTUniverse::new` coerces
48
+ * `FrameGenMode::TopDown ⇒ true` (density clustering IS the brownian regime) and
49
+ * otherwise takes `config.brownian_motion.unwrap_or(false)` (universe.rs, the
50
+ * FrameGenMode match). The host ferries the caller's un-coerced REQUEST in the
51
+ * config bag and reads the resolved answer back through here, so the coercion rule
52
+ * lives in exactly ONE language. A JS-side copy of that match is a schema mirror and
53
+ * drifts — it already produced a read-back that disagreed with the running walk.
54
+ *
55
+ * Also tracks `set_brownian_motion` (the post-init live flip), so this is engine
56
+ * state at all times, never a snapshot of the construction argument.
57
+ * @returns {boolean}
58
+ */
59
+ brownian_motion() {
60
+ const ret = wasm.wasmuniverse_brownian_motion(this.__wbg_ptr);
61
+ return ret !== 0;
62
+ }
63
+ /**
64
+ * Create a non-leaf parent frame at scale layer from a corner rect + children.
65
+ *
66
+ * Mirrors JS Dimension.createFrameFromRect(rect, childFrames, vx, vy,
67
+ * addToDimension=true, isStationary=false).
68
+ *
69
+ * rect: [left, top, w, h]
70
+ * children: flat array of frame handle IDs
71
+ * add_to_dimension: true = push to dim.frame_ids (default JS behavior)
72
+ * is_stationary: mirrors the JS is_stationary param
73
+ *
74
+ * Returns frame handle, or usize::MAX on failure (dimension not found /
75
+ * size mismatch).
76
+ * @param {number} layer
77
+ * @param {Float64Array} rect
78
+ * @param {Uint32Array} children
79
+ * @param {number} vx
80
+ * @param {number} vy
81
+ * @param {boolean} add_to_dimension
82
+ * @param {boolean} is_stationary
83
+ * @returns {number}
84
+ */
85
+ create_frame_from_rect(layer, rect, children, vx, vy, add_to_dimension, is_stationary) {
86
+ const ptr0 = passArrayF64ToWasm0(rect, wasm.__wbindgen_malloc);
87
+ const len0 = WASM_VECTOR_LEN;
88
+ const ptr1 = passArray32ToWasm0(children, wasm.__wbindgen_malloc);
89
+ const len1 = WASM_VECTOR_LEN;
90
+ const ret = wasm.wasmuniverse_create_frame_from_rect(this.__wbg_ptr, layer, ptr0, len0, ptr1, len1, vx, vy, add_to_dimension, is_stationary);
91
+ return ret >>> 0;
92
+ }
93
+ /**
94
+ * Create a new leaf frame and return its ID.
95
+ * @param {number} x
96
+ * @param {number} y
97
+ * @param {number} vx
98
+ * @param {number} vy
99
+ * @param {number} charge
100
+ * @returns {number}
101
+ */
102
+ create_leaf_frame(x, y, vx, vy, charge) {
103
+ const ret = wasm.wasmuniverse_create_leaf_frame(this.__wbg_ptr, x, y, vx, vy, charge);
104
+ return ret >>> 0;
105
+ }
106
+ /**
107
+ * Create a parent frame enclosing two child frames in the given dimension layer.
108
+ *
109
+ * Mirrors JS `Dimension.createParentFrame(childA, childB)`.
110
+ * Returns the new parent FrameId, or usize::MAX if the dimension does not exist
111
+ * or the children are too far apart (span > mb_w/mb_h).
112
+ * @param {number} layer
113
+ * @param {number} child_a
114
+ * @param {number} child_b
115
+ * @returns {number}
116
+ */
117
+ create_parent_frame(layer, child_a, child_b) {
118
+ const ret = wasm.wasmuniverse_create_parent_frame(this.__wbg_ptr, layer, child_a, child_b);
119
+ return ret >>> 0;
120
+ }
121
+ /**
122
+ * Get debug stats from the last tick.
123
+ * @returns {number}
124
+ */
125
+ debug_dim_update_pairs() {
126
+ const ret = wasm.wasmuniverse_debug_dim_update_pairs(this.__wbg_ptr);
127
+ return ret >>> 0;
128
+ }
129
+ /**
130
+ * Get number of promotions attempted in last tick.
131
+ * @returns {number}
132
+ */
133
+ debug_promotions_attempted() {
134
+ const ret = wasm.wasmuniverse_debug_promotions_attempted(this.__wbg_ptr);
135
+ return ret >>> 0;
136
+ }
137
+ /**
138
+ * Get number of promotions that succeeded in last tick.
139
+ * @returns {number}
140
+ */
141
+ debug_promotions_succeeded() {
142
+ const ret = wasm.wasmuniverse_debug_promotions_succeeded(this.__wbg_ptr);
143
+ return ret >>> 0;
144
+ }
145
+ /**
146
+ * Run one tick. Returns TickData as a JS object.
147
+ *
148
+ * An engine panic inside the tick — the injection path's diagnostics are the live class —
149
+ * reaches the caller as a JS error carrying the panic's own sentence, via the hook
150
+ * installed in `WasmUniverse::new`, instead of a bare `RuntimeError: unreachable`.
151
+ * @returns {any}
152
+ */
153
+ do_tick() {
154
+ const ret = wasm.wasmuniverse_do_tick(this.__wbg_ptr);
155
+ if (ret[2]) {
156
+ throw takeFromExternrefTable0(ret[1]);
157
+ }
158
+ return takeFromExternrefTable0(ret[0]);
159
+ }
160
+ /**
161
+ * The LIVE frame-generation mode of the running universe, as the wire name
162
+ * (`"TopDown"` | `"GroundUp"`).
163
+ *
164
+ * The engine — not the host — HOLDS this: `EGPTUniverse::new` takes
165
+ * `config.frame_gen_mode` and the whole Phase B / Phase C split hangs off it (the
166
+ * TopDown gate at `universe.rs`, plus the brownian / collisions / bonding coercions).
167
+ * The host ferries the caller's choice in the config bag and reads the running value
168
+ * back through here, so the mode that shapes the run and the mode the host reports are
169
+ * the SAME value in exactly ONE place. A JS-side copy is a cache: it goes stale the
170
+ * moment a re-init changes the mode without the copy being cleared — which is exactly
171
+ * the defect class the brownian mirror produced.
172
+ *
173
+ * SET ONCE at construction: there is deliberately no runtime setter (a mid-run flip
174
+ * would splice two frame-generation regimes into one run), so a new mode means a new
175
+ * `init()`.
176
+ * @returns {string}
177
+ */
178
+ frame_gen_mode() {
179
+ let deferred1_0;
180
+ let deferred1_1;
181
+ try {
182
+ const ret = wasm.wasmuniverse_frame_gen_mode(this.__wbg_ptr);
183
+ deferred1_0 = ret[0];
184
+ deferred1_1 = ret[1];
185
+ return getStringFromWasm0(ret[0], ret[1]);
186
+ } finally {
187
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
188
+ }
189
+ }
190
+ /**
191
+ * The LIVE fundamental (lowest / "light") dimension.
192
+ *
193
+ * Under dynamic dimensions the fundamental self-tracks as the lowest currently-allocated
194
+ * dimension (it self-lowers when `add_dimension` allocates a lower layer). Provider code
195
+ * MUST read this live value rather than snapshotting the init seed — a stale snapshot
196
+ * would create default-level leaves at the OLD floor.
197
+ * @returns {number}
198
+ */
199
+ fundamental_dimension() {
200
+ const ret = wasm.wasmuniverse_fundamental_dimension(this.__wbg_ptr);
201
+ return ret >>> 0;
202
+ }
203
+ /**
204
+ * Get frame position. Returns [x, y] or empty if invalid.
205
+ * @param {number} id
206
+ * @returns {Float64Array}
207
+ */
208
+ get_frame_position(id) {
209
+ const ret = wasm.wasmuniverse_get_frame_position(this.__wbg_ptr, id);
210
+ var v1 = getArrayF64FromWasm0(ret[0], ret[1]).slice();
211
+ wasm.__wbindgen_free(ret[0], ret[1] * 8, 8);
212
+ return v1;
213
+ }
214
+ /**
215
+ * Get a named Frame property by quantum_id (= FrameData.id from do_tick()).
216
+ *
217
+ * `id` is the external quantum_id, NOT the SoA FrameId (array index). This matches
218
+ * the JS reference convention where `getFrameProperty(id, prop)` takes the same
219
+ * `quantum_id` that appears in FrameData.id from doTick().
220
+ *
221
+ * Returns a JSON string encoding the value, or `null` (JSON) if the frame is
222
+ * not found / dead. Throws a JS error for unknown property names.
223
+ *
224
+ * Mirrors `EGPTUniverse.getFrameProperty(id, prop)` in the JS reference engine.
225
+ *
226
+ * Property name vocabulary: the engine contract's Frame property table.
227
+ * @param {number} id
228
+ * @param {string} prop
229
+ * @returns {string}
230
+ */
231
+ get_frame_property(id, prop) {
232
+ let deferred3_0;
233
+ let deferred3_1;
234
+ try {
235
+ const ptr0 = passStringToWasm0(prop, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
+ const len0 = WASM_VECTOR_LEN;
237
+ const ret = wasm.wasmuniverse_get_frame_property(this.__wbg_ptr, id, ptr0, len0);
238
+ var ptr2 = ret[0];
239
+ var len2 = ret[1];
240
+ if (ret[3]) {
241
+ ptr2 = 0; len2 = 0;
242
+ throw takeFromExternrefTable0(ret[2]);
243
+ }
244
+ deferred3_0 = ptr2;
245
+ deferred3_1 = len2;
246
+ return getStringFromWasm0(ptr2, len2);
247
+ } finally {
248
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
249
+ }
250
+ }
251
+ /**
252
+ * Return the external quantum_id for a frame handle (SoA FrameId).
253
+ *
254
+ * G-EMIT companion: after make_leaf_frame() returns a SoA handle, the host
255
+ * emitter tick-fn uses this to get the quantum_id it needs for set_frame_property()
256
+ * (to stamp data.render.color on the newly-created frame before injecting it).
257
+ *
258
+ * Returns 0 if the handle is out of range (safe sentinel — quantum_ids start at 1).
259
+ * @param {number} frame_handle
260
+ * @returns {number}
261
+ */
262
+ get_frame_quantum_id(frame_handle) {
263
+ const ret = wasm.wasmuniverse_get_frame_quantum_id(this.__wbg_ptr, frame_handle);
264
+ return ret >>> 0;
265
+ }
266
+ /**
267
+ * MANDATORY BACKING — return the SoA FrameId of this LO's backing frame.
268
+ *
269
+ * Under mandatory backing, `register_large_object` ALWAYS
270
+ * creates the backing frame, so sugar (e.g. `absorbRadiation.js`) READS the id here
271
+ * instead of creating+attaching its own frame or shadow-tracking the id (either would be
272
+ * new drift). Companion: `get_frame_quantum_id(fid)` converts to the external quantum_id
273
+ * the frame accessors key on. Returns -1 for an out-of-range handle (safe sentinel).
274
+ *
275
+ * Return type is `i32` (NOT i64/isize): a backing frame_id is a small SoA store index, and
276
+ * wasm-bindgen maps i32 → a JS Number (i64 → a JS BigInt, which breaks `getFrameQuantumId`
277
+ * arithmetic downstream). Mirrors `get_frame_quantum_id`'s u32→Number shape.
278
+ * @param {number} handle
279
+ * @returns {number}
280
+ */
281
+ get_large_object_frame_id(handle) {
282
+ const ret = wasm.wasmuniverse_get_large_object_frame_id(this.__wbg_ptr, handle);
283
+ return ret;
284
+ }
285
+ /**
286
+ * Inject an already-created frame (by FrameId / frame handle) into the injection buffer.
287
+ *
288
+ * Companion to make_leaf_frame(): the host emitter tick-fn calls make_leaf_frame()
289
+ * to create a frame (with correct wavelength/charge/color), then calls inject_frame()
290
+ * to enqueue it for Phase A consumption (route_injected_frames).
291
+ *
292
+ * frame_handle: the usize returned by make_leaf_frame() (SoA FrameId / array index).
293
+ * @param {number} frame_handle
294
+ */
295
+ inject_frame(frame_handle) {
296
+ wasm.wasmuniverse_inject_frame(this.__wbg_ptr, frame_handle);
297
+ }
298
+ /**
299
+ * Enqueue a one-time batch of property mutations to apply at the top of the
300
+ * next tick (Phase A, before move) — the EXTENSIBLE deferred-write path.
301
+ *
302
+ * FAIL-LOUD: throws on malformed batch JSON,
303
+ * unknown/forbidden/readonly prop, or invalid value. Does NOT silently drop
304
+ * mutations. This is stricter than inject_frames' break-on-short-chunk.
305
+ *
306
+ * `batch_json` — JSON string, array of { id, prop, value } objects:
307
+ * id — quantum_id (= FrameData.id from do_tick(); NOT the SoA FrameId)
308
+ * prop — writable Frame property name (§2.3 Frame property table)
309
+ * value — JSON-encoded value (same ABI as set_frame_property json_value)
310
+ *
311
+ * Mirrors JS EGPTUniverse.injectMutations(batch).
312
+ * @param {string} batch_json
313
+ */
314
+ inject_mutations(batch_json) {
315
+ const ptr0 = passStringToWasm0(batch_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
316
+ const len0 = WASM_VECTOR_LEN;
317
+ const ret = wasm.wasmuniverse_inject_mutations(this.__wbg_ptr, ptr0, len0);
318
+ if (ret[1]) {
319
+ throw takeFromExternrefTable0(ret[0]);
320
+ }
321
+ }
322
+ /**
323
+ * Insert a child frame into a parent frame (mirrors JS Frame.insert).
324
+ *
325
+ * Returns true if inserted, false on failure (parent is leaf/dead/full,
326
+ * child out-of-bounds, or child has zero mass).
327
+ * @param {number} parent_handle
328
+ * @param {number} child_handle
329
+ * @returns {boolean}
330
+ */
331
+ insert_into_frame(parent_handle, child_handle) {
332
+ const ret = wasm.wasmuniverse_insert_into_frame(this.__wbg_ptr, parent_handle, child_handle);
333
+ return ret !== 0;
334
+ }
335
+ /**
336
+ * Dimension frame-id snapshot for the physics-invariant oracle.
337
+ *
338
+ * Returns a JSON string encoding an object mapping layer → array of SoA indices:
339
+ * { "<layer>": [<soa_id>, ...], ... }
340
+ *
341
+ * Oracle use: cross-reference each SoA id against the topology snapshot to verify
342
+ * that every id in a dimension's frame list is alive (no stray handles) and that
343
+ * no id appears twice (no duplicate registration).
344
+ * @returns {string}
345
+ */
346
+ invariant_dimension_frames_json() {
347
+ let deferred1_0;
348
+ let deferred1_1;
349
+ try {
350
+ const ret = wasm.wasmuniverse_invariant_dimension_frames_json(this.__wbg_ptr);
351
+ deferred1_0 = ret[0];
352
+ deferred1_1 = ret[1];
353
+ return getStringFromWasm0(ret[0], ret[1]);
354
+ } finally {
355
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
356
+ }
357
+ }
358
+ /**
359
+ * Topology snapshot for the physics-invariant oracle.
360
+ *
361
+ * Returns a JSON string encoding an array of slot descriptors, one per allocated
362
+ * FrameStore slot (including dead slots — the oracle needs to detect stray handles
363
+ * pointing at dead frames). Shape of each entry:
364
+ * {
365
+ * "soa": <SoA array index (slot number)>,
366
+ * "qid": <quantum_id — same value as FrameData.id from do_tick()>,
367
+ * "alive": <bool>,
368
+ * "leaf": <bool>,
369
+ * "layer": <u32>,
370
+ * "mass": <f64>,
371
+ * "x": <f64>,
372
+ * "y": <f64>,
373
+ * "parent_soa": <SoA index of parent, or null if none>,
374
+ * "children_soa": [<SoA indices of children>]
375
+ * }
376
+ *
377
+ * Oracle use: build a qid→soa map and a soa→qid map, then walk topology entirely
378
+ * in quantum_id space for human-readable violation reports.
379
+ * @returns {string}
380
+ */
381
+ invariant_topology_json() {
382
+ let deferred1_0;
383
+ let deferred1_1;
384
+ try {
385
+ const ret = wasm.wasmuniverse_invariant_topology_json(this.__wbg_ptr);
386
+ deferred1_0 = ret[0];
387
+ deferred1_1 = ret[1];
388
+ return getStringFromWasm0(ret[0], ret[1]);
389
+ } finally {
390
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
391
+ }
392
+ }
393
+ /**
394
+ * Kill a frame by ID.
395
+ *
396
+ * Mirrors JS `EGPTUniverse.killFrame(id)` (the JS reference engine), which sets
397
+ * `is_alive = false` and LEAVES CHILDREN ALIVE — children are orphaned and
398
+ * their parent pointer is nulled by `garbageCollectDeadParents` at end-of-tick.
399
+ * (Distinct from `Frame.kill()` / the LO ABSORB path, which remove children.)
400
+ * @param {number} id
401
+ */
402
+ kill_frame(id) {
403
+ wasm.wasmuniverse_kill_frame(this.__wbg_ptr, id);
404
+ }
405
+ /**
406
+ * THE CAPACITY LAW, PUBLISHED — the cell capacity of a leaf (or a dimension cell) at
407
+ * `level`, straight from its ONE owner, `constants::ActiveAxes::level_capacity`.
408
+ *
409
+ * Host sugar that must SIZE a frame by level — the ABSORB radiator's emissivity law is the
410
+ * live consumer — asks the engine instead of re-deriving `4^level`. `4^level` is the
411
+ * `A={x,y}` answer only: on `A={x}` a level-2 leaf owns 4 cells and on `A={x,y,z}` it owns
412
+ * 64, so a hand mirror hands the sugar a mass the frame has no room for. Capacity is the
413
+ * denominator of BOTH the move gate (`fullness = mass/capacity`) and the wavelength
414
+ * (`λ_eff = capacity/mass · scale`), so getting it wrong mis-scales how often a body steps
415
+ * and how long its wave is, together and in the same direction.
416
+ * @param {number} level
417
+ * @returns {number}
418
+ */
419
+ level_capacity(level) {
420
+ const ret = wasm.wasmuniverse_level_capacity(this.__wbg_ptr, level);
421
+ return ret;
422
+ }
423
+ /**
424
+ * Create a leaf frame mirroring JS Frame.makeLeafFrame.
425
+ *
426
+ * Parameters match the JS signature order:
427
+ * make_leaf_frame(left, top, level, wavelength, vx, vy, wrap, charge)
428
+ *
429
+ * charge: 0 = Positive, 1 = Negative, -1 = random (one rng draw).
430
+ * Returns the frame handle (usize ID).
431
+ * @param {number} left
432
+ * @param {number} top
433
+ * @param {number} level
434
+ * @param {number} wavelength
435
+ * @param {number} vx
436
+ * @param {number} vy
437
+ * @param {boolean} wrap
438
+ * @param {number} charge
439
+ * @returns {number}
440
+ */
441
+ make_leaf_frame(left, top, level, wavelength, vx, vy, wrap, charge) {
442
+ const ret = wasm.wasmuniverse_make_leaf_frame(this.__wbg_ptr, left, top, level, wavelength, vx, vy, wrap, charge);
443
+ return ret >>> 0;
444
+ }
445
+ /**
446
+ * Create a new universe from a JS config object.
447
+ *
448
+ * Expected config shape:
449
+ * ```js
450
+ * {
451
+ * fps: 60,
452
+ * iframe_interval_seconds: 1.0,
453
+ * with_inter_quantum_collisions: true,
454
+ * with_bonding: false,
455
+ * frame_gen_mode: "GroundUp", // or "TopDown"
456
+ * min_fill_rate: 0.1,
457
+ * universe_rect: [0, 0, 600, 600], // [left, top, width, height]
458
+ * depth: 600, // optional; world z-extent, default = width (a cube)
459
+ * wavelength_scale: 1.0,
460
+ * fundamental_dimension: 0,
461
+ * seed: 42
462
+ * }
463
+ * ```
464
+ *
465
+ * AN UNKNOWN KEY IS UNDETECTABLE AT THIS BOUNDARY, and `#[serde(deny_unknown_fields)]`
466
+ * cannot change that: `serde_wasm_bindgen` deserializes a struct by looking each KNOWN field
467
+ * name up as a property and never enumerates the object's own keys, so an unrecognised or
468
+ * near-miss key (`wavelengthScale` beside `wavelength_scale`) is silently ignored here while
469
+ * a wrong type, a bad enum value and a missing field all still throw. The gate is the JS
470
+ * wrapper's `create()` / `init()` contract tables (`wasm-engine.js`, `_assertNoUnknownKeys`
471
+ * + `_RETIRED_CONFIG_KEYS`), which throw naming the key — and the one-construction-authority
472
+ * rule keeps every caller behind them. Do not add a second key list here.
473
+ * @param {any} config
474
+ */
475
+ constructor(config) {
476
+ const ret = wasm.wasmuniverse_new(config);
477
+ if (ret[2]) {
478
+ throw takeFromExternrefTable0(ret[1]);
479
+ }
480
+ this.__wbg_ptr = ret[0];
481
+ WasmUniverseFinalization.register(this, this.__wbg_ptr, this);
482
+ return this;
483
+ }
484
+ /**
485
+ * EXPOSED OBB QUERY PRIMITIVE (community surface — circulation §4).
486
+ *
487
+ * Return the fundamental-dimension alive frames whose CURRENT position lies inside a
488
+ * rotated box, as canonical FrameData JSON (same shape as `query_rect_frames`).
489
+ * CONVENTION-FREE: `theta` is radians in the engine's coordinate frame; `hw/hh/hz` are
490
+ * half-extents (pixels); `cz`/`hz` are the z-slab (2D callers pass a wide `hz`). The
491
+ * FRQTL "tall-mirror" convention (SlabFace) sits ABOVE this primitive on the JS side —
492
+ * a third-party caller passes standard-math geometry and gets the same evaluator.
493
+ *
494
+ * WASM-only surface (circulation §4): no JS-reference twin; the conformance oracle is
495
+ * the hand-computed point-in-OBB expectation set (prev_z precedent).
496
+ * @param {number} cx
497
+ * @param {number} cy
498
+ * @param {number} cz
499
+ * @param {number} theta
500
+ * @param {number} hw
501
+ * @param {number} hh
502
+ * @param {number} hz
503
+ * @returns {string}
504
+ */
505
+ query_obb_frames(cx, cy, cz, theta, hw, hh, hz) {
506
+ let deferred2_0;
507
+ let deferred2_1;
508
+ try {
509
+ const ret = wasm.wasmuniverse_query_obb_frames(this.__wbg_ptr, cx, cy, cz, theta, hw, hh, hz);
510
+ var ptr1 = ret[0];
511
+ var len1 = ret[1];
512
+ if (ret[3]) {
513
+ ptr1 = 0; len1 = 0;
514
+ throw takeFromExternrefTable0(ret[2]);
515
+ }
516
+ deferred2_0 = ptr1;
517
+ deferred2_1 = len1;
518
+ return getStringFromWasm0(ptr1, len1);
519
+ } finally {
520
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
521
+ }
522
+ }
523
+ /**
524
+ * Query particle count in a rectangular region (post-tick).
525
+ * @param {number} left
526
+ * @param {number} top
527
+ * @param {number} w
528
+ * @param {number} h
529
+ * @returns {number}
530
+ */
531
+ query_rect(left, top, w, h) {
532
+ const ret = wasm.wasmuniverse_query_rect(this.__wbg_ptr, left, top, w, h);
533
+ return ret >>> 0;
534
+ }
535
+ /**
536
+ * Query frames overlapping a rectangular region (post-tick).
537
+ *
538
+ * SLICE 2 — EXTENSIBLE read path. Extends count-only query_rect() with a
539
+ * variant that returns the frame set as canonical FrameData objects.
540
+ *
541
+ * Returns a JSON string: array of FrameData objects (same shape as the
542
+ * `frames` array in do_tick() TickData output). Empty region → "[]".
543
+ *
544
+ * The returned FrameData shape is the CANONICAL shape from tick_data.rs —
545
+ * NOT a parallel DTO. Callers on the JS side pass this through the same
546
+ * _wrapTickData marshalling path used for do_tick() output.
547
+ *
548
+ * Mirrors JS EGPTUniverse.queryRectFrames(left, top, w, h).
549
+ * @param {number} left
550
+ * @param {number} top
551
+ * @param {number} w
552
+ * @param {number} h
553
+ * @returns {string}
554
+ */
555
+ query_rect_frames(left, top, w, h) {
556
+ let deferred2_0;
557
+ let deferred2_1;
558
+ try {
559
+ const ret = wasm.wasmuniverse_query_rect_frames(this.__wbg_ptr, left, top, w, h);
560
+ var ptr1 = ret[0];
561
+ var len1 = ret[1];
562
+ if (ret[3]) {
563
+ ptr1 = 0; len1 = 0;
564
+ throw takeFromExternrefTable0(ret[2]);
565
+ }
566
+ deferred2_0 = ptr1;
567
+ deferred2_1 = len1;
568
+ return getStringFromWasm0(ptr1, len1);
569
+ } finally {
570
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
571
+ }
572
+ }
573
+ /**
574
+ * Draw the next value from the deterministic Mulberry32 stream.
575
+ *
576
+ * Generic primitive for host tick-fns (G-EMIT). Host-side emitter tick-fns call
577
+ * this to draw x/y/angle/charge from the same single deterministic RNG stream
578
+ * that physics uses. Draw order must match the JS reference emitter tick-fn
579
+ * so the golden deterministic stream is preserved.
580
+ * @returns {number}
581
+ */
582
+ random() {
583
+ const ret = wasm.wasmuniverse_random(this.__wbg_ptr);
584
+ return ret;
585
+ }
586
+ /**
587
+ * Register a large object and return its handle.
588
+ *
589
+ * Expected spec shape:
590
+ * ```js
591
+ * {
592
+ * rect: [left, top, width, height], // legacy 4-element (z=0, d=width)
593
+ * // OR, for explicit z/depth (FRQTL-MAINT, 2026-07-01):
594
+ * rect: [left, top, z, width, height, depth], // 6-element, MIRRORS
595
+ * // Rectangle::from_top_left(l,t,z,w,h,d)
596
+ * name: "LEFT_wall",
597
+ * observed_dimensions: [], // empty = all dimensions
598
+ * program: { on: "collision", ops: [...] }, // optional op-program
599
+ * collect_collided: false,
600
+ * region: null, // or the SlabFace-resolved OBB descriptor
601
+ * }
602
+ * ```
603
+ * There is no `collision_type`, `actions`, `reposition` or `search_padding` key: the
604
+ * eject face, the velocity response and the whole action vocabulary are lowered into
605
+ * `program` by actionCompiler.js before registration.
606
+ *
607
+ * FRQTL-MAINT (2026-07-01): `rect` now accepts an explicit 6-element form
608
+ * `[left, top, z, width, height, depth]` in the SAME argument order as
609
+ * `Rectangle::from_top_left(left, top, near, w, h, d)` — no invented ordering.
610
+ * The legacy 4-element `[left, top, width, height]` form is unchanged and
611
+ * back-compat (z=0.0, depth=width — bit-identical to the pre-fix behavior,
612
+ * so every existing caller/golden is untouched). THROW-OR-APPLY: any other
613
+ * length is a hard error, never a silent truncation/pad.
614
+ * @param {any} spec
615
+ * @returns {number}
616
+ */
617
+ register_large_object(spec) {
618
+ const ret = wasm.wasmuniverse_register_large_object(this.__wbg_ptr, spec);
619
+ if (ret[2]) {
620
+ throw takeFromExternrefTable0(ret[1]);
621
+ }
622
+ return ret[0] >>> 0;
623
+ }
624
+ /**
625
+ * Total PRNG draws consumed so far.
626
+ * @returns {bigint}
627
+ */
628
+ rng_call_count() {
629
+ const ret = wasm.wasmuniverse_rng_call_count(this.__wbg_ptr);
630
+ return BigInt.asUintN(64, ret);
631
+ }
632
+ /**
633
+ * Current PRNG state.
634
+ * @returns {number}
635
+ */
636
+ rng_state() {
637
+ const ret = wasm.wasmuniverse_rng_state(this.__wbg_ptr);
638
+ return ret;
639
+ }
640
+ /**
641
+ * Set brownian motion mode at runtime (post-init).
642
+ * @param {boolean} enabled
643
+ */
644
+ set_brownian_motion(enabled) {
645
+ wasm.wasmuniverse_set_brownian_motion(this.__wbg_ptr, enabled);
646
+ }
647
+ /**
648
+ * Set a named Frame property by quantum_id (= FrameData.id from do_tick()).
649
+ *
650
+ * `id` is the external quantum_id, NOT the SoA FrameId (array index). See
651
+ * get_frame_property for the id convention.
652
+ *
653
+ * `json_value`: JSON-encoded value string (e.g. `"42.0"`, `"\"POSITIVE\""`, `"null"`).
654
+ *
655
+ * THROW-OR-APPLY: throws a JS TypeError for forbidden topology props, derived read-only
656
+ * props, unknown props, or invalid values. Never silently no-ops — Frames have no
657
+ * JS-wrapper upstream; the engine owns them.
658
+ *
659
+ * Mirrors `EGPTUniverse.setFrameProperty(id, prop, value)` in the JS reference engine.
660
+ * @param {number} id
661
+ * @param {string} prop
662
+ * @param {string} json_value
663
+ */
664
+ set_frame_property(id, prop, json_value) {
665
+ const ptr0 = passStringToWasm0(prop, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
666
+ const len0 = WASM_VECTOR_LEN;
667
+ const ptr1 = passStringToWasm0(json_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
668
+ const len1 = WASM_VECTOR_LEN;
669
+ const ret = wasm.wasmuniverse_set_frame_property(this.__wbg_ptr, id, ptr0, len0, ptr1, len1);
670
+ if (ret[1]) {
671
+ throw takeFromExternrefTable0(ret[0]);
672
+ }
673
+ }
674
+ /**
675
+ * Set or replace the op-program on a registered large object (§10.3 L3).
676
+ *
677
+ * Accepts a JSON string encoding an OpProgram (or null / "null" to clear).
678
+ * Called by updateObjectProperty(handle, 'LargeObject', 'program', prog).
679
+ *
680
+ * §10.3 use case: attach eject op-programs to oven walls after registration,
681
+ * so that cavity walls block quanta via set-expressions instead of native WALL eject.
682
+ *
683
+ * Returns Ok on success, Err with a message on parse failure (FAIL-LOUD for bad JSON).
684
+ * @param {number} handle
685
+ * @param {string} program_json
686
+ */
687
+ set_large_object_program_json(handle, program_json) {
688
+ const ptr0 = passStringToWasm0(program_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
689
+ const len0 = WASM_VECTOR_LEN;
690
+ const ret = wasm.wasmuniverse_set_large_object_program_json(this.__wbg_ptr, handle, ptr0, len0);
691
+ if (ret[1]) {
692
+ throw takeFromExternrefTable0(ret[0]);
693
+ }
694
+ }
695
+ /**
696
+ * G4b — Generic LargeObject property write. The ONE typed-setter replacement
697
+ * (collapses set_large_object_active / _observed_dimensions / update_large_object_rect /
698
+ * _count into one accessor), mirroring set_frame_property's (handle, prop, json) shape.
699
+ * THROW-OR-APPLY: unknown / non-engine-writable props throw. Engine-writable LO props:
700
+ * count (int), layer (int|null → observed_dimensions), rect ([l,t,w,h]), active (bool).
701
+ * (program is attached via set_large_object_program_json — a typed AST payload, not a scalar.)
702
+ * @param {number} handle
703
+ * @param {string} prop
704
+ * @param {string} json_value
705
+ */
706
+ set_large_object_property(handle, prop, json_value) {
707
+ const ptr0 = passStringToWasm0(prop, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
708
+ const len0 = WASM_VECTOR_LEN;
709
+ const ptr1 = passStringToWasm0(json_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
710
+ const len1 = WASM_VECTOR_LEN;
711
+ const ret = wasm.wasmuniverse_set_large_object_property(this.__wbg_ptr, handle, ptr0, len0, ptr1, len1);
712
+ if (ret[1]) {
713
+ throw takeFromExternrefTable0(ret[0]);
714
+ }
715
+ }
716
+ /**
717
+ * Set no_escape mode at runtime (post-init).
718
+ * When true, children inserted into a parent frame are hard-trapped
719
+ * inside the parent rect (boundary = parent rect, wrap = true).
720
+ * Required for stable composite frames (Atomic Model).
721
+ * Mirrors JS EGPTUniverse.noEscape setter.
722
+ * @param {boolean} enabled
723
+ */
724
+ set_no_escape(enabled) {
725
+ wasm.wasmuniverse_set_no_escape(this.__wbg_ptr, enabled);
726
+ }
727
+ /**
728
+ * G4b — Generic Universe property write. The Universe is READ-ONLY (UniverseDescriptor:
729
+ * tick/activeQuanta are engine-derived), so every write FAIL-LOUDs — the ABI mirror of the
730
+ * op-program handle-2 read-only panic. Provides the generic accessor the spec mandates per kind.
731
+ * @param {string} prop
732
+ * @param {string} _json_value
733
+ */
734
+ set_universe_property(prop, _json_value) {
735
+ const ptr0 = passStringToWasm0(prop, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
736
+ const len0 = WASM_VECTOR_LEN;
737
+ const ptr1 = passStringToWasm0(_json_value, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
738
+ const len1 = WASM_VECTOR_LEN;
739
+ const ret = wasm.wasmuniverse_set_universe_property(this.__wbg_ptr, ptr0, len0, ptr1, len1);
740
+ if (ret[1]) {
741
+ throw takeFromExternrefTable0(ret[0]);
742
+ }
743
+ }
744
+ /**
745
+ * [GLOBAL] Set the universe wavelength SCALE (runtime slider change) — the one
746
+ * universe-wide multiplier on every frame's (capacity/mass) wavelength ratio.
747
+ * @param {number} value
748
+ */
749
+ set_wavelength_scale(value) {
750
+ wasm.wasmuniverse_set_wavelength_scale(this.__wbg_ptr, value);
751
+ }
752
+ /**
753
+ * Set inter-quantum collisions mode at runtime (post-init).
754
+ * @param {boolean} enabled
755
+ */
756
+ set_with_inter_quantum_collisions(enabled) {
757
+ wasm.wasmuniverse_set_with_inter_quantum_collisions(this.__wbg_ptr, enabled);
758
+ }
759
+ /**
760
+ * Current tick count.
761
+ * @returns {bigint}
762
+ */
763
+ tick() {
764
+ const ret = wasm.wasmuniverse_tick(this.__wbg_ptr);
765
+ return BigInt.asUintN(64, ret);
766
+ }
767
+ /**
768
+ * Unregister a large object by handle (SLICE 3, B1).
769
+ *
770
+ * Gate-2 binding (§10.8 B1):
771
+ * B1.1 — FAIL-LOUD on unknown handle: throws JS TypeError.
772
+ * B1.2 — Reuses the ONE integer handle table (Vec index). Slot is tombstoned;
773
+ * handle is never reused.
774
+ * B1.3 — Must be called between ticks, not inside a tick callback.
775
+ *
776
+ * After unregistering, the LO stops acting next tick (active=false).
777
+ * The TickData.objects[] section still emits an entry for this handle
778
+ * (count=0) so handle-index ordering remains stable.
779
+ *
780
+ * Mirrors JS EGPTUniverse.prototype.unregisterLargeObject(handle).
781
+ * @param {number} handle
782
+ */
783
+ unregister_large_object(handle) {
784
+ const ret = wasm.wasmuniverse_unregister_large_object(this.__wbg_ptr, handle);
785
+ if (ret[1]) {
786
+ throw takeFromExternrefTable0(ret[0]);
787
+ }
788
+ }
789
+ /**
790
+ * The LIVE wavelength SCALE of the running universe.
791
+ *
792
+ * The engine — not the host — HOLDS this: `EGPTUniverse::new` takes
793
+ * `config.wavelength_scale` and every leaf's wavelength is recomputed from it on
794
+ * the tick it is read (`compute_wavelength`: `λ_eff = floor(capacity/mass ·
795
+ * wavelength_scale)`, min 4). The host ferries the caller's value in the config bag
796
+ * and reads the running value back through here, so the number that shapes the walk
797
+ * and the number the host reports are the SAME number in exactly ONE place. A JS-side
798
+ * copy is a cache: it goes stale the moment anything writes the scale without going
799
+ * through the JS property — including a write straight at this handle.
800
+ *
801
+ * Also tracks `set_wavelength_scale` (the live slider flip), so this is engine state
802
+ * at all times, never a snapshot of the construction argument.
803
+ * @returns {number}
804
+ */
805
+ wavelength_scale() {
806
+ const ret = wasm.wasmuniverse_wavelength_scale(this.__wbg_ptr);
807
+ return ret;
808
+ }
809
+ }
810
+ if (Symbol.dispose) WasmUniverse.prototype[Symbol.dispose] = WasmUniverse.prototype.free;
811
+ exports.WasmUniverse = WasmUniverse;
812
+ function __wbg_get_imports() {
813
+ const import0 = {
814
+ __proto__: null,
815
+ __wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
816
+ const ret = Error(getStringFromWasm0(arg0, arg1));
817
+ return ret;
818
+ },
819
+ __wbg_Number_6b506e6536831eaa: function(arg0) {
820
+ const ret = Number(arg0);
821
+ return ret;
822
+ },
823
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
824
+ const ret = String(arg1);
825
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
826
+ const len1 = WASM_VECTOR_LEN;
827
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
828
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
829
+ },
830
+ __wbg___wbindgen_bigint_get_as_i64_38130e98eecd467d: function(arg0, arg1) {
831
+ const v = arg1;
832
+ const ret = typeof(v) === 'bigint' ? v : undefined;
833
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
834
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
835
+ },
836
+ __wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
837
+ const v = arg0;
838
+ const ret = typeof(v) === 'boolean' ? v : undefined;
839
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
840
+ },
841
+ __wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
842
+ const ret = debugString(arg1);
843
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
844
+ const len1 = WASM_VECTOR_LEN;
845
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
846
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
847
+ },
848
+ __wbg___wbindgen_in_70a403a56e771704: function(arg0, arg1) {
849
+ const ret = arg0 in arg1;
850
+ return ret;
851
+ },
852
+ __wbg___wbindgen_is_bigint_6ffd6468a9bc44b9: function(arg0) {
853
+ const ret = typeof(arg0) === 'bigint';
854
+ return ret;
855
+ },
856
+ __wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
857
+ const ret = typeof(arg0) === 'function';
858
+ return ret;
859
+ },
860
+ __wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
861
+ const val = arg0;
862
+ const ret = typeof(val) === 'object' && val !== null;
863
+ return ret;
864
+ },
865
+ __wbg___wbindgen_is_string_c236cabd84a4d769: function(arg0) {
866
+ const ret = typeof(arg0) === 'string';
867
+ return ret;
868
+ },
869
+ __wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
870
+ const ret = arg0 === undefined;
871
+ return ret;
872
+ },
873
+ __wbg___wbindgen_jsval_eq_1068e624fa87f6ab: function(arg0, arg1) {
874
+ const ret = arg0 === arg1;
875
+ return ret;
876
+ },
877
+ __wbg___wbindgen_jsval_loose_eq_2c56564c75129511: function(arg0, arg1) {
878
+ const ret = arg0 == arg1;
879
+ return ret;
880
+ },
881
+ __wbg___wbindgen_number_get_9bb1761122181af2: function(arg0, arg1) {
882
+ const obj = arg1;
883
+ const ret = typeof(obj) === 'number' ? obj : undefined;
884
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
885
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
886
+ },
887
+ __wbg___wbindgen_rethrow_c4d99b4b53265290: function(arg0) {
888
+ throw arg0;
889
+ },
890
+ __wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
891
+ const obj = arg1;
892
+ const ret = typeof(obj) === 'string' ? obj : undefined;
893
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
894
+ var len1 = WASM_VECTOR_LEN;
895
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
896
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
897
+ },
898
+ __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
899
+ throw new Error(getStringFromWasm0(arg0, arg1));
900
+ },
901
+ __wbg_call_8a89609d89f6608a: function() { return handleError(function (arg0, arg1) {
902
+ const ret = arg0.call(arg1);
903
+ return ret;
904
+ }, arguments); },
905
+ __wbg_done_60cf307fcc680536: function(arg0) {
906
+ const ret = arg0.done;
907
+ return ret;
908
+ },
909
+ __wbg_entries_04b37a02507f1713: function(arg0) {
910
+ const ret = Object.entries(arg0);
911
+ return ret;
912
+ },
913
+ __wbg_get_1f8f054ddbaa7db2: function() { return handleError(function (arg0, arg1) {
914
+ const ret = Reflect.get(arg0, arg1);
915
+ return ret;
916
+ }, arguments); },
917
+ __wbg_get_2b48c7d0d006a781: function(arg0, arg1) {
918
+ const ret = arg0[arg1 >>> 0];
919
+ return ret;
920
+ },
921
+ __wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
922
+ const ret = arg0[arg1 >>> 0];
923
+ return ret;
924
+ },
925
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
926
+ const ret = arg0[arg1];
927
+ return ret;
928
+ },
929
+ __wbg_instanceof_ArrayBuffer_8f49811467741499: function(arg0) {
930
+ let result;
931
+ try {
932
+ result = arg0 instanceof ArrayBuffer;
933
+ } catch (_) {
934
+ result = false;
935
+ }
936
+ const ret = result;
937
+ return ret;
938
+ },
939
+ __wbg_instanceof_Map_9fc06d9a951bcee6: function(arg0) {
940
+ let result;
941
+ try {
942
+ result = arg0 instanceof Map;
943
+ } catch (_) {
944
+ result = false;
945
+ }
946
+ const ret = result;
947
+ return ret;
948
+ },
949
+ __wbg_instanceof_Uint8Array_86f30649f63ef9c2: function(arg0) {
950
+ let result;
951
+ try {
952
+ result = arg0 instanceof Uint8Array;
953
+ } catch (_) {
954
+ result = false;
955
+ }
956
+ const ret = result;
957
+ return ret;
958
+ },
959
+ __wbg_isArray_67c2c9c4313f4448: function(arg0) {
960
+ const ret = Array.isArray(arg0);
961
+ return ret;
962
+ },
963
+ __wbg_isSafeInteger_66acec27e09e99a7: function(arg0) {
964
+ const ret = Number.isSafeInteger(arg0);
965
+ return ret;
966
+ },
967
+ __wbg_iterator_8732428d309e270e: function() {
968
+ const ret = Symbol.iterator;
969
+ return ret;
970
+ },
971
+ __wbg_length_4a591ecaa01354d9: function(arg0) {
972
+ const ret = arg0.length;
973
+ return ret;
974
+ },
975
+ __wbg_length_66f1a4b2e9026940: function(arg0) {
976
+ const ret = arg0.length;
977
+ return ret;
978
+ },
979
+ __wbg_new_50bb5ebeecef71a8: function(arg0, arg1) {
980
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
981
+ return ret;
982
+ },
983
+ __wbg_new_578aeef4b6b94378: function(arg0) {
984
+ const ret = new Uint8Array(arg0);
985
+ return ret;
986
+ },
987
+ __wbg_new_622fc80556be2e26: function() {
988
+ const ret = new Map();
989
+ return ret;
990
+ },
991
+ __wbg_new_ce1ab61c1c2b300d: function() {
992
+ const ret = new Object();
993
+ return ret;
994
+ },
995
+ __wbg_new_d90091b82fdf5b91: function() {
996
+ const ret = new Array();
997
+ return ret;
998
+ },
999
+ __wbg_next_9e03acdf51c4960d: function(arg0) {
1000
+ const ret = arg0.next;
1001
+ return ret;
1002
+ },
1003
+ __wbg_next_eb8ca7351fa27906: function() { return handleError(function (arg0) {
1004
+ const ret = arg0.next();
1005
+ return ret;
1006
+ }, arguments); },
1007
+ __wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
1008
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1009
+ },
1010
+ __wbg_set_52b1e1eb5bed906a: function(arg0, arg1, arg2) {
1011
+ const ret = arg0.set(arg1, arg2);
1012
+ return ret;
1013
+ },
1014
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1015
+ arg0[arg1] = arg2;
1016
+ },
1017
+ __wbg_set_dca99999bba88a9a: function(arg0, arg1, arg2) {
1018
+ arg0[arg1 >>> 0] = arg2;
1019
+ },
1020
+ __wbg_value_f3625092ee4b37f4: function(arg0) {
1021
+ const ret = arg0.value;
1022
+ return ret;
1023
+ },
1024
+ __wbindgen_cast_0000000000000001: function(arg0) {
1025
+ // Cast intrinsic for `F64 -> Externref`.
1026
+ const ret = arg0;
1027
+ return ret;
1028
+ },
1029
+ __wbindgen_cast_0000000000000002: function(arg0) {
1030
+ // Cast intrinsic for `I64 -> Externref`.
1031
+ const ret = arg0;
1032
+ return ret;
1033
+ },
1034
+ __wbindgen_cast_0000000000000003: function(arg0, arg1) {
1035
+ // Cast intrinsic for `Ref(String) -> Externref`.
1036
+ const ret = getStringFromWasm0(arg0, arg1);
1037
+ return ret;
1038
+ },
1039
+ __wbindgen_cast_0000000000000004: function(arg0) {
1040
+ // Cast intrinsic for `U64 -> Externref`.
1041
+ const ret = BigInt.asUintN(64, arg0);
1042
+ return ret;
1043
+ },
1044
+ __wbindgen_init_externref_table: function() {
1045
+ const table = wasm.__wbindgen_externrefs;
1046
+ const offset = table.grow(4);
1047
+ table.set(0, undefined);
1048
+ table.set(offset + 0, undefined);
1049
+ table.set(offset + 1, null);
1050
+ table.set(offset + 2, true);
1051
+ table.set(offset + 3, false);
1052
+ },
1053
+ };
1054
+ return {
1055
+ __proto__: null,
1056
+ "./egpt_wasm_bg.js": import0,
1057
+ };
1058
+ }
1059
+
1060
+ const WasmUniverseFinalization = (typeof FinalizationRegistry === 'undefined')
1061
+ ? { register: () => {}, unregister: () => {} }
1062
+ : new FinalizationRegistry(ptr => wasm.__wbg_wasmuniverse_free(ptr, 1));
1063
+
1064
+ function addToExternrefTable0(obj) {
1065
+ const idx = wasm.__externref_table_alloc();
1066
+ wasm.__wbindgen_externrefs.set(idx, obj);
1067
+ return idx;
1068
+ }
1069
+
1070
+ function debugString(val) {
1071
+ // primitive types
1072
+ const type = typeof val;
1073
+ if (type == 'number' || type == 'boolean' || val == null) {
1074
+ return `${val}`;
1075
+ }
1076
+ if (type == 'string') {
1077
+ return `"${val}"`;
1078
+ }
1079
+ if (type == 'symbol') {
1080
+ const description = val.description;
1081
+ if (description == null) {
1082
+ return 'Symbol';
1083
+ } else {
1084
+ return `Symbol(${description})`;
1085
+ }
1086
+ }
1087
+ if (type == 'function') {
1088
+ const name = val.name;
1089
+ if (typeof name == 'string' && name.length > 0) {
1090
+ return `Function(${name})`;
1091
+ } else {
1092
+ return 'Function';
1093
+ }
1094
+ }
1095
+ // objects
1096
+ if (Array.isArray(val)) {
1097
+ const length = val.length;
1098
+ let debug = '[';
1099
+ if (length > 0) {
1100
+ debug += debugString(val[0]);
1101
+ }
1102
+ for(let i = 1; i < length; i++) {
1103
+ debug += ', ' + debugString(val[i]);
1104
+ }
1105
+ debug += ']';
1106
+ return debug;
1107
+ }
1108
+ // Test for built-in
1109
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
1110
+ let className;
1111
+ if (builtInMatches && builtInMatches.length > 1) {
1112
+ className = builtInMatches[1];
1113
+ } else {
1114
+ // Failed to match the standard '[object ClassName]'
1115
+ return toString.call(val);
1116
+ }
1117
+ if (className == 'Object') {
1118
+ // we're a user defined class or Object
1119
+ // JSON.stringify avoids problems with cycles, and is generally much
1120
+ // easier than looping through ownProperties of `val`.
1121
+ try {
1122
+ return 'Object(' + JSON.stringify(val) + ')';
1123
+ } catch (_) {
1124
+ return 'Object';
1125
+ }
1126
+ }
1127
+ // errors
1128
+ if (val instanceof Error) {
1129
+ return `${val.name}: ${val.message}\n${val.stack}`;
1130
+ }
1131
+ // TODO we could test for more things here, like `Set`s and `Map`s.
1132
+ return className;
1133
+ }
1134
+
1135
+ function getArrayF64FromWasm0(ptr, len) {
1136
+ ptr = ptr >>> 0;
1137
+ return getFloat64ArrayMemory0().subarray(ptr / 8, ptr / 8 + len);
1138
+ }
1139
+
1140
+ function getArrayU8FromWasm0(ptr, len) {
1141
+ ptr = ptr >>> 0;
1142
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
1143
+ }
1144
+
1145
+ let cachedDataViewMemory0 = null;
1146
+ function getDataViewMemory0() {
1147
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
1148
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
1149
+ }
1150
+ return cachedDataViewMemory0;
1151
+ }
1152
+
1153
+ let cachedFloat64ArrayMemory0 = null;
1154
+ function getFloat64ArrayMemory0() {
1155
+ if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1156
+ cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1157
+ }
1158
+ return cachedFloat64ArrayMemory0;
1159
+ }
1160
+
1161
+ function getStringFromWasm0(ptr, len) {
1162
+ return decodeText(ptr >>> 0, len);
1163
+ }
1164
+
1165
+ let cachedUint32ArrayMemory0 = null;
1166
+ function getUint32ArrayMemory0() {
1167
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
1168
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
1169
+ }
1170
+ return cachedUint32ArrayMemory0;
1171
+ }
1172
+
1173
+ let cachedUint8ArrayMemory0 = null;
1174
+ function getUint8ArrayMemory0() {
1175
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
1176
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
1177
+ }
1178
+ return cachedUint8ArrayMemory0;
1179
+ }
1180
+
1181
+ function handleError(f, args) {
1182
+ try {
1183
+ return f.apply(this, args);
1184
+ } catch (e) {
1185
+ const idx = addToExternrefTable0(e);
1186
+ wasm.__wbindgen_exn_store(idx);
1187
+ }
1188
+ }
1189
+
1190
+ function isLikeNone(x) {
1191
+ return x === undefined || x === null;
1192
+ }
1193
+
1194
+ function passArray32ToWasm0(arg, malloc) {
1195
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
1196
+ getUint32ArrayMemory0().set(arg, ptr / 4);
1197
+ WASM_VECTOR_LEN = arg.length;
1198
+ return ptr;
1199
+ }
1200
+
1201
+ function passArrayF64ToWasm0(arg, malloc) {
1202
+ const ptr = malloc(arg.length * 8, 8) >>> 0;
1203
+ getFloat64ArrayMemory0().set(arg, ptr / 8);
1204
+ WASM_VECTOR_LEN = arg.length;
1205
+ return ptr;
1206
+ }
1207
+
1208
+ function passStringToWasm0(arg, malloc, realloc) {
1209
+ if (realloc === undefined) {
1210
+ const buf = cachedTextEncoder.encode(arg);
1211
+ const ptr = malloc(buf.length, 1) >>> 0;
1212
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
1213
+ WASM_VECTOR_LEN = buf.length;
1214
+ return ptr;
1215
+ }
1216
+
1217
+ let len = arg.length;
1218
+ let ptr = malloc(len, 1) >>> 0;
1219
+
1220
+ const mem = getUint8ArrayMemory0();
1221
+
1222
+ let offset = 0;
1223
+
1224
+ for (; offset < len; offset++) {
1225
+ const code = arg.charCodeAt(offset);
1226
+ if (code > 0x7F) break;
1227
+ mem[ptr + offset] = code;
1228
+ }
1229
+ if (offset !== len) {
1230
+ if (offset !== 0) {
1231
+ arg = arg.slice(offset);
1232
+ }
1233
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
1234
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
1235
+ const ret = cachedTextEncoder.encodeInto(arg, view);
1236
+
1237
+ offset += ret.written;
1238
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
1239
+ }
1240
+
1241
+ WASM_VECTOR_LEN = offset;
1242
+ return ptr;
1243
+ }
1244
+
1245
+ function takeFromExternrefTable0(idx) {
1246
+ const value = wasm.__wbindgen_externrefs.get(idx);
1247
+ wasm.__externref_table_dealloc(idx);
1248
+ return value;
1249
+ }
1250
+
1251
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
1252
+ cachedTextDecoder.decode();
1253
+ function decodeText(ptr, len) {
1254
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
1255
+ }
1256
+
1257
+ const cachedTextEncoder = new TextEncoder();
1258
+
1259
+ if (!('encodeInto' in cachedTextEncoder)) {
1260
+ cachedTextEncoder.encodeInto = function (arg, view) {
1261
+ const buf = cachedTextEncoder.encode(arg);
1262
+ view.set(buf);
1263
+ return {
1264
+ read: arg.length,
1265
+ written: buf.length
1266
+ };
1267
+ };
1268
+ }
1269
+
1270
+ let WASM_VECTOR_LEN = 0;
1271
+
1272
+ const wasmPath = `${__dirname}/egpt_wasm_bg.wasm`;
1273
+ const wasmBytes = require('fs').readFileSync(wasmPath);
1274
+ const wasmModule = new WebAssembly.Module(wasmBytes);
1275
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
1276
+ let wasm = wasmInstance.exports;
1277
+ wasm.__wbindgen_start();