@awesome-flow/noise 0.6.0 → 0.7.1

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 (67) hide show
  1. package/dist/abstract/index.cjs +1 -3561
  2. package/dist/abstract/index.d.cts +8 -14
  3. package/dist/abstract/index.d.ts +8 -14
  4. package/dist/abstract/index.js +1 -3595
  5. package/dist/{index-BungWYrh.d.cts → index-CfiOpOzX.d.cts} +1 -1
  6. package/dist/{index-DsQSjZC5.d.ts → index-mlK0X4O1.d.ts} +1 -1
  7. package/dist/modules/index.cjs +1 -70
  8. package/dist/modules/index.d.cts +2 -10
  9. package/dist/modules/index.d.ts +2 -10
  10. package/dist/modules/index.js +1 -33
  11. package/dist/{node-props-BbqbXDXn.d.cts → node-props-CAV2WNDN.d.cts} +3 -7
  12. package/dist/{node-props-BbqbXDXn.d.ts → node-props-CAV2WNDN.d.ts} +3 -7
  13. package/dist/nodes/generators/index.cjs +1 -389
  14. package/dist/nodes/generators/index.d.cts +9 -14
  15. package/dist/nodes/generators/index.d.ts +9 -14
  16. package/dist/nodes/generators/index.js +1 -343
  17. package/dist/nodes/groups/index.cjs +1 -113
  18. package/dist/nodes/groups/index.d.cts +2 -2
  19. package/dist/nodes/groups/index.d.ts +2 -2
  20. package/dist/nodes/groups/index.js +1 -92
  21. package/dist/nodes/index.cjs +1 -3496
  22. package/dist/nodes/index.d.cts +3 -6
  23. package/dist/nodes/index.d.ts +3 -6
  24. package/dist/nodes/index.js +1 -3507
  25. package/dist/nodes/modifiers/index.cjs +1 -1493
  26. package/dist/nodes/modifiers/index.d.cts +7 -10
  27. package/dist/nodes/modifiers/index.d.ts +7 -10
  28. package/dist/nodes/modifiers/index.js +1 -1506
  29. package/dist/nodes/output/index.cjs +1 -1390
  30. package/dist/nodes/output/index.d.cts +3 -3
  31. package/dist/nodes/output/index.d.ts +3 -3
  32. package/dist/nodes/output/index.js +1 -1406
  33. package/dist/nodes/selectors/index.cjs +1 -1372
  34. package/dist/nodes/selectors/index.d.cts +3 -6
  35. package/dist/nodes/selectors/index.d.ts +3 -6
  36. package/dist/nodes/selectors/index.js +1 -1390
  37. package/dist/nodes/transformers/index.cjs +1 -337
  38. package/dist/nodes/transformers/index.d.cts +7 -10
  39. package/dist/nodes/transformers/index.d.ts +7 -10
  40. package/dist/nodes/transformers/index.js +1 -319
  41. package/dist/templates/generators/index.cjs +1 -1273
  42. package/dist/templates/generators/index.d.cts +7 -14
  43. package/dist/templates/generators/index.d.ts +7 -14
  44. package/dist/templates/generators/index.js +1 -1282
  45. package/dist/templates/groups/index.cjs +1 -1253
  46. package/dist/templates/groups/index.js +1 -1272
  47. package/dist/templates/index.cjs +1 -1315
  48. package/dist/templates/index.d.cts +4 -7
  49. package/dist/templates/index.d.ts +4 -7
  50. package/dist/templates/index.js +1 -1303
  51. package/dist/templates/modifiers/index.cjs +1 -1269
  52. package/dist/templates/modifiers/index.d.cts +10 -13
  53. package/dist/templates/modifiers/index.d.ts +10 -13
  54. package/dist/templates/modifiers/index.js +1 -1280
  55. package/dist/templates/output/index.cjs +1 -1259
  56. package/dist/templates/output/index.d.cts +3 -3
  57. package/dist/templates/output/index.d.ts +3 -3
  58. package/dist/templates/output/index.js +1 -1275
  59. package/dist/templates/selectors/index.cjs +1 -1255
  60. package/dist/templates/selectors/index.d.cts +2 -5
  61. package/dist/templates/selectors/index.d.ts +2 -5
  62. package/dist/templates/selectors/index.js +1 -1273
  63. package/dist/templates/transformers/index.cjs +1 -1261
  64. package/dist/templates/transformers/index.d.cts +3 -6
  65. package/dist/templates/transformers/index.d.ts +3 -6
  66. package/dist/templates/transformers/index.js +1 -1276
  67. package/package.json +12 -8
@@ -1,3595 +1 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
19
- // If the importer is in node compatibility mode or this is not an ESM
20
- // file that has been converted to a CommonJS file using a Babel-
21
- // compatible transform (i.e. "__esModule" has not been set), then set
22
- // "default" to the CommonJS "module.exports" for node compatibility.
23
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
24
- mod
25
- ));
26
-
27
- // ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
28
- var require_fast_deep_equal = __commonJS({
29
- "../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports, module) {
30
- "use strict";
31
- module.exports = function equal(a, b) {
32
- if (a === b)
33
- return true;
34
- if (a && b && typeof a == "object" && typeof b == "object") {
35
- if (a.constructor !== b.constructor)
36
- return false;
37
- var length, i, keys;
38
- if (Array.isArray(a)) {
39
- length = a.length;
40
- if (length != b.length)
41
- return false;
42
- for (i = length; i-- !== 0; )
43
- if (!equal(a[i], b[i]))
44
- return false;
45
- return true;
46
- }
47
- if (a.constructor === RegExp)
48
- return a.source === b.source && a.flags === b.flags;
49
- if (a.valueOf !== Object.prototype.valueOf)
50
- return a.valueOf() === b.valueOf();
51
- if (a.toString !== Object.prototype.toString)
52
- return a.toString() === b.toString();
53
- keys = Object.keys(a);
54
- length = keys.length;
55
- if (length !== Object.keys(b).length)
56
- return false;
57
- for (i = length; i-- !== 0; )
58
- if (!Object.prototype.hasOwnProperty.call(b, keys[i]))
59
- return false;
60
- for (i = length; i-- !== 0; ) {
61
- var key = keys[i];
62
- if (!equal(a[key], b[key]))
63
- return false;
64
- }
65
- return true;
66
- }
67
- return a !== a && b !== b;
68
- };
69
- }
70
- });
71
-
72
- // src/abstract/handle-types.ts
73
- var NoiseHandleType = /* @__PURE__ */ ((NoiseHandleType2) => {
74
- NoiseHandleType2["texture"] = "texture";
75
- NoiseHandleType2["noise"] = "noise";
76
- NoiseHandleType2["position"] = "position";
77
- NoiseHandleType2["module"] = "module";
78
- return NoiseHandleType2;
79
- })(NoiseHandleType || {});
80
- var DisplacementHandle = /* @__PURE__ */ ((DisplacementHandle2) => {
81
- DisplacementHandle2["sourceModule"] = "source";
82
- DisplacementHandle2["xModule"] = "x-module";
83
- DisplacementHandle2["yModule"] = "y-module";
84
- DisplacementHandle2["zModule"] = "z-module";
85
- DisplacementHandle2["output"] = "output";
86
- return DisplacementHandle2;
87
- })(DisplacementHandle || {});
88
- var NoiseSourceControlHandle = /* @__PURE__ */ ((NoiseSourceControlHandle2) => {
89
- NoiseSourceControlHandle2["source"] = "source";
90
- NoiseSourceControlHandle2["control"] = "control";
91
- NoiseSourceControlHandle2["output"] = "output";
92
- return NoiseSourceControlHandle2;
93
- })(NoiseSourceControlHandle || {});
94
-
95
- // src/nodes/generators/noise-simplex-node.tsx
96
- import { NodeContainer } from "@awesome-flow/core/layout";
97
- import { useEffect, useMemo } from "react";
98
- import { useUpdateNodeComputedData } from "@awesome-flow/core/hooks";
99
-
100
- // src/modules/simplex-module.ts
101
- import Module from "libnoise-ts/module/Module";
102
- import { createNoise3D } from "simplex-noise";
103
- var SimplexModule = class extends Module {
104
- noise;
105
- constructor(random) {
106
- super();
107
- this.noise = createNoise3D(random);
108
- }
109
- getValue(x, y, z) {
110
- return this.noise(x, y, z);
111
- }
112
- };
113
-
114
- // src/nodes/generators/noise-simplex-node.tsx
115
- import { jsx } from "react/jsx-runtime";
116
- function NoiseSimplexNode({ id, selected, data, type }) {
117
- const updateComputedData = useUpdateNodeComputedData();
118
- const module = useMemo(() => new SimplexModule(), []);
119
- useEffect(() => {
120
- updateComputedData(id, { module });
121
- }, []);
122
- return /* @__PURE__ */ jsx(NodeContainer, { id, selected, data, type });
123
- }
124
- var noise_simplex_node_default = NoiseSimplexNode;
125
-
126
- // src/nodes/generators/position-const-node.tsx
127
- import { NodeContainer as NodeContainer2 } from "@awesome-flow/core/layout";
128
- import { useEffect as useEffect2, useState } from "react";
129
- import { Group, NumberInput, Stack } from "@mantine/core";
130
- import { useUpdateNodeComputedData as useUpdateNodeComputedData2, useUpdateNodeData } from "@awesome-flow/core/hooks";
131
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
132
- function PositionConstNode({ id, selected, data, type }) {
133
- const position = data.position ?? { x: 0, y: 0, z: 0 };
134
- const [x, setX] = useState(position.x);
135
- const [y, setY] = useState(position.y);
136
- const [z, setZ] = useState(position.z);
137
- const updateNodeData = useUpdateNodeData();
138
- const updateComputedData = useUpdateNodeComputedData2();
139
- useEffect2(() => {
140
- const position2 = { x, y, z };
141
- updateNodeData(id, {
142
- position: position2
143
- });
144
- updateComputedData(id, {
145
- positions: [position2]
146
- });
147
- }, [x, y, z]);
148
- return /* @__PURE__ */ jsx2(NodeContainer2, { id, selected, data, type, children: /* @__PURE__ */ jsxs(Stack, { children: [
149
- /* @__PURE__ */ jsxs(Group, { children: [
150
- "x: ",
151
- /* @__PURE__ */ jsx2(NumberInput, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
152
- ] }),
153
- /* @__PURE__ */ jsxs(Group, { children: [
154
- "y: ",
155
- /* @__PURE__ */ jsx2(NumberInput, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
156
- ] }),
157
- /* @__PURE__ */ jsxs(Group, { children: [
158
- "z: ",
159
- /* @__PURE__ */ jsx2(NumberInput, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
160
- ] })
161
- ] }) });
162
- }
163
- var position_const_node_default = PositionConstNode;
164
-
165
- // src/nodes/generators/position-grid-node.tsx
166
- import { NodeContainer as NodeContainer3 } from "@awesome-flow/core/layout";
167
- import { useEffect as useEffect3, useState as useState2 } from "react";
168
- import { Group as Group2, NumberInput as NumberInput2, Stack as Stack2 } from "@mantine/core";
169
- import { useUpdateNodeComputedData as useUpdateNodeComputedData3, useUpdateNodeData as useUpdateNodeData2 } from "@awesome-flow/core/hooks";
170
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
171
- function PositionGridNode({ id, selected, data, type }) {
172
- const [x, setX] = useState2(data.center?.x);
173
- const [y, setY] = useState2(data.center?.y);
174
- const [z, setZ] = useState2(data.center?.z);
175
- const [radius, setRadius] = useState2(data.radius);
176
- const updateNodeData = useUpdateNodeData2();
177
- const updateComputedData = useUpdateNodeComputedData3();
178
- useEffect3(() => {
179
- updateNodeData(id, {
180
- center: { x, y, z }
181
- });
182
- }, [x, y, z]);
183
- useEffect3(() => {
184
- updateNodeData(id, {
185
- radius
186
- });
187
- }, [radius]);
188
- useEffect3(() => {
189
- const positions = [];
190
- for (let i = -radius; i < radius; i++) {
191
- for (let j = -radius; j < radius; j++) {
192
- positions.push({ x: x + i, y: y + j, z });
193
- }
194
- }
195
- updateComputedData(id, {
196
- positions
197
- });
198
- }, [x, y, z, radius]);
199
- return /* @__PURE__ */ jsx3(NodeContainer3, { id, selected, data, type, children: /* @__PURE__ */ jsxs2(Stack2, { children: [
200
- /* @__PURE__ */ jsxs2(Group2, { children: [
201
- "x: ",
202
- /* @__PURE__ */ jsx3(NumberInput2, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
203
- ] }),
204
- /* @__PURE__ */ jsxs2(Group2, { children: [
205
- "y: ",
206
- /* @__PURE__ */ jsx3(NumberInput2, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
207
- ] }),
208
- /* @__PURE__ */ jsxs2(Group2, { children: [
209
- "z: ",
210
- /* @__PURE__ */ jsx3(NumberInput2, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
211
- ] }),
212
- /* @__PURE__ */ jsxs2(Group2, { children: [
213
- "r: ",
214
- /* @__PURE__ */ jsx3(NumberInput2, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
215
- ] })
216
- ] }) });
217
- }
218
- var position_grid_node_default = PositionGridNode;
219
-
220
- // src/nodes/modifiers/noise-normalize-node.tsx
221
- import { NodeContainer as NodeContainer4, NodeTrackConnections } from "@awesome-flow/core/layout";
222
- import { useEffect as useEffect4, useState as useState3 } from "react";
223
- import { Group as Group3, NumberInput as NumberInput3, Stack as Stack3 } from "@mantine/core";
224
- import {
225
- useIncomingComputedData,
226
- useUpdateNodeComputedData as useUpdateNodeComputedData4,
227
- useUpdateNodeData as useUpdateNodeData3
228
- } from "@awesome-flow/core/hooks";
229
-
230
- // src/modules/normalize-noise-module.ts
231
- import ModifierModule from "libnoise-ts/module/modifier";
232
- var NormalizeNoiseModule = class extends ModifierModule {
233
- constructor(source, lowerBound, upperBound) {
234
- super(source);
235
- this.lowerBound = lowerBound;
236
- this.upperBound = upperBound;
237
- }
238
- getValue(x, y, z) {
239
- return normalize(this.sourceModule.getValue(x, y, z), this.lowerBound, this.upperBound);
240
- }
241
- };
242
- function normalize(value, min, max) {
243
- return (value - min) / (max - min);
244
- }
245
-
246
- // src/nodes/modifiers/noise-normalize-node.tsx
247
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
248
- function NoiseNormalizeNode({ id, selected, data, type }) {
249
- const [intervalStart, setIntervalStart] = useState3(data.intervalStart);
250
- const [intervalEnd, setIntervalEnd] = useState3(data.intervalEnd);
251
- const incoming = useIncomingComputedData(id);
252
- const updateNodeData = useUpdateNodeData3();
253
- const updateComputedData = useUpdateNodeComputedData4();
254
- useEffect4(() => {
255
- if (incoming?.length) {
256
- const source = incoming[0].module;
257
- const module = new NormalizeNoiseModule(source, intervalStart, intervalEnd);
258
- updateComputedData(id, { module });
259
- }
260
- updateNodeData(id, { intervalStart, intervalEnd });
261
- }, [incoming, intervalStart, intervalEnd]);
262
- return /* @__PURE__ */ jsxs3(NodeContainer4, { id, selected, data, type, children: [
263
- /* @__PURE__ */ jsx4(Stack3, { children: /* @__PURE__ */ jsxs3(Group3, { children: [
264
- /* @__PURE__ */ jsx4(
265
- NumberInput3,
266
- {
267
- size: "xs",
268
- w: 100,
269
- value: intervalStart,
270
- onChange: (e) => setIntervalStart(Number(e))
271
- }
272
- ),
273
- /* @__PURE__ */ jsx4(
274
- NumberInput3,
275
- {
276
- size: "xs",
277
- w: 100,
278
- value: intervalEnd,
279
- onChange: (e) => setIntervalEnd(Number(e))
280
- }
281
- )
282
- ] }) }),
283
- /* @__PURE__ */ jsx4(NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
284
- ] });
285
- }
286
- var noise_normalize_node_default = NoiseNormalizeNode;
287
-
288
- // src/nodes/generators/noise-const-node.tsx
289
- import { NodeContainer as NodeContainer5 } from "@awesome-flow/core/layout";
290
- import { useEffect as useEffect5, useMemo as useMemo2, useState as useState4 } from "react";
291
- import { Group as Group4, NumberInput as NumberInput4, Stack as Stack4 } from "@mantine/core";
292
- import { useUpdateNodeComputedData as useUpdateNodeComputedData5, useUpdateNodeData as useUpdateNodeData4 } from "@awesome-flow/core/hooks";
293
- import { Const } from "libnoise-ts/module/generator";
294
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
295
- function NoiseConstNode({ id, selected, data, type }) {
296
- const [min, setMin] = useState4(data.min);
297
- const [max, setMax] = useState4(data.max);
298
- const [noise, setNoise] = useState4(data.noise);
299
- const updateNodeData = useUpdateNodeData4();
300
- const updateComputedData = useUpdateNodeComputedData5();
301
- const module = useMemo2(() => new Const(), []);
302
- useEffect5(() => {
303
- module.value = noise;
304
- updateNodeData(id, { noise, min, max });
305
- updateComputedData(id, { module });
306
- }, [noise, min, max, module, updateNodeData, id, updateComputedData]);
307
- return /* @__PURE__ */ jsx5(NodeContainer5, { id, selected, data, type, children: /* @__PURE__ */ jsxs4(Stack4, { children: [
308
- /* @__PURE__ */ jsxs4(Group4, { children: [
309
- /* @__PURE__ */ jsx5(NumberInput4, { size: "xs", w: 100, value: min, onChange: (e) => setMin(Number(e)) }),
310
- /* @__PURE__ */ jsx5(NumberInput4, { size: "xs", w: 100, value: max, onChange: (e) => setMax(Number(e)) })
311
- ] }),
312
- /* @__PURE__ */ jsxs4(Group4, { children: [
313
- "noise:",
314
- /* @__PURE__ */ jsx5(
315
- NumberInput4,
316
- {
317
- size: "xs",
318
- value: noise,
319
- onChange: (e) => setNoise(Number(e)),
320
- max,
321
- min,
322
- step: 0.1
323
- }
324
- )
325
- ] })
326
- ] }) });
327
- }
328
- var noise_const_node_default = NoiseConstNode;
329
-
330
- // src/nodes/generators/noise-billow-node.tsx
331
- import { NodeContainer as NodeContainer6, NodeTrackConnections as NodeTrackConnections2 } from "@awesome-flow/core/layout";
332
- import { useCallback, useMemo as useMemo3 } from "react";
333
- import { Billow } from "libnoise-ts/module/generator";
334
- import { useUpdateNodeComputedData as useUpdateNodeComputedData6 } from "@awesome-flow/core/hooks";
335
- import { NodePropertyVariables } from "@awesome-flow/core/components";
336
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
337
- function NoiseBillowNode({ id, selected, data, type }) {
338
- const updateComputedData = useUpdateNodeComputedData6();
339
- const module = useMemo3(() => new Billow(), []);
340
- const onPropertiesChange = useCallback(
341
- (properties) => {
342
- Object.keys(properties).forEach((k) => {
343
- module[k] = properties[k].value;
344
- });
345
- updateComputedData(id, { module });
346
- },
347
- [id, module, updateComputedData]
348
- );
349
- return /* @__PURE__ */ jsxs5(NodeContainer6, { id, selected, data, type, children: [
350
- /* @__PURE__ */ jsx6(NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
351
- /* @__PURE__ */ jsx6(NodeTrackConnections2, { handles: data.handles, nodeId: id, type: "target" })
352
- ] });
353
- }
354
- var noise_billow_node_default = NoiseBillowNode;
355
-
356
- // src/nodes/output/noise-logger-node.tsx
357
- import { NodeContainer as NodeContainer7, NodeTrackConnections as NodeTrackConnections3 } from "@awesome-flow/core/layout";
358
- import { useMemo as useMemo4 } from "react";
359
- import { Divider, Stack as Stack5, Text } from "@mantine/core";
360
- import { useIncomingComputedData as useIncomingComputedData2 } from "@awesome-flow/core/hooks";
361
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
362
- function NoiseLoggerNode({ id, selected, data, type }) {
363
- const incoming = useIncomingComputedData2(id);
364
- const noise = useMemo4(() => incoming?.map((p) => p.noise).flat(), [incoming]);
365
- return /* @__PURE__ */ jsxs6(NodeContainer7, { id, selected, data, type, children: [
366
- /* @__PURE__ */ jsxs6(Text, { children: [
367
- "Size: ",
368
- noise?.length || 0
369
- ] }),
370
- /* @__PURE__ */ jsx7(Divider, { h: 5 }),
371
- /* @__PURE__ */ jsx7(Stack5, { children: noise?.map((v, i) => /* @__PURE__ */ jsxs6(Text, { children: [
372
- v.position?.x,
373
- ":",
374
- v.position?.y,
375
- ":",
376
- v.position?.z,
377
- ": ",
378
- v.value
379
- ] }, i)) }),
380
- /* @__PURE__ */ jsx7(NodeTrackConnections3, { handles: data.handles, nodeId: id, type: "target" })
381
- ] });
382
- }
383
- var noise_logger_node_default = NoiseLoggerNode;
384
-
385
- // src/nodes/output/noise-raw-texture-node.tsx
386
- import { NodeContainer as NodeContainer8, NodeTrackConnections as NodeTrackConnections4 } from "@awesome-flow/core/layout";
387
- import { useEffect as useEffect6, useMemo as useMemo5, useState as useState5 } from "react";
388
- import { useIncomingComputedData as useIncomingComputedData3, useUpdateNodeComputedData as useUpdateNodeComputedData7 } from "@awesome-flow/core/hooks";
389
- import { Group as Group5, Stack as Stack6 } from "@mantine/core";
390
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
391
- function NoiseRawTextureNode({ id, selected, data, type }) {
392
- const updateComputedData = useUpdateNodeComputedData7();
393
- const [dataLength, setDataLength] = useState5(0);
394
- const [resolution, setResolution] = useState5(0);
395
- const incoming = useIncomingComputedData3(id);
396
- const noise = useMemo5(() => incoming?.map((p) => p.noise).flat(), [incoming]);
397
- useEffect6(() => {
398
- if (noise?.length) {
399
- const size = Math.ceil(Math.sqrt(noise.length));
400
- const colors = noise.map((n) => [n.value * 255, n.value * 255, n.value * 255, 255]).flat();
401
- const dataArray = new Uint8Array(size * size * 4);
402
- dataArray.set(colors);
403
- setResolution(size);
404
- setDataLength(dataArray.length);
405
- updateComputedData(id, { textureData: dataArray, textureResolution: size });
406
- }
407
- }, [noise]);
408
- return /* @__PURE__ */ jsxs7(NodeContainer8, { id, selected, data, type, children: [
409
- /* @__PURE__ */ jsxs7(Stack6, { children: [
410
- /* @__PURE__ */ jsxs7(Group5, { children: [
411
- "Resolution: ",
412
- resolution,
413
- "x",
414
- resolution
415
- ] }),
416
- /* @__PURE__ */ jsxs7(Group5, { children: [
417
- "Input Length: ",
418
- noise?.length || 0
419
- ] }),
420
- /* @__PURE__ */ jsxs7(Group5, { children: [
421
- "Output Length (",
422
- resolution,
423
- "*",
424
- resolution,
425
- "*4): ",
426
- dataLength
427
- ] })
428
- ] }),
429
- /* @__PURE__ */ jsx8(NodeTrackConnections4, { handles: data.handles, nodeId: id, type: "target" })
430
- ] });
431
- }
432
- var noise_raw_texture_node_default = NoiseRawTextureNode;
433
-
434
- // src/nodes/generators/noise-checkerboard-node.tsx
435
- import { NodeContainer as NodeContainer9 } from "@awesome-flow/core/layout";
436
- import { useEffect as useEffect7, useMemo as useMemo6 } from "react";
437
- import { Checkerboard } from "libnoise-ts/module/generator";
438
- import { useUpdateNodeComputedData as useUpdateNodeComputedData8 } from "@awesome-flow/core/hooks";
439
- import { jsx as jsx9 } from "react/jsx-runtime";
440
- function NoiseCheckerboardNode({ id, selected, data, type }) {
441
- const updateComputedData = useUpdateNodeComputedData8();
442
- const module = useMemo6(() => new Checkerboard(), []);
443
- useEffect7(() => {
444
- updateComputedData(id, { module });
445
- }, [id, module, updateComputedData]);
446
- return /* @__PURE__ */ jsx9(NodeContainer9, { id, selected, data, type });
447
- }
448
- var noise_checkerboard_node_default = NoiseCheckerboardNode;
449
-
450
- // src/nodes/output/positions-logger-node.tsx
451
- import { NodeContainer as NodeContainer10, NodeTrackConnections as NodeTrackConnections5 } from "@awesome-flow/core/layout";
452
- import { useMemo as useMemo7 } from "react";
453
- import { Divider as Divider2, Stack as Stack7, Text as Text2 } from "@mantine/core";
454
- import { useIncomingComputedData as useIncomingComputedData4 } from "@awesome-flow/core/hooks";
455
- import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
456
- function PositionsLoggerNode({ id, selected, data, type }) {
457
- const incoming = useIncomingComputedData4(id);
458
- const positions = useMemo7(() => {
459
- return incoming?.map((p) => p.positions).flat();
460
- }, [incoming]);
461
- return /* @__PURE__ */ jsxs8(NodeContainer10, { id, selected, data, type, children: [
462
- /* @__PURE__ */ jsxs8(Text2, { children: [
463
- "Size: ",
464
- positions?.length || 0
465
- ] }),
466
- /* @__PURE__ */ jsx10(Divider2, { h: 5 }),
467
- /* @__PURE__ */ jsx10(Stack7, { children: positions?.map((v, i) => /* @__PURE__ */ jsxs8(Text2, { children: [
468
- v.x,
469
- ":",
470
- v.y,
471
- ":",
472
- v.z
473
- ] }, i)) }),
474
- /* @__PURE__ */ jsx10(NodeTrackConnections5, { handles: data.handles, nodeId: id, type: "target" })
475
- ] });
476
- }
477
- var positions_logger_node_default = PositionsLoggerNode;
478
-
479
- // src/nodes/generators/noise-cylinders-node.tsx
480
- import { NodeContainer as NodeContainer11, NodeTrackConnections as NodeTrackConnections6 } from "@awesome-flow/core/layout";
481
- import { useCallback as useCallback2, useMemo as useMemo8 } from "react";
482
- import { Cylinders } from "libnoise-ts/module/generator";
483
- import { useUpdateNodeComputedData as useUpdateNodeComputedData9 } from "@awesome-flow/core/hooks";
484
- import { NodePropertyVariables as NodePropertyVariables2 } from "@awesome-flow/core/components";
485
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
486
- function NoiseCylindersNode({ id, selected, data, type }) {
487
- const updateComputedData = useUpdateNodeComputedData9();
488
- const module = useMemo8(() => new Cylinders(), []);
489
- const onPropertiesChange = useCallback2(
490
- (properties) => {
491
- Object.keys(properties).forEach((k) => {
492
- module[k] = properties[k].value;
493
- });
494
- updateComputedData(id, { module });
495
- },
496
- [id, module, updateComputedData]
497
- );
498
- return /* @__PURE__ */ jsxs9(NodeContainer11, { id, selected, data, type, children: [
499
- /* @__PURE__ */ jsx11(NodePropertyVariables2, { data, nodeId: id, onPropertiesChange }),
500
- /* @__PURE__ */ jsx11(NodeTrackConnections6, { handles: data.handles, nodeId: id, type: "target" })
501
- ] });
502
- }
503
- var noise_cylinders_node_default = NoiseCylindersNode;
504
-
505
- // src/nodes/generators/noise-perlin-node.tsx
506
- import { NodeContainer as NodeContainer12, NodeTrackConnections as NodeTrackConnections7 } from "@awesome-flow/core/layout";
507
- import { useCallback as useCallback3, useMemo as useMemo9 } from "react";
508
- import { Perlin } from "libnoise-ts/module/generator";
509
- import { useUpdateNodeComputedData as useUpdateNodeComputedData10 } from "@awesome-flow/core/hooks";
510
- import { NodePropertyVariables as NodePropertyVariables3 } from "@awesome-flow/core/components";
511
- import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
512
- function NoisePerlinNode({ id, selected, data, type }) {
513
- const updateComputedData = useUpdateNodeComputedData10();
514
- const module = useMemo9(() => new Perlin(), []);
515
- const onPropertiesChange = useCallback3(
516
- (properties) => {
517
- Object.keys(properties).forEach((k) => {
518
- module[k] = properties[k].value;
519
- });
520
- updateComputedData(id, { module });
521
- },
522
- [id, module, updateComputedData]
523
- );
524
- return /* @__PURE__ */ jsxs10(NodeContainer12, { id, selected, data, type, children: [
525
- /* @__PURE__ */ jsx12(NodePropertyVariables3, { data, nodeId: id, onPropertiesChange }),
526
- /* @__PURE__ */ jsx12(NodeTrackConnections7, { handles: data.handles, nodeId: id, type: "target" })
527
- ] });
528
- }
529
- var noise_perlin_node_default = NoisePerlinNode;
530
-
531
- // src/nodes/generators/noise-ridgedmulti-node.tsx
532
- import { NodeContainer as NodeContainer13, NodeTrackConnections as NodeTrackConnections8 } from "@awesome-flow/core/layout";
533
- import { useCallback as useCallback4, useMemo as useMemo10 } from "react";
534
- import { RidgedMulti } from "libnoise-ts/module/generator";
535
- import { useUpdateNodeComputedData as useUpdateNodeComputedData11 } from "@awesome-flow/core/hooks";
536
- import { NodePropertyVariables as NodePropertyVariables4 } from "@awesome-flow/core/components";
537
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
538
- function NoiseRidgedMultiNode({ id, selected, data, type }) {
539
- const updateComputedData = useUpdateNodeComputedData11();
540
- const module = useMemo10(() => new RidgedMulti(), []);
541
- const onPropertiesChange = useCallback4((properties) => {
542
- Object.keys(properties).forEach((k) => module[k] = properties[k].value);
543
- updateComputedData(id, { module });
544
- }, []);
545
- return /* @__PURE__ */ jsxs11(NodeContainer13, { id, selected, data, type, children: [
546
- /* @__PURE__ */ jsx13(NodePropertyVariables4, { data, nodeId: id, onPropertiesChange }),
547
- /* @__PURE__ */ jsx13(NodeTrackConnections8, { handles: data.handles, nodeId: id, type: "target" })
548
- ] });
549
- }
550
- var noise_ridgedmulti_node_default = NoiseRidgedMultiNode;
551
-
552
- // src/nodes/generators/noise-spheres-node.tsx
553
- import { NodeContainer as NodeContainer14, NodeTrackConnections as NodeTrackConnections9 } from "@awesome-flow/core/layout";
554
- import { useCallback as useCallback5, useMemo as useMemo11 } from "react";
555
- import { Spheres } from "libnoise-ts/module/generator";
556
- import { useUpdateNodeComputedData as useUpdateNodeComputedData12 } from "@awesome-flow/core/hooks";
557
- import { NodePropertyVariables as NodePropertyVariables5 } from "@awesome-flow/core/components";
558
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
559
- function NoiseSpheresNode({ id, selected, data, type }) {
560
- const updateComputedData = useUpdateNodeComputedData12();
561
- const module = useMemo11(() => new Spheres(), []);
562
- const onPropertiesChange = useCallback5((properties) => {
563
- Object.keys(properties).forEach((k) => module[k] = properties[k].value);
564
- updateComputedData(id, { module });
565
- }, []);
566
- return /* @__PURE__ */ jsxs12(NodeContainer14, { id, selected, data, type, children: [
567
- /* @__PURE__ */ jsx14(NodePropertyVariables5, { data, nodeId: id, onPropertiesChange }),
568
- /* @__PURE__ */ jsx14(NodeTrackConnections9, { handles: data.handles, nodeId: id, type: "target" })
569
- ] });
570
- }
571
- var noise_spheres_node_default = NoiseSpheresNode;
572
-
573
- // src/nodes/generators/noise-voronoi-node.tsx
574
- import { NodeContainer as NodeContainer15, NodeTrackConnections as NodeTrackConnections10 } from "@awesome-flow/core/layout";
575
- import { useCallback as useCallback6 } from "react";
576
- import { Voronoi } from "libnoise-ts/module/generator";
577
- import { useUpdateNodeComputedData as useUpdateNodeComputedData13 } from "@awesome-flow/core/hooks";
578
- import { NodePropertyVariables as NodePropertyVariables6 } from "@awesome-flow/core/components";
579
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
580
- function NoiseVoronoiNode({ id, selected, data, type }) {
581
- const updateComputedData = useUpdateNodeComputedData13();
582
- const onPropertiesChange = useCallback6(
583
- (properties) => {
584
- const module = new Voronoi(
585
- properties.frequency.value,
586
- properties.displacement.value,
587
- properties.distance.value,
588
- properties.seed.value
589
- );
590
- updateComputedData(id, { module });
591
- },
592
- []
593
- );
594
- return /* @__PURE__ */ jsxs13(NodeContainer15, { id, selected, data, type, children: [
595
- /* @__PURE__ */ jsx15(NodePropertyVariables6, { data, nodeId: id, onPropertiesChange }),
596
- /* @__PURE__ */ jsx15(NodeTrackConnections10, { handles: data.handles, nodeId: id, type: "target" })
597
- ] });
598
- }
599
- var noise_voronoi_node_default = NoiseVoronoiNode;
600
-
601
- // src/nodes/modifiers/noise-combine-node.tsx
602
- import { NodeCombobox, NodeContainer as NodeContainer16, NodeTrackConnections as NodeTrackConnections11 } from "@awesome-flow/core/layout";
603
- import { useCallback as useCallback7, useEffect as useEffect8 } from "react";
604
- import {
605
- useIncomingComputedData as useIncomingComputedData5,
606
- useUpdateNodeComputedData as useUpdateNodeComputedData14,
607
- useUpdateNodeData as useUpdateNodeData5
608
- } from "@awesome-flow/core/hooks";
609
- import {
610
- IconAsterisk,
611
- IconChevronLeft,
612
- IconChevronRight,
613
- IconChevronUp,
614
- IconPlus
615
- } from "@tabler/icons-react";
616
-
617
- // src/abstract/operations.ts
618
- import { Add, Max, Min, Multiply, Power } from "libnoise-ts/module/combiner";
619
- var NoiseCombineType = /* @__PURE__ */ ((NoiseCombineType3) => {
620
- NoiseCombineType3["add"] = "add";
621
- NoiseCombineType3["max"] = "max";
622
- NoiseCombineType3["min"] = "min";
623
- NoiseCombineType3["multiply"] = "multiply";
624
- NoiseCombineType3["power"] = "power";
625
- return NoiseCombineType3;
626
- })(NoiseCombineType || {});
627
- var noiseCombineModuleMap = {
628
- ["add" /* add */]: Add,
629
- ["max" /* max */]: Max,
630
- ["min" /* min */]: Min,
631
- ["multiply" /* multiply */]: Multiply,
632
- ["power" /* power */]: Power
633
- };
634
-
635
- // src/nodes/modifiers/noise-combine-node.tsx
636
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
637
- var options = {
638
- add: /* @__PURE__ */ jsx16(IconPlus, {}),
639
- min: /* @__PURE__ */ jsx16(IconChevronLeft, {}),
640
- max: /* @__PURE__ */ jsx16(IconChevronRight, {}),
641
- multiply: /* @__PURE__ */ jsx16(IconAsterisk, {}),
642
- power: /* @__PURE__ */ jsx16(IconChevronUp, {})
643
- };
644
- function NoiseCombineNode({ id, selected, data, type }) {
645
- const updateNodeData = useUpdateNodeData5();
646
- const updateComputedData = useUpdateNodeComputedData14();
647
- const incoming = useIncomingComputedData5(id);
648
- useEffect8(() => {
649
- const ModuleFactory = noiseCombineModuleMap[data.operation];
650
- if (incoming?.length > 1) {
651
- const module = new ModuleFactory(incoming[0].module, incoming[1].module);
652
- updateComputedData(id, { module });
653
- }
654
- }, [data.operation, incoming]);
655
- const onChange = useCallback7((operation) => {
656
- updateNodeData(id, { operation });
657
- }, []);
658
- return /* @__PURE__ */ jsxs14(NodeContainer16, { id, selected, data, type, children: [
659
- /* @__PURE__ */ jsx16(NodeCombobox, { options, selected: data.operation, onChange, width: 150 }),
660
- /* @__PURE__ */ jsx16(NodeTrackConnections11, { handles: data.handles, nodeId: id, type: "target" })
661
- ] });
662
- }
663
- var noise_combine_node_default = NoiseCombineNode;
664
-
665
- // src/nodes/modifiers/noise-clamp-node.tsx
666
- import { NodeContainer as NodeContainer17, NodeTrackConnections as NodeTrackConnections12 } from "@awesome-flow/core/layout";
667
- import { useEffect as useEffect9, useState as useState6 } from "react";
668
- import { Group as Group6, NumberInput as NumberInput5, Stack as Stack8 } from "@mantine/core";
669
- import {
670
- useIncomingComputedData as useIncomingComputedData6,
671
- useUpdateNodeComputedData as useUpdateNodeComputedData15,
672
- useUpdateNodeData as useUpdateNodeData6
673
- } from "@awesome-flow/core/hooks";
674
- import { Clamp } from "libnoise-ts/module/modifier";
675
- import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
676
- function NoiseClampNode({ id, selected, data, type }) {
677
- const [lowerBound, setLowerBound] = useState6(data.lowerBound);
678
- const [upperBound, setUpperBound] = useState6(data.upperBound);
679
- const incoming = useIncomingComputedData6(id);
680
- const updateNodeData = useUpdateNodeData6();
681
- const updateComputedData = useUpdateNodeComputedData15();
682
- useEffect9(() => {
683
- if (incoming?.length) {
684
- const module = new Clamp(incoming[0].module, lowerBound, upperBound);
685
- updateComputedData(id, { module });
686
- }
687
- updateNodeData(id, { lowerBound, upperBound });
688
- }, [incoming, lowerBound, upperBound]);
689
- return /* @__PURE__ */ jsxs15(NodeContainer17, { id, selected, data, type, children: [
690
- /* @__PURE__ */ jsx17(Stack8, { children: /* @__PURE__ */ jsxs15(Group6, { children: [
691
- /* @__PURE__ */ jsx17(
692
- NumberInput5,
693
- {
694
- size: "xs",
695
- w: 100,
696
- value: lowerBound,
697
- onChange: (e) => setLowerBound(Number(e)),
698
- step: 0.1
699
- }
700
- ),
701
- /* @__PURE__ */ jsx17(
702
- NumberInput5,
703
- {
704
- size: "xs",
705
- w: 100,
706
- value: upperBound,
707
- onChange: (e) => setUpperBound(Number(e)),
708
- step: 0.1
709
- }
710
- )
711
- ] }) }),
712
- /* @__PURE__ */ jsx17(NodeTrackConnections12, { handles: data.handles, nodeId: id, type: "target" })
713
- ] });
714
- }
715
- var noise_clamp_node_default = NoiseClampNode;
716
-
717
- // src/nodes/modifiers/noise-abs-node.tsx
718
- import { NodeContainer as NodeContainer18, NodeTrackConnections as NodeTrackConnections13 } from "@awesome-flow/core/layout";
719
- import { useEffect as useEffect10 } from "react";
720
- import { useIncomingComputedData as useIncomingComputedData7, useUpdateNodeComputedData as useUpdateNodeComputedData16 } from "@awesome-flow/core/hooks";
721
- import { Abs } from "libnoise-ts/module/modifier";
722
- import { jsx as jsx18 } from "react/jsx-runtime";
723
- function NoiseAbsNode({ id, selected, data, type }) {
724
- const incoming = useIncomingComputedData7(id);
725
- const updateComputedData = useUpdateNodeComputedData16();
726
- useEffect10(() => {
727
- if (incoming?.length > 0) {
728
- const module = new Abs(incoming[0].module);
729
- updateComputedData(id, { module });
730
- }
731
- }, [incoming]);
732
- return /* @__PURE__ */ jsx18(NodeContainer18, { id, selected, data, type, children: /* @__PURE__ */ jsx18(NodeTrackConnections13, { handles: data.handles, nodeId: id, type: "target" }) });
733
- }
734
- var noise_abs_node_default = NoiseAbsNode;
735
-
736
- // src/nodes/output/noise-output-node.tsx
737
- import { NodeContainer as NodeContainer19, NodeTrackConnections as NodeTrackConnections14 } from "@awesome-flow/core/layout";
738
- import { useCallback as useCallback8, useState as useState7 } from "react";
739
- import { useUpdateNodeComputedData as useUpdateNodeComputedData17 } from "@awesome-flow/core/hooks";
740
- import { HandlesIncomingDataStatus } from "@awesome-flow/core/components";
741
- import { Text as Text3 } from "@mantine/core";
742
- import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
743
- function NoiseOutputNode({ id, selected, data, type }) {
744
- const [size, setSize] = useState7(0);
745
- const updateComputedData = useUpdateNodeComputedData17();
746
- const onDataUpdated = useCallback8(
747
- (handleData) => {
748
- const incomingPositions = handleData["position" /* position */];
749
- const incomingModule = handleData["module" /* module */];
750
- if (incomingPositions?.length && incomingModule?.length && incomingModule[0]?.module) {
751
- const { module } = incomingModule[0];
752
- const noise = [];
753
- for (const input of incomingPositions) {
754
- for (const position of input.positions) {
755
- const value = module.getValue(position.x, position.y, position.z);
756
- noise.push({
757
- position,
758
- value
759
- });
760
- }
761
- }
762
- updateComputedData(id, { noise, module });
763
- setSize(noise.length);
764
- }
765
- },
766
- []
767
- );
768
- return /* @__PURE__ */ jsxs16(NodeContainer19, { id, selected, data, type, children: [
769
- /* @__PURE__ */ jsx19(
770
- HandlesIncomingDataStatus,
771
- {
772
- nodeId: id,
773
- handles: data.handles,
774
- handleKey: "dataType",
775
- onDataUpdated,
776
- type: "target",
777
- resetComputedData: true
778
- }
779
- ),
780
- /* @__PURE__ */ jsxs16(Text3, { mt: 5, children: [
781
- "Noise points: ",
782
- size
783
- ] }),
784
- /* @__PURE__ */ jsx19(NodeTrackConnections14, { handles: data.handles, nodeId: id, type: "target" })
785
- ] });
786
- }
787
- var noise_output_node_default = NoiseOutputNode;
788
-
789
- // src/nodes/modifiers/noise-curve-node.tsx
790
- import { NodeContainer as NodeContainer20, NodeTrackConnections as NodeTrackConnections15 } from "@awesome-flow/core/layout";
791
- import { ActionIcon, Button, Group as Group7, NumberInput as NumberInput6, Space } from "@mantine/core";
792
- import {
793
- useIncomingComputedData as useIncomingComputedData8,
794
- useUpdateNodeComputedData as useUpdateNodeComputedData18,
795
- useUpdateNodeData as useUpdateNodeData7
796
- } from "@awesome-flow/core/hooks";
797
-
798
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/use-form.mjs
799
- import { useState as useState11, useCallback as useCallback14 } from "react";
800
-
801
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/actions/actions.mjs
802
- import { useLayoutEffect, useEffect as useEffect11 } from "react";
803
- function validateFormName(name) {
804
- if (!/^[0-9a-zA-Z-]+$/.test(name)) {
805
- throw new Error(
806
- `[@mantine/use-form] Form name "${name}" is invalid, it should contain only letters, numbers and dashes`
807
- );
808
- }
809
- }
810
- var useIsomorphicEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect11;
811
- function useFormEvent(eventKey, handler) {
812
- useIsomorphicEffect(() => {
813
- if (eventKey) {
814
- window.addEventListener(eventKey, handler);
815
- return () => window.removeEventListener(eventKey, handler);
816
- }
817
- return void 0;
818
- }, [eventKey]);
819
- }
820
- function useFormActions(name, form) {
821
- if (name) {
822
- validateFormName(name);
823
- }
824
- useFormEvent(
825
- `mantine-form:${name}:set-field-value`,
826
- (event) => form.setFieldValue(event.detail.path, event.detail.value)
827
- );
828
- useFormEvent(
829
- `mantine-form:${name}:set-values`,
830
- (event) => form.setValues(event.detail)
831
- );
832
- useFormEvent(
833
- `mantine-form:${name}:set-initial-values`,
834
- (event) => form.setInitialValues(event.detail)
835
- );
836
- useFormEvent(
837
- `mantine-form:${name}:set-errors`,
838
- (event) => form.setErrors(event.detail)
839
- );
840
- useFormEvent(
841
- `mantine-form:${name}:set-field-error`,
842
- (event) => form.setFieldError(event.detail.path, event.detail.error)
843
- );
844
- useFormEvent(
845
- `mantine-form:${name}:clear-field-error`,
846
- (event) => form.clearFieldError(event.detail)
847
- );
848
- useFormEvent(`mantine-form:${name}:clear-errors`, form.clearErrors);
849
- useFormEvent(`mantine-form:${name}:reset`, form.reset);
850
- useFormEvent(`mantine-form:${name}:validate`, form.validate);
851
- useFormEvent(
852
- `mantine-form:${name}:validate-field`,
853
- (event) => form.validateField(event.detail)
854
- );
855
- useFormEvent(
856
- `mantine-form:${name}:reorder-list-item`,
857
- (event) => form.reorderListItem(event.detail.path, event.detail.payload)
858
- );
859
- useFormEvent(
860
- `mantine-form:${name}:remove-list-item`,
861
- (event) => form.removeListItem(event.detail.path, event.detail.index)
862
- );
863
- useFormEvent(
864
- `mantine-form:${name}:insert-list-item`,
865
- (event) => form.insertListItem(event.detail.path, event.detail.item, event.detail.index)
866
- );
867
- useFormEvent(
868
- `mantine-form:${name}:set-dirty`,
869
- (event) => form.setDirty(event.detail)
870
- );
871
- useFormEvent(
872
- `mantine-form:${name}:set-touched`,
873
- (event) => form.setTouched(event.detail)
874
- );
875
- useFormEvent(
876
- `mantine-form:${name}:reset-dirty`,
877
- (event) => form.resetDirty(event.detail)
878
- );
879
- useFormEvent(`mantine-form:${name}:reset-touched`, form.resetTouched);
880
- }
881
-
882
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/get-input-on-change/get-input-on-change.mjs
883
- function getInputOnChange(setValue) {
884
- return (val) => {
885
- if (!val) {
886
- setValue(val);
887
- } else if (typeof val === "function") {
888
- setValue(val);
889
- } else if (typeof val === "object" && "nativeEvent" in val) {
890
- const { currentTarget } = val;
891
- if (currentTarget instanceof HTMLInputElement) {
892
- if (currentTarget.type === "checkbox") {
893
- setValue(currentTarget.checked);
894
- } else {
895
- setValue(currentTarget.value);
896
- }
897
- } else if (currentTarget instanceof HTMLTextAreaElement || currentTarget instanceof HTMLSelectElement) {
898
- setValue(currentTarget.value);
899
- }
900
- } else {
901
- setValue(val);
902
- }
903
- };
904
- }
905
-
906
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-errors/use-form-errors.mjs
907
- import { useState as useState8, useRef, useCallback as useCallback9 } from "react";
908
-
909
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-errors/filter-errors/filter-errors.mjs
910
- function filterErrors(errors) {
911
- if (errors === null || typeof errors !== "object") {
912
- return {};
913
- }
914
- return Object.keys(errors).reduce((acc, key) => {
915
- const errorValue = errors[key];
916
- if (errorValue !== void 0 && errorValue !== null && errorValue !== false) {
917
- acc[key] = errorValue;
918
- }
919
- return acc;
920
- }, {});
921
- }
922
-
923
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-errors/use-form-errors.mjs
924
- function useFormErrors(initialErrors) {
925
- const [errorsState, setErrorsState] = useState8(filterErrors(initialErrors));
926
- const errorsRef = useRef(errorsState);
927
- const setErrors = useCallback9((errors) => {
928
- setErrorsState((current) => {
929
- const newErrors = filterErrors(typeof errors === "function" ? errors(current) : errors);
930
- errorsRef.current = newErrors;
931
- return newErrors;
932
- });
933
- }, []);
934
- const clearErrors = useCallback9(() => setErrors({}), []);
935
- const clearFieldError = useCallback9(
936
- (path) => {
937
- if (errorsRef.current[path] === void 0) {
938
- return;
939
- }
940
- setErrors((current) => {
941
- const errors = { ...current };
942
- delete errors[path];
943
- return errors;
944
- });
945
- },
946
- [errorsState]
947
- );
948
- const setFieldError = useCallback9(
949
- (path, error) => {
950
- if (error == null || error === false) {
951
- clearFieldError(path);
952
- } else if (errorsRef.current[path] !== error) {
953
- setErrors((current) => ({ ...current, [path]: error }));
954
- }
955
- },
956
- [errorsState]
957
- );
958
- return {
959
- errorsState,
960
- setErrors,
961
- clearErrors,
962
- setFieldError,
963
- clearFieldError
964
- };
965
- }
966
-
967
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-list/use-form-list.mjs
968
- import { useCallback as useCallback10 } from "react";
969
-
970
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/clear-list-state.mjs
971
- function clearListState(field, state) {
972
- if (state === null || typeof state !== "object") {
973
- return {};
974
- }
975
- const clone = { ...state };
976
- Object.keys(state).forEach((errorKey) => {
977
- if (errorKey.includes(`${String(field)}.`)) {
978
- delete clone[errorKey];
979
- }
980
- });
981
- return clone;
982
- }
983
-
984
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/change-error-indices.mjs
985
- function getIndexFromKeyAfterPath(key, path) {
986
- const split = key.substring(path.length + 1).split(".")[0];
987
- return parseInt(split, 10);
988
- }
989
- function changeErrorIndices(path, index, errors, change) {
990
- if (index === void 0) {
991
- return errors;
992
- }
993
- const pathString = `${String(path)}`;
994
- let clearedErrors = errors;
995
- if (change === -1) {
996
- clearedErrors = clearListState(`${pathString}.${index}`, clearedErrors);
997
- }
998
- const cloned = { ...clearedErrors };
999
- const changedKeys = /* @__PURE__ */ new Set();
1000
- Object.entries(clearedErrors).filter(([key]) => {
1001
- if (!key.startsWith(`${pathString}.`)) {
1002
- return false;
1003
- }
1004
- const currIndex = getIndexFromKeyAfterPath(key, pathString);
1005
- if (Number.isNaN(currIndex)) {
1006
- return false;
1007
- }
1008
- return currIndex >= index;
1009
- }).forEach(([key, value]) => {
1010
- const currIndex = getIndexFromKeyAfterPath(key, pathString);
1011
- const newKey = key.replace(
1012
- `${pathString}.${currIndex}`,
1013
- `${pathString}.${currIndex + change}`
1014
- );
1015
- cloned[newKey] = value;
1016
- changedKeys.add(newKey);
1017
- if (!changedKeys.has(key)) {
1018
- delete cloned[key];
1019
- }
1020
- });
1021
- return cloned;
1022
- }
1023
-
1024
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/reorder-errors.mjs
1025
- function reorderErrors(path, { from, to }, errors) {
1026
- const oldKeyStart = `${path}.${from}`;
1027
- const newKeyStart = `${path}.${to}`;
1028
- const clone = { ...errors };
1029
- Object.keys(errors).every((key) => {
1030
- let oldKey;
1031
- let newKey;
1032
- if (key.startsWith(oldKeyStart)) {
1033
- oldKey = key;
1034
- newKey = key.replace(oldKeyStart, newKeyStart);
1035
- }
1036
- if (key.startsWith(newKeyStart)) {
1037
- oldKey = key.replace(newKeyStart, oldKeyStart);
1038
- newKey = key;
1039
- }
1040
- if (oldKey && newKey) {
1041
- const value1 = clone[oldKey];
1042
- const value2 = clone[newKey];
1043
- value2 === void 0 ? delete clone[oldKey] : clone[oldKey] = value2;
1044
- value1 === void 0 ? delete clone[newKey] : clone[newKey] = value1;
1045
- return false;
1046
- }
1047
- return true;
1048
- });
1049
- return clone;
1050
- }
1051
-
1052
- // ../../node_modules/.pnpm/klona@2.0.6/node_modules/klona/full/index.mjs
1053
- function set(obj, key, val) {
1054
- if (typeof val.value === "object")
1055
- val.value = klona(val.value);
1056
- if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
1057
- Object.defineProperty(obj, key, val);
1058
- } else
1059
- obj[key] = val.value;
1060
- }
1061
- function klona(x) {
1062
- if (typeof x !== "object")
1063
- return x;
1064
- var i = 0, k, list, tmp, str = Object.prototype.toString.call(x);
1065
- if (str === "[object Object]") {
1066
- tmp = Object.create(x.__proto__ || null);
1067
- } else if (str === "[object Array]") {
1068
- tmp = Array(x.length);
1069
- } else if (str === "[object Set]") {
1070
- tmp = /* @__PURE__ */ new Set();
1071
- x.forEach(function(val) {
1072
- tmp.add(klona(val));
1073
- });
1074
- } else if (str === "[object Map]") {
1075
- tmp = /* @__PURE__ */ new Map();
1076
- x.forEach(function(val, key) {
1077
- tmp.set(klona(key), klona(val));
1078
- });
1079
- } else if (str === "[object Date]") {
1080
- tmp = /* @__PURE__ */ new Date(+x);
1081
- } else if (str === "[object RegExp]") {
1082
- tmp = new RegExp(x.source, x.flags);
1083
- } else if (str === "[object DataView]") {
1084
- tmp = new x.constructor(klona(x.buffer));
1085
- } else if (str === "[object ArrayBuffer]") {
1086
- tmp = x.slice(0);
1087
- } else if (str.slice(-6) === "Array]") {
1088
- tmp = new x.constructor(x);
1089
- }
1090
- if (tmp) {
1091
- for (list = Object.getOwnPropertySymbols(x); i < list.length; i++) {
1092
- set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
1093
- }
1094
- for (i = 0, list = Object.getOwnPropertyNames(x); i < list.length; i++) {
1095
- if (Object.hasOwnProperty.call(tmp, k = list[i]) && tmp[k] === x[k])
1096
- continue;
1097
- set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
1098
- }
1099
- }
1100
- return tmp || x;
1101
- }
1102
-
1103
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-splitted-path.mjs
1104
- function getSplittedPath(path) {
1105
- if (typeof path !== "string") {
1106
- return [];
1107
- }
1108
- return path.split(".");
1109
- }
1110
-
1111
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-path.mjs
1112
- function getPath(path, values) {
1113
- const splittedPath = getSplittedPath(path);
1114
- if (splittedPath.length === 0 || typeof values !== "object" || values === null) {
1115
- return void 0;
1116
- }
1117
- let value = values[splittedPath[0]];
1118
- for (let i = 1; i < splittedPath.length; i += 1) {
1119
- if (value === void 0) {
1120
- break;
1121
- }
1122
- value = value[splittedPath[i]];
1123
- }
1124
- return value;
1125
- }
1126
-
1127
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/set-path.mjs
1128
- function setPath(path, value, values) {
1129
- const splittedPath = getSplittedPath(path);
1130
- if (splittedPath.length === 0) {
1131
- return values;
1132
- }
1133
- const cloned = klona(values);
1134
- if (splittedPath.length === 1) {
1135
- cloned[splittedPath[0]] = value;
1136
- return cloned;
1137
- }
1138
- let val = cloned[splittedPath[0]];
1139
- for (let i = 1; i < splittedPath.length - 1; i += 1) {
1140
- if (val === void 0) {
1141
- return cloned;
1142
- }
1143
- val = val[splittedPath[i]];
1144
- }
1145
- val[splittedPath[splittedPath.length - 1]] = value;
1146
- return cloned;
1147
- }
1148
-
1149
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/reorder-path.mjs
1150
- function reorderPath(path, { from, to }, values) {
1151
- const currentValue = getPath(path, values);
1152
- if (!Array.isArray(currentValue)) {
1153
- return values;
1154
- }
1155
- const cloned = [...currentValue];
1156
- const item = currentValue[from];
1157
- cloned.splice(from, 1);
1158
- cloned.splice(to, 0, item);
1159
- return setPath(path, cloned, values);
1160
- }
1161
-
1162
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/insert-path.mjs
1163
- function insertPath(path, value, index, values) {
1164
- const currentValue = getPath(path, values);
1165
- if (!Array.isArray(currentValue)) {
1166
- return values;
1167
- }
1168
- const cloned = [...currentValue];
1169
- cloned.splice(typeof index === "number" ? index : cloned.length, 0, value);
1170
- return setPath(path, cloned, values);
1171
- }
1172
-
1173
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/remove-path.mjs
1174
- function removePath(path, index, values) {
1175
- const currentValue = getPath(path, values);
1176
- if (!Array.isArray(currentValue)) {
1177
- return values;
1178
- }
1179
- return setPath(
1180
- path,
1181
- currentValue.filter((_, itemIndex) => itemIndex !== index),
1182
- values
1183
- );
1184
- }
1185
-
1186
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-list/use-form-list.mjs
1187
- function useFormList({
1188
- $values,
1189
- $errors,
1190
- $status
1191
- }) {
1192
- const reorderListItem = useCallback10((path, payload) => {
1193
- $status.clearFieldDirty(path);
1194
- $errors.setErrors((errs) => reorderErrors(path, payload, errs));
1195
- $values.setValues({
1196
- values: reorderPath(path, payload, $values.refValues.current),
1197
- updateState: true
1198
- });
1199
- }, []);
1200
- const removeListItem = useCallback10((path, index) => {
1201
- $status.clearFieldDirty(path);
1202
- $errors.setErrors((errs) => changeErrorIndices(path, index, errs, -1));
1203
- $values.setValues({
1204
- values: removePath(path, index, $values.refValues.current),
1205
- updateState: true
1206
- });
1207
- }, []);
1208
- const insertListItem = useCallback10((path, item, index) => {
1209
- $status.clearFieldDirty(path);
1210
- $errors.setErrors((errs) => changeErrorIndices(path, index, errs, 1));
1211
- $values.setValues({
1212
- values: insertPath(path, item, index, $values.refValues.current),
1213
- updateState: true
1214
- });
1215
- }, []);
1216
- return { reorderListItem, removeListItem, insertListItem };
1217
- }
1218
-
1219
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.mjs
1220
- var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
1221
- import { useState as useState9, useRef as useRef2, useCallback as useCallback11 } from "react";
1222
-
1223
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/get-status/get-status.mjs
1224
- function getStatus(status, path) {
1225
- const paths = Object.keys(status);
1226
- if (typeof path === "string") {
1227
- const nestedPaths = paths.filter((statusPath) => statusPath.startsWith(`${path}.`));
1228
- return status[path] || nestedPaths.some((statusPath) => status[statusPath]) || false;
1229
- }
1230
- return paths.some((statusPath) => status[statusPath]);
1231
- }
1232
-
1233
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-status/use-form-status.mjs
1234
- function useFormStatus({
1235
- initialDirty,
1236
- initialTouched,
1237
- mode,
1238
- $values
1239
- }) {
1240
- const [touchedState, setTouchedState] = useState9(initialTouched);
1241
- const [dirtyState, setDirtyState] = useState9(initialDirty);
1242
- const touchedRef = useRef2(initialTouched);
1243
- const dirtyRef = useRef2(initialDirty);
1244
- const setTouched = useCallback11((values) => {
1245
- const resolvedValues = typeof values === "function" ? values(touchedRef.current) : values;
1246
- touchedRef.current = resolvedValues;
1247
- if (mode === "controlled") {
1248
- setTouchedState(resolvedValues);
1249
- }
1250
- }, []);
1251
- const setDirty = useCallback11((values) => {
1252
- const resolvedValues = typeof values === "function" ? values(dirtyRef.current) : values;
1253
- dirtyRef.current = resolvedValues;
1254
- if (mode === "controlled") {
1255
- setDirtyState(resolvedValues);
1256
- }
1257
- }, []);
1258
- const resetTouched = useCallback11(() => setTouched({}), []);
1259
- const resetDirty = (values) => {
1260
- const newSnapshot = values ? { ...values, ...$values.refValues.current } : $values.refValues.current;
1261
- $values.setValuesSnapshot(newSnapshot);
1262
- setDirty({});
1263
- };
1264
- const setFieldTouched = useCallback11((path, touched) => {
1265
- setTouched((currentTouched) => {
1266
- if (getStatus(currentTouched, path) === touched) {
1267
- return currentTouched;
1268
- }
1269
- return { ...currentTouched, [path]: touched };
1270
- });
1271
- }, []);
1272
- const setFieldDirty = useCallback11((path, dirty) => {
1273
- setDirty((currentDirty) => {
1274
- if (getStatus(currentDirty, path) === dirty) {
1275
- return currentDirty;
1276
- }
1277
- return { ...currentDirty, [path]: dirty };
1278
- });
1279
- }, []);
1280
- const isTouched = useCallback11(
1281
- (path) => getStatus(touchedRef.current, path),
1282
- []
1283
- );
1284
- const clearFieldDirty = useCallback11(
1285
- (path) => setDirty((current) => {
1286
- if (typeof path !== "string") {
1287
- return current;
1288
- }
1289
- const result = clearListState(path, current);
1290
- delete result[path];
1291
- if ((0, import_fast_deep_equal.default)(result, current)) {
1292
- return current;
1293
- }
1294
- return result;
1295
- }),
1296
- []
1297
- );
1298
- const isDirty = useCallback11((path) => {
1299
- if (path) {
1300
- const overriddenValue = getPath(path, dirtyRef.current);
1301
- if (typeof overriddenValue === "boolean") {
1302
- return overriddenValue;
1303
- }
1304
- const sliceOfValues = getPath(path, $values.refValues.current);
1305
- const sliceOfInitialValues = getPath(path, $values.valuesSnapshot.current);
1306
- return !(0, import_fast_deep_equal.default)(sliceOfValues, sliceOfInitialValues);
1307
- }
1308
- const isOverridden = Object.keys(dirtyRef.current).length > 0;
1309
- if (isOverridden) {
1310
- return getStatus(dirtyRef.current);
1311
- }
1312
- return !(0, import_fast_deep_equal.default)($values.refValues.current, $values.valuesSnapshot.current);
1313
- }, []);
1314
- const getDirty = useCallback11(() => dirtyRef.current, []);
1315
- const getTouched = useCallback11(() => touchedRef.current, []);
1316
- return {
1317
- touchedState,
1318
- dirtyState,
1319
- touchedRef,
1320
- dirtyRef,
1321
- setTouched,
1322
- setDirty,
1323
- resetDirty,
1324
- resetTouched,
1325
- isTouched,
1326
- setFieldTouched,
1327
- setFieldDirty,
1328
- setTouchedState,
1329
- setDirtyState,
1330
- clearFieldDirty,
1331
- isDirty,
1332
- getDirty,
1333
- getTouched
1334
- };
1335
- }
1336
-
1337
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-values/use-form-values.mjs
1338
- import { useRef as useRef3, useState as useState10, useCallback as useCallback12 } from "react";
1339
- function useFormValues({
1340
- initialValues,
1341
- onValuesChange,
1342
- mode
1343
- }) {
1344
- const initialized = useRef3(false);
1345
- const [stateValues, setStateValues] = useState10(initialValues || {});
1346
- const refValues = useRef3(stateValues);
1347
- const valuesSnapshot = useRef3(stateValues);
1348
- const setValues = useCallback12(
1349
- ({
1350
- values,
1351
- subscribers,
1352
- updateState = true,
1353
- mergeWithPreviousValues = true
1354
- }) => {
1355
- const previousValues = refValues.current;
1356
- const resolvedValues = values instanceof Function ? values(refValues.current) : values;
1357
- const updatedValues = mergeWithPreviousValues ? { ...previousValues, ...resolvedValues } : resolvedValues;
1358
- refValues.current = updatedValues;
1359
- updateState && setStateValues(updatedValues);
1360
- onValuesChange?.(updatedValues, previousValues);
1361
- subscribers?.filter(Boolean).forEach((subscriber) => subscriber({ updatedValues, previousValues }));
1362
- },
1363
- [onValuesChange]
1364
- );
1365
- const setFieldValue = useCallback12((payload) => {
1366
- const currentValue = getPath(payload.path, refValues.current);
1367
- const updatedValue = payload.value instanceof Function ? payload.value(currentValue) : payload.value;
1368
- if (currentValue !== updatedValue) {
1369
- const previousValues = refValues.current;
1370
- const updatedValues = setPath(payload.path, updatedValue, refValues.current);
1371
- setValues({ values: updatedValues, updateState: payload.updateState });
1372
- payload.subscribers?.filter(Boolean).forEach(
1373
- (subscriber) => subscriber({ path: payload.path, updatedValues, previousValues })
1374
- );
1375
- }
1376
- }, []);
1377
- const setValuesSnapshot = useCallback12((payload) => {
1378
- valuesSnapshot.current = payload;
1379
- }, []);
1380
- const initialize = useCallback12((values, onInitialize) => {
1381
- if (!initialized.current) {
1382
- initialized.current = true;
1383
- setValues({ values, updateState: mode === "controlled" });
1384
- setValuesSnapshot(values);
1385
- onInitialize();
1386
- }
1387
- }, []);
1388
- const resetValues = useCallback12(() => {
1389
- setValues({
1390
- values: valuesSnapshot.current,
1391
- updateState: true,
1392
- mergeWithPreviousValues: false
1393
- });
1394
- }, []);
1395
- const getValues = useCallback12(() => refValues.current, []);
1396
- return {
1397
- initialized,
1398
- stateValues,
1399
- refValues,
1400
- valuesSnapshot,
1401
- setValues,
1402
- setFieldValue,
1403
- resetValues,
1404
- setValuesSnapshot,
1405
- initialize,
1406
- getValues
1407
- };
1408
- }
1409
-
1410
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/hooks/use-form-watch/use-form-watch.mjs
1411
- import { useRef as useRef4, useCallback as useCallback13, useEffect as useEffect12 } from "react";
1412
- function useFormWatch({
1413
- $status
1414
- }) {
1415
- const subscribers = useRef4(
1416
- {}
1417
- );
1418
- const watch = useCallback13((path, callback) => {
1419
- useEffect12(() => {
1420
- subscribers.current[path] = subscribers.current[path] || [];
1421
- subscribers.current[path].push(callback);
1422
- return () => {
1423
- subscribers.current[path] = subscribers.current[path].filter((cb) => cb !== callback);
1424
- };
1425
- }, [callback]);
1426
- }, []);
1427
- const getFieldSubscribers = useCallback13((path) => {
1428
- if (!subscribers.current[path]) {
1429
- return [];
1430
- }
1431
- return subscribers.current[path].map(
1432
- (callback) => (input) => callback({
1433
- previousValue: getPath(path, input.previousValues),
1434
- value: getPath(path, input.updatedValues),
1435
- touched: $status.isTouched(path),
1436
- dirty: $status.isDirty(path)
1437
- })
1438
- );
1439
- }, []);
1440
- return {
1441
- subscribers,
1442
- watch,
1443
- getFieldSubscribers
1444
- };
1445
- }
1446
-
1447
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-data-path.mjs
1448
- function getDataPath(formName, fieldPath) {
1449
- return formName ? `${formName}-${fieldPath.toString()}` : fieldPath.toString();
1450
- }
1451
-
1452
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/validate-values.mjs
1453
- function getValidationResults(errors) {
1454
- const filteredErrors = filterErrors(errors);
1455
- return { hasErrors: Object.keys(filteredErrors).length > 0, errors: filteredErrors };
1456
- }
1457
- function validateRulesRecord(rules, values, path = "", errors = {}) {
1458
- if (typeof rules !== "object" || rules === null) {
1459
- return errors;
1460
- }
1461
- return Object.keys(rules).reduce((acc, ruleKey) => {
1462
- const rule = rules[ruleKey];
1463
- const rulePath = `${path === "" ? "" : `${path}.`}${ruleKey}`;
1464
- const value = getPath(rulePath, values);
1465
- let arrayValidation = false;
1466
- if (typeof rule === "function") {
1467
- acc[rulePath] = rule(value, values, rulePath);
1468
- }
1469
- if (typeof rule === "object" && Array.isArray(value)) {
1470
- arrayValidation = true;
1471
- value.forEach(
1472
- (_item, index) => validateRulesRecord(rule, values, `${rulePath}.${index}`, acc)
1473
- );
1474
- }
1475
- if (typeof rule === "object" && typeof value === "object" && value !== null) {
1476
- if (!arrayValidation) {
1477
- validateRulesRecord(rule, values, rulePath, acc);
1478
- }
1479
- }
1480
- return acc;
1481
- }, errors);
1482
- }
1483
- function validateValues(validate, values) {
1484
- if (typeof validate === "function") {
1485
- return getValidationResults(validate(values));
1486
- }
1487
- return getValidationResults(validateRulesRecord(validate, values));
1488
- }
1489
-
1490
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/validate-field-value.mjs
1491
- function validateFieldValue(path, rules, values) {
1492
- if (typeof path !== "string") {
1493
- return { hasError: false, error: null };
1494
- }
1495
- const results = validateValues(rules, values);
1496
- const pathInError = Object.keys(results.errors).find(
1497
- (errorKey) => path.split(".").every((pathPart, i) => pathPart === errorKey.split(".")[i])
1498
- );
1499
- return { hasError: !!pathInError, error: pathInError ? results.errors[pathInError] : null };
1500
- }
1501
-
1502
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/form-index.mjs
1503
- var FORM_INDEX = "__MANTINE_FORM_INDEX__";
1504
-
1505
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/should-validate-on-change.mjs
1506
- function shouldValidateOnChange(path, validateInputOnChange) {
1507
- if (!validateInputOnChange) {
1508
- return false;
1509
- }
1510
- if (typeof validateInputOnChange === "boolean") {
1511
- return validateInputOnChange;
1512
- }
1513
- if (Array.isArray(validateInputOnChange)) {
1514
- return validateInputOnChange.includes(path.replace(/[.][0-9]/g, `.${FORM_INDEX}`));
1515
- }
1516
- return false;
1517
- }
1518
-
1519
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/use-form.mjs
1520
- function useForm({
1521
- name,
1522
- mode = "controlled",
1523
- initialValues,
1524
- initialErrors = {},
1525
- initialDirty = {},
1526
- initialTouched = {},
1527
- clearInputErrorOnChange = true,
1528
- validateInputOnChange = false,
1529
- validateInputOnBlur = false,
1530
- onValuesChange,
1531
- transformValues = (values) => values,
1532
- enhanceGetInputProps,
1533
- validate: rules
1534
- } = {}) {
1535
- const $errors = useFormErrors(initialErrors);
1536
- const $values = useFormValues({ initialValues, onValuesChange, mode });
1537
- const $status = useFormStatus({ initialDirty, initialTouched, $values, mode });
1538
- const $list = useFormList({ $values, $errors, $status });
1539
- const $watch = useFormWatch({ $status });
1540
- const [formKey, setFormKey] = useState11(0);
1541
- const [fieldKeys, setFieldKeys] = useState11({});
1542
- const reset = useCallback14(() => {
1543
- $values.resetValues();
1544
- $errors.clearErrors();
1545
- $status.resetDirty();
1546
- $status.resetTouched();
1547
- mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
1548
- }, []);
1549
- const initialize = useCallback14((values) => {
1550
- $values.initialize(values, () => mode === "uncontrolled" && setFormKey((key2) => key2 + 1));
1551
- }, []);
1552
- const setFieldValue = useCallback14(
1553
- (path, value, options2) => {
1554
- const shouldValidate = shouldValidateOnChange(path, validateInputOnChange);
1555
- $status.clearFieldDirty(path);
1556
- $status.setFieldTouched(path, true);
1557
- !shouldValidate && clearInputErrorOnChange && $errors.clearFieldError(path);
1558
- $values.setFieldValue({
1559
- path,
1560
- value,
1561
- updateState: mode === "controlled",
1562
- subscribers: [
1563
- ...$watch.getFieldSubscribers(path),
1564
- shouldValidate ? (payload) => {
1565
- const validationResults = validateFieldValue(path, rules, payload.updatedValues);
1566
- validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
1567
- } : null,
1568
- options2?.forceUpdate !== false && mode !== "controlled" ? () => setFieldKeys((keys) => ({
1569
- ...keys,
1570
- [path]: (keys[path] || 0) + 1
1571
- })) : null
1572
- ]
1573
- });
1574
- },
1575
- [onValuesChange, rules]
1576
- );
1577
- const setValues = useCallback14(
1578
- (values) => {
1579
- const previousValues = $values.refValues.current;
1580
- $values.setValues({ values, updateState: mode === "controlled" });
1581
- clearInputErrorOnChange && $errors.clearErrors();
1582
- mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
1583
- Object.keys($watch.subscribers.current).forEach((path) => {
1584
- const value = getPath(path, $values.refValues.current);
1585
- const previousValue = getPath(path, previousValues);
1586
- if (value !== previousValue) {
1587
- $watch.getFieldSubscribers(path).forEach((cb) => cb({ previousValues, updatedValues: $values.refValues.current }));
1588
- }
1589
- });
1590
- },
1591
- [onValuesChange, clearInputErrorOnChange]
1592
- );
1593
- const validate = useCallback14(() => {
1594
- const results = validateValues(rules, $values.refValues.current);
1595
- $errors.setErrors(results.errors);
1596
- return results;
1597
- }, [rules]);
1598
- const validateField = useCallback14(
1599
- (path) => {
1600
- const results = validateFieldValue(path, rules, $values.refValues.current);
1601
- results.hasError ? $errors.setFieldError(path, results.error) : $errors.clearFieldError(path);
1602
- return results;
1603
- },
1604
- [rules]
1605
- );
1606
- const getInputProps = (path, { type = "input", withError = true, withFocus = true, ...otherOptions } = {}) => {
1607
- const onChange = getInputOnChange(
1608
- (value) => setFieldValue(path, value, { forceUpdate: false })
1609
- );
1610
- const payload = { onChange, "data-path": getDataPath(name, path) };
1611
- if (withError) {
1612
- payload.error = $errors.errorsState[path];
1613
- }
1614
- if (type === "checkbox") {
1615
- payload[mode === "controlled" ? "checked" : "defaultChecked"] = getPath(
1616
- path,
1617
- $values.refValues.current
1618
- );
1619
- } else {
1620
- payload[mode === "controlled" ? "value" : "defaultValue"] = getPath(
1621
- path,
1622
- $values.refValues.current
1623
- );
1624
- }
1625
- if (withFocus) {
1626
- payload.onFocus = () => $status.setFieldTouched(path, true);
1627
- payload.onBlur = () => {
1628
- if (shouldValidateOnChange(path, validateInputOnBlur)) {
1629
- const validationResults = validateFieldValue(path, rules, $values.refValues.current);
1630
- validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
1631
- }
1632
- };
1633
- }
1634
- return Object.assign(
1635
- payload,
1636
- enhanceGetInputProps?.({
1637
- inputProps: payload,
1638
- field: path,
1639
- options: { type, withError, withFocus, ...otherOptions },
1640
- form
1641
- })
1642
- );
1643
- };
1644
- const onSubmit = (handleSubmit, handleValidationFailure) => (event) => {
1645
- event?.preventDefault();
1646
- const results = validate();
1647
- if (results.hasErrors) {
1648
- handleValidationFailure?.(results.errors, $values.refValues.current, event);
1649
- } else {
1650
- handleSubmit?.(transformValues($values.refValues.current), event);
1651
- }
1652
- };
1653
- const getTransformedValues = (input) => transformValues(input || $values.refValues.current);
1654
- const onReset = useCallback14((event) => {
1655
- event.preventDefault();
1656
- reset();
1657
- }, []);
1658
- const isValid = useCallback14(
1659
- (path) => path ? !validateFieldValue(path, rules, $values.refValues.current).hasError : !validateValues(rules, $values.refValues.current).hasErrors,
1660
- [rules]
1661
- );
1662
- const key = (path) => `${formKey}-${path}-${fieldKeys[path] || 0}`;
1663
- const getInputNode = useCallback14(
1664
- (path) => document.querySelector(`[data-path="${getDataPath(name, path)}"]`),
1665
- []
1666
- );
1667
- const form = {
1668
- watch: $watch.watch,
1669
- initialized: $values.initialized.current,
1670
- values: $values.stateValues,
1671
- getValues: $values.getValues,
1672
- setInitialValues: $values.setValuesSnapshot,
1673
- initialize,
1674
- setValues,
1675
- setFieldValue,
1676
- errors: $errors.errorsState,
1677
- setErrors: $errors.setErrors,
1678
- setFieldError: $errors.setFieldError,
1679
- clearFieldError: $errors.clearFieldError,
1680
- clearErrors: $errors.clearErrors,
1681
- resetDirty: $status.resetDirty,
1682
- setTouched: $status.setTouched,
1683
- setDirty: $status.setDirty,
1684
- isTouched: $status.isTouched,
1685
- resetTouched: $status.resetTouched,
1686
- isDirty: $status.isDirty,
1687
- getTouched: $status.getTouched,
1688
- getDirty: $status.getDirty,
1689
- reorderListItem: $list.reorderListItem,
1690
- insertListItem: $list.insertListItem,
1691
- removeListItem: $list.removeListItem,
1692
- reset,
1693
- validate,
1694
- validateField,
1695
- getInputProps,
1696
- onSubmit,
1697
- onReset,
1698
- isValid,
1699
- getTransformedValues,
1700
- key,
1701
- getInputNode
1702
- };
1703
- useFormActions(name, form);
1704
- return form;
1705
- }
1706
-
1707
- // src/nodes/modifiers/noise-curve-node.tsx
1708
- import { useCallback as useCallback15, useEffect as useEffect13, useState as useState12 } from "react";
1709
- import { Curve } from "libnoise-ts/module/modifier";
1710
- import { Tuple } from "libnoise-ts/util";
1711
- import { IconX } from "@tabler/icons-react";
1712
- import { randomId } from "@mantine/hooks";
1713
- import { NodeState } from "@awesome-flow/core/abstract";
1714
- import { Fragment, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
1715
- function NoiseCurveNode({ id, selected, data, type }) {
1716
- const incoming = useIncomingComputedData8(id);
1717
- const updateNodeData = useUpdateNodeData7();
1718
- const updateComputedData = useUpdateNodeComputedData18();
1719
- const [values, setValues] = useState12([]);
1720
- const form = useForm({
1721
- mode: "uncontrolled",
1722
- initialValues: {
1723
- points: []
1724
- },
1725
- validateInputOnChange: [`points.${FORM_INDEX}.input`],
1726
- clearInputErrorOnChange: true,
1727
- validate: {
1728
- points: {
1729
- input: (value, values2) => {
1730
- const counts = {};
1731
- values2.points.forEach((x) => {
1732
- counts[x.input] = (counts[x.input] || 0) + 1;
1733
- });
1734
- return counts[value] > 1;
1735
- }
1736
- }
1737
- },
1738
- onValuesChange: useCallback15((values2) => {
1739
- if (form.isValid()) {
1740
- const points = values2.points.map((v) => ({ input: v.input, output: v.output }));
1741
- setValues(points);
1742
- updateNodeData(id, { points });
1743
- }
1744
- form.validate();
1745
- }, [])
1746
- });
1747
- useEffect13(() => {
1748
- const points = data.points?.length ? data.points.map((v) => ({ input: v.input, output: v.output, key: randomId() })) : [1, 2, 3, 4].map(() => ({ input: 0, output: 0, key: randomId() }));
1749
- form.initialize({ points });
1750
- }, []);
1751
- useEffect13(() => {
1752
- if (incoming?.length && values?.length >= 4) {
1753
- const module = new Curve(
1754
- incoming[0].module,
1755
- values.map((p) => new Tuple(p.input, p.output))
1756
- );
1757
- updateComputedData(id, { module });
1758
- }
1759
- }, [values, incoming]);
1760
- const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ jsxs17(Group7, { mt: "xs", children: [
1761
- /* @__PURE__ */ jsx20(
1762
- NumberInput6,
1763
- {
1764
- size: "xs",
1765
- w: 100,
1766
- placeholder: "Input Value",
1767
- ...form.getInputProps(`points.${index}.input`),
1768
- step: 0.1
1769
- },
1770
- form.key(`points.${index}.input`)
1771
- ),
1772
- /* @__PURE__ */ jsx20(
1773
- NumberInput6,
1774
- {
1775
- size: "xs",
1776
- w: 100,
1777
- placeholder: "Output Value",
1778
- ...form.getInputProps(`points.${index}.output`),
1779
- step: 0.1
1780
- },
1781
- form.key(`points.${index}.output`)
1782
- ),
1783
- data.state === NodeState.edit && values.length > 4 && /* @__PURE__ */ jsx20(
1784
- ActionIcon,
1785
- {
1786
- color: "red",
1787
- variant: "outline",
1788
- size: "sm",
1789
- onClick: () => form.removeListItem("points", index),
1790
- children: /* @__PURE__ */ jsx20(IconX, { size: "1rem" })
1791
- }
1792
- )
1793
- ] }, item.key));
1794
- return /* @__PURE__ */ jsxs17(NodeContainer20, { id, selected, type, data, children: [
1795
- fields,
1796
- data.state === NodeState.edit && /* @__PURE__ */ jsxs17(Fragment, { children: [
1797
- /* @__PURE__ */ jsx20(Space, { h: 10 }),
1798
- /* @__PURE__ */ jsx20(
1799
- Button,
1800
- {
1801
- variant: "outline",
1802
- size: "xs",
1803
- fullWidth: true,
1804
- onClick: () => form.insertListItem("points", { input: 0, output: 0, key: randomId() }),
1805
- children: "Add control point"
1806
- }
1807
- )
1808
- ] }),
1809
- /* @__PURE__ */ jsx20(NodeTrackConnections15, { handles: data.handles, nodeId: id, type: "target" })
1810
- ] });
1811
- }
1812
- var noise_curve_node_default = NoiseCurveNode;
1813
-
1814
- // src/nodes/modifiers/noise-exponent-node.tsx
1815
- import { NodeContainer as NodeContainer21, NodeTrackConnections as NodeTrackConnections16 } from "@awesome-flow/core/layout";
1816
- import { useEffect as useEffect14, useState as useState13 } from "react";
1817
- import { Group as Group8, NumberInput as NumberInput7, Stack as Stack9 } from "@mantine/core";
1818
- import {
1819
- useIncomingComputedData as useIncomingComputedData9,
1820
- useUpdateNodeComputedData as useUpdateNodeComputedData19,
1821
- useUpdateNodeData as useUpdateNodeData8
1822
- } from "@awesome-flow/core/hooks";
1823
- import { Exponent } from "libnoise-ts/module/modifier";
1824
- import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
1825
- function NoiseExponentNode({ id, selected, data, type }) {
1826
- const [exponent, setExponent] = useState13(data.exponent);
1827
- const incoming = useIncomingComputedData9(id);
1828
- const updateNodeData = useUpdateNodeData8();
1829
- const updateComputedData = useUpdateNodeComputedData19();
1830
- useEffect14(() => {
1831
- if (incoming?.length > 0) {
1832
- const module = new Exponent(incoming[0].module, exponent);
1833
- updateComputedData(id, { module });
1834
- }
1835
- updateNodeData(id, { exponent });
1836
- }, [incoming, exponent]);
1837
- return /* @__PURE__ */ jsxs18(NodeContainer21, { id, selected, data, type, children: [
1838
- /* @__PURE__ */ jsx21(Stack9, { children: /* @__PURE__ */ jsxs18(Group8, { children: [
1839
- "Exponent:",
1840
- /* @__PURE__ */ jsx21(
1841
- NumberInput7,
1842
- {
1843
- size: "xs",
1844
- value: exponent,
1845
- onChange: (e) => setExponent(Number(e)),
1846
- step: 0.1
1847
- }
1848
- )
1849
- ] }) }),
1850
- /* @__PURE__ */ jsx21(NodeTrackConnections16, { handles: data.handles, nodeId: id, type: "target" })
1851
- ] });
1852
- }
1853
- var noise_exponent_node_default = NoiseExponentNode;
1854
-
1855
- // src/nodes/modifiers/noise-invert-node.tsx
1856
- import { NodeContainer as NodeContainer22, NodeTrackConnections as NodeTrackConnections17 } from "@awesome-flow/core/layout";
1857
- import { useEffect as useEffect15 } from "react";
1858
- import { useIncomingComputedData as useIncomingComputedData10, useUpdateNodeComputedData as useUpdateNodeComputedData20 } from "@awesome-flow/core/hooks";
1859
- import { Invert } from "libnoise-ts/module/modifier";
1860
- import { jsx as jsx22 } from "react/jsx-runtime";
1861
- function NoiseInvertNode({ id, selected, data, type }) {
1862
- const incoming = useIncomingComputedData10(id);
1863
- const updateComputedData = useUpdateNodeComputedData20();
1864
- useEffect15(() => {
1865
- if (incoming?.length > 0) {
1866
- const module = new Invert(incoming[0].module);
1867
- updateComputedData(id, { module });
1868
- }
1869
- }, [incoming]);
1870
- return /* @__PURE__ */ jsx22(NodeContainer22, { id, selected, data, type, children: /* @__PURE__ */ jsx22(NodeTrackConnections17, { handles: data.handles, nodeId: id, type: "target" }) });
1871
- }
1872
- var noise_invert_node_default = NoiseInvertNode;
1873
-
1874
- // src/nodes/modifiers/noise-scale-bias-node.tsx
1875
- import { NodeContainer as NodeContainer23, NodeTrackConnections as NodeTrackConnections18 } from "@awesome-flow/core/layout";
1876
- import { useEffect as useEffect16, useState as useState14 } from "react";
1877
- import { Group as Group9, NumberInput as NumberInput8, Stack as Stack10 } from "@mantine/core";
1878
- import {
1879
- useIncomingComputedData as useIncomingComputedData11,
1880
- useUpdateNodeComputedData as useUpdateNodeComputedData21,
1881
- useUpdateNodeData as useUpdateNodeData9
1882
- } from "@awesome-flow/core/hooks";
1883
- import { ScaleBias } from "libnoise-ts/module/modifier";
1884
- import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
1885
- function NoiseScaleBiasNode({ id, selected, data, type }) {
1886
- const [scale, setScale] = useState14(data.scale);
1887
- const [bias, setBias] = useState14(data.bias);
1888
- const incoming = useIncomingComputedData11(id);
1889
- const updateNodeData = useUpdateNodeData9();
1890
- const updateComputedData = useUpdateNodeComputedData21();
1891
- useEffect16(() => {
1892
- if (incoming?.length > 0) {
1893
- const module = new ScaleBias(incoming[0].module, scale, bias);
1894
- updateComputedData(id, { module });
1895
- }
1896
- updateNodeData(id, { scale, bias });
1897
- }, [incoming, scale, bias]);
1898
- return /* @__PURE__ */ jsxs19(NodeContainer23, { id, selected, data, type, children: [
1899
- /* @__PURE__ */ jsxs19(Stack10, { children: [
1900
- /* @__PURE__ */ jsxs19(Group9, { children: [
1901
- "Scale:",
1902
- /* @__PURE__ */ jsx23(
1903
- NumberInput8,
1904
- {
1905
- size: "xs",
1906
- w: 100,
1907
- value: scale,
1908
- onChange: (e) => setScale(Number(e)),
1909
- step: 0.1
1910
- }
1911
- )
1912
- ] }),
1913
- /* @__PURE__ */ jsxs19(Group9, { children: [
1914
- "Bias:",
1915
- /* @__PURE__ */ jsx23(
1916
- NumberInput8,
1917
- {
1918
- size: "xs",
1919
- w: 100,
1920
- value: bias,
1921
- onChange: (e) => setBias(Number(e)),
1922
- step: 0.1
1923
- }
1924
- )
1925
- ] })
1926
- ] }),
1927
- /* @__PURE__ */ jsx23(NodeTrackConnections18, { handles: data.handles, nodeId: id, type: "target" })
1928
- ] });
1929
- }
1930
- var noise_scale_bias_node_default = NoiseScaleBiasNode;
1931
-
1932
- // src/nodes/modifiers/noise-terrace-node.tsx
1933
- import { NodeContainer as NodeContainer24, NodeTrackConnections as NodeTrackConnections19 } from "@awesome-flow/core/layout";
1934
- import { ActionIcon as ActionIcon2, Button as Button2, Group as Group10, NumberInput as NumberInput9, Space as Space2 } from "@mantine/core";
1935
- import {
1936
- useIncomingComputedData as useIncomingComputedData12,
1937
- useUpdateNodeComputedData as useUpdateNodeComputedData22,
1938
- useUpdateNodeData as useUpdateNodeData10
1939
- } from "@awesome-flow/core/hooks";
1940
- import { useCallback as useCallback16, useEffect as useEffect17, useState as useState15 } from "react";
1941
- import { Terrace } from "libnoise-ts/module/modifier";
1942
- import { IconX as IconX2 } from "@tabler/icons-react";
1943
- import { randomId as randomId2 } from "@mantine/hooks";
1944
- import { NodeState as NodeState2 } from "@awesome-flow/core/abstract";
1945
- import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
1946
- function NoiseTerraceNode({ id, selected, data, type }) {
1947
- const incoming = useIncomingComputedData12(id);
1948
- const updateNodeData = useUpdateNodeData10();
1949
- const updateComputedData = useUpdateNodeComputedData22();
1950
- const [values, setValues] = useState15([]);
1951
- const form = useForm({
1952
- mode: "uncontrolled",
1953
- initialValues: {
1954
- points: []
1955
- },
1956
- validateInputOnChange: [`points.${FORM_INDEX}.input`],
1957
- clearInputErrorOnChange: true,
1958
- onValuesChange: useCallback16((values2) => {
1959
- if (form.isValid()) {
1960
- const points = values2.points.map((v) => v.value);
1961
- setValues(points);
1962
- updateNodeData(id, { points });
1963
- }
1964
- form.validate();
1965
- }, [])
1966
- });
1967
- useEffect17(() => {
1968
- const points = data.points?.length ? data.points.map((v) => ({ value: v, key: randomId2() })) : [1, 2].map(() => ({ value: 0, key: randomId2() }));
1969
- form.initialize({ points });
1970
- }, []);
1971
- useEffect17(() => {
1972
- if (incoming?.length && values?.length >= 2) {
1973
- const module = new Terrace(incoming[0].module, values);
1974
- updateComputedData(id, { module });
1975
- }
1976
- }, [values, incoming]);
1977
- const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ jsxs20(Group10, { mt: "xs", children: [
1978
- /* @__PURE__ */ jsx24(
1979
- NumberInput9,
1980
- {
1981
- size: "xs",
1982
- placeholder: "Input Value",
1983
- ...form.getInputProps(`points.${index}.value`),
1984
- step: 0.1
1985
- },
1986
- form.key(`points.${index}.value`)
1987
- ),
1988
- data.state === NodeState2.edit && values.length > 2 && /* @__PURE__ */ jsx24(
1989
- ActionIcon2,
1990
- {
1991
- color: "red",
1992
- variant: "outline",
1993
- size: "sm",
1994
- onClick: () => form.removeListItem("points", index),
1995
- children: /* @__PURE__ */ jsx24(IconX2, { size: "1rem" })
1996
- }
1997
- )
1998
- ] }, item.key));
1999
- return /* @__PURE__ */ jsxs20(NodeContainer24, { id, selected, type, data, children: [
2000
- fields,
2001
- data.state === NodeState2.edit && /* @__PURE__ */ jsxs20(Fragment2, { children: [
2002
- /* @__PURE__ */ jsx24(Space2, { h: 10 }),
2003
- /* @__PURE__ */ jsx24(
2004
- Button2,
2005
- {
2006
- variant: "outline",
2007
- size: "xs",
2008
- fullWidth: true,
2009
- onClick: () => form.insertListItem("points", { value: 0, key: randomId2() }),
2010
- children: "Add control point"
2011
- }
2012
- )
2013
- ] }),
2014
- /* @__PURE__ */ jsx24(NodeTrackConnections19, { handles: data.handles, nodeId: id, type: "target" })
2015
- ] });
2016
- }
2017
- var noise_terrace_node_default = NoiseTerraceNode;
2018
-
2019
- // src/nodes/selectors/noise-blend-node.tsx
2020
- import { NodeContainer as NodeContainer25, NodeTrackConnections as NodeTrackConnections20 } from "@awesome-flow/core/layout";
2021
- import { useCallback as useCallback17 } from "react";
2022
- import { useUpdateNodeComputedData as useUpdateNodeComputedData23 } from "@awesome-flow/core/hooks";
2023
- import { Blend } from "libnoise-ts/module/selector";
2024
- import { HandlesIncomingDataStatus as HandlesIncomingDataStatus2 } from "@awesome-flow/core/components";
2025
- import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
2026
- function NoiseBlendNode({ id, selected, data, type }) {
2027
- const updateComputedData = useUpdateNodeComputedData23();
2028
- const onDataUpdated = useCallback17(
2029
- (incomingData) => {
2030
- const incomingSources = incomingData["source" /* source */];
2031
- const incomingControl = incomingData["control" /* control */];
2032
- if (incomingSources?.length >= 2 && incomingControl?.length) {
2033
- const module = new Blend(
2034
- incomingSources[0].module,
2035
- incomingSources[1].module,
2036
- incomingControl[0].module
2037
- );
2038
- updateComputedData(id, { module });
2039
- }
2040
- },
2041
- []
2042
- );
2043
- return /* @__PURE__ */ jsxs21(NodeContainer25, { id, selected, data, type, children: [
2044
- /* @__PURE__ */ jsx25(
2045
- HandlesIncomingDataStatus2,
2046
- {
2047
- nodeId: id,
2048
- handles: data.handles,
2049
- handleKey: "dataId",
2050
- onDataUpdated,
2051
- type: "target",
2052
- resetComputedData: true
2053
- }
2054
- ),
2055
- /* @__PURE__ */ jsx25(NodeTrackConnections20, { handles: data.handles, nodeId: id, type: "target" })
2056
- ] });
2057
- }
2058
- var noise_blend_node_default = NoiseBlendNode;
2059
-
2060
- // src/nodes/selectors/noise-select-node.tsx
2061
- import { NodeContainer as NodeContainer26, NodeTrackConnections as NodeTrackConnections21 } from "@awesome-flow/core/layout";
2062
- import { useCallback as useCallback18, useEffect as useEffect18, useState as useState16 } from "react";
2063
- import { useUpdateNodeComputedData as useUpdateNodeComputedData24, useUpdateNodeData as useUpdateNodeData11 } from "@awesome-flow/core/hooks";
2064
- import { Select } from "libnoise-ts/module/selector";
2065
- import { Group as Group11, NumberInput as NumberInput10, Stack as Stack11 } from "@mantine/core";
2066
- import { HandlesIncomingDataStatus as HandlesIncomingDataStatus3 } from "@awesome-flow/core/components";
2067
- import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
2068
- function NoiseSelectNode({ id, selected, data, type }) {
2069
- const [edgeFalloff, setEdgeFalloff] = useState16(data.edgeFalloff);
2070
- const [lowerBound, setLowerBound] = useState16(data.lowerBound);
2071
- const [upperBound, setUpperBound] = useState16(data.upperBound);
2072
- const updateNodeData = useUpdateNodeData11();
2073
- const updateComputedData = useUpdateNodeComputedData24();
2074
- useEffect18(() => {
2075
- updateNodeData(id, { edgeFalloff, lowerBound, upperBound });
2076
- }, [edgeFalloff, lowerBound, upperBound]);
2077
- const onDataUpdated = useCallback18(
2078
- (incomingData) => {
2079
- const incomingSources = incomingData["source" /* source */];
2080
- const incomingControl = incomingData["control" /* control */];
2081
- if (incomingSources?.length >= 2 && incomingControl?.length) {
2082
- const module = new Select(
2083
- incomingSources[0].module,
2084
- incomingSources[1].module,
2085
- incomingControl[0].module,
2086
- edgeFalloff,
2087
- lowerBound,
2088
- upperBound
2089
- );
2090
- updateComputedData(id, { module });
2091
- }
2092
- },
2093
- []
2094
- );
2095
- return /* @__PURE__ */ jsxs22(NodeContainer26, { id, selected, data, type, children: [
2096
- /* @__PURE__ */ jsxs22(Stack11, { children: [
2097
- /* @__PURE__ */ jsxs22(Group11, { children: [
2098
- "Edge Falloff:",
2099
- /* @__PURE__ */ jsx26(
2100
- NumberInput10,
2101
- {
2102
- size: "xs",
2103
- w: 100,
2104
- value: edgeFalloff,
2105
- onChange: (e) => setEdgeFalloff(Number(e)),
2106
- step: 0.1
2107
- }
2108
- )
2109
- ] }),
2110
- /* @__PURE__ */ jsxs22(Group11, { children: [
2111
- "Lower Bound:",
2112
- /* @__PURE__ */ jsx26(
2113
- NumberInput10,
2114
- {
2115
- size: "xs",
2116
- w: 100,
2117
- value: lowerBound,
2118
- onChange: (e) => setLowerBound(Number(e)),
2119
- step: 0.1
2120
- }
2121
- )
2122
- ] }),
2123
- /* @__PURE__ */ jsxs22(Group11, { children: [
2124
- "Upper Bound:",
2125
- /* @__PURE__ */ jsx26(
2126
- NumberInput10,
2127
- {
2128
- size: "xs",
2129
- w: 100,
2130
- value: upperBound,
2131
- onChange: (e) => setUpperBound(Number(e)),
2132
- step: 0.1
2133
- }
2134
- )
2135
- ] }),
2136
- /* @__PURE__ */ jsx26(
2137
- HandlesIncomingDataStatus3,
2138
- {
2139
- nodeId: id,
2140
- handles: data.handles,
2141
- handleKey: "dataId",
2142
- onDataUpdated,
2143
- type: "target",
2144
- resetComputedData: true
2145
- }
2146
- )
2147
- ] }),
2148
- /* @__PURE__ */ jsx26(NodeTrackConnections21, { handles: data.handles, nodeId: id, type: "target" })
2149
- ] });
2150
- }
2151
- var noise_select_node_default = NoiseSelectNode;
2152
-
2153
- // src/nodes/transformers/noise-displace-node.tsx
2154
- import { NodeContainer as NodeContainer27, NodeTrackConnections as NodeTrackConnections22 } from "@awesome-flow/core/layout";
2155
- import { useCallback as useCallback19 } from "react";
2156
- import { useUpdateNodeComputedData as useUpdateNodeComputedData25 } from "@awesome-flow/core/hooks";
2157
- import { Displace } from "libnoise-ts/module/transformer";
2158
- import { HandlesIncomingDataStatus as HandlesIncomingDataStatus4 } from "@awesome-flow/core/components";
2159
- import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
2160
- function NoiseDisplaceNode({ id, selected, data, type }) {
2161
- const updateComputedData = useUpdateNodeComputedData25();
2162
- const onDataUpdated = useCallback19(
2163
- (handleData) => {
2164
- const sourceModule = handleData["source" /* sourceModule */];
2165
- const xModule = handleData["x-module" /* xModule */];
2166
- const yModule = handleData["y-module" /* yModule */];
2167
- const zModule = handleData["z-module" /* zModule */];
2168
- if (sourceModule && xModule && yModule && zModule) {
2169
- const module = new Displace(
2170
- sourceModule[0].module,
2171
- xModule[0].module,
2172
- yModule[0].module,
2173
- zModule[0].module
2174
- );
2175
- updateComputedData(id, { module });
2176
- }
2177
- },
2178
- []
2179
- );
2180
- return /* @__PURE__ */ jsxs23(NodeContainer27, { id, selected, data, type, children: [
2181
- /* @__PURE__ */ jsx27(
2182
- HandlesIncomingDataStatus4,
2183
- {
2184
- nodeId: id,
2185
- handles: data.handles,
2186
- handleKey: "dataId",
2187
- onDataUpdated,
2188
- type: "target",
2189
- resetComputedData: true
2190
- }
2191
- ),
2192
- /* @__PURE__ */ jsx27(NodeTrackConnections22, { handles: data.handles, nodeId: id, type: "target" })
2193
- ] });
2194
- }
2195
- var noise_displace_node_default = NoiseDisplaceNode;
2196
-
2197
- // src/nodes/transformers/noise-rotate-point-node.tsx
2198
- import { NodeContainer as NodeContainer28, NodeTrackConnections as NodeTrackConnections23 } from "@awesome-flow/core/layout";
2199
- import { useEffect as useEffect19, useState as useState17 } from "react";
2200
- import {
2201
- useIncomingComputedData as useIncomingComputedData13,
2202
- useUpdateNodeComputedData as useUpdateNodeComputedData26,
2203
- useUpdateNodeData as useUpdateNodeData12
2204
- } from "@awesome-flow/core/hooks";
2205
- import { Group as Group12, NumberInput as NumberInput11, Stack as Stack12 } from "@mantine/core";
2206
- import { RotatePoint } from "libnoise-ts/module/transformer";
2207
- import { jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
2208
- function NoiseRotatePointNode({
2209
- id,
2210
- selected,
2211
- data,
2212
- type
2213
- }) {
2214
- const [xAngle, setXAngle] = useState17(data.xAngle);
2215
- const [yAngle, setYAngle] = useState17(data.yAngle);
2216
- const [zAngle, setZAngle] = useState17(data.zAngle);
2217
- const incoming = useIncomingComputedData13(id);
2218
- const updateNodeData = useUpdateNodeData12();
2219
- const updateComputedData = useUpdateNodeComputedData26();
2220
- useEffect19(() => {
2221
- if (incoming?.length) {
2222
- const module = new RotatePoint(incoming[0].module, xAngle, yAngle, zAngle);
2223
- updateComputedData(id, { module });
2224
- }
2225
- updateNodeData(id, { xAngle, yAngle, zAngle });
2226
- }, [id, updateComputedData, updateNodeData, incoming, xAngle, yAngle, zAngle]);
2227
- return /* @__PURE__ */ jsxs24(NodeContainer28, { id, selected, data, type, children: [
2228
- /* @__PURE__ */ jsxs24(Stack12, { children: [
2229
- /* @__PURE__ */ jsxs24(Group12, { children: [
2230
- "X Angle:",
2231
- /* @__PURE__ */ jsx28(
2232
- NumberInput11,
2233
- {
2234
- size: "xs",
2235
- w: 100,
2236
- value: xAngle,
2237
- onChange: (e) => setXAngle(Number(e)),
2238
- step: 0.01
2239
- }
2240
- )
2241
- ] }),
2242
- /* @__PURE__ */ jsxs24(Group12, { children: [
2243
- "Y Angle:",
2244
- /* @__PURE__ */ jsx28(
2245
- NumberInput11,
2246
- {
2247
- size: "xs",
2248
- w: 100,
2249
- value: yAngle,
2250
- onChange: (e) => setYAngle(Number(e)),
2251
- step: 0.01
2252
- }
2253
- )
2254
- ] }),
2255
- /* @__PURE__ */ jsxs24(Group12, { children: [
2256
- "Z Angle:",
2257
- /* @__PURE__ */ jsx28(
2258
- NumberInput11,
2259
- {
2260
- size: "xs",
2261
- w: 100,
2262
- value: zAngle,
2263
- onChange: (e) => setZAngle(Number(e)),
2264
- step: 0.01
2265
- }
2266
- )
2267
- ] })
2268
- ] }),
2269
- /* @__PURE__ */ jsx28(NodeTrackConnections23, { handles: data.handles, nodeId: id, type: "target" })
2270
- ] });
2271
- }
2272
- var noise_rotate_point_node_default = NoiseRotatePointNode;
2273
-
2274
- // src/nodes/transformers/noise-scale-point-node.tsx
2275
- import { NodeContainer as NodeContainer29, NodeTrackConnections as NodeTrackConnections24 } from "@awesome-flow/core/layout";
2276
- import { useEffect as useEffect20, useState as useState18 } from "react";
2277
- import {
2278
- useIncomingComputedData as useIncomingComputedData14,
2279
- useUpdateNodeComputedData as useUpdateNodeComputedData27,
2280
- useUpdateNodeData as useUpdateNodeData13
2281
- } from "@awesome-flow/core/hooks";
2282
- import { Group as Group13, NumberInput as NumberInput12, Stack as Stack13 } from "@mantine/core";
2283
- import { ScalePoint } from "libnoise-ts/module/transformer";
2284
- import { jsx as jsx29, jsxs as jsxs25 } from "react/jsx-runtime";
2285
- function NoiseScalePointNode({
2286
- id,
2287
- selected,
2288
- data,
2289
- type
2290
- }) {
2291
- const [xScale, setXScale] = useState18(data.xScale);
2292
- const [yScale, setYScale] = useState18(data.yScale);
2293
- const [zScale, setZScale] = useState18(data.zScale);
2294
- const incoming = useIncomingComputedData14(id);
2295
- const updateNodeData = useUpdateNodeData13();
2296
- const updateComputedData = useUpdateNodeComputedData27();
2297
- useEffect20(() => {
2298
- if (incoming?.length) {
2299
- const module = new ScalePoint(incoming[0].module, xScale, yScale, zScale);
2300
- updateComputedData(id, { module });
2301
- }
2302
- updateNodeData(id, { xScale, yScale, zScale });
2303
- }, [id, incoming, updateComputedData, updateNodeData, xScale, yScale, zScale]);
2304
- return /* @__PURE__ */ jsxs25(NodeContainer29, { id, selected, data, type, children: [
2305
- /* @__PURE__ */ jsxs25(Stack13, { children: [
2306
- /* @__PURE__ */ jsxs25(Group13, { children: [
2307
- "X Scale:",
2308
- /* @__PURE__ */ jsx29(
2309
- NumberInput12,
2310
- {
2311
- size: "xs",
2312
- w: 100,
2313
- value: xScale,
2314
- onChange: (e) => setXScale(Number(e)),
2315
- step: 0.01
2316
- }
2317
- )
2318
- ] }),
2319
- /* @__PURE__ */ jsxs25(Group13, { children: [
2320
- "Y Scale:",
2321
- /* @__PURE__ */ jsx29(
2322
- NumberInput12,
2323
- {
2324
- size: "xs",
2325
- w: 100,
2326
- value: yScale,
2327
- onChange: (e) => setYScale(Number(e)),
2328
- step: 0.01
2329
- }
2330
- )
2331
- ] }),
2332
- /* @__PURE__ */ jsxs25(Group13, { children: [
2333
- "Z Scale:",
2334
- /* @__PURE__ */ jsx29(
2335
- NumberInput12,
2336
- {
2337
- size: "xs",
2338
- w: 100,
2339
- value: zScale,
2340
- onChange: (e) => setZScale(Number(e)),
2341
- step: 0.01
2342
- }
2343
- )
2344
- ] })
2345
- ] }),
2346
- /* @__PURE__ */ jsx29(NodeTrackConnections24, { handles: data.handles, nodeId: id, type: "target" })
2347
- ] });
2348
- }
2349
- var noise_scale_point_node_default = NoiseScalePointNode;
2350
-
2351
- // src/nodes/transformers/noise-translate-point-node.tsx
2352
- import { NodeContainer as NodeContainer30, NodeTrackConnections as NodeTrackConnections25 } from "@awesome-flow/core/layout";
2353
- import { useEffect as useEffect21, useState as useState19 } from "react";
2354
- import {
2355
- useIncomingComputedData as useIncomingComputedData15,
2356
- useUpdateNodeComputedData as useUpdateNodeComputedData28,
2357
- useUpdateNodeData as useUpdateNodeData14
2358
- } from "@awesome-flow/core/hooks";
2359
- import { Group as Group14, NumberInput as NumberInput13, Stack as Stack14 } from "@mantine/core";
2360
- import { TranslatePoint } from "libnoise-ts/module/transformer";
2361
- import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
2362
- function NoiseTranslatePointNode({
2363
- id,
2364
- selected,
2365
- data,
2366
- type
2367
- }) {
2368
- const [translateX, setTranslateX] = useState19(data.translateX);
2369
- const [translateY, setTranslateY] = useState19(data.translateY);
2370
- const [translateZ, setTranslateZ] = useState19(data.translateZ);
2371
- const incoming = useIncomingComputedData15(id);
2372
- const updateNodeData = useUpdateNodeData14();
2373
- const updateComputedData = useUpdateNodeComputedData28();
2374
- useEffect21(() => {
2375
- if (incoming?.length) {
2376
- const module = new TranslatePoint(incoming[0].module, translateX, translateY, translateZ);
2377
- updateComputedData(id, { module });
2378
- }
2379
- updateNodeData(id, { translateX, translateY, translateZ });
2380
- }, [id, incoming, translateX, translateY, translateZ, updateComputedData, updateNodeData]);
2381
- return /* @__PURE__ */ jsxs26(NodeContainer30, { id, selected, data, type, children: [
2382
- /* @__PURE__ */ jsxs26(Stack14, { children: [
2383
- /* @__PURE__ */ jsxs26(Group14, { children: [
2384
- "Translate X:",
2385
- /* @__PURE__ */ jsx30(
2386
- NumberInput13,
2387
- {
2388
- size: "xs",
2389
- w: 100,
2390
- value: translateX,
2391
- onChange: (e) => setTranslateX(Number(e)),
2392
- step: 1
2393
- }
2394
- )
2395
- ] }),
2396
- /* @__PURE__ */ jsxs26(Group14, { children: [
2397
- "Translate Y:",
2398
- /* @__PURE__ */ jsx30(
2399
- NumberInput13,
2400
- {
2401
- size: "xs",
2402
- w: 100,
2403
- value: translateY,
2404
- onChange: (e) => setTranslateY(Number(e)),
2405
- step: 1
2406
- }
2407
- )
2408
- ] }),
2409
- /* @__PURE__ */ jsxs26(Group14, { children: [
2410
- "Translate Z:",
2411
- /* @__PURE__ */ jsx30(
2412
- NumberInput13,
2413
- {
2414
- size: "xs",
2415
- w: 100,
2416
- value: translateZ,
2417
- onChange: (e) => setTranslateZ(Number(e)),
2418
- step: 1
2419
- }
2420
- )
2421
- ] })
2422
- ] }),
2423
- /* @__PURE__ */ jsx30(NodeTrackConnections25, { handles: data.handles, nodeId: id, type: "target" })
2424
- ] });
2425
- }
2426
- var noise_translate_point_node_default = NoiseTranslatePointNode;
2427
-
2428
- // src/nodes/transformers/noise-turbulence-node .tsx
2429
- import { NodeContainer as NodeContainer31, NodeTrackConnections as NodeTrackConnections26 } from "@awesome-flow/core/layout";
2430
- import { useCallback as useCallback20, useEffect as useEffect22, useState as useState20 } from "react";
2431
- import { useIncomingComputedData as useIncomingComputedData16, useUpdateNodeComputedData as useUpdateNodeComputedData29 } from "@awesome-flow/core/hooks";
2432
- import { Turbulence } from "libnoise-ts/module/transformer";
2433
- import { NodePropertyVariables as NodePropertyVariables7 } from "@awesome-flow/core/components";
2434
- import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
2435
- function NoiseTurbulenceNode({
2436
- id,
2437
- selected,
2438
- data,
2439
- type
2440
- }) {
2441
- const [properties, setProperties] = useState20(null);
2442
- const incoming = useIncomingComputedData16(id);
2443
- const updateComputedData = useUpdateNodeComputedData29();
2444
- const onPropertiesChange = useCallback20((props) => {
2445
- setProperties(props);
2446
- }, []);
2447
- useEffect22(() => {
2448
- if (incoming?.length && properties) {
2449
- const module = new Turbulence(
2450
- incoming[0].module,
2451
- properties.frequency.value,
2452
- properties.power.value,
2453
- properties.roughness.value,
2454
- properties.seed.value
2455
- );
2456
- updateComputedData(id, { module });
2457
- }
2458
- }, [id, incoming, properties]);
2459
- return /* @__PURE__ */ jsxs27(NodeContainer31, { id, selected, data, type, children: [
2460
- /* @__PURE__ */ jsx31(NodePropertyVariables7, { data, nodeId: id, onPropertiesChange }),
2461
- /* @__PURE__ */ jsx31(NodeTrackConnections26, { handles: data.handles, nodeId: id, type: "target" })
2462
- ] });
2463
- }
2464
- var noise_turbulence_node_default = NoiseTurbulenceNode;
2465
-
2466
- // src/templates/generators/noise-checkerboard-template.ts
2467
- import { Position } from "@xyflow/system";
2468
-
2469
- // src/abstract/templates.ts
2470
- var NoiseTemplateGroup = /* @__PURE__ */ ((NoiseTemplateGroup2) => {
2471
- NoiseTemplateGroup2["positions"] = "Positions";
2472
- NoiseTemplateGroup2["output"] = "Output";
2473
- NoiseTemplateGroup2["noiseGenerators"] = "Noise Generators";
2474
- NoiseTemplateGroup2["noiseModifiers"] = "Noise Modifiers";
2475
- NoiseTemplateGroup2["noiseSelectors"] = "Noise Selectors";
2476
- NoiseTemplateGroup2["noiseTransformers"] = "Noise Transformers";
2477
- return NoiseTemplateGroup2;
2478
- })(NoiseTemplateGroup || {});
2479
-
2480
- // src/templates/generators/noise-checkerboard-template.ts
2481
- var NoiseCheckerboardNodeTemplateFactory = class {
2482
- template = {
2483
- type: "noise-checkerboard" /* noiseCheckerboard */,
2484
- group: "Noise Generators" /* noiseGenerators */,
2485
- data: {
2486
- title: "Checkerboard Noise"
2487
- },
2488
- handles: [
2489
- {
2490
- position: Position.Right,
2491
- dataType: "module" /* module */,
2492
- connection: "source"
2493
- }
2494
- ]
2495
- };
2496
- };
2497
-
2498
- // src/templates/generators/noise-const-template.ts
2499
- import { Position as Position2 } from "@xyflow/system";
2500
- var NoiseConstNodeTemplateFactory = class {
2501
- template = {
2502
- type: "noise-constant" /* noiseConst */,
2503
- group: "Noise Generators" /* noiseGenerators */,
2504
- data: {
2505
- title: "Const Value Noise",
2506
- noise: 0,
2507
- min: -1,
2508
- max: 1
2509
- },
2510
- handles: [
2511
- {
2512
- position: Position2.Right,
2513
- dataType: "module" /* module */,
2514
- connection: "source"
2515
- }
2516
- ]
2517
- };
2518
- };
2519
-
2520
- // src/templates/generators/noise-cylinders-template.ts
2521
- import { CoreHandleType } from "@awesome-flow/core/abstract";
2522
- import { Position as Position3 } from "@xyflow/system";
2523
- var NoiseCylindersNodeTemplateFactory = class {
2524
- template = {
2525
- type: "noise-cylinders" /* noiseCylinders */,
2526
- group: "Noise Generators" /* noiseGenerators */,
2527
- data: {
2528
- title: "Cylinders Noise",
2529
- frequency: 0.1
2530
- },
2531
- handles: [
2532
- {
2533
- position: Position3.Left,
2534
- dataType: CoreHandleType.variableProperty,
2535
- connection: "target"
2536
- },
2537
- {
2538
- position: Position3.Right,
2539
- dataType: "module" /* module */,
2540
- connection: "source"
2541
- }
2542
- ]
2543
- };
2544
- };
2545
-
2546
- // src/templates/generators/noise-perlin-template.ts
2547
- import { CoreHandleType as CoreHandleType2 } from "@awesome-flow/core/abstract";
2548
- import { Position as Position4 } from "@xyflow/system";
2549
- var NoisePerlinNodeTemplateFactory = class {
2550
- template = {
2551
- type: "noise-perlin" /* noisePerlin */,
2552
- group: "Noise Generators" /* noiseGenerators */,
2553
- data: {
2554
- title: "Perlin Noise",
2555
- frequency: 0.1,
2556
- lacunarity: 2,
2557
- octaves: 5,
2558
- persistence: 0.5,
2559
- seed: 0
2560
- },
2561
- handles: [
2562
- {
2563
- position: Position4.Left,
2564
- dataType: CoreHandleType2.variableProperty,
2565
- connection: "target"
2566
- },
2567
- {
2568
- position: Position4.Right,
2569
- dataType: "module" /* module */,
2570
- connection: "source"
2571
- }
2572
- ]
2573
- };
2574
- };
2575
-
2576
- // src/templates/generators/noise-ridgedmulti-template.ts
2577
- import { CoreHandleType as CoreHandleType3 } from "@awesome-flow/core/abstract";
2578
- import { Position as Position5 } from "@xyflow/system";
2579
- var NoiseRidgedMultiNodeTemplateFactory = class {
2580
- template = {
2581
- type: "noise-ridged-multi" /* noiseRidgedMulti */,
2582
- group: "Noise Generators" /* noiseGenerators */,
2583
- data: {
2584
- title: "Ridged Multi Noise",
2585
- frequency: 0.1,
2586
- lacunarity: 2,
2587
- octaves: 6,
2588
- offset: 1,
2589
- gain: 2,
2590
- seed: 0
2591
- },
2592
- handles: [
2593
- {
2594
- position: Position5.Left,
2595
- dataType: CoreHandleType3.variableProperty,
2596
- connection: "target"
2597
- },
2598
- {
2599
- position: Position5.Right,
2600
- dataType: "module" /* module */,
2601
- connection: "source"
2602
- }
2603
- ]
2604
- };
2605
- };
2606
-
2607
- // src/templates/generators/noise-simplex-template.ts
2608
- import {
2609
- CoreHandleType as CoreHandleType4
2610
- } from "@awesome-flow/core/abstract";
2611
- import { Position as Position6 } from "@xyflow/system";
2612
- var NoiseSimplexNodeTemplateFactory = class {
2613
- template = {
2614
- type: "noise-simplex" /* noiseSimplex */,
2615
- group: "Noise Generators" /* noiseGenerators */,
2616
- data: {
2617
- title: "Simplex Noise"
2618
- },
2619
- handles: [
2620
- {
2621
- position: Position6.Left,
2622
- dataType: CoreHandleType4.variableProperty,
2623
- connection: "target"
2624
- },
2625
- {
2626
- position: Position6.Right,
2627
- dataType: "module" /* module */,
2628
- connection: "source"
2629
- }
2630
- ]
2631
- };
2632
- };
2633
-
2634
- // src/templates/generators/noise-spheres-template.ts
2635
- import { CoreHandleType as CoreHandleType5 } from "@awesome-flow/core/abstract";
2636
- import { Position as Position7 } from "@xyflow/system";
2637
- var NoiseSpheresNodeTemplateFactory = class {
2638
- template = {
2639
- type: "noise-spheres" /* noiseSpheres */,
2640
- group: "Noise Generators" /* noiseGenerators */,
2641
- data: {
2642
- title: "Spheres Noise",
2643
- frequency: 0.1
2644
- },
2645
- handles: [
2646
- {
2647
- position: Position7.Left,
2648
- dataType: CoreHandleType5.variableProperty,
2649
- connection: "target"
2650
- },
2651
- {
2652
- position: Position7.Right,
2653
- dataType: "module" /* module */,
2654
- connection: "source"
2655
- }
2656
- ]
2657
- };
2658
- };
2659
-
2660
- // src/templates/generators/noise-voronoi-template.ts
2661
- import { CoreHandleType as CoreHandleType6 } from "@awesome-flow/core/abstract";
2662
- import { Position as Position8 } from "@xyflow/system";
2663
- var NoiseVoronoiNodeTemplateFactory = class {
2664
- template = {
2665
- type: "noise-voronoi" /* noiseVoronoi */,
2666
- group: "Noise Generators" /* noiseGenerators */,
2667
- data: {
2668
- title: "Voronoi Noise",
2669
- frequency: 0.1,
2670
- displacement: 1,
2671
- distance: true,
2672
- seed: 0
2673
- },
2674
- handles: [
2675
- {
2676
- position: Position8.Left,
2677
- dataType: CoreHandleType6.variableProperty,
2678
- connection: "target"
2679
- },
2680
- {
2681
- position: Position8.Right,
2682
- dataType: "module" /* module */,
2683
- connection: "source"
2684
- }
2685
- ]
2686
- };
2687
- };
2688
-
2689
- // src/templates/generators/position-const-template.ts
2690
- import { Position as Position9 } from "@xyflow/system";
2691
- var PositionConstNodeTemplateFactory = class {
2692
- template = {
2693
- type: "position" /* position */,
2694
- group: "Positions" /* positions */,
2695
- data: {
2696
- title: "Position Output",
2697
- position: { x: 0, y: 0, z: 0 }
2698
- },
2699
- handles: [
2700
- {
2701
- position: Position9.Right,
2702
- dataType: "position" /* position */,
2703
- connection: "source"
2704
- }
2705
- ]
2706
- };
2707
- };
2708
-
2709
- // src/templates/generators/position-grid-template.ts
2710
- import { Position as Position10 } from "@xyflow/system";
2711
- var PositionGridNodeTemplateFactory = class {
2712
- template = {
2713
- type: "grid" /* grid */,
2714
- group: "Positions" /* positions */,
2715
- data: {
2716
- title: "Grid Output",
2717
- center: { x: 0, y: 0, z: 0 },
2718
- radius: 1
2719
- },
2720
- handles: [
2721
- {
2722
- position: Position10.Right,
2723
- dataType: "position" /* position */,
2724
- connection: "source"
2725
- }
2726
- ]
2727
- };
2728
- };
2729
-
2730
- // src/templates/modifiers/noise-normalize-template.ts
2731
- import { IDGenerator } from "@awesome-flow/core/utils";
2732
- import { Position as Position11 } from "@xyflow/system";
2733
- var NoiseNormalizeNodeTemplateFactory = class {
2734
- template = {
2735
- id: IDGenerator.template(),
2736
- type: "noise-normalize" /* noiseNormalize */,
2737
- group: "Noise Modifiers" /* noiseModifiers */,
2738
- data: {
2739
- title: "Normalize Noise",
2740
- intervalStart: -1,
2741
- intervalEnd: 1
2742
- },
2743
- handles: [
2744
- {
2745
- position: Position11.Left,
2746
- dataType: "module" /* module */,
2747
- connection: "target",
2748
- maxConnections: 1
2749
- },
2750
- {
2751
- position: Position11.Right,
2752
- dataType: "module" /* module */,
2753
- connection: "source"
2754
- }
2755
- ]
2756
- };
2757
- };
2758
-
2759
- // src/templates/output/noise-logger-template.ts
2760
- import { Position as Position12 } from "@xyflow/system";
2761
- var NoiseLoggerNodeTemplateFactory = class {
2762
- template = {
2763
- type: "noise-logger" /* noiseLogger */,
2764
- group: "Output" /* output */,
2765
- data: {
2766
- title: "Noise Logger"
2767
- },
2768
- handles: [
2769
- {
2770
- position: Position12.Left,
2771
- dataType: "noise" /* noise */,
2772
- connection: "target"
2773
- }
2774
- ]
2775
- };
2776
- };
2777
-
2778
- // src/templates/output/noise-raw-texture-template.ts
2779
- import { Position as Position13 } from "@xyflow/system";
2780
- var NoiseRawTextureTemplateFactory = class {
2781
- template = {
2782
- type: "texture-data" /* textureData */,
2783
- group: "Output" /* output */,
2784
- data: {
2785
- title: "Texture Data"
2786
- },
2787
- handles: [
2788
- {
2789
- position: Position13.Left,
2790
- dataType: "noise" /* noise */,
2791
- connection: "target",
2792
- maxConnections: 1
2793
- },
2794
- {
2795
- position: Position13.Right,
2796
- dataType: "texture" /* texture */,
2797
- connection: "source"
2798
- }
2799
- ]
2800
- };
2801
- };
2802
-
2803
- // src/templates/output/position-logger-template.ts
2804
- import { Position as Position14 } from "@xyflow/system";
2805
- var PositionLoggerNodeTemplateFactory = class {
2806
- template = {
2807
- type: "position-logger" /* positionLogger */,
2808
- group: "Positions" /* positions */,
2809
- data: {
2810
- title: "Position Logger"
2811
- },
2812
- handles: [
2813
- {
2814
- position: Position14.Left,
2815
- dataType: "position" /* position */,
2816
- connection: "target"
2817
- }
2818
- ]
2819
- };
2820
- };
2821
-
2822
- // src/templates/modifiers/noise-combine-template.ts
2823
- import { Position as Position15 } from "@xyflow/system";
2824
- var NoiseCombineNodeTemplateFactory = class {
2825
- template = {
2826
- type: "noise-combiner" /* noiseCombine */,
2827
- group: "Noise Modifiers" /* noiseModifiers */,
2828
- data: {
2829
- title: "Combine Noise",
2830
- operation: "add" /* add */
2831
- },
2832
- handles: [
2833
- {
2834
- position: Position15.Left,
2835
- dataType: "module" /* module */,
2836
- connection: "target",
2837
- maxConnections: 2
2838
- },
2839
- {
2840
- position: Position15.Right,
2841
- dataType: "module" /* module */,
2842
- connection: "source"
2843
- }
2844
- ]
2845
- };
2846
- };
2847
-
2848
- // src/templates/modifiers/noise-clamp-template.ts
2849
- import { Position as Position16 } from "@xyflow/system";
2850
- var NoiseClampNodeTemplateFactory = class {
2851
- template = {
2852
- type: "noise-clamp" /* noiseClamp */,
2853
- group: "Noise Modifiers" /* noiseModifiers */,
2854
- data: {
2855
- title: "Clamp Noise",
2856
- lowerBound: -1,
2857
- upperBound: 1
2858
- },
2859
- handles: [
2860
- {
2861
- position: Position16.Left,
2862
- dataType: "module" /* module */,
2863
- connection: "target",
2864
- maxConnections: 1
2865
- },
2866
- {
2867
- position: Position16.Right,
2868
- dataType: "module" /* module */,
2869
- connection: "source"
2870
- }
2871
- ]
2872
- };
2873
- };
2874
-
2875
- // src/templates/modifiers/noise-abs-template.ts
2876
- import { Position as Position17 } from "@xyflow/system";
2877
- var NoiseAbsNodeTemplateFactory = class {
2878
- template = {
2879
- type: "noise-abs" /* noiseAbs */,
2880
- group: "Noise Modifiers" /* noiseModifiers */,
2881
- data: {
2882
- title: "Abs Noise"
2883
- },
2884
- handles: [
2885
- {
2886
- position: Position17.Left,
2887
- dataType: "module" /* module */,
2888
- connection: "target",
2889
- maxConnections: 1
2890
- },
2891
- {
2892
- position: Position17.Right,
2893
- dataType: "module" /* module */,
2894
- connection: "source"
2895
- }
2896
- ]
2897
- };
2898
- };
2899
-
2900
- // src/templates/output/noise-output-template.ts
2901
- import { Position as Position18 } from "@xyflow/system";
2902
- var NoiseOutputNodeTemplateFactory = class {
2903
- template = {
2904
- type: "noise-output" /* noiseOutput */,
2905
- group: "Output" /* output */,
2906
- data: {
2907
- title: "Noise Output"
2908
- },
2909
- handles: [
2910
- {
2911
- position: Position18.Left,
2912
- dataType: "position" /* position */,
2913
- connection: "target"
2914
- },
2915
- {
2916
- position: Position18.Left,
2917
- dataType: "module" /* module */,
2918
- connection: "target",
2919
- maxConnections: 1
2920
- },
2921
- {
2922
- position: Position18.Right,
2923
- dataType: "noise" /* noise */,
2924
- connection: "source"
2925
- }
2926
- ]
2927
- };
2928
- };
2929
-
2930
- // src/templates/modifiers/noise-curve-template.ts
2931
- import { CoreHandleType as CoreHandleType7 } from "@awesome-flow/core/abstract";
2932
- import { Position as Position19 } from "@xyflow/system";
2933
- var NoiseCurveNodeTemplateFactory = class {
2934
- template = {
2935
- type: "noise-curve" /* noiseCurve */,
2936
- group: "Noise Modifiers" /* noiseModifiers */,
2937
- data: {
2938
- title: "Noise Curve",
2939
- points: []
2940
- },
2941
- handles: [
2942
- {
2943
- position: Position19.Left,
2944
- dataType: "module" /* module */,
2945
- connection: "target",
2946
- maxConnections: 1
2947
- },
2948
- {
2949
- position: Position19.Left,
2950
- dataType: CoreHandleType7.variableProperty,
2951
- connection: "target"
2952
- },
2953
- {
2954
- position: Position19.Right,
2955
- dataType: "module" /* module */,
2956
- connection: "source"
2957
- }
2958
- ]
2959
- };
2960
- };
2961
-
2962
- // src/templates/modifiers/noise-exponent-template.ts
2963
- import { Position as Position20 } from "@xyflow/system";
2964
- var NoiseExponentNodeTemplateFactory = class {
2965
- template = {
2966
- type: "noise-exponent" /* noiseExponent */,
2967
- group: "Noise Modifiers" /* noiseModifiers */,
2968
- data: {
2969
- title: "Noise Exponent",
2970
- exponent: 1
2971
- },
2972
- handles: [
2973
- {
2974
- position: Position20.Left,
2975
- dataType: "module" /* module */,
2976
- connection: "target",
2977
- maxConnections: 1
2978
- },
2979
- {
2980
- position: Position20.Right,
2981
- dataType: "module" /* module */,
2982
- connection: "source"
2983
- }
2984
- ]
2985
- };
2986
- };
2987
-
2988
- // src/templates/modifiers/noise-invert-template.ts
2989
- import { Position as Position21 } from "@xyflow/system";
2990
- var NoiseInvertNodeTemplateFactory = class {
2991
- template = {
2992
- type: "noise-invert" /* noiseInvert */,
2993
- group: "Noise Modifiers" /* noiseModifiers */,
2994
- data: {
2995
- title: "Invert Noise"
2996
- },
2997
- handles: [
2998
- {
2999
- position: Position21.Left,
3000
- dataType: "module" /* module */,
3001
- connection: "target",
3002
- maxConnections: 1
3003
- },
3004
- {
3005
- position: Position21.Right,
3006
- dataType: "module" /* module */,
3007
- connection: "source"
3008
- }
3009
- ]
3010
- };
3011
- };
3012
-
3013
- // src/templates/modifiers/noise-scalebias-template.ts
3014
- import { Position as Position22 } from "@xyflow/system";
3015
- var NoiseScaleBiasNodeTemplateFactory = class {
3016
- template = {
3017
- type: "noise-scale-bias" /* noiseScaleBias */,
3018
- group: "Noise Modifiers" /* noiseModifiers */,
3019
- data: {
3020
- title: "Scale/Bias Noise",
3021
- scale: 1,
3022
- bias: 0
3023
- },
3024
- handles: [
3025
- {
3026
- position: Position22.Left,
3027
- dataType: "module" /* module */,
3028
- connection: "target",
3029
- maxConnections: 1
3030
- },
3031
- {
3032
- position: Position22.Right,
3033
- dataType: "module" /* module */,
3034
- connection: "source"
3035
- }
3036
- ]
3037
- };
3038
- };
3039
-
3040
- // src/templates/modifiers/noise-terrace-template.ts
3041
- import { Position as Position23 } from "@xyflow/system";
3042
- var NoiseTerraceNodeTemplateFactory = class {
3043
- template = {
3044
- type: "noise-terrace" /* noiseTerrace */,
3045
- group: "Noise Modifiers" /* noiseModifiers */,
3046
- data: {
3047
- title: "Noise Terrace",
3048
- points: []
3049
- },
3050
- handles: [
3051
- {
3052
- position: Position23.Left,
3053
- dataType: "module" /* module */,
3054
- connection: "target",
3055
- maxConnections: 1
3056
- },
3057
- {
3058
- position: Position23.Right,
3059
- dataType: "module" /* module */,
3060
- connection: "source"
3061
- }
3062
- ]
3063
- };
3064
- };
3065
-
3066
- // src/templates/selectors/noise-blend-template.ts
3067
- import { Position as Position24 } from "@xyflow/system";
3068
- var NoiseBlendNodeTemplateFactory = class {
3069
- template = {
3070
- type: "noise-blend" /* noiseBlend */,
3071
- group: "Noise Selectors" /* noiseSelectors */,
3072
- data: {
3073
- title: "Noise Blend"
3074
- },
3075
- handles: [
3076
- {
3077
- position: Position24.Left,
3078
- dataType: "module" /* module */,
3079
- connection: "target",
3080
- label: "Source Modules",
3081
- dataId: "source" /* source */,
3082
- maxConnections: 2,
3083
- minConnections: 2
3084
- },
3085
- {
3086
- position: Position24.Left,
3087
- dataType: "module" /* module */,
3088
- dataId: "control" /* control */,
3089
- connection: "target",
3090
- label: "Control Module",
3091
- maxConnections: 1
3092
- },
3093
- {
3094
- position: Position24.Right,
3095
- dataType: "module" /* module */,
3096
- dataId: "output" /* output */,
3097
- connection: "source"
3098
- }
3099
- ]
3100
- };
3101
- };
3102
-
3103
- // src/templates/selectors/noise-select-template.ts
3104
- import { Position as Position25 } from "@xyflow/system";
3105
- var NoiseSelectNodeTemplateFactory = class {
3106
- template = {
3107
- type: "noise-select" /* noiseSelect */,
3108
- group: "Noise Selectors" /* noiseSelectors */,
3109
- data: {
3110
- title: "Noise Select",
3111
- edgeFalloff: 0,
3112
- lowerBound: -1,
3113
- upperBound: 1
3114
- },
3115
- handles: [
3116
- {
3117
- position: Position25.Left,
3118
- dataType: "module" /* module */,
3119
- dataId: "source" /* source */,
3120
- connection: "target",
3121
- label: "Source Modules",
3122
- maxConnections: 2,
3123
- minConnections: 2
3124
- },
3125
- {
3126
- position: Position25.Left,
3127
- dataType: "module" /* module */,
3128
- dataId: "control" /* control */,
3129
- connection: "target",
3130
- label: "Control Module",
3131
- maxConnections: 1
3132
- },
3133
- {
3134
- position: Position25.Right,
3135
- dataType: "module" /* module */,
3136
- dataId: "output" /* output */,
3137
- connection: "source"
3138
- }
3139
- ]
3140
- };
3141
- };
3142
-
3143
- // src/templates/transformers/noise-displace-template.ts
3144
- import { Position as Position26 } from "@xyflow/system";
3145
- var NoiseDisplaceNodeTemplateFactory = class {
3146
- template = {
3147
- type: "noise-displace" /* noiseDisplace */,
3148
- group: "Noise Transformers" /* noiseTransformers */,
3149
- data: {
3150
- title: "Noise Displace"
3151
- },
3152
- handles: [
3153
- {
3154
- position: Position26.Left,
3155
- connection: "target",
3156
- label: "Source Module",
3157
- dataType: "module" /* module */,
3158
- dataId: "source" /* sourceModule */,
3159
- maxConnections: 1
3160
- },
3161
- {
3162
- position: Position26.Left,
3163
- connection: "target",
3164
- label: "X Module",
3165
- dataType: "module" /* module */,
3166
- dataId: "x-module" /* xModule */,
3167
- maxConnections: 1
3168
- },
3169
- {
3170
- position: Position26.Left,
3171
- connection: "target",
3172
- label: "Y Module",
3173
- dataType: "module" /* module */,
3174
- dataId: "y-module" /* yModule */,
3175
- maxConnections: 1
3176
- },
3177
- {
3178
- position: Position26.Left,
3179
- connection: "target",
3180
- label: "Z Module",
3181
- dataType: "module" /* module */,
3182
- dataId: "z-module" /* zModule */,
3183
- maxConnections: 1
3184
- },
3185
- {
3186
- position: Position26.Right,
3187
- dataType: "module" /* module */,
3188
- dataId: "output" /* output */,
3189
- connection: "source"
3190
- }
3191
- ]
3192
- };
3193
- };
3194
-
3195
- // src/templates/transformers/noise-rotate-point-template.ts
3196
- import { Position as Position27 } from "@xyflow/system";
3197
- var NoiseRotatePointNodeTemplateFactory = class {
3198
- template = {
3199
- type: "noise-rotate-point" /* noiseRotatePoint */,
3200
- group: "Noise Transformers" /* noiseTransformers */,
3201
- data: {
3202
- title: "Noise Rotate Point",
3203
- xAngle: 0,
3204
- yAngle: 0,
3205
- zAngle: 0
3206
- },
3207
- handles: [
3208
- {
3209
- position: Position27.Left,
3210
- dataType: "module" /* module */,
3211
- connection: "target",
3212
- label: "Source Module",
3213
- maxConnections: 1
3214
- },
3215
- {
3216
- position: Position27.Right,
3217
- dataType: "module" /* module */,
3218
- connection: "source"
3219
- }
3220
- ]
3221
- };
3222
- };
3223
-
3224
- // src/templates/transformers/noise-scale-point-template.ts
3225
- import { Position as Position28 } from "@xyflow/system";
3226
- var NoiseScalePointNodeTemplateFactory = class {
3227
- template = {
3228
- type: "noise-scale-point" /* noiseScalePoint */,
3229
- group: "Noise Transformers" /* noiseTransformers */,
3230
- data: {
3231
- title: "Noise Scale Point",
3232
- xScale: 1,
3233
- yScale: 1,
3234
- zScale: 1
3235
- },
3236
- handles: [
3237
- {
3238
- position: Position28.Left,
3239
- dataType: "module" /* module */,
3240
- connection: "target",
3241
- label: "Source Module",
3242
- maxConnections: 1
3243
- },
3244
- {
3245
- position: Position28.Right,
3246
- dataType: "module" /* module */,
3247
- connection: "source"
3248
- }
3249
- ]
3250
- };
3251
- };
3252
-
3253
- // src/templates/transformers/noise-translate-point-template.ts
3254
- import { Position as Position29 } from "@xyflow/system";
3255
- var NoiseTranslatePointNodeTemplateFactory = class {
3256
- template = {
3257
- type: "noise-translate-point" /* noiseTranslatePoint */,
3258
- group: "Noise Transformers" /* noiseTransformers */,
3259
- data: {
3260
- title: "Noise Translate Point",
3261
- translateX: 0,
3262
- translateY: 0,
3263
- translateZ: 0
3264
- },
3265
- handles: [
3266
- {
3267
- position: Position29.Left,
3268
- dataType: "module" /* module */,
3269
- connection: "target",
3270
- label: "Source Module",
3271
- maxConnections: 1
3272
- },
3273
- {
3274
- position: Position29.Right,
3275
- dataType: "module" /* module */,
3276
- connection: "source"
3277
- }
3278
- ]
3279
- };
3280
- };
3281
-
3282
- // src/templates/transformers/noise-turbulence-template.ts
3283
- import { CoreHandleType as CoreHandleType8 } from "@awesome-flow/core/abstract";
3284
- import { Position as Position30 } from "@xyflow/system";
3285
- var NoiseTurbulenceNodeTemplateFactory = class {
3286
- template = {
3287
- type: "noise-turbulence" /* noiseTurbulence */,
3288
- group: "Noise Transformers" /* noiseTransformers */,
3289
- data: {
3290
- title: "Noise Turbulence",
3291
- frequency: 1,
3292
- power: 1,
3293
- roughness: 1,
3294
- seed: 0
3295
- },
3296
- handles: [
3297
- {
3298
- position: Position30.Left,
3299
- dataType: "module" /* module */,
3300
- connection: "target",
3301
- label: "Source Module",
3302
- maxConnections: 1
3303
- },
3304
- {
3305
- position: Position30.Left,
3306
- dataType: CoreHandleType8.variableProperty,
3307
- label: "Variable Properties",
3308
- connection: "target"
3309
- },
3310
- {
3311
- position: Position30.Right,
3312
- dataType: "module" /* module */,
3313
- connection: "source"
3314
- }
3315
- ]
3316
- };
3317
- };
3318
-
3319
- // src/templates/generators/noise-billow-template.ts
3320
- import { CoreHandleType as CoreHandleType9 } from "@awesome-flow/core/abstract";
3321
- import { IDGenerator as IDGenerator2 } from "@awesome-flow/core/utils";
3322
- import { Position as Position31 } from "@xyflow/system";
3323
- var NoiseBillowNodeTemplateFactory = class {
3324
- template = {
3325
- id: IDGenerator2.template(),
3326
- type: "noise-billow" /* noiseBillow */,
3327
- group: "Noise Generators" /* noiseGenerators */,
3328
- data: {
3329
- title: "Billow Noise",
3330
- frequency: 0.1,
3331
- lacunarity: 2,
3332
- octaves: 5,
3333
- persistence: 0.5,
3334
- seed: 0
3335
- },
3336
- handles: [
3337
- {
3338
- position: Position31.Left,
3339
- dataType: CoreHandleType9.variableProperty,
3340
- connection: "target"
3341
- },
3342
- {
3343
- position: Position31.Right,
3344
- dataType: "module" /* module */,
3345
- connection: "source"
3346
- }
3347
- ]
3348
- };
3349
- };
3350
-
3351
- // src/templates/groups/module-group-template.ts
3352
- import {
3353
- CoreTemplateGroup
3354
- } from "@awesome-flow/core/abstract";
3355
- import { IDGenerator as IDGenerator3 } from "@awesome-flow/core/utils";
3356
- import { Position as Position32 } from "@xyflow/system";
3357
- var ModuleGroupNodeTemplateFactory = class {
3358
- template = {
3359
- id: IDGenerator3.template(),
3360
- type: "group-module" /* groupModule */,
3361
- group: CoreTemplateGroup.groups,
3362
- data: {
3363
- title: "Modules Group",
3364
- isGroup: true,
3365
- initialSize: {
3366
- width: 300,
3367
- height: 200
3368
- },
3369
- collapsedSize: {
3370
- width: 300,
3371
- height: 80
3372
- }
3373
- },
3374
- handles: [
3375
- {
3376
- position: Position32.Bottom,
3377
- dataType: "module" /* module */,
3378
- connection: "target",
3379
- maxConnections: 1,
3380
- hideOnCollapse: true
3381
- },
3382
- {
3383
- position: Position32.Right,
3384
- dataType: "module" /* module */,
3385
- connection: "source"
3386
- }
3387
- ]
3388
- };
3389
- };
3390
-
3391
- // src/nodes/groups/module-group-node.tsx
3392
- import { NodeContainer as NodeContainer32, NodeCollapse, NodeTrackConnections as NodeTrackConnections27 } from "@awesome-flow/core/layout";
3393
- import { NodeResizer, useStore, useUpdateNodeInternals } from "@xyflow/react";
3394
- import { useCallback as useCallback21, useEffect as useEffect23, useMemo as useMemo12 } from "react";
3395
- import { shallow } from "zustand/shallow";
3396
- import { Badge, Group as Group15 } from "@mantine/core";
3397
- import {
3398
- useFlowStore,
3399
- useIncomingComputedData as useIncomingComputedData17,
3400
- useInteractiveStore,
3401
- useUpdateNodeComputedData as useUpdateNodeComputedData30
3402
- } from "@awesome-flow/core/hooks";
3403
- import { jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
3404
- function ModuleGroupNode({
3405
- id,
3406
- selected,
3407
- data,
3408
- type,
3409
- width,
3410
- height
3411
- }) {
3412
- const updateNodeInternals = useUpdateNodeInternals();
3413
- const triggerNodeChanges = useStore((s) => s.triggerNodeChanges);
3414
- const { groupNodes, setGroupCollapsed } = useFlowStore(
3415
- useCallback21(
3416
- (state) => ({ groupNodes: state.groups[id], setGroupCollapsed: state.setGroupCollapsed }),
3417
- []
3418
- )
3419
- );
3420
- const intersectingNode = useInteractiveStore(
3421
- useCallback21((state) => state.nodeIntersectionTargets[id], [id]),
3422
- shallow
3423
- );
3424
- useEffect23(() => {
3425
- updateNodeInternals(id);
3426
- }, [width, height]);
3427
- useEffect23(() => {
3428
- triggerNodeChanges([
3429
- {
3430
- id,
3431
- type: "select",
3432
- selected: !!intersectingNode
3433
- }
3434
- ]);
3435
- }, [intersectingNode]);
3436
- const onCollapsed = useCallback21((collapsed) => {
3437
- setGroupCollapsed(id, collapsed);
3438
- }, []);
3439
- const size = useMemo12(() => {
3440
- return {
3441
- width: data.initialSize?.width || 100,
3442
- height: data.initialSize?.height || 50
3443
- };
3444
- }, [data.initialSize]);
3445
- const incomingModules = useIncomingComputedData17(id);
3446
- const updateComputedData = useUpdateNodeComputedData30();
3447
- useEffect23(() => {
3448
- if (incomingModules?.length) {
3449
- const { module } = incomingModules[0];
3450
- updateComputedData(id, { module });
3451
- }
3452
- }, [incomingModules]);
3453
- return /* @__PURE__ */ jsxs28(
3454
- NodeContainer32,
3455
- {
3456
- id,
3457
- selected,
3458
- data,
3459
- title: /* @__PURE__ */ jsx32(Group15, { justify: "space-between", children: /* @__PURE__ */ jsxs28(Group15, { gap: "xs", children: [
3460
- /* @__PURE__ */ jsx32(Badge, { size: "xs", variant: "outline", radius: "xs", color: "gray", children: groupNodes?.length || 0 }),
3461
- /* @__PURE__ */ jsx32(NodeCollapse, { nodeId: id, isCollapsed: data.isCollapsed, onCollapsed })
3462
- ] }) }),
3463
- type,
3464
- children: [
3465
- /* @__PURE__ */ jsx32(
3466
- NodeResizer,
3467
- {
3468
- nodeId: id,
3469
- minWidth: size.width,
3470
- minHeight: size.height,
3471
- isVisible: selected && !data.isCollapsed
3472
- }
3473
- ),
3474
- /* @__PURE__ */ jsx32(NodeTrackConnections27, { handles: data.handles, nodeId: id, type: "target" })
3475
- ]
3476
- }
3477
- );
3478
- }
3479
- var module_group_node_default = ModuleGroupNode;
3480
-
3481
- // src/abstract/node-types.ts
3482
- var NoiseNodeType = /* @__PURE__ */ ((NoiseNodeType2) => {
3483
- NoiseNodeType2["position"] = "position";
3484
- NoiseNodeType2["grid"] = "grid";
3485
- NoiseNodeType2["textureData"] = "texture-data";
3486
- NoiseNodeType2["groupModule"] = "group-module";
3487
- NoiseNodeType2["positionLogger"] = "position-logger";
3488
- NoiseNodeType2["noiseLogger"] = "noise-logger";
3489
- NoiseNodeType2["noiseOutput"] = "noise-output";
3490
- NoiseNodeType2["noiseConst"] = "noise-constant";
3491
- NoiseNodeType2["noiseSimplex"] = "noise-simplex";
3492
- NoiseNodeType2["noiseBillow"] = "noise-billow";
3493
- NoiseNodeType2["noiseCheckerboard"] = "noise-checkerboard";
3494
- NoiseNodeType2["noiseNormalize"] = "noise-normalize";
3495
- NoiseNodeType2["noiseCylinders"] = "noise-cylinders";
3496
- NoiseNodeType2["noisePerlin"] = "noise-perlin";
3497
- NoiseNodeType2["noiseRidgedMulti"] = "noise-ridged-multi";
3498
- NoiseNodeType2["noiseSpheres"] = "noise-spheres";
3499
- NoiseNodeType2["noiseVoronoi"] = "noise-voronoi";
3500
- NoiseNodeType2["noiseCombine"] = "noise-combiner";
3501
- NoiseNodeType2["noiseClamp"] = "noise-clamp";
3502
- NoiseNodeType2["noiseAbs"] = "noise-abs";
3503
- NoiseNodeType2["noiseCurve"] = "noise-curve";
3504
- NoiseNodeType2["noiseExponent"] = "noise-exponent";
3505
- NoiseNodeType2["noiseInvert"] = "noise-invert";
3506
- NoiseNodeType2["noiseScaleBias"] = "noise-scale-bias";
3507
- NoiseNodeType2["noiseTerrace"] = "noise-terrace";
3508
- NoiseNodeType2["noiseBlend"] = "noise-blend";
3509
- NoiseNodeType2["noiseSelect"] = "noise-select";
3510
- NoiseNodeType2["noiseDisplace"] = "noise-displace";
3511
- NoiseNodeType2["noiseRotatePoint"] = "noise-rotate-point";
3512
- NoiseNodeType2["noiseScalePoint"] = "noise-scale-point";
3513
- NoiseNodeType2["noiseTranslatePoint"] = "noise-translate-point";
3514
- NoiseNodeType2["noiseTurbulence"] = "noise-turbulence";
3515
- return NoiseNodeType2;
3516
- })(NoiseNodeType || {});
3517
- var noiseNodeTypes = {
3518
- ["group-module" /* groupModule */]: module_group_node_default,
3519
- ["position" /* position */]: position_const_node_default,
3520
- ["grid" /* grid */]: position_grid_node_default,
3521
- ["noise-output" /* noiseOutput */]: noise_output_node_default,
3522
- ["texture-data" /* textureData */]: noise_raw_texture_node_default,
3523
- ["noise-logger" /* noiseLogger */]: noise_logger_node_default,
3524
- ["position-logger" /* positionLogger */]: positions_logger_node_default,
3525
- ["noise-constant" /* noiseConst */]: noise_const_node_default,
3526
- ["noise-billow" /* noiseBillow */]: noise_billow_node_default,
3527
- ["noise-simplex" /* noiseSimplex */]: noise_simplex_node_default,
3528
- ["noise-checkerboard" /* noiseCheckerboard */]: noise_checkerboard_node_default,
3529
- ["noise-cylinders" /* noiseCylinders */]: noise_cylinders_node_default,
3530
- ["noise-perlin" /* noisePerlin */]: noise_perlin_node_default,
3531
- ["noise-ridged-multi" /* noiseRidgedMulti */]: noise_ridgedmulti_node_default,
3532
- ["noise-spheres" /* noiseSpheres */]: noise_spheres_node_default,
3533
- ["noise-voronoi" /* noiseVoronoi */]: noise_voronoi_node_default,
3534
- ["noise-combiner" /* noiseCombine */]: noise_combine_node_default,
3535
- ["noise-clamp" /* noiseClamp */]: noise_clamp_node_default,
3536
- ["noise-abs" /* noiseAbs */]: noise_abs_node_default,
3537
- ["noise-normalize" /* noiseNormalize */]: noise_normalize_node_default,
3538
- ["noise-curve" /* noiseCurve */]: noise_curve_node_default,
3539
- ["noise-exponent" /* noiseExponent */]: noise_exponent_node_default,
3540
- ["noise-invert" /* noiseInvert */]: noise_invert_node_default,
3541
- ["noise-scale-bias" /* noiseScaleBias */]: noise_scale_bias_node_default,
3542
- ["noise-terrace" /* noiseTerrace */]: noise_terrace_node_default,
3543
- ["noise-blend" /* noiseBlend */]: noise_blend_node_default,
3544
- ["noise-select" /* noiseSelect */]: noise_select_node_default,
3545
- ["noise-displace" /* noiseDisplace */]: noise_displace_node_default,
3546
- ["noise-rotate-point" /* noiseRotatePoint */]: noise_rotate_point_node_default,
3547
- ["noise-scale-point" /* noiseScalePoint */]: noise_scale_point_node_default,
3548
- ["noise-translate-point" /* noiseTranslatePoint */]: noise_translate_point_node_default,
3549
- ["noise-turbulence" /* noiseTurbulence */]: noise_turbulence_node_default
3550
- };
3551
- var noiseNodeTemplates = {
3552
- ["noise-output" /* noiseOutput */]: new NoiseOutputNodeTemplateFactory(),
3553
- ["noise-simplex" /* noiseSimplex */]: new NoiseSimplexNodeTemplateFactory(),
3554
- ["noise-billow" /* noiseBillow */]: new NoiseBillowNodeTemplateFactory(),
3555
- ["noise-checkerboard" /* noiseCheckerboard */]: new NoiseCheckerboardNodeTemplateFactory(),
3556
- ["noise-normalize" /* noiseNormalize */]: new NoiseNormalizeNodeTemplateFactory(),
3557
- ["noise-logger" /* noiseLogger */]: new NoiseLoggerNodeTemplateFactory(),
3558
- ["noise-constant" /* noiseConst */]: new NoiseConstNodeTemplateFactory(),
3559
- ["position" /* position */]: new PositionConstNodeTemplateFactory(),
3560
- ["position-logger" /* positionLogger */]: new PositionLoggerNodeTemplateFactory(),
3561
- ["grid" /* grid */]: new PositionGridNodeTemplateFactory(),
3562
- ["texture-data" /* textureData */]: new NoiseRawTextureTemplateFactory(),
3563
- ["noise-cylinders" /* noiseCylinders */]: new NoiseCylindersNodeTemplateFactory(),
3564
- ["noise-perlin" /* noisePerlin */]: new NoisePerlinNodeTemplateFactory(),
3565
- ["noise-ridged-multi" /* noiseRidgedMulti */]: new NoiseRidgedMultiNodeTemplateFactory(),
3566
- ["noise-spheres" /* noiseSpheres */]: new NoiseSpheresNodeTemplateFactory(),
3567
- ["noise-voronoi" /* noiseVoronoi */]: new NoiseVoronoiNodeTemplateFactory(),
3568
- ["noise-combiner" /* noiseCombine */]: new NoiseCombineNodeTemplateFactory(),
3569
- ["noise-clamp" /* noiseClamp */]: new NoiseClampNodeTemplateFactory(),
3570
- ["noise-abs" /* noiseAbs */]: new NoiseAbsNodeTemplateFactory(),
3571
- ["noise-curve" /* noiseCurve */]: new NoiseCurveNodeTemplateFactory(),
3572
- ["noise-exponent" /* noiseExponent */]: new NoiseExponentNodeTemplateFactory(),
3573
- ["noise-invert" /* noiseInvert */]: new NoiseInvertNodeTemplateFactory(),
3574
- ["noise-scale-bias" /* noiseScaleBias */]: new NoiseScaleBiasNodeTemplateFactory(),
3575
- ["noise-terrace" /* noiseTerrace */]: new NoiseTerraceNodeTemplateFactory(),
3576
- ["noise-blend" /* noiseBlend */]: new NoiseBlendNodeTemplateFactory(),
3577
- ["noise-select" /* noiseSelect */]: new NoiseSelectNodeTemplateFactory(),
3578
- ["noise-displace" /* noiseDisplace */]: new NoiseDisplaceNodeTemplateFactory(),
3579
- ["noise-rotate-point" /* noiseRotatePoint */]: new NoiseRotatePointNodeTemplateFactory(),
3580
- ["noise-scale-point" /* noiseScalePoint */]: new NoiseScalePointNodeTemplateFactory(),
3581
- ["noise-translate-point" /* noiseTranslatePoint */]: new NoiseTranslatePointNodeTemplateFactory(),
3582
- ["noise-turbulence" /* noiseTurbulence */]: new NoiseTurbulenceNodeTemplateFactory(),
3583
- ["group-module" /* groupModule */]: new ModuleGroupNodeTemplateFactory()
3584
- };
3585
- export {
3586
- DisplacementHandle,
3587
- NoiseCombineType,
3588
- NoiseHandleType,
3589
- NoiseNodeType,
3590
- NoiseSourceControlHandle,
3591
- NoiseTemplateGroup,
3592
- noiseCombineModuleMap,
3593
- noiseNodeTemplates,
3594
- noiseNodeTypes
3595
- };
1
+ var c=(a=>(a.texture="texture",a.noise="noise",a.position="position",a.module="module",a))(c||{}),be=(i=>(i.sourceModule="source",i.xModule="x-module",i.yModule="y-module",i.zModule="z-module",i.output="output",i))(be||{}),I=(p=>(p.source="source",p.control="control",p.output="output",p))(I||{});import{NodePropertyVariables as Ot}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Xt}from"@awesome-flow/core/hooks";import{NodeContainer as Yt,NodeTrackConnections as Zt}from"@awesome-flow/core/layout";import{Billow as qt}from"libnoise-simplex-ts";import{useCallback as $t}from"react";import{jsx as Ho,jsxs as Wt}from"react/jsx-runtime";function Kt({id:e,selected:m,data:o,type:p}){let a=Xt(),i=$t(t=>{let n=new qt;Object.keys(t).forEach(r=>n[r]=t[r].value),a(e,{module:n})},[e]);return Wt(Yt,{id:e,selected:m,data:o,type:p,children:[Ho(Ot,{data:o,nodeId:e,onPropertiesChange:i}),Ho(Zt,{handles:o.handles,nodeId:e,type:"target"})]})}var Me=Kt;import{useUpdateNodeComputedData as _t}from"@awesome-flow/core/hooks";import{NodeContainer as Jt}from"@awesome-flow/core/layout";import{Checkerboard as Qt}from"libnoise-simplex-ts";import{useEffect as jt}from"react";import{jsx as oa}from"react/jsx-runtime";function ea({id:e,selected:m,data:o,type:p}){let a=_t();return jt(()=>{let i=new Qt;a(e,{module:i})},[e]),oa(Jt,{id:e,selected:m,data:o,type:p})}var Se=ea;import{useUpdateNodeComputedData as ta,useUpdateNodeData as aa}from"@awesome-flow/core/hooks";import{NodeContainer as ra}from"@awesome-flow/core/layout";import{Group as Ao,NumberInput as we,Stack as ia}from"@mantine/core";import{Const as na}from"libnoise-simplex-ts";import{useEffect as pa,useState as ve}from"react";import{jsx as F,jsxs as Be}from"react/jsx-runtime";function sa({id:e,selected:m,data:o,type:p}){let[a,i]=ve(o.min),[t,n]=ve(o.max),[r,d]=ve(o.noise),N=aa(),s=ta();return pa(()=>{let u=new na(r);N(e,{noise:r,min:a,max:t}),s(e,{module:u})},[r,a,t]),F(ra,{id:e,selected:m,data:o,type:p,children:Be(ia,{children:[Be(Ao,{children:[F(we,{size:"xs",w:100,value:a,onChange:u=>i(Number(u))}),F(we,{size:"xs",w:100,value:t,onChange:u=>n(Number(u))})]}),Be(Ao,{children:["noise:",F(we,{size:"xs",value:r,onChange:u=>d(Number(u)),max:t,min:a,step:.1})]})]})})}var ke=sa;import{NodePropertyVariables as ma}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as da}from"@awesome-flow/core/hooks";import{NodeContainer as la,NodeTrackConnections as ua}from"@awesome-flow/core/layout";import{Cylinders as Na}from"libnoise-simplex-ts";import{useCallback as ca}from"react";import{jsx as Oo,jsxs as ya}from"react/jsx-runtime";function fa({id:e,selected:m,data:o,type:p}){let a=da(),i=ca(t=>{let n=new Na;Object.keys(t).forEach(r=>n[r]=t[r].value),a(e,{module:n})},[e]);return ya(la,{id:e,selected:m,data:o,type:p,children:[Oo(ma,{data:o,nodeId:e,onPropertiesChange:i}),Oo(ua,{handles:o.handles,nodeId:e,type:"target"})]})}var Ge=fa;import{NodePropertyVariables as Ca}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Ta}from"@awesome-flow/core/hooks";import{NodeContainer as ga,NodeTrackConnections as Da}from"@awesome-flow/core/layout";import{Perlin as ha}from"libnoise-simplex-ts";import{useCallback as Pa}from"react";import{jsx as Xo,jsxs as Ia}from"react/jsx-runtime";function xa({id:e,selected:m,data:o,type:p}){let a=Ta(),i=Pa(t=>{let n=new ha;Object.keys(t).forEach(r=>n[r]=t[r].value),a(e,{module:n})},[e,a]);return Ia(ga,{id:e,selected:m,data:o,type:p,children:[Xo(Ca,{data:o,nodeId:e,onPropertiesChange:i}),Xo(Da,{handles:o.handles,nodeId:e,type:"target"})]})}var ze=xa;import{NodePropertyVariables as ba}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Ma}from"@awesome-flow/core/hooks";import{NodeContainer as Sa,NodeTrackConnections as wa}from"@awesome-flow/core/layout";import{RidgedMulti as va}from"libnoise-simplex-ts";import{useCallback as Ba}from"react";import{jsx as Yo,jsxs as Ga}from"react/jsx-runtime";function ka({id:e,selected:m,data:o,type:p}){let a=Ma(),i=Ba(t=>{let n=new va;Object.keys(t).forEach(r=>n[r]=t[r].value),a(e,{module:n})},[]);return Ga(Sa,{id:e,selected:m,data:o,type:p,children:[Yo(ba,{data:o,nodeId:e,onPropertiesChange:i}),Yo(wa,{handles:o.handles,nodeId:e,type:"target"})]})}var Re=ka;import{NodePropertyVariables as za}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Ra}from"@awesome-flow/core/hooks";import{NodeContainer as Fa,NodeTrackConnections as La}from"@awesome-flow/core/layout";import{Spheres as Ua}from"libnoise-simplex-ts";import{useCallback as Va}from"react";import{jsx as Zo,jsxs as Ha}from"react/jsx-runtime";function Ea({id:e,selected:m,data:o,type:p}){let a=Ra(),i=Va(t=>{let n=new Ua;Object.keys(t).forEach(r=>n[r]=t[r].value),a(e,{module:n})},[]);return Ha(Fa,{id:e,selected:m,data:o,type:p,children:[Zo(za,{data:o,nodeId:e,onPropertiesChange:i}),Zo(La,{handles:o.handles,nodeId:e,type:"target"})]})}var Fe=Ea;import{NodePropertyVariables as Aa}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Oa}from"@awesome-flow/core/hooks";import{NodeContainer as Xa,NodeTrackConnections as Ya}from"@awesome-flow/core/layout";import{Voronoi as Za}from"libnoise-simplex-ts";import{useCallback as qa}from"react";import{jsx as qo,jsxs as Ka}from"react/jsx-runtime";function $a({id:e,selected:m,data:o,type:p}){let a=Oa(),i=qa(t=>{let n=new Za(t.frequency.value,t.displacement.value,t.distance.value,t.seed.value);a(e,{module:n})},[]);return Ka(Xa,{id:e,selected:m,data:o,type:p,children:[qo(Aa,{data:o,nodeId:e,onPropertiesChange:i}),qo(Ya,{handles:o.handles,nodeId:e,type:"target"})]})}var Le=$a;import{useUpdateNodeComputedData as Wa,useUpdateNodeData as _a}from"@awesome-flow/core/hooks";import{NodeContainer as Ja}from"@awesome-flow/core/layout";import{Group as Ue,NumberInput as Ve,Stack as Qa}from"@mantine/core";import{useEffect as ja,useState as Ee}from"react";import{jsx as L,jsxs as U}from"react/jsx-runtime";function er({id:e,selected:m,data:o,type:p}){let a=o.position??{x:0,y:0,z:0},[i,t]=Ee(a.x),[n,r]=Ee(a.y),[d,N]=Ee(a.z),s=_a(),u=Wa();return ja(()=>{let l={x:i,y:n,z:d};s(e,{position:l}),u(e,{positions:[l]})},[i,n,d]),L(Ja,{id:e,selected:m,data:o,type:p,children:U(Qa,{children:[U(Ue,{children:["x: ",L(Ve,{size:"xs",w:100,value:i,onChange:l=>t(Number(l))})]}),U(Ue,{children:["y: ",L(Ve,{size:"xs",w:100,value:n,onChange:l=>r(Number(l))})]}),U(Ue,{children:["z: ",L(Ve,{size:"xs",w:100,value:d,onChange:l=>N(Number(l))})]})]})})}var He=er;import{useUpdateNodeComputedData as or,useUpdateNodeData as tr}from"@awesome-flow/core/hooks";import{NodeContainer as ar}from"@awesome-flow/core/layout";import{Group as V,NumberInput as E,Stack as rr}from"@mantine/core";import{useEffect as Ae,useState as H}from"react";import{jsx as b,jsxs as M}from"react/jsx-runtime";function ir({id:e,selected:m,data:o,type:p}){let[a,i]=H(o.center?.x),[t,n]=H(o.center?.y),[r,d]=H(o.center?.z),[N,s]=H(o.radius),u=tr(),l=or();return Ae(()=>{u(e,{center:{x:a,y:t,z:r}})},[a,t,r]),Ae(()=>{u(e,{radius:N})},[N]),Ae(()=>{let T=[];for(let g=-N;g<N;g++)for(let x=-N;x<N;x++)T.push({x:a+g,y:t+x,z:r});l(e,{positions:T})},[a,t,r,N]),b(ar,{id:e,selected:m,data:o,type:p,children:M(rr,{children:[M(V,{children:["x: ",b(E,{size:"xs",w:100,value:a,onChange:T=>i(Number(T))})]}),M(V,{children:["y: ",b(E,{size:"xs",w:100,value:t,onChange:T=>n(Number(T))})]}),M(V,{children:["z: ",b(E,{size:"xs",w:100,value:r,onChange:T=>d(Number(T))})]}),M(V,{children:["r: ",b(E,{size:"xs",w:100,value:N,onChange:T=>s(Number(T))})]})]})})}var Oe=ir;import{useFlowStore as nr,useIncomingComputedData as pr,useInteractiveStore as sr,useUpdateNodeComputedData as mr}from"@awesome-flow/core/hooks";import{NodeCollapse as dr,NodeContainer as lr,NodeTrackConnections as ur}from"@awesome-flow/core/layout";import{Badge as Nr,Group as $o}from"@mantine/core";import{NodeResizer as cr,useStore as fr,useUpdateNodeInternals as yr}from"@xyflow/react";import{useCallback as Xe,useEffect as Ye,useMemo as Cr}from"react";import{shallow as Tr}from"zustand/shallow";import{jsx as S,jsxs as Ko}from"react/jsx-runtime";function gr({id:e,selected:m,data:o,type:p,width:a,height:i}){let t=yr(),n=fr(g=>g.triggerNodeChanges),{groupNodes:r,setGroupCollapsed:d}=nr(Xe(g=>({groupNodes:g.groups[e],setGroupCollapsed:g.setGroupCollapsed}),[])),N=sr(Xe(g=>g.nodeIntersectionTargets[e],[e]),Tr);Ye(()=>{t(e)},[a,i]),Ye(()=>{n([{id:e,type:"select",selected:!!N}])},[N]);let s=Xe(g=>{d(e,g)},[]),u=Cr(()=>({width:o.initialSize?.width||100,height:o.initialSize?.height||50}),[o.initialSize]),l=pr(e),T=mr();return Ye(()=>{if(l?.length){let{module:g}=l[0];T(e,{module:g})}},[l]),Ko(lr,{id:e,selected:m,data:o,title:S($o,{justify:"space-between",children:Ko($o,{gap:"xs",children:[S(Nr,{size:"xs",variant:"outline",radius:"xs",color:"gray",children:r?.length||0}),S(dr,{nodeId:e,isCollapsed:o.isCollapsed,onCollapsed:s})]})}),type:p,children:[S(cr,{nodeId:e,minWidth:u.width,minHeight:u.height,isVisible:m&&!o.isCollapsed}),S(ur,{handles:o.handles,nodeId:e,type:"target"})]})}var Ze=gr;import{useIncomingComputedData as Dr,useUpdateNodeComputedData as hr}from"@awesome-flow/core/hooks";import{NodeContainer as Pr,NodeTrackConnections as xr}from"@awesome-flow/core/layout";import{Abs as Ir}from"libnoise-simplex-ts";import{useEffect as br}from"react";import{jsx as Wo}from"react/jsx-runtime";function Mr({id:e,selected:m,data:o,type:p}){let a=Dr(e),i=hr();return br(()=>{if(a?.length>0){let t=new Ir(a[0].module);i(e,{module:t})}},[a]),Wo(Pr,{id:e,selected:m,data:o,type:p,children:Wo(xr,{handles:o.handles,nodeId:e,type:"target"})})}var qe=Mr;import{useIncomingComputedData as Sr,useUpdateNodeComputedData as wr,useUpdateNodeData as vr}from"@awesome-flow/core/hooks";import{NodeContainer as Br,NodeTrackConnections as kr}from"@awesome-flow/core/layout";import{Group as Gr,NumberInput as _o,Stack as zr}from"@mantine/core";import{Clamp as Rr}from"libnoise-simplex-ts";import{useEffect as Fr,useState as Jo}from"react";import{jsx as A,jsxs as Qo}from"react/jsx-runtime";function Lr({id:e,selected:m,data:o,type:p}){let[a,i]=Jo(o.lowerBound),[t,n]=Jo(o.upperBound),r=Sr(e),d=vr(),N=wr();return Fr(()=>{if(r?.length){let s=new Rr(r[0].module,a,t);N(e,{module:s})}d(e,{lowerBound:a,upperBound:t})},[r,a,t]),Qo(Br,{id:e,selected:m,data:o,type:p,children:[A(zr,{children:Qo(Gr,{children:[A(_o,{size:"xs",w:100,value:a,onChange:s=>i(Number(s)),step:.1}),A(_o,{size:"xs",w:100,value:t,onChange:s=>n(Number(s)),step:.1})]})}),A(kr,{handles:o.handles,nodeId:e,type:"target"})]})}var $e=Lr;import{useIncomingComputedData as Or,useUpdateNodeComputedData as Xr,useUpdateNodeData as Yr}from"@awesome-flow/core/hooks";import{NodeCombobox as Zr,NodeContainer as qr,NodeTrackConnections as $r}from"@awesome-flow/core/layout";import{IconAsterisk as Kr,IconChevronLeft as Wr,IconChevronRight as _r,IconChevronUp as Jr,IconPlus as Qr}from"@tabler/icons-react";import{useCallback as jr,useEffect as ei}from"react";import{Add as Ur,Max as Vr,Min as Er,Multiply as Hr,Power as Ar}from"libnoise-simplex-ts";var jo=(i=>(i.add="add",i.max="max",i.min="min",i.multiply="multiply",i.power="power",i))(jo||{}),et={add:Ur,max:Vr,min:Er,multiply:Hr,power:Ar};import{jsx as D,jsxs as ai}from"react/jsx-runtime";var oi={add:D(Qr,{}),min:D(Wr,{}),max:D(_r,{}),multiply:D(Kr,{}),power:D(Jr,{})};function ti({id:e,selected:m,data:o,type:p}){let a=Yr(),i=Xr(),t=Or(e);ei(()=>{let r=et[o.operation];if(t?.length>1){let d=new r(t[0].module,t[1].module);i(e,{module:d})}},[o.operation,t]);let n=jr(r=>{a(e,{operation:r})},[]);return ai(qr,{id:e,selected:m,data:o,type:p,children:[D(Zr,{options:oi,selected:o.operation,onChange:n,width:150}),D($r,{handles:o.handles,nodeId:e,type:"target"})]})}var Ke=ti;import{NodeState as ot}from"@awesome-flow/core/abstract";import{useIncomingComputedData as ri,useUpdateNodeComputedData as ii,useUpdateNodeData as ni}from"@awesome-flow/core/hooks";import{NodeContainer as pi,NodeTrackConnections as si}from"@awesome-flow/core/layout";import{ActionIcon as mi,Button as di,Group as li,NumberInput as tt,Space as ui}from"@mantine/core";import{FORM_INDEX as Ni,useForm as ci}from"@mantine/form";import{randomId as We}from"@mantine/hooks";import{IconX as fi}from"@tabler/icons-react";import{Curve as yi,Tuple as Ci}from"libnoise-simplex-ts";import{useCallback as Ti,useEffect as at,useState as gi}from"react";import{Fragment as hi,jsx as h,jsxs as _e}from"react/jsx-runtime";function Di({id:e,selected:m,data:o,type:p}){let a=ri(e),i=ni(),t=ii(),[n,r]=gi([]),d=ci({mode:"uncontrolled",initialValues:{points:[]},validateInputOnChange:[`points.${Ni}.input`],clearInputErrorOnChange:!0,validate:{points:{input:(s,u)=>{let l={};return u.points.forEach(T=>{l[T.input]=(l[T.input]||0)+1}),l[s]>1}}},onValuesChange:Ti(s=>{if(d.validate(),d.isValid()){let u=s.points.map(l=>({input:l.input,output:l.output}));r(u),i(e,{points:u})}},[])});at(()=>{let s=o.points?.length?o.points.map(u=>({input:u.input,output:u.output,key:We()})):[1,2,3,4].map(()=>({input:0,output:0,key:We()}));d.initialize({points:s})},[]),at(()=>{if(a?.length&&n?.length>=4){let s=new yi(a[0].module,n.map(u=>new Ci(u.input,u.output)));t(e,{module:s})}},[n,a]);let N=d.getValues().points.map((s,u)=>_e(li,{mt:"xs",children:[h(tt,{size:"xs",w:100,placeholder:"Input Value",...d.getInputProps(`points.${u}.input`),step:.1},d.key(`points.${u}.input`)),h(tt,{size:"xs",w:100,placeholder:"Output Value",...d.getInputProps(`points.${u}.output`),step:.1},d.key(`points.${u}.output`)),o.state===ot.edit&&n.length>4&&h(mi,{color:"red",variant:"outline",size:"sm",onClick:()=>d.removeListItem("points",u),children:h(fi,{size:"1rem"})})]},s.key));return _e(pi,{id:e,selected:m,type:p,data:o,children:[N,o.state===ot.edit&&_e(hi,{children:[h(ui,{h:10}),h(di,{variant:"outline",size:"xs",fullWidth:!0,onClick:()=>d.insertListItem("points",{input:0,output:0,key:We()}),children:"Add control point"})]}),h(si,{handles:o.handles,nodeId:e,type:"target"})]})}var Je=Di;import{useIncomingComputedData as Pi,useUpdateNodeComputedData as xi,useUpdateNodeData as Ii}from"@awesome-flow/core/hooks";import{NodeContainer as bi,NodeTrackConnections as Mi}from"@awesome-flow/core/layout";import{Group as Si,NumberInput as wi,Stack as vi}from"@mantine/core";import{Exponent as Bi}from"libnoise-simplex-ts";import{useEffect as ki,useState as Gi}from"react";import{jsx as Qe,jsxs as rt}from"react/jsx-runtime";function zi({id:e,selected:m,data:o,type:p}){let[a,i]=Gi(o.exponent),t=Pi(e),n=Ii(),r=xi();return ki(()=>{if(t?.length>0){let d=new Bi(t[0].module,a);r(e,{module:d})}n(e,{exponent:a})},[t,a]),rt(bi,{id:e,selected:m,data:o,type:p,children:[Qe(vi,{children:rt(Si,{children:["Exponent:",Qe(wi,{size:"xs",value:a,onChange:d=>i(Number(d)),step:.1})]})}),Qe(Mi,{handles:o.handles,nodeId:e,type:"target"})]})}var je=zi;import{useIncomingComputedData as Ri,useUpdateNodeComputedData as Fi}from"@awesome-flow/core/hooks";import{NodeContainer as Li,NodeTrackConnections as Ui}from"@awesome-flow/core/layout";import{Invert as Vi}from"libnoise-simplex-ts";import{useEffect as Ei}from"react";import{jsx as it}from"react/jsx-runtime";function Hi({id:e,selected:m,data:o,type:p}){let a=Ri(e),i=Fi();return Ei(()=>{if(a?.length>0){let t=new Vi(a[0].module);i(e,{module:t})}},[a]),it(Li,{id:e,selected:m,data:o,type:p,children:it(Ui,{handles:o.handles,nodeId:e,type:"target"})})}var eo=Hi;import{useIncomingComputedData as Xi,useUpdateNodeComputedData as Yi,useUpdateNodeData as Zi}from"@awesome-flow/core/hooks";import{NodeContainer as qi,NodeTrackConnections as $i}from"@awesome-flow/core/layout";import{Group as Ki,NumberInput as nt,Stack as Wi}from"@mantine/core";import{useEffect as _i,useState as pt}from"react";import{ModifierModule as Ai}from"libnoise-simplex-ts";var O=class extends Ai{constructor(o,p,a){super(o);this.lowerBound=p;this.upperBound=a}getValue(o,p,a){return Oi(this.sourceModule.getValue(o,p,a),this.lowerBound,this.upperBound)}};function Oi(e,m,o){return(e-m)/(o-m)}import{jsx as X,jsxs as st}from"react/jsx-runtime";function Ji({id:e,selected:m,data:o,type:p}){let[a,i]=pt(o.intervalStart),[t,n]=pt(o.intervalEnd),r=Xi(e),d=Zi(),N=Yi();return _i(()=>{if(r?.length){let s=r[0].module,u=new O(s,a,t);N(e,{module:u})}d(e,{intervalStart:a,intervalEnd:t})},[r,a,t]),st(qi,{id:e,selected:m,data:o,type:p,children:[X(Wi,{children:st(Ki,{children:[X(nt,{size:"xs",w:100,value:a,onChange:s=>i(Number(s))}),X(nt,{size:"xs",w:100,value:t,onChange:s=>n(Number(s))})]})}),X($i,{handles:o.handles,nodeId:e,type:"target"})]})}var oo=Ji;import{useIncomingComputedData as Qi,useUpdateNodeComputedData as ji,useUpdateNodeData as en}from"@awesome-flow/core/hooks";import{NodeContainer as on,NodeTrackConnections as tn}from"@awesome-flow/core/layout";import{Group as mt,NumberInput as dt,Stack as an}from"@mantine/core";import{ScaleBias as rn}from"libnoise-simplex-ts";import{useEffect as nn,useState as lt}from"react";import{jsx as to,jsxs as Y}from"react/jsx-runtime";function pn({id:e,selected:m,data:o,type:p}){let[a,i]=lt(o.scale),[t,n]=lt(o.bias),r=Qi(e),d=en(),N=ji();return nn(()=>{if(r?.length>0){let s=new rn(r[0].module,a,t);N(e,{module:s})}d(e,{scale:a,bias:t})},[r,a,t]),Y(on,{id:e,selected:m,data:o,type:p,children:[Y(an,{children:[Y(mt,{children:["Scale:",to(dt,{size:"xs",w:100,value:a,onChange:s=>i(Number(s)),step:.1})]}),Y(mt,{children:["Bias:",to(dt,{size:"xs",w:100,value:t,onChange:s=>n(Number(s)),step:.1})]})]}),to(tn,{handles:o.handles,nodeId:e,type:"target"})]})}var ao=pn;import{NodeState as ut}from"@awesome-flow/core/abstract";import{useIncomingComputedData as sn,useUpdateNodeComputedData as mn,useUpdateNodeData as dn}from"@awesome-flow/core/hooks";import{NodeContainer as ln,NodeTrackConnections as un}from"@awesome-flow/core/layout";import{ActionIcon as Nn,Button as cn,Group as fn,NumberInput as yn,Space as Cn}from"@mantine/core";import{FORM_INDEX as Tn,useForm as gn}from"@mantine/form";import{randomId as ro}from"@mantine/hooks";import{IconX as Dn}from"@tabler/icons-react";import{Terrace as hn}from"libnoise-simplex-ts";import{useCallback as Pn,useEffect as Nt,useState as xn}from"react";import{Fragment as bn,jsx as P,jsxs as io}from"react/jsx-runtime";function In({id:e,selected:m,data:o,type:p}){let a=sn(e),i=dn(),t=mn(),[n,r]=xn([]),d=gn({mode:"uncontrolled",initialValues:{points:[]},validateInputOnChange:[`points.${Tn}.input`],clearInputErrorOnChange:!0,onValuesChange:Pn(s=>{if(d.isValid()){let u=s.points.map(l=>l.value);r(u),i(e,{points:u})}d.validate()},[])});Nt(()=>{let s=o.points?.length?o.points.map(u=>({value:u,key:ro()})):[1,2].map(()=>({value:0,key:ro()}));d.initialize({points:s})},[]),Nt(()=>{if(a?.length&&n?.length>=2){let s=new hn(a[0].module,n);t(e,{module:s})}},[n,a]);let N=d.getValues().points.map((s,u)=>io(fn,{mt:"xs",children:[P(yn,{size:"xs",placeholder:"Input Value",...d.getInputProps(`points.${u}.value`),step:.1},d.key(`points.${u}.value`)),o.state===ut.edit&&n.length>2&&P(Nn,{color:"red",variant:"outline",size:"sm",onClick:()=>d.removeListItem("points",u),children:P(Dn,{size:"1rem"})})]},s.key));return io(ln,{id:e,selected:m,type:p,data:o,children:[N,o.state===ut.edit&&io(bn,{children:[P(Cn,{h:10}),P(cn,{variant:"outline",size:"xs",fullWidth:!0,onClick:()=>d.insertListItem("points",{value:0,key:ro()}),children:"Add control point"})]}),P(un,{handles:o.handles,nodeId:e,type:"target"})]})}var no=In;import{useIncomingComputedData as Mn}from"@awesome-flow/core/hooks";import{NodeContainer as Sn,NodeTrackConnections as wn}from"@awesome-flow/core/layout";import{Divider as vn,Stack as Bn,Text as ct}from"@mantine/core";import{useMemo as kn}from"react";import{jsx as so,jsxs as po}from"react/jsx-runtime";function Gn({id:e,selected:m,data:o,type:p}){let a=Mn(e),i=kn(()=>a?.map(t=>t.noise).flat(),[a]);return po(Sn,{id:e,selected:m,data:o,type:p,children:[po(ct,{children:["Size: ",i?.length||0]}),so(vn,{h:5}),so(Bn,{children:i?.map((t,n)=>po(ct,{children:[t.position?.x,":",t.position?.y,":",t.position?.z,": ",t.value]},n))}),so(wn,{handles:o.handles,nodeId:e,type:"target"})]})}var mo=Gn;import{HandlesIncomingDataStatus as zn}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Rn}from"@awesome-flow/core/hooks";import{NodeContainer as Fn,NodeTrackConnections as Ln}from"@awesome-flow/core/layout";import{Text as Un}from"@mantine/core";import{useCallback as Vn,useState as En}from"react";import{jsx as ft,jsxs as yt}from"react/jsx-runtime";function Hn({id:e,selected:m,data:o,type:p}){let[a,i]=En(0),t=Rn(),n=Vn(r=>{let d=r.position,N=r.module;if(d?.length&&N?.length&&N[0]?.module){let{module:s}=N[0],u=[];for(let l of d)for(let T of l.positions){let g=s.getValue(T.x,T.y,T.z);u.push({position:T,value:g})}t(e,{noise:u,module:s}),i(u.length)}},[]);return yt(Fn,{id:e,selected:m,data:o,type:p,children:[ft(zn,{nodeId:e,handles:o.handles,handleKey:"dataType",onDataUpdated:n,type:"target",resetComputedData:!0}),yt(Un,{mt:5,children:["Noise points: ",a]}),ft(Ln,{handles:o.handles,nodeId:e,type:"target"})]})}var lo=Hn;import{useIncomingComputedData as An,useUpdateNodeComputedData as On}from"@awesome-flow/core/hooks";import{NodeContainer as Xn,NodeTrackConnections as Yn}from"@awesome-flow/core/layout";import{Group as uo,Stack as Zn}from"@mantine/core";import{useEffect as qn,useMemo as $n,useState as Ct}from"react";import{jsx as Wn,jsxs as w}from"react/jsx-runtime";function Kn({id:e,selected:m,data:o,type:p}){let a=On(),[i,t]=Ct(0),[n,r]=Ct(0),d=An(e),N=$n(()=>d?.map(s=>s.noise).flat(),[d]);return qn(()=>{if(N?.length){let s=Math.ceil(Math.sqrt(N.length)),u=N.map(T=>[T.value*255,T.value*255,T.value*255,255]).flat(),l=new Uint8Array(s*s*4);l.set(u),r(s),t(l.length),a(e,{textureData:l,textureResolutionX:s,textureResolutionY:s})}},[N]),w(Xn,{id:e,selected:m,data:o,type:p,children:[w(Zn,{children:[w(uo,{children:["Resolution: ",n,"x",n]}),w(uo,{children:["Input Length: ",N?.length||0]}),w(uo,{children:["Output Length (",n,"*",n,"*4): ",i]})]}),Wn(Yn,{handles:o.handles,nodeId:e,type:"target"})]})}var No=Kn;import{useIncomingComputedData as _n}from"@awesome-flow/core/hooks";import{NodeContainer as Jn,NodeTrackConnections as Qn}from"@awesome-flow/core/layout";import{Divider as jn,Stack as ep,Text as Tt}from"@mantine/core";import{useMemo as op}from"react";import{jsx as fo,jsxs as co}from"react/jsx-runtime";function tp({id:e,selected:m,data:o,type:p}){let a=_n(e),i=op(()=>a?.map(t=>t.positions).flat(),[a]);return co(Jn,{id:e,selected:m,data:o,type:p,children:[co(Tt,{children:["Size: ",i?.length||0]}),fo(jn,{h:5}),fo(ep,{children:i?.map((t,n)=>co(Tt,{children:[t.x,":",t.y,":",t.z]},n))}),fo(Qn,{handles:o.handles,nodeId:e,type:"target"})]})}var yo=tp;import{HandlesIncomingDataStatus as ap}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as rp}from"@awesome-flow/core/hooks";import{NodeContainer as ip,NodeTrackConnections as np}from"@awesome-flow/core/layout";import{Blend as pp}from"libnoise-simplex-ts";import{useCallback as sp}from"react";import{jsx as gt,jsxs as dp}from"react/jsx-runtime";function mp({id:e,selected:m,data:o,type:p}){let a=rp(),i=sp(t=>{let n=t.source,r=t.control;if(n?.length>=2&&r?.length){let d=new pp(n[0].module,n[1].module,r[0].module);a(e,{module:d})}},[]);return dp(ip,{id:e,selected:m,data:o,type:p,children:[gt(ap,{nodeId:e,handles:o.handles,handleKey:"dataId",onDataUpdated:i,type:"target",resetComputedData:!0}),gt(np,{handles:o.handles,nodeId:e,type:"target"})]})}var Co=mp;import{HandlesIncomingDataStatus as lp}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as up,useUpdateNodeData as Np}from"@awesome-flow/core/hooks";import{NodeContainer as cp,NodeTrackConnections as fp}from"@awesome-flow/core/layout";import{Group as To,NumberInput as go,Stack as yp}from"@mantine/core";import{Select as Cp}from"libnoise-simplex-ts";import{useCallback as Tp,useEffect as gp,useState as Do}from"react";import{jsx as v,jsxs as B}from"react/jsx-runtime";function Dp({id:e,selected:m,data:o,type:p}){let[a,i]=Do(o.edgeFalloff),[t,n]=Do(o.lowerBound),[r,d]=Do(o.upperBound),N=Np(),s=up();gp(()=>{N(e,{edgeFalloff:a,lowerBound:t,upperBound:r})},[a,t,r]);let u=Tp(l=>{let T=l.source,g=l.control;if(T?.length>=2&&g?.length){let x=new Cp(T[0].module,T[1].module,g[0].module,a,t,r);s(e,{module:x})}},[]);return B(cp,{id:e,selected:m,data:o,type:p,children:[B(yp,{children:[B(To,{children:["Edge Falloff:",v(go,{size:"xs",w:100,value:a,onChange:l=>i(Number(l)),step:.1})]}),B(To,{children:["Lower Bound:",v(go,{size:"xs",w:100,value:t,onChange:l=>n(Number(l)),step:.1})]}),B(To,{children:["Upper Bound:",v(go,{size:"xs",w:100,value:r,onChange:l=>d(Number(l)),step:.1})]}),v(lp,{nodeId:e,handles:o.handles,handleKey:"dataId",onDataUpdated:u,type:"target",resetComputedData:!0})]}),v(fp,{handles:o.handles,nodeId:e,type:"target"})]})}var ho=Dp;import{HandlesIncomingDataStatus as hp}from"@awesome-flow/core/components";import{useUpdateNodeComputedData as Pp}from"@awesome-flow/core/hooks";import{NodeContainer as xp,NodeTrackConnections as Ip}from"@awesome-flow/core/layout";import{Displace as bp}from"libnoise-simplex-ts";import{useCallback as Mp}from"react";import{jsx as Dt,jsxs as wp}from"react/jsx-runtime";function Sp({id:e,selected:m,data:o,type:p}){let a=Pp(),i=Mp(t=>{let n=t.source,r=t["x-module"],d=t["y-module"],N=t["z-module"];if(n&&r&&d&&N){let s=new bp(n[0].module,r[0].module,d[0].module,N[0].module);a(e,{module:s})}},[]);return wp(xp,{id:e,selected:m,data:o,type:p,children:[Dt(hp,{nodeId:e,handles:o.handles,handleKey:"dataId",onDataUpdated:i,type:"target",resetComputedData:!0}),Dt(Ip,{handles:o.handles,nodeId:e,type:"target"})]})}var Po=Sp;import{useIncomingComputedData as vp,useUpdateNodeComputedData as Bp,useUpdateNodeData as kp}from"@awesome-flow/core/hooks";import{NodeContainer as Gp,NodeTrackConnections as zp}from"@awesome-flow/core/layout";import{Group as xo,NumberInput as Io,Stack as Rp}from"@mantine/core";import{RotatePoint as Fp}from"libnoise-simplex-ts";import{useEffect as Lp,useState as bo}from"react";import{jsx as Z,jsxs as k}from"react/jsx-runtime";function Up({id:e,selected:m,data:o,type:p}){let[a,i]=bo(o.xAngle),[t,n]=bo(o.yAngle),[r,d]=bo(o.zAngle),N=vp(e),s=kp(),u=Bp();return Lp(()=>{if(N?.length){let l=new Fp(N[0].module,a,t,r);u(e,{module:l})}s(e,{xAngle:a,yAngle:t,zAngle:r})},[e,u,s,N,a,t,r]),k(Gp,{id:e,selected:m,data:o,type:p,children:[k(Rp,{children:[k(xo,{children:["X Angle:",Z(Io,{size:"xs",w:100,value:a,onChange:l=>i(Number(l)),step:.01})]}),k(xo,{children:["Y Angle:",Z(Io,{size:"xs",w:100,value:t,onChange:l=>n(Number(l)),step:.01})]}),k(xo,{children:["Z Angle:",Z(Io,{size:"xs",w:100,value:r,onChange:l=>d(Number(l)),step:.01})]})]}),Z(zp,{handles:o.handles,nodeId:e,type:"target"})]})}var Mo=Up;import{useIncomingComputedData as Vp,useUpdateNodeComputedData as Ep,useUpdateNodeData as Hp}from"@awesome-flow/core/hooks";import{NodeContainer as Ap,NodeTrackConnections as Op}from"@awesome-flow/core/layout";import{Group as So,NumberInput as wo,Stack as Xp}from"@mantine/core";import{ScalePoint as Yp}from"libnoise-simplex-ts";import{useEffect as Zp,useState as vo}from"react";import{jsx as q,jsxs as G}from"react/jsx-runtime";function qp({id:e,selected:m,data:o,type:p}){let[a,i]=vo(o.xScale),[t,n]=vo(o.yScale),[r,d]=vo(o.zScale),N=Vp(e),s=Hp(),u=Ep();return Zp(()=>{if(N?.length){let l=new Yp(N[0].module,a,t,r);u(e,{module:l})}s(e,{xScale:a,yScale:t,zScale:r})},[e,N,u,s,a,t,r]),G(Ap,{id:e,selected:m,data:o,type:p,children:[G(Xp,{children:[G(So,{children:["X Scale:",q(wo,{size:"xs",w:100,value:a,onChange:l=>i(Number(l)),step:.01})]}),G(So,{children:["Y Scale:",q(wo,{size:"xs",w:100,value:t,onChange:l=>n(Number(l)),step:.01})]}),G(So,{children:["Z Scale:",q(wo,{size:"xs",w:100,value:r,onChange:l=>d(Number(l)),step:.01})]})]}),q(Op,{handles:o.handles,nodeId:e,type:"target"})]})}var Bo=qp;import{useIncomingComputedData as $p,useUpdateNodeComputedData as Kp,useUpdateNodeData as Wp}from"@awesome-flow/core/hooks";import{NodeContainer as _p,NodeTrackConnections as Jp}from"@awesome-flow/core/layout";import{Group as ko,NumberInput as Go,Stack as Qp}from"@mantine/core";import{TranslatePoint as jp}from"libnoise-simplex-ts";import{useEffect as es,useState as zo}from"react";import{jsx as $,jsxs as z}from"react/jsx-runtime";function os({id:e,selected:m,data:o,type:p}){let[a,i]=zo(o.translateX),[t,n]=zo(o.translateY),[r,d]=zo(o.translateZ),N=$p(e),s=Wp(),u=Kp();return es(()=>{if(N?.length){let l=new jp(N[0].module,a,t,r);u(e,{module:l})}s(e,{translateX:a,translateY:t,translateZ:r})},[e,N,a,t,r,u,s]),z(_p,{id:e,selected:m,data:o,type:p,children:[z(Qp,{children:[z(ko,{children:["Translate X:",$(Go,{size:"xs",w:100,value:a,onChange:l=>i(Number(l)),step:1})]}),z(ko,{children:["Translate Y:",$(Go,{size:"xs",w:100,value:t,onChange:l=>n(Number(l)),step:1})]}),z(ko,{children:["Translate Z:",$(Go,{size:"xs",w:100,value:r,onChange:l=>d(Number(l)),step:1})]})]}),$(Jp,{handles:o.handles,nodeId:e,type:"target"})]})}var Ro=os;import{NodePropertyVariables as ts}from"@awesome-flow/core/components";import{useIncomingComputedData as as,useUpdateNodeComputedData as rs}from"@awesome-flow/core/hooks";import{NodeContainer as is,NodeTrackConnections as ns}from"@awesome-flow/core/layout";import{Turbulence as ps}from"libnoise-simplex-ts";import{useCallback as ss,useEffect as ms,useState as ds}from"react";import{jsx as ht,jsxs as us}from"react/jsx-runtime";function ls({id:e,selected:m,data:o,type:p}){let[a,i]=ds(null),t=as(e),n=rs(),r=ss(d=>{i(d)},[]);return ms(()=>{if(t?.length&&a){let d=new ps(t[0].module,a.frequency.value,a.power.value,a.roughness.value,a.seed.value);n(e,{module:d})}},[e,t,a]),us(is,{id:e,selected:m,data:o,type:p,children:[ht(ts,{data:o,nodeId:e,onPropertiesChange:r}),ht(ns,{handles:o.handles,nodeId:e,type:"target"})]})}var Fo=ls;import{CoreHandleType as Ns}from"@awesome-flow/core/abstract";import{IDGenerator as cs}from"@awesome-flow/core/utils";import{Position as Pt}from"@xyflow/system";var C=(t=>(t.positions="Positions",t.output="Output",t.noiseGenerators="Noise Generators",t.noiseModifiers="Noise Modifiers",t.noiseSelectors="Noise Selectors",t.noiseTransformers="Noise Transformers",t))(C||{});var K=class{template={id:cs.template(),type:"noise-billow",group:"Noise Generators",data:{title:"Billow Noise",frequency:.1,lacunarity:2,octaves:5,persistence:.5,seed:0},handles:[{position:Pt.Left,dataType:Ns.variableProperty,connection:"target"},{position:Pt.Right,dataType:"module",connection:"source"}]}};import{Position as fs}from"@xyflow/system";var W=class{template={type:"noise-checkerboard",group:"Noise Generators",data:{title:"Checkerboard Noise"},handles:[{position:fs.Right,dataType:"module",connection:"source"}]}};import{Position as ys}from"@xyflow/system";var _=class{template={type:"noise-constant",group:"Noise Generators",data:{title:"Const Value Noise",noise:0,min:-1,max:1},handles:[{position:ys.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as Cs}from"@awesome-flow/core/abstract";import{Position as xt}from"@xyflow/system";var J=class{template={type:"noise-cylinders",group:"Noise Generators",data:{title:"Cylinders Noise",frequency:.1},handles:[{position:xt.Left,dataType:Cs.variableProperty,connection:"target"},{position:xt.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as Ts}from"@awesome-flow/core/abstract";import{Position as It}from"@xyflow/system";var Q=class{template={type:"noise-perlin",group:"Noise Generators",data:{title:"Perlin Noise",frequency:.1,lacunarity:2,octaves:5,persistence:.5,seed:0},handles:[{position:It.Left,dataType:Ts.variableProperty,connection:"target"},{position:It.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as gs}from"@awesome-flow/core/abstract";import{Position as bt}from"@xyflow/system";var j=class{template={type:"noise-ridged-multi",group:"Noise Generators",data:{title:"Ridged Multi Noise",frequency:.1,lacunarity:2,octaves:6,offset:1,gain:2,seed:0},handles:[{position:bt.Left,dataType:gs.variableProperty,connection:"target"},{position:bt.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as Ds}from"@awesome-flow/core/abstract";import{Position as Mt}from"@xyflow/system";var ee=class{template={type:"noise-spheres",group:"Noise Generators",data:{title:"Spheres Noise",frequency:.1},handles:[{position:Mt.Left,dataType:Ds.variableProperty,connection:"target"},{position:Mt.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as hs}from"@awesome-flow/core/abstract";import{Position as St}from"@xyflow/system";var oe=class{template={type:"noise-voronoi",group:"Noise Generators",data:{title:"Voronoi Noise",frequency:.1,displacement:1,distance:!0,seed:0},handles:[{position:St.Left,dataType:hs.variableProperty,connection:"target"},{position:St.Right,dataType:"module",connection:"source"}]}};import{Position as Ps}from"@xyflow/system";var te=class{template={type:"position",group:"Positions",data:{title:"Position Output",position:{x:0,y:0,z:0}},handles:[{position:Ps.Right,dataType:"position",connection:"source"}]}};import{Position as xs}from"@xyflow/system";var ae=class{template={type:"grid",group:"Positions",data:{title:"Grid Output",center:{x:0,y:0,z:0},radius:1},handles:[{position:xs.Right,dataType:"position",connection:"source"}]}};import{CoreTemplateGroup as Is}from"@awesome-flow/core/abstract";import{IDGenerator as bs}from"@awesome-flow/core/utils";import{Position as wt}from"@xyflow/system";var re=class{template={id:bs.template(),type:"group-module",group:Is.groups,data:{title:"Modules Group",isGroup:!0,initialSize:{width:300,height:200},collapsedSize:{width:300,height:80}},handles:[{position:wt.Bottom,dataType:"module",connection:"target",maxConnections:1,hideOnCollapse:!0},{position:wt.Right,dataType:"module",connection:"source"}]}};import{Position as vt}from"@xyflow/system";var ie=class{template={type:"noise-abs",group:"Noise Modifiers",data:{title:"Abs Noise"},handles:[{position:vt.Left,dataType:"module",connection:"target",maxConnections:1},{position:vt.Right,dataType:"module",connection:"source"}]}};import{Position as Bt}from"@xyflow/system";var ne=class{template={type:"noise-clamp",group:"Noise Modifiers",data:{title:"Clamp Noise",lowerBound:-1,upperBound:1},handles:[{position:Bt.Left,dataType:"module",connection:"target",maxConnections:1},{position:Bt.Right,dataType:"module",connection:"source"}]}};import{Position as kt}from"@xyflow/system";var pe=class{template={type:"noise-combiner",group:"Noise Modifiers",data:{title:"Combine Noise",operation:"add"},handles:[{position:kt.Left,dataType:"module",connection:"target",maxConnections:2},{position:kt.Right,dataType:"module",connection:"source"}]}};import{Position as Gt}from"@xyflow/system";var se=class{template={type:"noise-curve",group:"Noise Modifiers",data:{title:"Noise Curve",points:[]},handles:[{position:Gt.Left,dataType:"module",connection:"target",maxConnections:1},{position:Gt.Right,dataType:"module",connection:"source"}]}};import{Position as zt}from"@xyflow/system";var me=class{template={type:"noise-exponent",group:"Noise Modifiers",data:{title:"Noise Exponent",exponent:1},handles:[{position:zt.Left,dataType:"module",connection:"target",maxConnections:1},{position:zt.Right,dataType:"module",connection:"source"}]}};import{Position as Rt}from"@xyflow/system";var de=class{template={type:"noise-invert",group:"Noise Modifiers",data:{title:"Invert Noise"},handles:[{position:Rt.Left,dataType:"module",connection:"target",maxConnections:1},{position:Rt.Right,dataType:"module",connection:"source"}]}};import{IDGenerator as Ms}from"@awesome-flow/core/utils";import{Position as Ft}from"@xyflow/system";var le=class{template={id:Ms.template(),type:"noise-normalize",group:"Noise Modifiers",data:{title:"Normalize Noise",intervalStart:-1,intervalEnd:1},handles:[{position:Ft.Left,dataType:"module",connection:"target",maxConnections:1},{position:Ft.Right,dataType:"module",connection:"source"}]}};import{Position as Lt}from"@xyflow/system";var ue=class{template={type:"noise-scale-bias",group:"Noise Modifiers",data:{title:"Scale/Bias Noise",scale:1,bias:0},handles:[{position:Lt.Left,dataType:"module",connection:"target",maxConnections:1},{position:Lt.Right,dataType:"module",connection:"source"}]}};import{Position as Ut}from"@xyflow/system";var Ne=class{template={type:"noise-terrace",group:"Noise Modifiers",data:{title:"Noise Terrace",points:[]},handles:[{position:Ut.Left,dataType:"module",connection:"target",maxConnections:1},{position:Ut.Right,dataType:"module",connection:"source"}]}};import{Position as Ss}from"@xyflow/system";var ce=class{template={type:"noise-logger",group:"Output",data:{title:"Noise Logger"},handles:[{position:Ss.Left,dataType:"noise",connection:"target"}]}};import{Position as Lo}from"@xyflow/system";var fe=class{template={type:"noise-output",group:"Output",data:{title:"Noise Output"},handles:[{position:Lo.Left,dataType:"position",connection:"target"},{position:Lo.Left,dataType:"module",connection:"target",maxConnections:1},{position:Lo.Right,dataType:"noise",connection:"source"}]}};import{Position as Vt}from"@xyflow/system";var ye=class{template={type:"texture-data",group:"Output",data:{title:"Texture Data"},handles:[{position:Vt.Left,dataType:"noise",connection:"target",maxConnections:1},{position:Vt.Right,dataType:"texture",connection:"source"}]}};import{Position as ws}from"@xyflow/system";var Ce=class{template={type:"position-logger",group:"Positions",data:{title:"Position Logger"},handles:[{position:ws.Left,dataType:"position",connection:"target"}]}};import{Position as Uo}from"@xyflow/system";var Te=class{template={type:"noise-blend",group:"Noise Selectors",data:{title:"Noise Blend"},handles:[{position:Uo.Left,dataType:"module",connection:"target",label:"Source Modules",dataId:"source",maxConnections:2,minConnections:2},{position:Uo.Left,dataType:"module",dataId:"control",connection:"target",label:"Control Module",maxConnections:1},{position:Uo.Right,dataType:"module",dataId:"output",connection:"source"}]}};import{Position as Vo}from"@xyflow/system";var ge=class{template={type:"noise-select",group:"Noise Selectors",data:{title:"Noise Select",edgeFalloff:0,lowerBound:-1,upperBound:1},handles:[{position:Vo.Left,dataType:"module",dataId:"source",connection:"target",label:"Source Modules",maxConnections:2,minConnections:2},{position:Vo.Left,dataType:"module",dataId:"control",connection:"target",label:"Control Module",maxConnections:1},{position:Vo.Right,dataType:"module",dataId:"output",connection:"source"}]}};import{Position as R}from"@xyflow/system";var De=class{template={type:"noise-displace",group:"Noise Transformers",data:{title:"Noise Displace"},handles:[{position:R.Left,connection:"target",label:"Source Module",dataType:"module",dataId:"source",maxConnections:1},{position:R.Left,connection:"target",label:"X Module",dataType:"module",dataId:"x-module",maxConnections:1},{position:R.Left,connection:"target",label:"Y Module",dataType:"module",dataId:"y-module",maxConnections:1},{position:R.Left,connection:"target",label:"Z Module",dataType:"module",dataId:"z-module",maxConnections:1},{position:R.Right,dataType:"module",dataId:"output",connection:"source"}]}};import{Position as Et}from"@xyflow/system";var he=class{template={type:"noise-rotate-point",group:"Noise Transformers",data:{title:"Noise Rotate Point",xAngle:0,yAngle:0,zAngle:0},handles:[{position:Et.Left,dataType:"module",connection:"target",label:"Source Module",maxConnections:1},{position:Et.Right,dataType:"module",connection:"source"}]}};import{Position as Ht}from"@xyflow/system";var Pe=class{template={type:"noise-scale-point",group:"Noise Transformers",data:{title:"Noise Scale Point",xScale:1,yScale:1,zScale:1},handles:[{position:Ht.Left,dataType:"module",connection:"target",label:"Source Module",maxConnections:1},{position:Ht.Right,dataType:"module",connection:"source"}]}};import{Position as At}from"@xyflow/system";var xe=class{template={type:"noise-translate-point",group:"Noise Transformers",data:{title:"Noise Translate Point",translateX:0,translateY:0,translateZ:0},handles:[{position:At.Left,dataType:"module",connection:"target",label:"Source Module",maxConnections:1},{position:At.Right,dataType:"module",connection:"source"}]}};import{CoreHandleType as vs}from"@awesome-flow/core/abstract";import{Position as Eo}from"@xyflow/system";var Ie=class{template={type:"noise-turbulence",group:"Noise Transformers",data:{title:"Noise Turbulence",frequency:1,power:1,roughness:1,seed:0},handles:[{position:Eo.Left,dataType:"module",connection:"target",label:"Source Module",maxConnections:1},{position:Eo.Left,dataType:vs.variableProperty,label:"Variable Properties",connection:"target"},{position:Eo.Right,dataType:"module",connection:"source"}]}};var f=(y=>(y.position="position",y.grid="grid",y.textureData="texture-data",y.groupModule="group-module",y.positionLogger="position-logger",y.noiseLogger="noise-logger",y.noiseOutput="noise-output",y.noiseConst="noise-constant",y.noiseBillow="noise-billow",y.noiseCheckerboard="noise-checkerboard",y.noiseNormalize="noise-normalize",y.noiseCylinders="noise-cylinders",y.noisePerlin="noise-perlin",y.noiseRidgedMulti="noise-ridged-multi",y.noiseSpheres="noise-spheres",y.noiseVoronoi="noise-voronoi",y.noiseCombine="noise-combiner",y.noiseClamp="noise-clamp",y.noiseAbs="noise-abs",y.noiseCurve="noise-curve",y.noiseExponent="noise-exponent",y.noiseInvert="noise-invert",y.noiseScaleBias="noise-scale-bias",y.noiseTerrace="noise-terrace",y.noiseBlend="noise-blend",y.noiseSelect="noise-select",y.noiseDisplace="noise-displace",y.noiseRotatePoint="noise-rotate-point",y.noiseScalePoint="noise-scale-point",y.noiseTranslatePoint="noise-translate-point",y.noiseTurbulence="noise-turbulence",y))(f||{}),TT={"group-module":Ze,position:He,grid:Oe,"noise-output":lo,"texture-data":No,"noise-logger":mo,"position-logger":yo,"noise-constant":ke,"noise-billow":Me,"noise-checkerboard":Se,"noise-cylinders":Ge,"noise-perlin":ze,"noise-ridged-multi":Re,"noise-spheres":Fe,"noise-voronoi":Le,"noise-combiner":Ke,"noise-clamp":$e,"noise-abs":qe,"noise-normalize":oo,"noise-curve":Je,"noise-exponent":je,"noise-invert":eo,"noise-scale-bias":ao,"noise-terrace":no,"noise-blend":Co,"noise-select":ho,"noise-displace":Po,"noise-rotate-point":Mo,"noise-scale-point":Bo,"noise-translate-point":Ro,"noise-turbulence":Fo},gT={"noise-output":new fe,"noise-billow":new K,"noise-checkerboard":new W,"noise-normalize":new le,"noise-logger":new ce,"noise-constant":new _,position:new te,"position-logger":new Ce,grid:new ae,"texture-data":new ye,"noise-cylinders":new J,"noise-perlin":new Q,"noise-ridged-multi":new j,"noise-spheres":new ee,"noise-voronoi":new oe,"noise-combiner":new pe,"noise-clamp":new ne,"noise-abs":new ie,"noise-curve":new se,"noise-exponent":new me,"noise-invert":new de,"noise-scale-bias":new ue,"noise-terrace":new Ne,"noise-blend":new Te,"noise-select":new ge,"noise-displace":new De,"noise-rotate-point":new he,"noise-scale-point":new Pe,"noise-translate-point":new xe,"noise-turbulence":new Ie,"group-module":new re};export{be as DisplacementHandle,jo as NoiseCombineType,c as NoiseHandleType,f as NoiseNodeType,I as NoiseSourceControlHandle,C as NoiseTemplateGroup,et as noiseCombineModuleMap,gT as noiseNodeTemplates,TT as noiseNodeTypes};