nucleation 0.6.0 → 0.7.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 (190) hide show
  1. package/AnimationEffect.d.mts +44 -0
  2. package/AnimationEffect.d.ts +1 -1
  3. package/Autostack.d.mts +43 -0
  4. package/Autostack.d.ts +2 -2
  5. package/BlockPos.d.mts +28 -0
  6. package/BlockState.d.mts +39 -0
  7. package/BlockState.d.ts +1 -1
  8. package/Blocks.d.mts +91 -0
  9. package/Blocks.d.ts +1 -1
  10. package/Brush.d.mts +99 -0
  11. package/Brush.d.ts +21 -12
  12. package/Brush.mjs +66 -9
  13. package/BuildAnimation.d.mts +142 -0
  14. package/BuildAnimation.d.ts +5 -5
  15. package/BuildingTool.d.mts +46 -0
  16. package/BuildingTool.d.ts +4 -4
  17. package/CellularSdfConfig.d.mts +22 -0
  18. package/CellularSdfConfig.d.ts +22 -0
  19. package/CellularSdfConfig.mjs +69 -0
  20. package/ChunkMeshResult.d.mts +75 -0
  21. package/ChunkMeshResult.d.ts +7 -7
  22. package/CircuitBuilder.d.mts +118 -0
  23. package/CircuitBuilder.d.ts +6 -6
  24. package/Curve3D.d.mts +27 -0
  25. package/Curve3D.d.ts +1 -1
  26. package/DefinitionRegion.d.mts +274 -0
  27. package/DefinitionRegion.d.ts +5 -5
  28. package/Diff.d.mts +88 -0
  29. package/Diff.d.ts +2 -2
  30. package/Dimensions.d.mts +28 -0
  31. package/DistanceField.d.mts +39 -0
  32. package/DistanceField.d.ts +1 -1
  33. package/ExecutionMode.d.mts +42 -0
  34. package/ExecutionMode.d.ts +2 -2
  35. package/Field3.d.mts +40 -0
  36. package/Field3.d.ts +40 -0
  37. package/Field3.mjs +160 -0
  38. package/FieldProgram.d.mts +40 -0
  39. package/FieldProgram.d.ts +40 -0
  40. package/FieldProgram.mjs +167 -0
  41. package/FieldProgramBinaryOp.d.mts +42 -0
  42. package/FieldProgramBinaryOp.d.ts +42 -0
  43. package/FieldProgramBinaryOp.mjs +118 -0
  44. package/FieldProgramBuilder.d.mts +104 -0
  45. package/FieldProgramBuilder.d.ts +104 -0
  46. package/FieldProgramBuilder.mjs +486 -0
  47. package/FieldProgramDistanceKind.d.mts +26 -0
  48. package/FieldProgramDistanceKind.d.ts +26 -0
  49. package/FieldProgramDistanceKind.mjs +78 -0
  50. package/FieldProgramUnaryOp.d.mts +34 -0
  51. package/FieldProgramUnaryOp.d.ts +34 -0
  52. package/FieldProgramUnaryOp.mjs +102 -0
  53. package/FieldProgramValueType.d.mts +25 -0
  54. package/FieldProgramValueType.d.ts +25 -0
  55. package/FieldProgramValueType.mjs +75 -0
  56. package/FieldRange.d.mts +15 -0
  57. package/FieldRange.d.ts +15 -0
  58. package/FieldRange.mjs +108 -0
  59. package/Fingerprint.d.mts +44 -0
  60. package/Fingerprint.d.ts +2 -2
  61. package/GeneratedChunk.d.mts +35 -0
  62. package/GeneratedChunk.d.ts +35 -0
  63. package/GeneratedChunk.mjs +178 -0
  64. package/GeneratedChunkCoverage.d.mts +25 -0
  65. package/GeneratedChunkCoverage.d.ts +25 -0
  66. package/GeneratedChunkCoverage.mjs +75 -0
  67. package/GeneratedChunkOverlayMode.d.mts +24 -0
  68. package/GeneratedChunkOverlayMode.d.ts +24 -0
  69. package/GeneratedChunkOverlayMode.mjs +72 -0
  70. package/GeneratedWorldStream.d.mts +28 -0
  71. package/GeneratedWorldStream.d.ts +28 -0
  72. package/GeneratedWorldStream.mjs +86 -0
  73. package/Geo.d.mts +41 -0
  74. package/Geo.d.ts +2 -2
  75. package/InterpolationSpace.d.mts +25 -0
  76. package/IoLayout.d.mts +26 -0
  77. package/IoLayoutBuilder.d.mts +73 -0
  78. package/IoLayoutBuilder.d.ts +4 -4
  79. package/IoType.d.mts +41 -0
  80. package/ItemModelConfig.d.mts +65 -0
  81. package/ItemModelConfig.d.ts +1 -1
  82. package/ItemModelPackBuilder.d.mts +32 -0
  83. package/ItemModelPackBuilder.d.ts +1 -1
  84. package/ItemModelResult.d.mts +72 -0
  85. package/ItemModelResult.d.ts +7 -7
  86. package/ItemScale.d.mts +31 -0
  87. package/LayoutFunction.d.mts +52 -0
  88. package/LayoutFunction.d.ts +1 -1
  89. package/MchprsWorld.d.mts +131 -0
  90. package/MchprsWorld.d.ts +3 -3
  91. package/MeshBounds.d.mts +40 -0
  92. package/MeshConfig.d.mts +101 -0
  93. package/MeshConfig.d.ts +1 -1
  94. package/MeshJob.d.mts +44 -0
  95. package/MeshJob.d.ts +7 -7
  96. package/MeshPhase.d.mts +38 -0
  97. package/MeshProgress.d.mts +32 -0
  98. package/MeshProgress.d.ts +1 -1
  99. package/MeshResult.d.mts +65 -0
  100. package/MeshResult.d.ts +5 -5
  101. package/MultiMeshResult.d.mts +50 -0
  102. package/MultiMeshResult.d.ts +5 -5
  103. package/Nbt.d.mts +50 -0
  104. package/Nbt.d.ts +1 -1
  105. package/NucleationError.d.mts +41 -0
  106. package/NucleationError.d.ts +5 -0
  107. package/NucleationError.mjs +8 -1
  108. package/OutputCondition.d.mts +45 -0
  109. package/OutputCondition.d.ts +1 -1
  110. package/Palette.d.mts +145 -0
  111. package/Palette.d.ts +9 -1
  112. package/Palette.mjs +35 -0
  113. package/PaletteBuilder.d.mts +119 -0
  114. package/PaletteBuilder.d.ts +2 -2
  115. package/RawMeshExport.d.mts +74 -0
  116. package/RawMeshExport.d.ts +4 -4
  117. package/RedstoneGraph.d.mts +58 -0
  118. package/RedstoneGraph.d.ts +1 -1
  119. package/RegionBounds.d.mts +41 -0
  120. package/RenderConfig.d.mts +101 -0
  121. package/RenderConfig.d.ts +1 -1
  122. package/Renderer.d.mts +51 -0
  123. package/Renderer.d.ts +4 -4
  124. package/ResourcePack.d.mts +105 -0
  125. package/ResourcePack.d.ts +3 -3
  126. package/ResourcePackList.d.mts +32 -0
  127. package/Schematic.d.mts +734 -0
  128. package/Schematic.d.ts +4 -4
  129. package/SchematicBuilder.d.mts +103 -0
  130. package/SchematicBuilder.d.ts +2 -2
  131. package/SchematicRegions.d.mts +93 -0
  132. package/SchematicRegions.d.ts +3 -3
  133. package/Scripting.d.mts +40 -0
  134. package/Scripting.d.ts +2 -2
  135. package/Sdf.d.mts +234 -0
  136. package/Sdf.d.ts +208 -13
  137. package/Sdf.mjs +1106 -11
  138. package/SdfAxis.d.mts +25 -0
  139. package/SdfAxis.d.ts +25 -0
  140. package/SdfAxis.mjs +75 -0
  141. package/SdfBounds.d.mts +19 -0
  142. package/SdfBounds.d.ts +19 -0
  143. package/SdfBounds.mjs +160 -0
  144. package/SdfCellMode.d.mts +26 -0
  145. package/SdfCellMode.d.ts +26 -0
  146. package/SdfCellMode.mjs +78 -0
  147. package/SdfNormal.d.mts +16 -0
  148. package/SdfNormal.d.ts +16 -0
  149. package/SdfNormal.mjs +121 -0
  150. package/Shape.d.mts +143 -0
  151. package/Shape.d.ts +2 -2
  152. package/SortStrategy.d.mts +86 -0
  153. package/SortStrategy.d.ts +1 -1
  154. package/Store.d.mts +83 -0
  155. package/Store.d.ts +2 -2
  156. package/StoreIo.d.mts +71 -0
  157. package/StoreIo.d.ts +2 -2
  158. package/TextureAtlas.d.mts +40 -0
  159. package/TextureAtlas.d.ts +4 -4
  160. package/TextureInfo.d.mts +34 -0
  161. package/TypedCircuitExecutor.d.mts +101 -0
  162. package/TypedCircuitExecutor.d.ts +6 -6
  163. package/Value.d.mts +73 -0
  164. package/Value.d.ts +1 -1
  165. package/VideoConfig.d.mts +15 -0
  166. package/Voxelizer.d.mts +58 -0
  167. package/Voxelizer.d.ts +4 -4
  168. package/WorldChunkView.d.mts +75 -0
  169. package/WorldChunkView.d.ts +2 -2
  170. package/WorldGenerator.d.mts +75 -0
  171. package/WorldGenerator.d.ts +75 -0
  172. package/WorldGenerator.mjs +255 -0
  173. package/WorldSink.d.mts +50 -0
  174. package/WorldSink.d.ts +2 -2
  175. package/WorldStream.d.mts +45 -0
  176. package/WorldStream.d.ts +2 -2
  177. package/WsPartitionHints.d.mts +29 -0
  178. package/WsPartitionHints.d.ts +1 -1
  179. package/WsProfile.d.mts +46 -0
  180. package/WsProfile.d.ts +1 -1
  181. package/WsRunResult.d.mts +83 -0
  182. package/WsRunResult.d.ts +5 -5
  183. package/WsSegmentJob.d.mts +28 -0
  184. package/WsSegmentJob.d.ts +1 -1
  185. package/diplomat-runtime.d.mts +15 -0
  186. package/index.d.mts +177 -0
  187. package/index.d.ts +106 -70
  188. package/index.mjs +37 -1
  189. package/nucleation.wasm +0 -0
  190. package/package.json +2 -1
@@ -0,0 +1,104 @@
1
+ // generated by diplomat-tool
2
+ import type { FieldProgram } from "./FieldProgram.mjs"
3
+ import type { FieldProgramBinaryOp } from "./FieldProgramBinaryOp.mjs"
4
+ import type { FieldProgramDistanceKind } from "./FieldProgramDistanceKind.mjs"
5
+ import type { FieldProgramUnaryOp } from "./FieldProgramUnaryOp.mjs"
6
+ import type { FieldProgramValueType } from "./FieldProgramValueType.mjs"
7
+ import type { NucleationError } from "./NucleationError.mjs"
8
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
9
+
10
+
11
+
12
+ /**
13
+ * Programmatic builder for a {@link FieldProgram}: append typed stack
14
+ * instructions, then {@link FieldProgramBuilder::build} to validate and
15
+ * obtain a {@link FieldProgram}. Consuming: every method after `build()`
16
+ * (successful or not) returns `AlreadyConsumed`.
17
+ */
18
+ export class FieldProgramBuilder {
19
+ /** @internal */
20
+ get ffiValue(): pointer;
21
+ /** @internal */
22
+ constructor();
23
+
24
+
25
+ static create(): FieldProgramBuilder;
26
+
27
+ /**
28
+ * Declare a new typed local slot and return its index.
29
+ */
30
+ addSlot(valueType: FieldProgramValueType): number;
31
+
32
+ pushConstScalar(value: number): void;
33
+
34
+ pushConstVec3(x: number, y: number, z: number): void;
35
+
36
+ pushConstBool(value: boolean): void;
37
+
38
+ /**
39
+ * Push the `Vec3` position the program is being evaluated at.
40
+ */
41
+ pushPos(): void;
42
+
43
+ loadLocal(slot: number): void;
44
+
45
+ storeLocal(slot: number): void;
46
+
47
+ /**
48
+ * Discard the top of the stack.
49
+ */
50
+ pop(): void;
51
+
52
+ unaryOp(op: FieldProgramUnaryOp): void;
53
+
54
+ binaryOp(op: FieldProgramBinaryOp): void;
55
+
56
+ /**
57
+ * Pop `(x, lo, hi)`, push `x` clamped to `[lo, hi]`.
58
+ */
59
+ clamp(): void;
60
+
61
+ /**
62
+ * Pop `(a, b, cond)`, push `a` if `cond` else `b`.
63
+ */
64
+ select(): void;
65
+
66
+ /**
67
+ * Pop `(x, y, z)`, push `Vec3([x, y, z])`.
68
+ */
69
+ makeVec3(): void;
70
+
71
+ /**
72
+ * Pop a `Bool`; if true, stop the nearest enclosing repeat after
73
+ * this iteration. Only valid inside `beginRepeat`/`endRepeat`.
74
+ */
75
+ breakIf(): void;
76
+
77
+ /**
78
+ * Open a new statically bounded repeat block; subsequent
79
+ * instructions append to its body until `endRepeat`.
80
+ */
81
+ beginRepeat(count: number): void;
82
+
83
+ /**
84
+ * Close the innermost open repeat block.
85
+ */
86
+ endRepeat(): void;
87
+
88
+ /**
89
+ * Declare which scalar slot holds the program's output.
90
+ */
91
+ setOutput(slot: number): void;
92
+
93
+ /**
94
+ * Set the program's explicit, author-asserted finite bounds.
95
+ */
96
+ setBounds(minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): void;
97
+
98
+ setDistanceKind(kind: FieldProgramDistanceKind): void;
99
+
100
+ /**
101
+ * Validate and finalize. Consumes the builder even on failure.
102
+ */
103
+ build(): FieldProgram;
104
+ }
@@ -0,0 +1,104 @@
1
+ // generated by diplomat-tool
2
+ import type { FieldProgram } from "./FieldProgram.mjs"
3
+ import type { FieldProgramBinaryOp } from "./FieldProgramBinaryOp.mjs"
4
+ import type { FieldProgramDistanceKind } from "./FieldProgramDistanceKind.mjs"
5
+ import type { FieldProgramUnaryOp } from "./FieldProgramUnaryOp.mjs"
6
+ import type { FieldProgramValueType } from "./FieldProgramValueType.mjs"
7
+ import type { NucleationError } from "./NucleationError.mjs"
8
+ import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
9
+
10
+
11
+
12
+ /**
13
+ * Programmatic builder for a {@link FieldProgram}: append typed stack
14
+ * instructions, then {@link FieldProgramBuilder::build} to validate and
15
+ * obtain a {@link FieldProgram}. Consuming: every method after `build()`
16
+ * (successful or not) returns `AlreadyConsumed`.
17
+ */
18
+ export class FieldProgramBuilder {
19
+ /** @internal */
20
+ get ffiValue(): pointer;
21
+ /** @internal */
22
+ constructor();
23
+
24
+
25
+ static create(): FieldProgramBuilder;
26
+
27
+ /**
28
+ * Declare a new typed local slot and return its index.
29
+ */
30
+ addSlot(valueType: FieldProgramValueType): number;
31
+
32
+ pushConstScalar(value: number): void;
33
+
34
+ pushConstVec3(x: number, y: number, z: number): void;
35
+
36
+ pushConstBool(value: boolean): void;
37
+
38
+ /**
39
+ * Push the `Vec3` position the program is being evaluated at.
40
+ */
41
+ pushPos(): void;
42
+
43
+ loadLocal(slot: number): void;
44
+
45
+ storeLocal(slot: number): void;
46
+
47
+ /**
48
+ * Discard the top of the stack.
49
+ */
50
+ pop(): void;
51
+
52
+ unaryOp(op: FieldProgramUnaryOp): void;
53
+
54
+ binaryOp(op: FieldProgramBinaryOp): void;
55
+
56
+ /**
57
+ * Pop `(x, lo, hi)`, push `x` clamped to `[lo, hi]`.
58
+ */
59
+ clamp(): void;
60
+
61
+ /**
62
+ * Pop `(a, b, cond)`, push `a` if `cond` else `b`.
63
+ */
64
+ select(): void;
65
+
66
+ /**
67
+ * Pop `(x, y, z)`, push `Vec3([x, y, z])`.
68
+ */
69
+ makeVec3(): void;
70
+
71
+ /**
72
+ * Pop a `Bool`; if true, stop the nearest enclosing repeat after
73
+ * this iteration. Only valid inside `beginRepeat`/`endRepeat`.
74
+ */
75
+ breakIf(): void;
76
+
77
+ /**
78
+ * Open a new statically bounded repeat block; subsequent
79
+ * instructions append to its body until `endRepeat`.
80
+ */
81
+ beginRepeat(count: number): void;
82
+
83
+ /**
84
+ * Close the innermost open repeat block.
85
+ */
86
+ endRepeat(): void;
87
+
88
+ /**
89
+ * Declare which scalar slot holds the program's output.
90
+ */
91
+ setOutput(slot: number): void;
92
+
93
+ /**
94
+ * Set the program's explicit, author-asserted finite bounds.
95
+ */
96
+ setBounds(minX: number, minY: number, minZ: number, maxX: number, maxY: number, maxZ: number): void;
97
+
98
+ setDistanceKind(kind: FieldProgramDistanceKind): void;
99
+
100
+ /**
101
+ * Validate and finalize. Consumes the builder even on failure.
102
+ */
103
+ build(): FieldProgram;
104
+ }
@@ -0,0 +1,486 @@
1
+ // generated by diplomat-tool
2
+ import { FieldProgram } from "./FieldProgram.mjs"
3
+ import { FieldProgramBinaryOp } from "./FieldProgramBinaryOp.mjs"
4
+ import { FieldProgramDistanceKind } from "./FieldProgramDistanceKind.mjs"
5
+ import { FieldProgramUnaryOp } from "./FieldProgramUnaryOp.mjs"
6
+ import { FieldProgramValueType } from "./FieldProgramValueType.mjs"
7
+ import { NucleationError } from "./NucleationError.mjs"
8
+ import wasm from "./diplomat-wasm.mjs";
9
+ import * as diplomatRuntime from "./diplomat-runtime.mjs";
10
+
11
+ const FieldProgramBuilder_box_destroy_registry = new FinalizationRegistry((ptr) => {
12
+ wasm.FieldProgramBuilder_destroy(ptr);
13
+ });
14
+
15
+ /**
16
+ * Programmatic builder for a {@link FieldProgram}: append typed stack
17
+ * instructions, then {@link FieldProgramBuilder::build} to validate and
18
+ * obtain a {@link FieldProgram}. Consuming: every method after `build()`
19
+ * (successful or not) returns `AlreadyConsumed`.
20
+ */
21
+ export class FieldProgramBuilder {
22
+ // Internal ptr reference:
23
+ #ptr = null;
24
+
25
+ // Lifetimes are only to keep dependencies alive.
26
+ // Since JS won't garbage collect until there are no incoming edges.
27
+ #selfEdge = [];
28
+
29
+ #internalConstructor(symbol, ptr, selfEdge) {
30
+ if (symbol !== diplomatRuntime.internalConstructor) {
31
+ console.error("FieldProgramBuilder is an Opaque type. You cannot call its constructor.");
32
+ return;
33
+ }
34
+ this.#ptr = ptr;
35
+ this.#selfEdge = selfEdge;
36
+
37
+ // Are we being borrowed? If not, we can register.
38
+ if (this.#selfEdge.length === 0) {
39
+ FieldProgramBuilder_box_destroy_registry.register(this, this.#ptr);
40
+ }
41
+
42
+ return this;
43
+ }
44
+ /** @internal */
45
+ get ffiValue() {
46
+ return this.#ptr;
47
+ }
48
+
49
+
50
+ static create() {
51
+
52
+ const result = wasm.FieldProgramBuilder_create();
53
+
54
+ try {
55
+ return new FieldProgramBuilder(diplomatRuntime.internalConstructor, result, []);
56
+ }
57
+
58
+ finally {
59
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Declare a new typed local slot and return its index.
65
+ */
66
+ addSlot(valueType) {
67
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 2, true);
68
+
69
+
70
+ const result = wasm.FieldProgramBuilder_add_slot(diplomatReceive.buffer, this.ffiValue, valueType.ffiValue);
71
+
72
+ try {
73
+ if (!diplomatReceive.resultFlag) {
74
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
75
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
76
+ }
77
+ return (new Uint16Array(wasm.memory.buffer, diplomatReceive.buffer, 1))[0];
78
+ }
79
+
80
+ finally {
81
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
82
+ diplomatReceive.free();
83
+ }
84
+ }
85
+
86
+ pushConstScalar(value) {
87
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
88
+
89
+
90
+ const result = wasm.FieldProgramBuilder_push_const_scalar(diplomatReceive.buffer, this.ffiValue, value);
91
+
92
+ try {
93
+ if (!diplomatReceive.resultFlag) {
94
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
95
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
96
+ }
97
+ }
98
+
99
+ finally {
100
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
101
+ diplomatReceive.free();
102
+ }
103
+ }
104
+
105
+ pushConstVec3(x, y, z) {
106
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
107
+
108
+
109
+ const result = wasm.FieldProgramBuilder_push_const_vec3(diplomatReceive.buffer, this.ffiValue, x, y, z);
110
+
111
+ try {
112
+ if (!diplomatReceive.resultFlag) {
113
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
114
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
115
+ }
116
+ }
117
+
118
+ finally {
119
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
120
+ diplomatReceive.free();
121
+ }
122
+ }
123
+
124
+ pushConstBool(value) {
125
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
126
+
127
+
128
+ const result = wasm.FieldProgramBuilder_push_const_bool(diplomatReceive.buffer, this.ffiValue, value);
129
+
130
+ try {
131
+ if (!diplomatReceive.resultFlag) {
132
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
133
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
134
+ }
135
+ }
136
+
137
+ finally {
138
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
139
+ diplomatReceive.free();
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Push the `Vec3` position the program is being evaluated at.
145
+ */
146
+ pushPos() {
147
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
148
+
149
+
150
+ const result = wasm.FieldProgramBuilder_push_pos(diplomatReceive.buffer, this.ffiValue);
151
+
152
+ try {
153
+ if (!diplomatReceive.resultFlag) {
154
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
155
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
156
+ }
157
+ }
158
+
159
+ finally {
160
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
161
+ diplomatReceive.free();
162
+ }
163
+ }
164
+
165
+ loadLocal(slot) {
166
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
167
+
168
+
169
+ const result = wasm.FieldProgramBuilder_load_local(diplomatReceive.buffer, this.ffiValue, slot);
170
+
171
+ try {
172
+ if (!diplomatReceive.resultFlag) {
173
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
174
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
175
+ }
176
+ }
177
+
178
+ finally {
179
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
180
+ diplomatReceive.free();
181
+ }
182
+ }
183
+
184
+ storeLocal(slot) {
185
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
186
+
187
+
188
+ const result = wasm.FieldProgramBuilder_store_local(diplomatReceive.buffer, this.ffiValue, slot);
189
+
190
+ try {
191
+ if (!diplomatReceive.resultFlag) {
192
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
193
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
194
+ }
195
+ }
196
+
197
+ finally {
198
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
199
+ diplomatReceive.free();
200
+ }
201
+ }
202
+
203
+ /**
204
+ * Discard the top of the stack.
205
+ */
206
+ pop() {
207
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
208
+
209
+
210
+ const result = wasm.FieldProgramBuilder_pop(diplomatReceive.buffer, this.ffiValue);
211
+
212
+ try {
213
+ if (!diplomatReceive.resultFlag) {
214
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
215
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
216
+ }
217
+ }
218
+
219
+ finally {
220
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
221
+ diplomatReceive.free();
222
+ }
223
+ }
224
+
225
+ unaryOp(op) {
226
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
227
+
228
+
229
+ const result = wasm.FieldProgramBuilder_unary_op(diplomatReceive.buffer, this.ffiValue, op.ffiValue);
230
+
231
+ try {
232
+ if (!diplomatReceive.resultFlag) {
233
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
234
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
235
+ }
236
+ }
237
+
238
+ finally {
239
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
240
+ diplomatReceive.free();
241
+ }
242
+ }
243
+
244
+ binaryOp(op) {
245
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
246
+
247
+
248
+ const result = wasm.FieldProgramBuilder_binary_op(diplomatReceive.buffer, this.ffiValue, op.ffiValue);
249
+
250
+ try {
251
+ if (!diplomatReceive.resultFlag) {
252
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
253
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
254
+ }
255
+ }
256
+
257
+ finally {
258
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
259
+ diplomatReceive.free();
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Pop `(x, lo, hi)`, push `x` clamped to `[lo, hi]`.
265
+ */
266
+ clamp() {
267
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
268
+
269
+
270
+ const result = wasm.FieldProgramBuilder_clamp(diplomatReceive.buffer, this.ffiValue);
271
+
272
+ try {
273
+ if (!diplomatReceive.resultFlag) {
274
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
275
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
276
+ }
277
+ }
278
+
279
+ finally {
280
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
281
+ diplomatReceive.free();
282
+ }
283
+ }
284
+
285
+ /**
286
+ * Pop `(a, b, cond)`, push `a` if `cond` else `b`.
287
+ */
288
+ select() {
289
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
290
+
291
+
292
+ const result = wasm.FieldProgramBuilder_select(diplomatReceive.buffer, this.ffiValue);
293
+
294
+ try {
295
+ if (!diplomatReceive.resultFlag) {
296
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
297
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
298
+ }
299
+ }
300
+
301
+ finally {
302
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
303
+ diplomatReceive.free();
304
+ }
305
+ }
306
+
307
+ /**
308
+ * Pop `(x, y, z)`, push `Vec3([x, y, z])`.
309
+ */
310
+ makeVec3() {
311
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
312
+
313
+
314
+ const result = wasm.FieldProgramBuilder_make_vec3(diplomatReceive.buffer, this.ffiValue);
315
+
316
+ try {
317
+ if (!diplomatReceive.resultFlag) {
318
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
319
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
320
+ }
321
+ }
322
+
323
+ finally {
324
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
325
+ diplomatReceive.free();
326
+ }
327
+ }
328
+
329
+ /**
330
+ * Pop a `Bool`; if true, stop the nearest enclosing repeat after
331
+ * this iteration. Only valid inside `beginRepeat`/`endRepeat`.
332
+ */
333
+ breakIf() {
334
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
335
+
336
+
337
+ const result = wasm.FieldProgramBuilder_break_if(diplomatReceive.buffer, this.ffiValue);
338
+
339
+ try {
340
+ if (!diplomatReceive.resultFlag) {
341
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
342
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
343
+ }
344
+ }
345
+
346
+ finally {
347
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
348
+ diplomatReceive.free();
349
+ }
350
+ }
351
+
352
+ /**
353
+ * Open a new statically bounded repeat block; subsequent
354
+ * instructions append to its body until `endRepeat`.
355
+ */
356
+ beginRepeat(count) {
357
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
358
+
359
+
360
+ const result = wasm.FieldProgramBuilder_begin_repeat(diplomatReceive.buffer, this.ffiValue, count);
361
+
362
+ try {
363
+ if (!diplomatReceive.resultFlag) {
364
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
365
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
366
+ }
367
+ }
368
+
369
+ finally {
370
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
371
+ diplomatReceive.free();
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Close the innermost open repeat block.
377
+ */
378
+ endRepeat() {
379
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
380
+
381
+
382
+ const result = wasm.FieldProgramBuilder_end_repeat(diplomatReceive.buffer, this.ffiValue);
383
+
384
+ try {
385
+ if (!diplomatReceive.resultFlag) {
386
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
387
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
388
+ }
389
+ }
390
+
391
+ finally {
392
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
393
+ diplomatReceive.free();
394
+ }
395
+ }
396
+
397
+ /**
398
+ * Declare which scalar slot holds the program's output.
399
+ */
400
+ setOutput(slot) {
401
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
402
+
403
+
404
+ const result = wasm.FieldProgramBuilder_set_output(diplomatReceive.buffer, this.ffiValue, slot);
405
+
406
+ try {
407
+ if (!diplomatReceive.resultFlag) {
408
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
409
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
410
+ }
411
+ }
412
+
413
+ finally {
414
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
415
+ diplomatReceive.free();
416
+ }
417
+ }
418
+
419
+ /**
420
+ * Set the program's explicit, author-asserted finite bounds.
421
+ */
422
+ setBounds(minX, minY, minZ, maxX, maxY, maxZ) {
423
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
424
+
425
+
426
+ const result = wasm.FieldProgramBuilder_set_bounds(diplomatReceive.buffer, this.ffiValue, minX, minY, minZ, maxX, maxY, maxZ);
427
+
428
+ try {
429
+ if (!diplomatReceive.resultFlag) {
430
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
431
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
432
+ }
433
+ }
434
+
435
+ finally {
436
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
437
+ diplomatReceive.free();
438
+ }
439
+ }
440
+
441
+ setDistanceKind(kind) {
442
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
443
+
444
+
445
+ const result = wasm.FieldProgramBuilder_set_distance_kind(diplomatReceive.buffer, this.ffiValue, kind.ffiValue);
446
+
447
+ try {
448
+ if (!diplomatReceive.resultFlag) {
449
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
450
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
451
+ }
452
+ }
453
+
454
+ finally {
455
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
456
+ diplomatReceive.free();
457
+ }
458
+ }
459
+
460
+ /**
461
+ * Validate and finalize. Consumes the builder even on failure.
462
+ */
463
+ build() {
464
+ const diplomatReceive = new diplomatRuntime.DiplomatReceiveBuf(wasm, 5, 4, true);
465
+
466
+
467
+ const result = wasm.FieldProgramBuilder_build(diplomatReceive.buffer, this.ffiValue);
468
+
469
+ try {
470
+ if (!diplomatReceive.resultFlag) {
471
+ const cause = new NucleationError(diplomatRuntime.internalConstructor, diplomatRuntime.enumDiscriminant(wasm, diplomatReceive.buffer));
472
+ throw new globalThis.Error('NucleationError.' + cause.value, { cause });
473
+ }
474
+ return new FieldProgram(diplomatRuntime.internalConstructor, diplomatRuntime.ptrRead(wasm, diplomatReceive.buffer), []);
475
+ }
476
+
477
+ finally {
478
+ diplomatRuntime.FUNCTION_PARAM_ALLOC.clean();
479
+ diplomatReceive.free();
480
+ }
481
+ }
482
+
483
+ constructor(symbol, ptr, selfEdge) {
484
+ return this.#internalConstructor(...arguments)
485
+ }
486
+ }