@awesome-flow/noise 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/abstract/index.cjs +8 -3469
  2. package/dist/abstract/index.d.cts +2 -2
  3. package/dist/abstract/index.d.ts +2 -2
  4. package/dist/abstract/index.js +15 -3508
  5. package/dist/chunk-2Y22M2Y4.js +0 -0
  6. package/dist/chunk-4PQ4USYV.cjs +1 -0
  7. package/dist/chunk-5ELMFIRV.js +0 -0
  8. package/dist/chunk-ACWBUUZ7.cjs +1376 -0
  9. package/dist/chunk-BG6U3TYO.js +1376 -0
  10. package/dist/chunk-D5JM4EYQ.cjs +305 -0
  11. package/dist/chunk-DWSACR65.js +305 -0
  12. package/dist/chunk-FFQRP23R.cjs +1 -0
  13. package/dist/chunk-JACBT4MS.cjs +1 -0
  14. package/dist/chunk-KHIIB5TH.js +93 -0
  15. package/dist/chunk-M67JHEU2.cjs +93 -0
  16. package/dist/chunk-N6YNJKLS.cjs +1 -0
  17. package/dist/chunk-PS5VUND5.js +348 -0
  18. package/dist/chunk-Q5FVGKKM.cjs +1 -0
  19. package/dist/chunk-RDQ4BOOV.js +522 -0
  20. package/dist/chunk-RKTZQUWR.cjs +348 -0
  21. package/dist/chunk-RVWCBH7K.js +0 -0
  22. package/dist/chunk-SD3T3LFY.js +0 -0
  23. package/dist/chunk-SGHEOOLW.js +19 -0
  24. package/dist/chunk-TOYKGWYO.js +0 -0
  25. package/dist/chunk-TZCT2GZV.cjs +522 -0
  26. package/dist/chunk-UNMRBZ5X.cjs +19 -0
  27. package/dist/chunk-WOJTKQKO.cjs +1 -0
  28. package/dist/chunk-XZQQ6N3L.js +0 -0
  29. package/dist/modules/index.cjs +4 -42
  30. package/dist/modules/index.js +3 -15
  31. package/dist/nodes/generators/index.cjs +13 -335
  32. package/dist/nodes/generators/index.d.cts +7 -7
  33. package/dist/nodes/generators/index.d.ts +7 -7
  34. package/dist/nodes/generators/index.js +12 -299
  35. package/dist/nodes/groups/index.cjs +4 -111
  36. package/dist/nodes/groups/index.d.cts +2 -2
  37. package/dist/nodes/groups/index.d.ts +2 -2
  38. package/dist/nodes/groups/index.js +2 -88
  39. package/dist/nodes/index.cjs +75 -3425
  40. package/dist/nodes/index.js +37 -3397
  41. package/dist/nodes/modifiers/index.cjs +4 -1459
  42. package/dist/nodes/modifiers/index.d.cts +6 -6
  43. package/dist/nodes/modifiers/index.d.ts +6 -6
  44. package/dist/nodes/modifiers/index.js +11 -1479
  45. package/dist/nodes/output/index.cjs +8 -1335
  46. package/dist/nodes/output/index.d.cts +3 -3
  47. package/dist/nodes/output/index.d.ts +3 -3
  48. package/dist/nodes/output/index.js +10 -1361
  49. package/dist/nodes/selectors/index.cjs +8 -1317
  50. package/dist/nodes/selectors/index.d.cts +1 -1
  51. package/dist/nodes/selectors/index.d.ts +1 -1
  52. package/dist/nodes/selectors/index.js +8 -1343
  53. package/dist/nodes/transformers/index.cjs +8 -331
  54. package/dist/nodes/transformers/index.d.cts +5 -5
  55. package/dist/nodes/transformers/index.d.ts +5 -5
  56. package/dist/nodes/transformers/index.js +6 -311
  57. package/dist/templates/generators/index.cjs +8 -1199
  58. package/dist/templates/generators/index.d.cts +5 -5
  59. package/dist/templates/generators/index.d.ts +5 -5
  60. package/dist/templates/generators/index.js +17 -1226
  61. package/dist/templates/groups/index.cjs +8 -1199
  62. package/dist/templates/groups/index.js +8 -1226
  63. package/dist/templates/index.cjs +77 -1263
  64. package/dist/templates/index.js +43 -1226
  65. package/dist/templates/modifiers/index.cjs +8 -1199
  66. package/dist/templates/modifiers/index.d.cts +9 -9
  67. package/dist/templates/modifiers/index.d.ts +9 -9
  68. package/dist/templates/modifiers/index.js +16 -1226
  69. package/dist/templates/output/index.cjs +8 -1199
  70. package/dist/templates/output/index.d.cts +3 -3
  71. package/dist/templates/output/index.d.ts +3 -3
  72. package/dist/templates/output/index.js +11 -1226
  73. package/dist/templates/selectors/index.cjs +8 -1199
  74. package/dist/templates/selectors/index.js +9 -1226
  75. package/dist/templates/transformers/index.cjs +8 -1199
  76. package/dist/templates/transformers/index.js +12 -1226
  77. package/package.json +30 -20
@@ -1,3490 +1,29 @@
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 __export = (target, all) => {
11
- for (var name in all)
12
- __defProp(target, name, { get: all[name], enumerable: true });
13
- };
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
- // If the importer is in node compatibility mode or this is not an ESM
24
- // file that has been converted to a CommonJS file using a Babel-
25
- // compatible transform (i.e. "__esModule" has not been set), then set
26
- // "default" to the CommonJS "module.exports" for node compatibility.
27
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
- mod
29
- ));
30
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
31
2
 
32
- // ../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
33
- var require_fast_deep_equal = __commonJS({
34
- "../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports2, module2) {
35
- "use strict";
36
- module2.exports = function equal(a, b) {
37
- if (a === b) return true;
38
- if (a && b && typeof a == "object" && typeof b == "object") {
39
- if (a.constructor !== b.constructor) return false;
40
- var length, i, keys;
41
- if (Array.isArray(a)) {
42
- length = a.length;
43
- if (length != b.length) return false;
44
- for (i = length; i-- !== 0; )
45
- if (!equal(a[i], b[i])) return false;
46
- return true;
47
- }
48
- if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
49
- if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
50
- if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
51
- keys = Object.keys(a);
52
- length = keys.length;
53
- if (length !== Object.keys(b).length) return false;
54
- for (i = length; i-- !== 0; )
55
- if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
56
- for (i = length; i-- !== 0; ) {
57
- var key = keys[i];
58
- if (!equal(a[key], b[key])) return false;
59
- }
60
- return true;
61
- }
62
- return a !== a && b !== b;
63
- };
64
- }
65
- });
66
3
 
67
- // src/abstract/index.ts
68
- var abstract_exports = {};
69
- __export(abstract_exports, {
70
- DisplacementHandle: () => DisplacementHandle,
71
- NoiseCombineType: () => NoiseCombineType,
72
- NoiseHandleType: () => NoiseHandleType,
73
- NoiseNodeType: () => NoiseNodeType,
74
- NoiseSourceControlHandle: () => NoiseSourceControlHandle,
75
- NoiseTemplateGroup: () => NoiseTemplateGroup,
76
- noiseCombineModuleMap: () => noiseCombineModuleMap,
77
- noiseNodeTemplates: () => noiseNodeTemplates,
78
- noiseNodeTypes: () => noiseNodeTypes
79
- });
80
- module.exports = __toCommonJS(abstract_exports);
81
4
 
82
- // src/abstract/handle-types.ts
83
- var NoiseHandleType = /* @__PURE__ */ ((NoiseHandleType2) => {
84
- NoiseHandleType2["texture"] = "texture";
85
- NoiseHandleType2["noise"] = "noise";
86
- NoiseHandleType2["position"] = "position";
87
- NoiseHandleType2["module"] = "module";
88
- return NoiseHandleType2;
89
- })(NoiseHandleType || {});
90
- var DisplacementHandle = /* @__PURE__ */ ((DisplacementHandle2) => {
91
- DisplacementHandle2["sourceModule"] = "source";
92
- DisplacementHandle2["xModule"] = "x-module";
93
- DisplacementHandle2["yModule"] = "y-module";
94
- DisplacementHandle2["zModule"] = "z-module";
95
- DisplacementHandle2["output"] = "output";
96
- return DisplacementHandle2;
97
- })(DisplacementHandle || {});
98
- var NoiseSourceControlHandle = /* @__PURE__ */ ((NoiseSourceControlHandle2) => {
99
- NoiseSourceControlHandle2["source"] = "source";
100
- NoiseSourceControlHandle2["control"] = "control";
101
- NoiseSourceControlHandle2["output"] = "output";
102
- return NoiseSourceControlHandle2;
103
- })(NoiseSourceControlHandle || {});
104
5
 
105
- // src/nodes/generators/position-const-node.tsx
106
- var import_layout = require("@awesome-flow/core/layout");
107
- var import_react = require("react");
108
- var import_core = require("@mantine/core");
109
- var import_hooks = require("@awesome-flow/core/hooks");
110
- var import_jsx_runtime = require("react/jsx-runtime");
111
- function PositionConstNode({ id, selected, data, type }) {
112
- const position = data.position ?? { x: 0, y: 0, z: 0 };
113
- const [x, setX] = (0, import_react.useState)(position.x);
114
- const [y, setY] = (0, import_react.useState)(position.y);
115
- const [z, setZ] = (0, import_react.useState)(position.z);
116
- const updateNodeData = (0, import_hooks.useUpdateNodeData)();
117
- const updateComputedData = (0, import_hooks.useUpdateNodeComputedData)();
118
- (0, import_react.useEffect)(() => {
119
- const position2 = { x, y, z };
120
- updateNodeData(id, {
121
- position: position2
122
- });
123
- updateComputedData(id, {
124
- positions: [position2]
125
- });
126
- }, [x, y, z]);
127
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_layout.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Stack, { children: [
128
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { children: [
129
- "x: ",
130
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.NumberInput, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
131
- ] }),
132
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { children: [
133
- "y: ",
134
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.NumberInput, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
135
- ] }),
136
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.Group, { children: [
137
- "z: ",
138
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.NumberInput, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
139
- ] })
140
- ] }) });
141
- }
142
- var position_const_node_default = PositionConstNode;
6
+ var _chunkACWBUUZ7cjs = require('../chunk-ACWBUUZ7.cjs');
143
7
 
144
- // src/nodes/generators/position-grid-node.tsx
145
- var import_layout2 = require("@awesome-flow/core/layout");
146
- var import_react2 = require("react");
147
- var import_core2 = require("@mantine/core");
148
- var import_hooks2 = require("@awesome-flow/core/hooks");
149
- var import_jsx_runtime2 = require("react/jsx-runtime");
150
- function PositionGridNode({ id, selected, data, type }) {
151
- const [x, setX] = (0, import_react2.useState)(data.center?.x);
152
- const [y, setY] = (0, import_react2.useState)(data.center?.y);
153
- const [z, setZ] = (0, import_react2.useState)(data.center?.z);
154
- const [radius, setRadius] = (0, import_react2.useState)(data.radius);
155
- const updateNodeData = (0, import_hooks2.useUpdateNodeData)();
156
- const updateComputedData = (0, import_hooks2.useUpdateNodeComputedData)();
157
- (0, import_react2.useEffect)(() => {
158
- updateNodeData(id, {
159
- center: { x, y, z }
160
- });
161
- }, [x, y, z]);
162
- (0, import_react2.useEffect)(() => {
163
- updateNodeData(id, {
164
- radius
165
- });
166
- }, [radius]);
167
- (0, import_react2.useEffect)(() => {
168
- const positions = [];
169
- for (let i = -radius; i < radius; i++) {
170
- for (let j = -radius; j < radius; j++) {
171
- positions.push({ x: x + i, y: y + j, z });
172
- }
173
- }
174
- updateComputedData(id, {
175
- positions
176
- });
177
- }, [x, y, z, radius]);
178
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_layout2.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Stack, { children: [
179
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Group, { children: [
180
- "x: ",
181
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.NumberInput, { size: "xs", w: 100, value: x, onChange: (e) => setX(Number(e)) })
182
- ] }),
183
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Group, { children: [
184
- "y: ",
185
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.NumberInput, { size: "xs", w: 100, value: y, onChange: (e) => setY(Number(e)) })
186
- ] }),
187
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Group, { children: [
188
- "z: ",
189
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.NumberInput, { size: "xs", w: 100, value: z, onChange: (e) => setZ(Number(e)) })
190
- ] }),
191
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.Group, { children: [
192
- "r: ",
193
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core2.NumberInput, { size: "xs", w: 100, value: radius, onChange: (e) => setRadius(Number(e)) })
194
- ] })
195
- ] }) });
196
- }
197
- var position_grid_node_default = PositionGridNode;
198
8
 
199
- // src/nodes/modifiers/noise-normalize-node.tsx
200
- var import_layout3 = require("@awesome-flow/core/layout");
201
- var import_react3 = require("react");
202
- var import_core3 = require("@mantine/core");
203
- var import_hooks3 = require("@awesome-flow/core/hooks");
204
9
 
205
- // src/modules/normalize-noise-module.ts
206
- var import_libnoise_simplex_ts = require("libnoise-simplex-ts");
207
- var NormalizeNoiseModule = class extends import_libnoise_simplex_ts.ModifierModule {
208
- constructor(source, lowerBound, upperBound) {
209
- super(source);
210
- this.lowerBound = lowerBound;
211
- this.upperBound = upperBound;
212
- }
213
- getValue(x, y, z) {
214
- return normalize(this.sourceModule.getValue(x, y, z), this.lowerBound, this.upperBound);
215
- }
216
- };
217
- function normalize(value, min, max) {
218
- return (value - min) / (max - min);
219
- }
220
10
 
221
- // src/nodes/modifiers/noise-normalize-node.tsx
222
- var import_jsx_runtime3 = require("react/jsx-runtime");
223
- function NoiseNormalizeNode({ id, selected, data, type }) {
224
- const [intervalStart, setIntervalStart] = (0, import_react3.useState)(data.intervalStart);
225
- const [intervalEnd, setIntervalEnd] = (0, import_react3.useState)(data.intervalEnd);
226
- const incoming = (0, import_hooks3.useIncomingComputedData)(id);
227
- const updateNodeData = (0, import_hooks3.useUpdateNodeData)();
228
- const updateComputedData = (0, import_hooks3.useUpdateNodeComputedData)();
229
- (0, import_react3.useEffect)(() => {
230
- if (incoming?.length) {
231
- const source = incoming[0].module;
232
- const module2 = new NormalizeNoiseModule(source, intervalStart, intervalEnd);
233
- updateComputedData(id, { module: module2 });
234
- }
235
- updateNodeData(id, { intervalStart, intervalEnd });
236
- }, [incoming, intervalStart, intervalEnd]);
237
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_layout3.NodeContainer, { id, selected, data, type, children: [
238
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_core3.Group, { children: [
239
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
240
- import_core3.NumberInput,
241
- {
242
- size: "xs",
243
- w: 100,
244
- value: intervalStart,
245
- onChange: (e) => setIntervalStart(Number(e))
246
- }
247
- ),
248
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
249
- import_core3.NumberInput,
250
- {
251
- size: "xs",
252
- w: 100,
253
- value: intervalEnd,
254
- onChange: (e) => setIntervalEnd(Number(e))
255
- }
256
- )
257
- ] }) }),
258
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_layout3.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
259
- ] });
260
- }
261
- var noise_normalize_node_default = NoiseNormalizeNode;
11
+ var _chunkRKTZQUWRcjs = require('../chunk-RKTZQUWR.cjs');
12
+ require('../chunk-D5JM4EYQ.cjs');
13
+ require('../chunk-M67JHEU2.cjs');
262
14
 
263
- // src/nodes/generators/noise-const-node.tsx
264
- var import_layout4 = require("@awesome-flow/core/layout");
265
- var import_react4 = require("react");
266
- var import_core4 = require("@mantine/core");
267
- var import_hooks4 = require("@awesome-flow/core/hooks");
268
- var import_libnoise_simplex_ts2 = require("libnoise-simplex-ts");
269
- var import_jsx_runtime4 = require("react/jsx-runtime");
270
- function NoiseConstNode({ id, selected, data, type }) {
271
- const [min, setMin] = (0, import_react4.useState)(data.min);
272
- const [max, setMax] = (0, import_react4.useState)(data.max);
273
- const [noise, setNoise] = (0, import_react4.useState)(data.noise);
274
- const updateNodeData = (0, import_hooks4.useUpdateNodeData)();
275
- const updateComputedData = (0, import_hooks4.useUpdateNodeComputedData)();
276
- const module2 = (0, import_react4.useMemo)(() => new import_libnoise_simplex_ts2.Const(), []);
277
- (0, import_react4.useEffect)(() => {
278
- module2.value = noise;
279
- updateNodeData(id, { noise, min, max });
280
- updateComputedData(id, { module: module2 });
281
- }, [noise, min, max, module2, updateNodeData, id, updateComputedData]);
282
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_layout4.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_core4.Stack, { children: [
283
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_core4.Group, { children: [
284
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.NumberInput, { size: "xs", w: 100, value: min, onChange: (e) => setMin(Number(e)) }),
285
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.NumberInput, { size: "xs", w: 100, value: max, onChange: (e) => setMax(Number(e)) })
286
- ] }),
287
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_core4.Group, { children: [
288
- "noise:",
289
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
290
- import_core4.NumberInput,
291
- {
292
- size: "xs",
293
- value: noise,
294
- onChange: (e) => setNoise(Number(e)),
295
- max,
296
- min,
297
- step: 0.1
298
- }
299
- )
300
- ] })
301
- ] }) });
302
- }
303
- var noise_const_node_default = NoiseConstNode;
304
15
 
305
- // src/nodes/generators/noise-billow-node.tsx
306
- var import_layout5 = require("@awesome-flow/core/layout");
307
- var import_react5 = require("react");
308
- var import_libnoise_simplex_ts3 = require("libnoise-simplex-ts");
309
- var import_hooks5 = require("@awesome-flow/core/hooks");
310
- var import_components = require("@awesome-flow/core/components");
311
- var import_jsx_runtime5 = require("react/jsx-runtime");
312
- function NoiseBillowNode({ id, selected, data, type }) {
313
- const updateComputedData = (0, import_hooks5.useUpdateNodeComputedData)();
314
- const module2 = (0, import_react5.useMemo)(() => new import_libnoise_simplex_ts3.Billow(), []);
315
- const onPropertiesChange = (0, import_react5.useCallback)(
316
- (properties) => {
317
- Object.keys(properties).forEach((k) => {
318
- module2[k] = properties[k].value;
319
- });
320
- updateComputedData(id, { module: module2 });
321
- },
322
- [id, module2, updateComputedData]
323
- );
324
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_layout5.NodeContainer, { id, selected, data, type, children: [
325
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_components.NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
326
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_layout5.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
327
- ] });
328
- }
329
- var noise_billow_node_default = NoiseBillowNode;
330
16
 
331
- // src/nodes/output/noise-logger-node.tsx
332
- var import_layout6 = require("@awesome-flow/core/layout");
333
- var import_react6 = require("react");
334
- var import_core5 = require("@mantine/core");
335
- var import_hooks6 = require("@awesome-flow/core/hooks");
336
- var import_jsx_runtime6 = require("react/jsx-runtime");
337
- function NoiseLoggerNode({ id, selected, data, type }) {
338
- const incoming = (0, import_hooks6.useIncomingComputedData)(id);
339
- const noise = (0, import_react6.useMemo)(() => incoming?.map((p) => p.noise).flat(), [incoming]);
340
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_layout6.NodeContainer, { id, selected, data, type, children: [
341
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core5.Text, { children: [
342
- "Size: ",
343
- noise?.length || 0
344
- ] }),
345
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core5.Divider, { h: 5 }),
346
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core5.Stack, { children: noise?.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core5.Text, { children: [
347
- v.position?.x,
348
- ":",
349
- v.position?.y,
350
- ":",
351
- v.position?.z,
352
- ": ",
353
- v.value
354
- ] }, i)) }),
355
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_layout6.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
356
- ] });
357
- }
358
- var noise_logger_node_default = NoiseLoggerNode;
17
+ var _chunkTZCT2GZVcjs = require('../chunk-TZCT2GZV.cjs');
18
+ require('../chunk-UNMRBZ5X.cjs');
359
19
 
360
- // src/nodes/output/noise-raw-texture-node.tsx
361
- var import_layout7 = require("@awesome-flow/core/layout");
362
- var import_react7 = require("react");
363
- var import_hooks7 = require("@awesome-flow/core/hooks");
364
- var import_core6 = require("@mantine/core");
365
- var import_jsx_runtime7 = require("react/jsx-runtime");
366
- function NoiseRawTextureNode({ id, selected, data, type }) {
367
- const updateComputedData = (0, import_hooks7.useUpdateNodeComputedData)();
368
- const [dataLength, setDataLength] = (0, import_react7.useState)(0);
369
- const [resolution, setResolution] = (0, import_react7.useState)(0);
370
- const incoming = (0, import_hooks7.useIncomingComputedData)(id);
371
- const noise = (0, import_react7.useMemo)(() => incoming?.map((p) => p.noise).flat(), [incoming]);
372
- (0, import_react7.useEffect)(() => {
373
- if (noise?.length) {
374
- const size = Math.ceil(Math.sqrt(noise.length));
375
- const colors = noise.map((n) => [n.value * 255, n.value * 255, n.value * 255, 255]).flat();
376
- const dataArray = new Uint8Array(size * size * 4);
377
- dataArray.set(colors);
378
- setResolution(size);
379
- setDataLength(dataArray.length);
380
- updateComputedData(id, {
381
- textureData: dataArray,
382
- textureResolutionX: size,
383
- textureResolutionY: size
384
- });
385
- }
386
- }, [noise]);
387
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_layout7.NodeContainer, { id, selected, data, type, children: [
388
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core6.Stack, { children: [
389
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core6.Group, { children: [
390
- "Resolution: ",
391
- resolution,
392
- "x",
393
- resolution
394
- ] }),
395
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core6.Group, { children: [
396
- "Input Length: ",
397
- noise?.length || 0
398
- ] }),
399
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core6.Group, { children: [
400
- "Output Length (",
401
- resolution,
402
- "*",
403
- resolution,
404
- "*4): ",
405
- dataLength
406
- ] })
407
- ] }),
408
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_layout7.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
409
- ] });
410
- }
411
- var noise_raw_texture_node_default = NoiseRawTextureNode;
412
20
 
413
- // src/nodes/generators/noise-checkerboard-node.tsx
414
- var import_layout8 = require("@awesome-flow/core/layout");
415
- var import_react8 = require("react");
416
- var import_libnoise_simplex_ts4 = require("libnoise-simplex-ts");
417
- var import_hooks8 = require("@awesome-flow/core/hooks");
418
- var import_jsx_runtime8 = require("react/jsx-runtime");
419
- function NoiseCheckerboardNode({ id, selected, data, type }) {
420
- const updateComputedData = (0, import_hooks8.useUpdateNodeComputedData)();
421
- const module2 = (0, import_react8.useMemo)(() => new import_libnoise_simplex_ts4.Checkerboard(), []);
422
- (0, import_react8.useEffect)(() => {
423
- updateComputedData(id, { module: module2 });
424
- }, [id, module2, updateComputedData]);
425
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_layout8.NodeContainer, { id, selected, data, type });
426
- }
427
- var noise_checkerboard_node_default = NoiseCheckerboardNode;
428
21
 
429
- // src/nodes/output/positions-logger-node.tsx
430
- var import_layout9 = require("@awesome-flow/core/layout");
431
- var import_react9 = require("react");
432
- var import_core7 = require("@mantine/core");
433
- var import_hooks9 = require("@awesome-flow/core/hooks");
434
- var import_jsx_runtime9 = require("react/jsx-runtime");
435
- function PositionsLoggerNode({ id, selected, data, type }) {
436
- const incoming = (0, import_hooks9.useIncomingComputedData)(id);
437
- const positions = (0, import_react9.useMemo)(() => {
438
- return incoming?.map((p) => p.positions).flat();
439
- }, [incoming]);
440
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_layout9.NodeContainer, { id, selected, data, type, children: [
441
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core7.Text, { children: [
442
- "Size: ",
443
- positions?.length || 0
444
- ] }),
445
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core7.Divider, { h: 5 }),
446
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_core7.Stack, { children: positions?.map((v, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_core7.Text, { children: [
447
- v.x,
448
- ":",
449
- v.y,
450
- ":",
451
- v.z
452
- ] }, i)) }),
453
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_layout9.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
454
- ] });
455
- }
456
- var positions_logger_node_default = PositionsLoggerNode;
457
22
 
458
- // src/nodes/generators/noise-cylinders-node.tsx
459
- var import_layout10 = require("@awesome-flow/core/layout");
460
- var import_react10 = require("react");
461
- var import_libnoise_simplex_ts5 = require("libnoise-simplex-ts");
462
- var import_hooks10 = require("@awesome-flow/core/hooks");
463
- var import_components2 = require("@awesome-flow/core/components");
464
- var import_jsx_runtime10 = require("react/jsx-runtime");
465
- function NoiseCylindersNode({ id, selected, data, type }) {
466
- const updateComputedData = (0, import_hooks10.useUpdateNodeComputedData)();
467
- const module2 = (0, import_react10.useMemo)(() => new import_libnoise_simplex_ts5.Cylinders(), []);
468
- const onPropertiesChange = (0, import_react10.useCallback)(
469
- (properties) => {
470
- Object.keys(properties).forEach((k) => {
471
- module2[k] = properties[k].value;
472
- });
473
- updateComputedData(id, { module: module2 });
474
- },
475
- [id, module2, updateComputedData]
476
- );
477
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_layout10.NodeContainer, { id, selected, data, type, children: [
478
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_components2.NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
479
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_layout10.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
480
- ] });
481
- }
482
- var noise_cylinders_node_default = NoiseCylindersNode;
483
23
 
484
- // src/nodes/generators/noise-perlin-node.tsx
485
- var import_layout11 = require("@awesome-flow/core/layout");
486
- var import_react11 = require("react");
487
- var import_libnoise_simplex_ts6 = require("libnoise-simplex-ts");
488
- var import_hooks11 = require("@awesome-flow/core/hooks");
489
- var import_components3 = require("@awesome-flow/core/components");
490
- var import_jsx_runtime11 = require("react/jsx-runtime");
491
- function NoisePerlinNode({ id, selected, data, type }) {
492
- const updateComputedData = (0, import_hooks11.useUpdateNodeComputedData)();
493
- const module2 = (0, import_react11.useMemo)(() => new import_libnoise_simplex_ts6.Perlin(), []);
494
- const onPropertiesChange = (0, import_react11.useCallback)(
495
- (properties) => {
496
- Object.keys(properties).forEach((k) => {
497
- module2[k] = properties[k].value;
498
- });
499
- updateComputedData(id, { module: module2 });
500
- },
501
- [id, module2, updateComputedData]
502
- );
503
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_layout11.NodeContainer, { id, selected, data, type, children: [
504
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components3.NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
505
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_layout11.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
506
- ] });
507
- }
508
- var noise_perlin_node_default = NoisePerlinNode;
509
24
 
510
- // src/nodes/generators/noise-ridgedmulti-node.tsx
511
- var import_layout12 = require("@awesome-flow/core/layout");
512
- var import_react12 = require("react");
513
- var import_libnoise_simplex_ts7 = require("libnoise-simplex-ts");
514
- var import_hooks12 = require("@awesome-flow/core/hooks");
515
- var import_components4 = require("@awesome-flow/core/components");
516
- var import_jsx_runtime12 = require("react/jsx-runtime");
517
- function NoiseRidgedMultiNode({ id, selected, data, type }) {
518
- const updateComputedData = (0, import_hooks12.useUpdateNodeComputedData)();
519
- const module2 = (0, import_react12.useMemo)(() => new import_libnoise_simplex_ts7.RidgedMulti(), []);
520
- const onPropertiesChange = (0, import_react12.useCallback)((properties) => {
521
- Object.keys(properties).forEach((k) => module2[k] = properties[k].value);
522
- updateComputedData(id, { module: module2 });
523
- }, []);
524
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_layout12.NodeContainer, { id, selected, data, type, children: [
525
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_components4.NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
526
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_layout12.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
527
- ] });
528
- }
529
- var noise_ridgedmulti_node_default = NoiseRidgedMultiNode;
530
25
 
531
- // src/nodes/generators/noise-spheres-node.tsx
532
- var import_layout13 = require("@awesome-flow/core/layout");
533
- var import_react13 = require("react");
534
- var import_libnoise_simplex_ts8 = require("libnoise-simplex-ts");
535
- var import_hooks13 = require("@awesome-flow/core/hooks");
536
- var import_components5 = require("@awesome-flow/core/components");
537
- var import_jsx_runtime13 = require("react/jsx-runtime");
538
- function NoiseSpheresNode({ id, selected, data, type }) {
539
- const updateComputedData = (0, import_hooks13.useUpdateNodeComputedData)();
540
- const module2 = (0, import_react13.useMemo)(() => new import_libnoise_simplex_ts8.Spheres(), []);
541
- const onPropertiesChange = (0, import_react13.useCallback)((properties) => {
542
- Object.keys(properties).forEach((k) => module2[k] = properties[k].value);
543
- updateComputedData(id, { module: module2 });
544
- }, []);
545
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_layout13.NodeContainer, { id, selected, data, type, children: [
546
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components5.NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
547
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_layout13.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
548
- ] });
549
- }
550
- var noise_spheres_node_default = NoiseSpheresNode;
551
26
 
552
- // src/nodes/generators/noise-voronoi-node.tsx
553
- var import_layout14 = require("@awesome-flow/core/layout");
554
- var import_react14 = require("react");
555
- var import_libnoise_simplex_ts9 = require("libnoise-simplex-ts");
556
- var import_hooks14 = require("@awesome-flow/core/hooks");
557
- var import_components6 = require("@awesome-flow/core/components");
558
- var import_jsx_runtime14 = require("react/jsx-runtime");
559
- function NoiseVoronoiNode({ id, selected, data, type }) {
560
- const updateComputedData = (0, import_hooks14.useUpdateNodeComputedData)();
561
- const onPropertiesChange = (0, import_react14.useCallback)(
562
- (properties) => {
563
- const module2 = new import_libnoise_simplex_ts9.Voronoi(
564
- properties.frequency.value,
565
- properties.displacement.value,
566
- properties.distance.value,
567
- properties.seed.value
568
- );
569
- updateComputedData(id, { module: module2 });
570
- },
571
- []
572
- );
573
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_layout14.NodeContainer, { id, selected, data, type, children: [
574
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_components6.NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
575
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_layout14.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
576
- ] });
577
- }
578
- var noise_voronoi_node_default = NoiseVoronoiNode;
579
27
 
580
- // src/nodes/modifiers/noise-combine-node.tsx
581
- var import_layout15 = require("@awesome-flow/core/layout");
582
- var import_react15 = require("react");
583
- var import_hooks15 = require("@awesome-flow/core/hooks");
584
- var import_icons_react = require("@tabler/icons-react");
585
28
 
586
- // src/abstract/operations.ts
587
- var import_libnoise_simplex_ts10 = require("libnoise-simplex-ts");
588
- var NoiseCombineType = /* @__PURE__ */ ((NoiseCombineType3) => {
589
- NoiseCombineType3["add"] = "add";
590
- NoiseCombineType3["max"] = "max";
591
- NoiseCombineType3["min"] = "min";
592
- NoiseCombineType3["multiply"] = "multiply";
593
- NoiseCombineType3["power"] = "power";
594
- return NoiseCombineType3;
595
- })(NoiseCombineType || {});
596
- var noiseCombineModuleMap = {
597
- ["add" /* add */]: import_libnoise_simplex_ts10.Add,
598
- ["max" /* max */]: import_libnoise_simplex_ts10.Max,
599
- ["min" /* min */]: import_libnoise_simplex_ts10.Min,
600
- ["multiply" /* multiply */]: import_libnoise_simplex_ts10.Multiply,
601
- ["power" /* power */]: import_libnoise_simplex_ts10.Power
602
- };
603
-
604
- // src/nodes/modifiers/noise-combine-node.tsx
605
- var import_jsx_runtime15 = require("react/jsx-runtime");
606
- var options = {
607
- add: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons_react.IconPlus, {}),
608
- min: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons_react.IconChevronLeft, {}),
609
- max: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons_react.IconChevronRight, {}),
610
- multiply: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons_react.IconAsterisk, {}),
611
- power: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_icons_react.IconChevronUp, {})
612
- };
613
- function NoiseCombineNode({ id, selected, data, type }) {
614
- const updateNodeData = (0, import_hooks15.useUpdateNodeData)();
615
- const updateComputedData = (0, import_hooks15.useUpdateNodeComputedData)();
616
- const incoming = (0, import_hooks15.useIncomingComputedData)(id);
617
- (0, import_react15.useEffect)(() => {
618
- const ModuleFactory = noiseCombineModuleMap[data.operation];
619
- if (incoming?.length > 1) {
620
- const module2 = new ModuleFactory(incoming[0].module, incoming[1].module);
621
- updateComputedData(id, { module: module2 });
622
- }
623
- }, [data.operation, incoming]);
624
- const onChange = (0, import_react15.useCallback)((operation) => {
625
- updateNodeData(id, { operation });
626
- }, []);
627
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_layout15.NodeContainer, { id, selected, data, type, children: [
628
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_layout15.NodeCombobox, { options, selected: data.operation, onChange, width: 150 }),
629
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_layout15.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
630
- ] });
631
- }
632
- var noise_combine_node_default = NoiseCombineNode;
633
-
634
- // src/nodes/modifiers/noise-clamp-node.tsx
635
- var import_layout16 = require("@awesome-flow/core/layout");
636
- var import_react16 = require("react");
637
- var import_core8 = require("@mantine/core");
638
- var import_hooks16 = require("@awesome-flow/core/hooks");
639
- var import_libnoise_simplex_ts11 = require("libnoise-simplex-ts");
640
- var import_jsx_runtime16 = require("react/jsx-runtime");
641
- function NoiseClampNode({ id, selected, data, type }) {
642
- const [lowerBound, setLowerBound] = (0, import_react16.useState)(data.lowerBound);
643
- const [upperBound, setUpperBound] = (0, import_react16.useState)(data.upperBound);
644
- const incoming = (0, import_hooks16.useIncomingComputedData)(id);
645
- const updateNodeData = (0, import_hooks16.useUpdateNodeData)();
646
- const updateComputedData = (0, import_hooks16.useUpdateNodeComputedData)();
647
- (0, import_react16.useEffect)(() => {
648
- if (incoming?.length) {
649
- const module2 = new import_libnoise_simplex_ts11.Clamp(incoming[0].module, lowerBound, upperBound);
650
- updateComputedData(id, { module: module2 });
651
- }
652
- updateNodeData(id, { lowerBound, upperBound });
653
- }, [incoming, lowerBound, upperBound]);
654
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_layout16.NodeContainer, { id, selected, data, type, children: [
655
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_core8.Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_core8.Group, { children: [
656
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
657
- import_core8.NumberInput,
658
- {
659
- size: "xs",
660
- w: 100,
661
- value: lowerBound,
662
- onChange: (e) => setLowerBound(Number(e)),
663
- step: 0.1
664
- }
665
- ),
666
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
667
- import_core8.NumberInput,
668
- {
669
- size: "xs",
670
- w: 100,
671
- value: upperBound,
672
- onChange: (e) => setUpperBound(Number(e)),
673
- step: 0.1
674
- }
675
- )
676
- ] }) }),
677
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_layout16.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
678
- ] });
679
- }
680
- var noise_clamp_node_default = NoiseClampNode;
681
-
682
- // src/nodes/modifiers/noise-abs-node.tsx
683
- var import_layout17 = require("@awesome-flow/core/layout");
684
- var import_react17 = require("react");
685
- var import_hooks17 = require("@awesome-flow/core/hooks");
686
- var import_libnoise_simplex_ts12 = require("libnoise-simplex-ts");
687
- var import_jsx_runtime17 = require("react/jsx-runtime");
688
- function NoiseAbsNode({ id, selected, data, type }) {
689
- const incoming = (0, import_hooks17.useIncomingComputedData)(id);
690
- const updateComputedData = (0, import_hooks17.useUpdateNodeComputedData)();
691
- (0, import_react17.useEffect)(() => {
692
- if (incoming?.length > 0) {
693
- const module2 = new import_libnoise_simplex_ts12.Abs(incoming[0].module);
694
- updateComputedData(id, { module: module2 });
695
- }
696
- }, [incoming]);
697
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_layout17.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_layout17.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" }) });
698
- }
699
- var noise_abs_node_default = NoiseAbsNode;
700
-
701
- // src/nodes/output/noise-output-node.tsx
702
- var import_layout18 = require("@awesome-flow/core/layout");
703
- var import_react18 = require("react");
704
- var import_hooks18 = require("@awesome-flow/core/hooks");
705
- var import_components7 = require("@awesome-flow/core/components");
706
- var import_core9 = require("@mantine/core");
707
- var import_jsx_runtime18 = require("react/jsx-runtime");
708
- function NoiseOutputNode({ id, selected, data, type }) {
709
- const [size, setSize] = (0, import_react18.useState)(0);
710
- const updateComputedData = (0, import_hooks18.useUpdateNodeComputedData)();
711
- const onDataUpdated = (0, import_react18.useCallback)(
712
- (handleData) => {
713
- const incomingPositions = handleData["position" /* position */];
714
- const incomingModule = handleData["module" /* module */];
715
- if (incomingPositions?.length && incomingModule?.length && incomingModule[0]?.module) {
716
- const { module: module2 } = incomingModule[0];
717
- const noise = [];
718
- for (const input of incomingPositions) {
719
- for (const position of input.positions) {
720
- const value = module2.getValue(position.x, position.y, position.z);
721
- noise.push({
722
- position,
723
- value
724
- });
725
- }
726
- }
727
- updateComputedData(id, { noise, module: module2 });
728
- setSize(noise.length);
729
- }
730
- },
731
- []
732
- );
733
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_layout18.NodeContainer, { id, selected, data, type, children: [
734
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
735
- import_components7.HandlesIncomingDataStatus,
736
- {
737
- nodeId: id,
738
- handles: data.handles,
739
- handleKey: "dataType",
740
- onDataUpdated,
741
- type: "target",
742
- resetComputedData: true
743
- }
744
- ),
745
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_core9.Text, { mt: 5, children: [
746
- "Noise points: ",
747
- size
748
- ] }),
749
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_layout18.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
750
- ] });
751
- }
752
- var noise_output_node_default = NoiseOutputNode;
753
-
754
- // src/nodes/modifiers/noise-curve-node.tsx
755
- var import_layout19 = require("@awesome-flow/core/layout");
756
- var import_core10 = require("@mantine/core");
757
- var import_hooks19 = require("@awesome-flow/core/hooks");
758
-
759
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/use-form.mjs
760
- var import_react25 = require("react");
761
-
762
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/actions/actions.mjs
763
- var import_react19 = require("react");
764
- function validateFormName(name) {
765
- if (!/^[0-9a-zA-Z-]+$/.test(name)) {
766
- throw new Error(
767
- `[@mantine/use-form] Form name "${name}" is invalid, it should contain only letters, numbers and dashes`
768
- );
769
- }
770
- }
771
- var useIsomorphicEffect = typeof window !== "undefined" ? import_react19.useLayoutEffect : import_react19.useEffect;
772
- function useFormEvent(eventKey, handler) {
773
- useIsomorphicEffect(() => {
774
- if (eventKey) {
775
- window.addEventListener(eventKey, handler);
776
- return () => window.removeEventListener(eventKey, handler);
777
- }
778
- return void 0;
779
- }, [eventKey]);
780
- }
781
- function useFormActions(name, form) {
782
- if (name) {
783
- validateFormName(name);
784
- }
785
- useFormEvent(
786
- `mantine-form:${name}:set-field-value`,
787
- (event) => form.setFieldValue(event.detail.path, event.detail.value)
788
- );
789
- useFormEvent(
790
- `mantine-form:${name}:set-values`,
791
- (event) => form.setValues(event.detail)
792
- );
793
- useFormEvent(
794
- `mantine-form:${name}:set-initial-values`,
795
- (event) => form.setInitialValues(event.detail)
796
- );
797
- useFormEvent(
798
- `mantine-form:${name}:set-errors`,
799
- (event) => form.setErrors(event.detail)
800
- );
801
- useFormEvent(
802
- `mantine-form:${name}:set-field-error`,
803
- (event) => form.setFieldError(event.detail.path, event.detail.error)
804
- );
805
- useFormEvent(
806
- `mantine-form:${name}:clear-field-error`,
807
- (event) => form.clearFieldError(event.detail)
808
- );
809
- useFormEvent(`mantine-form:${name}:clear-errors`, form.clearErrors);
810
- useFormEvent(`mantine-form:${name}:reset`, form.reset);
811
- useFormEvent(`mantine-form:${name}:validate`, form.validate);
812
- useFormEvent(
813
- `mantine-form:${name}:validate-field`,
814
- (event) => form.validateField(event.detail)
815
- );
816
- useFormEvent(
817
- `mantine-form:${name}:reorder-list-item`,
818
- (event) => form.reorderListItem(event.detail.path, event.detail.payload)
819
- );
820
- useFormEvent(
821
- `mantine-form:${name}:remove-list-item`,
822
- (event) => form.removeListItem(event.detail.path, event.detail.index)
823
- );
824
- useFormEvent(
825
- `mantine-form:${name}:insert-list-item`,
826
- (event) => form.insertListItem(event.detail.path, event.detail.item, event.detail.index)
827
- );
828
- useFormEvent(
829
- `mantine-form:${name}:set-dirty`,
830
- (event) => form.setDirty(event.detail)
831
- );
832
- useFormEvent(
833
- `mantine-form:${name}:set-touched`,
834
- (event) => form.setTouched(event.detail)
835
- );
836
- useFormEvent(
837
- `mantine-form:${name}:reset-dirty`,
838
- (event) => form.resetDirty(event.detail)
839
- );
840
- useFormEvent(`mantine-form:${name}:reset-touched`, form.resetTouched);
841
- }
842
-
843
- // ../../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
844
- function getInputOnChange(setValue) {
845
- return (val) => {
846
- if (!val) {
847
- setValue(val);
848
- } else if (typeof val === "function") {
849
- setValue(val);
850
- } else if (typeof val === "object" && "nativeEvent" in val) {
851
- const { currentTarget } = val;
852
- if (currentTarget instanceof HTMLInputElement) {
853
- if (currentTarget.type === "checkbox") {
854
- setValue(currentTarget.checked);
855
- } else {
856
- setValue(currentTarget.value);
857
- }
858
- } else if (currentTarget instanceof HTMLTextAreaElement || currentTarget instanceof HTMLSelectElement) {
859
- setValue(currentTarget.value);
860
- }
861
- } else {
862
- setValue(val);
863
- }
864
- };
865
- }
866
-
867
- // ../../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
868
- var import_react20 = require("react");
869
-
870
- // ../../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
871
- function filterErrors(errors) {
872
- if (errors === null || typeof errors !== "object") {
873
- return {};
874
- }
875
- return Object.keys(errors).reduce((acc, key) => {
876
- const errorValue = errors[key];
877
- if (errorValue !== void 0 && errorValue !== null && errorValue !== false) {
878
- acc[key] = errorValue;
879
- }
880
- return acc;
881
- }, {});
882
- }
883
-
884
- // ../../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
885
- function useFormErrors(initialErrors) {
886
- const [errorsState, setErrorsState] = (0, import_react20.useState)(filterErrors(initialErrors));
887
- const errorsRef = (0, import_react20.useRef)(errorsState);
888
- const setErrors = (0, import_react20.useCallback)((errors) => {
889
- setErrorsState((current) => {
890
- const newErrors = filterErrors(typeof errors === "function" ? errors(current) : errors);
891
- errorsRef.current = newErrors;
892
- return newErrors;
893
- });
894
- }, []);
895
- const clearErrors = (0, import_react20.useCallback)(() => setErrors({}), []);
896
- const clearFieldError = (0, import_react20.useCallback)(
897
- (path) => {
898
- if (errorsRef.current[path] === void 0) {
899
- return;
900
- }
901
- setErrors((current) => {
902
- const errors = { ...current };
903
- delete errors[path];
904
- return errors;
905
- });
906
- },
907
- [errorsState]
908
- );
909
- const setFieldError = (0, import_react20.useCallback)(
910
- (path, error) => {
911
- if (error == null || error === false) {
912
- clearFieldError(path);
913
- } else if (errorsRef.current[path] !== error) {
914
- setErrors((current) => ({ ...current, [path]: error }));
915
- }
916
- },
917
- [errorsState]
918
- );
919
- return {
920
- errorsState,
921
- setErrors,
922
- clearErrors,
923
- setFieldError,
924
- clearFieldError
925
- };
926
- }
927
-
928
- // ../../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
929
- var import_react21 = require("react");
930
-
931
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/clear-list-state.mjs
932
- function clearListState(field, state) {
933
- if (state === null || typeof state !== "object") {
934
- return {};
935
- }
936
- const clone = { ...state };
937
- Object.keys(state).forEach((errorKey) => {
938
- if (errorKey.includes(`${String(field)}.`)) {
939
- delete clone[errorKey];
940
- }
941
- });
942
- return clone;
943
- }
944
-
945
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/change-error-indices.mjs
946
- function getIndexFromKeyAfterPath(key, path) {
947
- const split = key.substring(path.length + 1).split(".")[0];
948
- return parseInt(split, 10);
949
- }
950
- function changeErrorIndices(path, index, errors, change) {
951
- if (index === void 0) {
952
- return errors;
953
- }
954
- const pathString = `${String(path)}`;
955
- let clearedErrors = errors;
956
- if (change === -1) {
957
- clearedErrors = clearListState(`${pathString}.${index}`, clearedErrors);
958
- }
959
- const cloned = { ...clearedErrors };
960
- const changedKeys = /* @__PURE__ */ new Set();
961
- Object.entries(clearedErrors).filter(([key]) => {
962
- if (!key.startsWith(`${pathString}.`)) {
963
- return false;
964
- }
965
- const currIndex = getIndexFromKeyAfterPath(key, pathString);
966
- if (Number.isNaN(currIndex)) {
967
- return false;
968
- }
969
- return currIndex >= index;
970
- }).forEach(([key, value]) => {
971
- const currIndex = getIndexFromKeyAfterPath(key, pathString);
972
- const newKey = key.replace(
973
- `${pathString}.${currIndex}`,
974
- `${pathString}.${currIndex + change}`
975
- );
976
- cloned[newKey] = value;
977
- changedKeys.add(newKey);
978
- if (!changedKeys.has(key)) {
979
- delete cloned[key];
980
- }
981
- });
982
- return cloned;
983
- }
984
-
985
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/lists/reorder-errors.mjs
986
- function reorderErrors(path, { from, to }, errors) {
987
- const oldKeyStart = `${path}.${from}`;
988
- const newKeyStart = `${path}.${to}`;
989
- const clone = { ...errors };
990
- Object.keys(errors).every((key) => {
991
- let oldKey;
992
- let newKey;
993
- if (key.startsWith(oldKeyStart)) {
994
- oldKey = key;
995
- newKey = key.replace(oldKeyStart, newKeyStart);
996
- }
997
- if (key.startsWith(newKeyStart)) {
998
- oldKey = key.replace(newKeyStart, oldKeyStart);
999
- newKey = key;
1000
- }
1001
- if (oldKey && newKey) {
1002
- const value1 = clone[oldKey];
1003
- const value2 = clone[newKey];
1004
- value2 === void 0 ? delete clone[oldKey] : clone[oldKey] = value2;
1005
- value1 === void 0 ? delete clone[newKey] : clone[newKey] = value1;
1006
- return false;
1007
- }
1008
- return true;
1009
- });
1010
- return clone;
1011
- }
1012
-
1013
- // ../../node_modules/.pnpm/klona@2.0.6/node_modules/klona/full/index.mjs
1014
- function set(obj, key, val) {
1015
- if (typeof val.value === "object") val.value = klona(val.value);
1016
- if (!val.enumerable || val.get || val.set || !val.configurable || !val.writable || key === "__proto__") {
1017
- Object.defineProperty(obj, key, val);
1018
- } else obj[key] = val.value;
1019
- }
1020
- function klona(x) {
1021
- if (typeof x !== "object") return x;
1022
- var i = 0, k, list, tmp, str = Object.prototype.toString.call(x);
1023
- if (str === "[object Object]") {
1024
- tmp = Object.create(x.__proto__ || null);
1025
- } else if (str === "[object Array]") {
1026
- tmp = Array(x.length);
1027
- } else if (str === "[object Set]") {
1028
- tmp = /* @__PURE__ */ new Set();
1029
- x.forEach(function(val) {
1030
- tmp.add(klona(val));
1031
- });
1032
- } else if (str === "[object Map]") {
1033
- tmp = /* @__PURE__ */ new Map();
1034
- x.forEach(function(val, key) {
1035
- tmp.set(klona(key), klona(val));
1036
- });
1037
- } else if (str === "[object Date]") {
1038
- tmp = /* @__PURE__ */ new Date(+x);
1039
- } else if (str === "[object RegExp]") {
1040
- tmp = new RegExp(x.source, x.flags);
1041
- } else if (str === "[object DataView]") {
1042
- tmp = new x.constructor(klona(x.buffer));
1043
- } else if (str === "[object ArrayBuffer]") {
1044
- tmp = x.slice(0);
1045
- } else if (str.slice(-6) === "Array]") {
1046
- tmp = new x.constructor(x);
1047
- }
1048
- if (tmp) {
1049
- for (list = Object.getOwnPropertySymbols(x); i < list.length; i++) {
1050
- set(tmp, list[i], Object.getOwnPropertyDescriptor(x, list[i]));
1051
- }
1052
- for (i = 0, list = Object.getOwnPropertyNames(x); i < list.length; i++) {
1053
- if (Object.hasOwnProperty.call(tmp, k = list[i]) && tmp[k] === x[k]) continue;
1054
- set(tmp, k, Object.getOwnPropertyDescriptor(x, k));
1055
- }
1056
- }
1057
- return tmp || x;
1058
- }
1059
-
1060
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-splitted-path.mjs
1061
- function getSplittedPath(path) {
1062
- if (typeof path !== "string") {
1063
- return [];
1064
- }
1065
- return path.split(".");
1066
- }
1067
-
1068
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-path.mjs
1069
- function getPath(path, values) {
1070
- const splittedPath = getSplittedPath(path);
1071
- if (splittedPath.length === 0 || typeof values !== "object" || values === null) {
1072
- return void 0;
1073
- }
1074
- let value = values[splittedPath[0]];
1075
- for (let i = 1; i < splittedPath.length; i += 1) {
1076
- if (value === void 0) {
1077
- break;
1078
- }
1079
- value = value[splittedPath[i]];
1080
- }
1081
- return value;
1082
- }
1083
-
1084
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/set-path.mjs
1085
- function setPath(path, value, values) {
1086
- const splittedPath = getSplittedPath(path);
1087
- if (splittedPath.length === 0) {
1088
- return values;
1089
- }
1090
- const cloned = klona(values);
1091
- if (splittedPath.length === 1) {
1092
- cloned[splittedPath[0]] = value;
1093
- return cloned;
1094
- }
1095
- let val = cloned[splittedPath[0]];
1096
- for (let i = 1; i < splittedPath.length - 1; i += 1) {
1097
- if (val === void 0) {
1098
- return cloned;
1099
- }
1100
- val = val[splittedPath[i]];
1101
- }
1102
- val[splittedPath[splittedPath.length - 1]] = value;
1103
- return cloned;
1104
- }
1105
-
1106
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/reorder-path.mjs
1107
- function reorderPath(path, { from, to }, values) {
1108
- const currentValue = getPath(path, values);
1109
- if (!Array.isArray(currentValue)) {
1110
- return values;
1111
- }
1112
- const cloned = [...currentValue];
1113
- const item = currentValue[from];
1114
- cloned.splice(from, 1);
1115
- cloned.splice(to, 0, item);
1116
- return setPath(path, cloned, values);
1117
- }
1118
-
1119
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/insert-path.mjs
1120
- function insertPath(path, value, index, values) {
1121
- const currentValue = getPath(path, values);
1122
- if (!Array.isArray(currentValue)) {
1123
- return values;
1124
- }
1125
- const cloned = [...currentValue];
1126
- cloned.splice(typeof index === "number" ? index : cloned.length, 0, value);
1127
- return setPath(path, cloned, values);
1128
- }
1129
-
1130
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/remove-path.mjs
1131
- function removePath(path, index, values) {
1132
- const currentValue = getPath(path, values);
1133
- if (!Array.isArray(currentValue)) {
1134
- return values;
1135
- }
1136
- return setPath(
1137
- path,
1138
- currentValue.filter((_, itemIndex) => itemIndex !== index),
1139
- values
1140
- );
1141
- }
1142
-
1143
- // ../../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
1144
- function useFormList({
1145
- $values,
1146
- $errors,
1147
- $status
1148
- }) {
1149
- const reorderListItem = (0, import_react21.useCallback)((path, payload) => {
1150
- $status.clearFieldDirty(path);
1151
- $errors.setErrors((errs) => reorderErrors(path, payload, errs));
1152
- $values.setValues({
1153
- values: reorderPath(path, payload, $values.refValues.current),
1154
- updateState: true
1155
- });
1156
- }, []);
1157
- const removeListItem = (0, import_react21.useCallback)((path, index) => {
1158
- $status.clearFieldDirty(path);
1159
- $errors.setErrors((errs) => changeErrorIndices(path, index, errs, -1));
1160
- $values.setValues({
1161
- values: removePath(path, index, $values.refValues.current),
1162
- updateState: true
1163
- });
1164
- }, []);
1165
- const insertListItem = (0, import_react21.useCallback)((path, item, index) => {
1166
- $status.clearFieldDirty(path);
1167
- $errors.setErrors((errs) => changeErrorIndices(path, index, errs, 1));
1168
- $values.setValues({
1169
- values: insertPath(path, item, index, $values.refValues.current),
1170
- updateState: true
1171
- });
1172
- }, []);
1173
- return { reorderListItem, removeListItem, insertListItem };
1174
- }
1175
-
1176
- // ../../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
1177
- var import_react22 = require("react");
1178
- var import_fast_deep_equal = __toESM(require_fast_deep_equal(), 1);
1179
-
1180
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/get-status/get-status.mjs
1181
- function getStatus(status, path) {
1182
- const paths = Object.keys(status);
1183
- if (typeof path === "string") {
1184
- const nestedPaths = paths.filter((statusPath) => statusPath.startsWith(`${path}.`));
1185
- return status[path] || nestedPaths.some((statusPath) => status[statusPath]) || false;
1186
- }
1187
- return paths.some((statusPath) => status[statusPath]);
1188
- }
1189
-
1190
- // ../../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
1191
- function useFormStatus({
1192
- initialDirty,
1193
- initialTouched,
1194
- mode,
1195
- $values
1196
- }) {
1197
- const [touchedState, setTouchedState] = (0, import_react22.useState)(initialTouched);
1198
- const [dirtyState, setDirtyState] = (0, import_react22.useState)(initialDirty);
1199
- const touchedRef = (0, import_react22.useRef)(initialTouched);
1200
- const dirtyRef = (0, import_react22.useRef)(initialDirty);
1201
- const setTouched = (0, import_react22.useCallback)((values) => {
1202
- const resolvedValues = typeof values === "function" ? values(touchedRef.current) : values;
1203
- touchedRef.current = resolvedValues;
1204
- if (mode === "controlled") {
1205
- setTouchedState(resolvedValues);
1206
- }
1207
- }, []);
1208
- const setDirty = (0, import_react22.useCallback)((values) => {
1209
- const resolvedValues = typeof values === "function" ? values(dirtyRef.current) : values;
1210
- dirtyRef.current = resolvedValues;
1211
- if (mode === "controlled") {
1212
- setDirtyState(resolvedValues);
1213
- }
1214
- }, []);
1215
- const resetTouched = (0, import_react22.useCallback)(() => setTouched({}), []);
1216
- const resetDirty = (values) => {
1217
- const newSnapshot = values ? { ...values, ...$values.refValues.current } : $values.refValues.current;
1218
- $values.setValuesSnapshot(newSnapshot);
1219
- setDirty({});
1220
- };
1221
- const setFieldTouched = (0, import_react22.useCallback)((path, touched) => {
1222
- setTouched((currentTouched) => {
1223
- if (getStatus(currentTouched, path) === touched) {
1224
- return currentTouched;
1225
- }
1226
- return { ...currentTouched, [path]: touched };
1227
- });
1228
- }, []);
1229
- const setFieldDirty = (0, import_react22.useCallback)((path, dirty) => {
1230
- setDirty((currentDirty) => {
1231
- if (getStatus(currentDirty, path) === dirty) {
1232
- return currentDirty;
1233
- }
1234
- return { ...currentDirty, [path]: dirty };
1235
- });
1236
- }, []);
1237
- const isTouched = (0, import_react22.useCallback)(
1238
- (path) => getStatus(touchedRef.current, path),
1239
- []
1240
- );
1241
- const clearFieldDirty = (0, import_react22.useCallback)(
1242
- (path) => setDirty((current) => {
1243
- if (typeof path !== "string") {
1244
- return current;
1245
- }
1246
- const result = clearListState(path, current);
1247
- delete result[path];
1248
- if ((0, import_fast_deep_equal.default)(result, current)) {
1249
- return current;
1250
- }
1251
- return result;
1252
- }),
1253
- []
1254
- );
1255
- const isDirty = (0, import_react22.useCallback)((path) => {
1256
- if (path) {
1257
- const overriddenValue = getPath(path, dirtyRef.current);
1258
- if (typeof overriddenValue === "boolean") {
1259
- return overriddenValue;
1260
- }
1261
- const sliceOfValues = getPath(path, $values.refValues.current);
1262
- const sliceOfInitialValues = getPath(path, $values.valuesSnapshot.current);
1263
- return !(0, import_fast_deep_equal.default)(sliceOfValues, sliceOfInitialValues);
1264
- }
1265
- const isOverridden = Object.keys(dirtyRef.current).length > 0;
1266
- if (isOverridden) {
1267
- return getStatus(dirtyRef.current);
1268
- }
1269
- return !(0, import_fast_deep_equal.default)($values.refValues.current, $values.valuesSnapshot.current);
1270
- }, []);
1271
- const getDirty = (0, import_react22.useCallback)(() => dirtyRef.current, []);
1272
- const getTouched = (0, import_react22.useCallback)(() => touchedRef.current, []);
1273
- return {
1274
- touchedState,
1275
- dirtyState,
1276
- touchedRef,
1277
- dirtyRef,
1278
- setTouched,
1279
- setDirty,
1280
- resetDirty,
1281
- resetTouched,
1282
- isTouched,
1283
- setFieldTouched,
1284
- setFieldDirty,
1285
- setTouchedState,
1286
- setDirtyState,
1287
- clearFieldDirty,
1288
- isDirty,
1289
- getDirty,
1290
- getTouched
1291
- };
1292
- }
1293
-
1294
- // ../../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
1295
- var import_react23 = require("react");
1296
- function useFormValues({
1297
- initialValues,
1298
- onValuesChange,
1299
- mode
1300
- }) {
1301
- const initialized = (0, import_react23.useRef)(false);
1302
- const [stateValues, setStateValues] = (0, import_react23.useState)(initialValues || {});
1303
- const refValues = (0, import_react23.useRef)(stateValues);
1304
- const valuesSnapshot = (0, import_react23.useRef)(stateValues);
1305
- const setValues = (0, import_react23.useCallback)(
1306
- ({
1307
- values,
1308
- subscribers,
1309
- updateState = true,
1310
- mergeWithPreviousValues = true
1311
- }) => {
1312
- const previousValues = refValues.current;
1313
- const resolvedValues = values instanceof Function ? values(refValues.current) : values;
1314
- const updatedValues = mergeWithPreviousValues ? { ...previousValues, ...resolvedValues } : resolvedValues;
1315
- refValues.current = updatedValues;
1316
- updateState && setStateValues(updatedValues);
1317
- onValuesChange?.(updatedValues, previousValues);
1318
- subscribers?.filter(Boolean).forEach((subscriber) => subscriber({ updatedValues, previousValues }));
1319
- },
1320
- [onValuesChange]
1321
- );
1322
- const setFieldValue = (0, import_react23.useCallback)((payload) => {
1323
- const currentValue = getPath(payload.path, refValues.current);
1324
- const updatedValue = payload.value instanceof Function ? payload.value(currentValue) : payload.value;
1325
- if (currentValue !== updatedValue) {
1326
- const previousValues = refValues.current;
1327
- const updatedValues = setPath(payload.path, updatedValue, refValues.current);
1328
- setValues({ values: updatedValues, updateState: payload.updateState });
1329
- payload.subscribers?.filter(Boolean).forEach(
1330
- (subscriber) => subscriber({ path: payload.path, updatedValues, previousValues })
1331
- );
1332
- }
1333
- }, []);
1334
- const setValuesSnapshot = (0, import_react23.useCallback)((payload) => {
1335
- valuesSnapshot.current = payload;
1336
- }, []);
1337
- const initialize = (0, import_react23.useCallback)((values, onInitialize) => {
1338
- if (!initialized.current) {
1339
- initialized.current = true;
1340
- setValues({ values, updateState: mode === "controlled" });
1341
- setValuesSnapshot(values);
1342
- onInitialize();
1343
- }
1344
- }, []);
1345
- const resetValues = (0, import_react23.useCallback)(() => {
1346
- setValues({
1347
- values: valuesSnapshot.current,
1348
- updateState: true,
1349
- mergeWithPreviousValues: false
1350
- });
1351
- }, []);
1352
- const getValues = (0, import_react23.useCallback)(() => refValues.current, []);
1353
- return {
1354
- initialized,
1355
- stateValues,
1356
- refValues,
1357
- valuesSnapshot,
1358
- setValues,
1359
- setFieldValue,
1360
- resetValues,
1361
- setValuesSnapshot,
1362
- initialize,
1363
- getValues
1364
- };
1365
- }
1366
-
1367
- // ../../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
1368
- var import_react24 = require("react");
1369
- function useFormWatch({
1370
- $status
1371
- }) {
1372
- const subscribers = (0, import_react24.useRef)(
1373
- {}
1374
- );
1375
- const watch = (0, import_react24.useCallback)((path, callback) => {
1376
- (0, import_react24.useEffect)(() => {
1377
- subscribers.current[path] = subscribers.current[path] || [];
1378
- subscribers.current[path].push(callback);
1379
- return () => {
1380
- subscribers.current[path] = subscribers.current[path].filter((cb) => cb !== callback);
1381
- };
1382
- }, [callback]);
1383
- }, []);
1384
- const getFieldSubscribers = (0, import_react24.useCallback)((path) => {
1385
- if (!subscribers.current[path]) {
1386
- return [];
1387
- }
1388
- return subscribers.current[path].map(
1389
- (callback) => (input) => callback({
1390
- previousValue: getPath(path, input.previousValues),
1391
- value: getPath(path, input.updatedValues),
1392
- touched: $status.isTouched(path),
1393
- dirty: $status.isDirty(path)
1394
- })
1395
- );
1396
- }, []);
1397
- return {
1398
- subscribers,
1399
- watch,
1400
- getFieldSubscribers
1401
- };
1402
- }
1403
-
1404
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/paths/get-data-path.mjs
1405
- function getDataPath(formName, fieldPath) {
1406
- return formName ? `${formName}-${fieldPath.toString()}` : fieldPath.toString();
1407
- }
1408
-
1409
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/validate-values.mjs
1410
- function getValidationResults(errors) {
1411
- const filteredErrors = filterErrors(errors);
1412
- return { hasErrors: Object.keys(filteredErrors).length > 0, errors: filteredErrors };
1413
- }
1414
- function validateRulesRecord(rules, values, path = "", errors = {}) {
1415
- if (typeof rules !== "object" || rules === null) {
1416
- return errors;
1417
- }
1418
- return Object.keys(rules).reduce((acc, ruleKey) => {
1419
- const rule = rules[ruleKey];
1420
- const rulePath = `${path === "" ? "" : `${path}.`}${ruleKey}`;
1421
- const value = getPath(rulePath, values);
1422
- let arrayValidation = false;
1423
- if (typeof rule === "function") {
1424
- acc[rulePath] = rule(value, values, rulePath);
1425
- }
1426
- if (typeof rule === "object" && Array.isArray(value)) {
1427
- arrayValidation = true;
1428
- value.forEach(
1429
- (_item, index) => validateRulesRecord(rule, values, `${rulePath}.${index}`, acc)
1430
- );
1431
- }
1432
- if (typeof rule === "object" && typeof value === "object" && value !== null) {
1433
- if (!arrayValidation) {
1434
- validateRulesRecord(rule, values, rulePath, acc);
1435
- }
1436
- }
1437
- return acc;
1438
- }, errors);
1439
- }
1440
- function validateValues(validate, values) {
1441
- if (typeof validate === "function") {
1442
- return getValidationResults(validate(values));
1443
- }
1444
- return getValidationResults(validateRulesRecord(validate, values));
1445
- }
1446
-
1447
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/validate-field-value.mjs
1448
- function validateFieldValue(path, rules, values) {
1449
- if (typeof path !== "string") {
1450
- return { hasError: false, error: null };
1451
- }
1452
- const results = validateValues(rules, values);
1453
- const pathInError = Object.keys(results.errors).find(
1454
- (errorKey) => path.split(".").every((pathPart, i) => pathPart === errorKey.split(".")[i])
1455
- );
1456
- return { hasError: !!pathInError, error: pathInError ? results.errors[pathInError] : null };
1457
- }
1458
-
1459
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/form-index.mjs
1460
- var FORM_INDEX = "__MANTINE_FORM_INDEX__";
1461
-
1462
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/validate/should-validate-on-change.mjs
1463
- function shouldValidateOnChange(path, validateInputOnChange) {
1464
- if (!validateInputOnChange) {
1465
- return false;
1466
- }
1467
- if (typeof validateInputOnChange === "boolean") {
1468
- return validateInputOnChange;
1469
- }
1470
- if (Array.isArray(validateInputOnChange)) {
1471
- return validateInputOnChange.includes(path.replace(/[.][0-9]/g, `.${FORM_INDEX}`));
1472
- }
1473
- return false;
1474
- }
1475
-
1476
- // ../../node_modules/.pnpm/@mantine+form@7.10.1_react@18.3.1/node_modules/@mantine/form/esm/use-form.mjs
1477
- function useForm({
1478
- name,
1479
- mode = "controlled",
1480
- initialValues,
1481
- initialErrors = {},
1482
- initialDirty = {},
1483
- initialTouched = {},
1484
- clearInputErrorOnChange = true,
1485
- validateInputOnChange = false,
1486
- validateInputOnBlur = false,
1487
- onValuesChange,
1488
- transformValues = (values) => values,
1489
- enhanceGetInputProps,
1490
- validate: rules
1491
- } = {}) {
1492
- const $errors = useFormErrors(initialErrors);
1493
- const $values = useFormValues({ initialValues, onValuesChange, mode });
1494
- const $status = useFormStatus({ initialDirty, initialTouched, $values, mode });
1495
- const $list = useFormList({ $values, $errors, $status });
1496
- const $watch = useFormWatch({ $status });
1497
- const [formKey, setFormKey] = (0, import_react25.useState)(0);
1498
- const [fieldKeys, setFieldKeys] = (0, import_react25.useState)({});
1499
- const reset = (0, import_react25.useCallback)(() => {
1500
- $values.resetValues();
1501
- $errors.clearErrors();
1502
- $status.resetDirty();
1503
- $status.resetTouched();
1504
- mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
1505
- }, []);
1506
- const initialize = (0, import_react25.useCallback)((values) => {
1507
- $values.initialize(values, () => mode === "uncontrolled" && setFormKey((key2) => key2 + 1));
1508
- }, []);
1509
- const setFieldValue = (0, import_react25.useCallback)(
1510
- (path, value, options2) => {
1511
- const shouldValidate = shouldValidateOnChange(path, validateInputOnChange);
1512
- $status.clearFieldDirty(path);
1513
- $status.setFieldTouched(path, true);
1514
- !shouldValidate && clearInputErrorOnChange && $errors.clearFieldError(path);
1515
- $values.setFieldValue({
1516
- path,
1517
- value,
1518
- updateState: mode === "controlled",
1519
- subscribers: [
1520
- ...$watch.getFieldSubscribers(path),
1521
- shouldValidate ? (payload) => {
1522
- const validationResults = validateFieldValue(path, rules, payload.updatedValues);
1523
- validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
1524
- } : null,
1525
- options2?.forceUpdate !== false && mode !== "controlled" ? () => setFieldKeys((keys) => ({
1526
- ...keys,
1527
- [path]: (keys[path] || 0) + 1
1528
- })) : null
1529
- ]
1530
- });
1531
- },
1532
- [onValuesChange, rules]
1533
- );
1534
- const setValues = (0, import_react25.useCallback)(
1535
- (values) => {
1536
- const previousValues = $values.refValues.current;
1537
- $values.setValues({ values, updateState: mode === "controlled" });
1538
- clearInputErrorOnChange && $errors.clearErrors();
1539
- mode === "uncontrolled" && setFormKey((key2) => key2 + 1);
1540
- Object.keys($watch.subscribers.current).forEach((path) => {
1541
- const value = getPath(path, $values.refValues.current);
1542
- const previousValue = getPath(path, previousValues);
1543
- if (value !== previousValue) {
1544
- $watch.getFieldSubscribers(path).forEach((cb) => cb({ previousValues, updatedValues: $values.refValues.current }));
1545
- }
1546
- });
1547
- },
1548
- [onValuesChange, clearInputErrorOnChange]
1549
- );
1550
- const validate = (0, import_react25.useCallback)(() => {
1551
- const results = validateValues(rules, $values.refValues.current);
1552
- $errors.setErrors(results.errors);
1553
- return results;
1554
- }, [rules]);
1555
- const validateField = (0, import_react25.useCallback)(
1556
- (path) => {
1557
- const results = validateFieldValue(path, rules, $values.refValues.current);
1558
- results.hasError ? $errors.setFieldError(path, results.error) : $errors.clearFieldError(path);
1559
- return results;
1560
- },
1561
- [rules]
1562
- );
1563
- const getInputProps = (path, { type = "input", withError = true, withFocus = true, ...otherOptions } = {}) => {
1564
- const onChange = getInputOnChange(
1565
- (value) => setFieldValue(path, value, { forceUpdate: false })
1566
- );
1567
- const payload = { onChange, "data-path": getDataPath(name, path) };
1568
- if (withError) {
1569
- payload.error = $errors.errorsState[path];
1570
- }
1571
- if (type === "checkbox") {
1572
- payload[mode === "controlled" ? "checked" : "defaultChecked"] = getPath(
1573
- path,
1574
- $values.refValues.current
1575
- );
1576
- } else {
1577
- payload[mode === "controlled" ? "value" : "defaultValue"] = getPath(
1578
- path,
1579
- $values.refValues.current
1580
- );
1581
- }
1582
- if (withFocus) {
1583
- payload.onFocus = () => $status.setFieldTouched(path, true);
1584
- payload.onBlur = () => {
1585
- if (shouldValidateOnChange(path, validateInputOnBlur)) {
1586
- const validationResults = validateFieldValue(path, rules, $values.refValues.current);
1587
- validationResults.hasError ? $errors.setFieldError(path, validationResults.error) : $errors.clearFieldError(path);
1588
- }
1589
- };
1590
- }
1591
- return Object.assign(
1592
- payload,
1593
- enhanceGetInputProps?.({
1594
- inputProps: payload,
1595
- field: path,
1596
- options: { type, withError, withFocus, ...otherOptions },
1597
- form
1598
- })
1599
- );
1600
- };
1601
- const onSubmit = (handleSubmit, handleValidationFailure) => (event) => {
1602
- event?.preventDefault();
1603
- const results = validate();
1604
- if (results.hasErrors) {
1605
- handleValidationFailure?.(results.errors, $values.refValues.current, event);
1606
- } else {
1607
- handleSubmit?.(transformValues($values.refValues.current), event);
1608
- }
1609
- };
1610
- const getTransformedValues = (input) => transformValues(input || $values.refValues.current);
1611
- const onReset = (0, import_react25.useCallback)((event) => {
1612
- event.preventDefault();
1613
- reset();
1614
- }, []);
1615
- const isValid = (0, import_react25.useCallback)(
1616
- (path) => path ? !validateFieldValue(path, rules, $values.refValues.current).hasError : !validateValues(rules, $values.refValues.current).hasErrors,
1617
- [rules]
1618
- );
1619
- const key = (path) => `${formKey}-${path}-${fieldKeys[path] || 0}`;
1620
- const getInputNode = (0, import_react25.useCallback)(
1621
- (path) => document.querySelector(`[data-path="${getDataPath(name, path)}"]`),
1622
- []
1623
- );
1624
- const form = {
1625
- watch: $watch.watch,
1626
- initialized: $values.initialized.current,
1627
- values: $values.stateValues,
1628
- getValues: $values.getValues,
1629
- setInitialValues: $values.setValuesSnapshot,
1630
- initialize,
1631
- setValues,
1632
- setFieldValue,
1633
- errors: $errors.errorsState,
1634
- setErrors: $errors.setErrors,
1635
- setFieldError: $errors.setFieldError,
1636
- clearFieldError: $errors.clearFieldError,
1637
- clearErrors: $errors.clearErrors,
1638
- resetDirty: $status.resetDirty,
1639
- setTouched: $status.setTouched,
1640
- setDirty: $status.setDirty,
1641
- isTouched: $status.isTouched,
1642
- resetTouched: $status.resetTouched,
1643
- isDirty: $status.isDirty,
1644
- getTouched: $status.getTouched,
1645
- getDirty: $status.getDirty,
1646
- reorderListItem: $list.reorderListItem,
1647
- insertListItem: $list.insertListItem,
1648
- removeListItem: $list.removeListItem,
1649
- reset,
1650
- validate,
1651
- validateField,
1652
- getInputProps,
1653
- onSubmit,
1654
- onReset,
1655
- isValid,
1656
- getTransformedValues,
1657
- key,
1658
- getInputNode
1659
- };
1660
- useFormActions(name, form);
1661
- return form;
1662
- }
1663
-
1664
- // src/nodes/modifiers/noise-curve-node.tsx
1665
- var import_react26 = require("react");
1666
- var import_libnoise_simplex_ts13 = require("libnoise-simplex-ts");
1667
- var import_icons_react2 = require("@tabler/icons-react");
1668
- var import_hooks20 = require("@mantine/hooks");
1669
- var import_abstract2 = require("@awesome-flow/core/abstract");
1670
- var import_jsx_runtime19 = require("react/jsx-runtime");
1671
- function NoiseCurveNode({ id, selected, data, type }) {
1672
- const incoming = (0, import_hooks19.useIncomingComputedData)(id);
1673
- const updateNodeData = (0, import_hooks19.useUpdateNodeData)();
1674
- const updateComputedData = (0, import_hooks19.useUpdateNodeComputedData)();
1675
- const [values, setValues] = (0, import_react26.useState)([]);
1676
- const form = useForm({
1677
- mode: "uncontrolled",
1678
- initialValues: {
1679
- points: []
1680
- },
1681
- validateInputOnChange: [`points.${FORM_INDEX}.input`],
1682
- clearInputErrorOnChange: true,
1683
- validate: {
1684
- points: {
1685
- input: (value, values2) => {
1686
- const counts = {};
1687
- values2.points.forEach((x) => {
1688
- counts[x.input] = (counts[x.input] || 0) + 1;
1689
- });
1690
- return counts[value] > 1;
1691
- }
1692
- }
1693
- },
1694
- onValuesChange: (0, import_react26.useCallback)((values2) => {
1695
- if (form.isValid()) {
1696
- const points = values2.points.map((v) => ({ input: v.input, output: v.output }));
1697
- setValues(points);
1698
- updateNodeData(id, { points });
1699
- }
1700
- form.validate();
1701
- }, [])
1702
- });
1703
- (0, import_react26.useEffect)(() => {
1704
- const points = data.points?.length ? data.points.map((v) => ({ input: v.input, output: v.output, key: (0, import_hooks20.randomId)() })) : [1, 2, 3, 4].map(() => ({ input: 0, output: 0, key: (0, import_hooks20.randomId)() }));
1705
- form.initialize({ points });
1706
- }, []);
1707
- (0, import_react26.useEffect)(() => {
1708
- if (incoming?.length && values?.length >= 4) {
1709
- const module2 = new import_libnoise_simplex_ts13.Curve(
1710
- incoming[0].module,
1711
- values.map((p) => new import_libnoise_simplex_ts13.Tuple(p.input, p.output))
1712
- );
1713
- updateComputedData(id, { module: module2 });
1714
- }
1715
- }, [values, incoming]);
1716
- const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_core10.Group, { mt: "xs", children: [
1717
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1718
- import_core10.NumberInput,
1719
- {
1720
- size: "xs",
1721
- w: 100,
1722
- placeholder: "Input Value",
1723
- ...form.getInputProps(`points.${index}.input`),
1724
- step: 0.1
1725
- },
1726
- form.key(`points.${index}.input`)
1727
- ),
1728
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1729
- import_core10.NumberInput,
1730
- {
1731
- size: "xs",
1732
- w: 100,
1733
- placeholder: "Output Value",
1734
- ...form.getInputProps(`points.${index}.output`),
1735
- step: 0.1
1736
- },
1737
- form.key(`points.${index}.output`)
1738
- ),
1739
- data.state === import_abstract2.NodeState.edit && values.length > 4 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1740
- import_core10.ActionIcon,
1741
- {
1742
- color: "red",
1743
- variant: "outline",
1744
- size: "sm",
1745
- onClick: () => form.removeListItem("points", index),
1746
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_icons_react2.IconX, { size: "1rem" })
1747
- }
1748
- )
1749
- ] }, item.key));
1750
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_layout19.NodeContainer, { id, selected, type, data, children: [
1751
- fields,
1752
- data.state === import_abstract2.NodeState.edit && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
1753
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_core10.Space, { h: 10 }),
1754
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
1755
- import_core10.Button,
1756
- {
1757
- variant: "outline",
1758
- size: "xs",
1759
- fullWidth: true,
1760
- onClick: () => form.insertListItem("points", { input: 0, output: 0, key: (0, import_hooks20.randomId)() }),
1761
- children: "Add control point"
1762
- }
1763
- )
1764
- ] }),
1765
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_layout19.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
1766
- ] });
1767
- }
1768
- var noise_curve_node_default = NoiseCurveNode;
1769
-
1770
- // src/nodes/modifiers/noise-exponent-node.tsx
1771
- var import_layout20 = require("@awesome-flow/core/layout");
1772
- var import_react27 = require("react");
1773
- var import_core11 = require("@mantine/core");
1774
- var import_hooks21 = require("@awesome-flow/core/hooks");
1775
- var import_libnoise_simplex_ts14 = require("libnoise-simplex-ts");
1776
- var import_jsx_runtime20 = require("react/jsx-runtime");
1777
- function NoiseExponentNode({ id, selected, data, type }) {
1778
- const [exponent, setExponent] = (0, import_react27.useState)(data.exponent);
1779
- const incoming = (0, import_hooks21.useIncomingComputedData)(id);
1780
- const updateNodeData = (0, import_hooks21.useUpdateNodeData)();
1781
- const updateComputedData = (0, import_hooks21.useUpdateNodeComputedData)();
1782
- (0, import_react27.useEffect)(() => {
1783
- if (incoming?.length > 0) {
1784
- const module2 = new import_libnoise_simplex_ts14.Exponent(incoming[0].module, exponent);
1785
- updateComputedData(id, { module: module2 });
1786
- }
1787
- updateNodeData(id, { exponent });
1788
- }, [incoming, exponent]);
1789
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_layout20.NodeContainer, { id, selected, data, type, children: [
1790
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_core11.Stack, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_core11.Group, { children: [
1791
- "Exponent:",
1792
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1793
- import_core11.NumberInput,
1794
- {
1795
- size: "xs",
1796
- value: exponent,
1797
- onChange: (e) => setExponent(Number(e)),
1798
- step: 0.1
1799
- }
1800
- )
1801
- ] }) }),
1802
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_layout20.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
1803
- ] });
1804
- }
1805
- var noise_exponent_node_default = NoiseExponentNode;
1806
-
1807
- // src/nodes/modifiers/noise-invert-node.tsx
1808
- var import_layout21 = require("@awesome-flow/core/layout");
1809
- var import_react28 = require("react");
1810
- var import_hooks22 = require("@awesome-flow/core/hooks");
1811
- var import_libnoise_simplex_ts15 = require("libnoise-simplex-ts");
1812
- var import_jsx_runtime21 = require("react/jsx-runtime");
1813
- function NoiseInvertNode({ id, selected, data, type }) {
1814
- const incoming = (0, import_hooks22.useIncomingComputedData)(id);
1815
- const updateComputedData = (0, import_hooks22.useUpdateNodeComputedData)();
1816
- (0, import_react28.useEffect)(() => {
1817
- if (incoming?.length > 0) {
1818
- const module2 = new import_libnoise_simplex_ts15.Invert(incoming[0].module);
1819
- updateComputedData(id, { module: module2 });
1820
- }
1821
- }, [incoming]);
1822
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_layout21.NodeContainer, { id, selected, data, type, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_layout21.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" }) });
1823
- }
1824
- var noise_invert_node_default = NoiseInvertNode;
1825
-
1826
- // src/nodes/modifiers/noise-scale-bias-node.tsx
1827
- var import_layout22 = require("@awesome-flow/core/layout");
1828
- var import_react29 = require("react");
1829
- var import_core12 = require("@mantine/core");
1830
- var import_hooks23 = require("@awesome-flow/core/hooks");
1831
- var import_libnoise_simplex_ts16 = require("libnoise-simplex-ts");
1832
- var import_jsx_runtime22 = require("react/jsx-runtime");
1833
- function NoiseScaleBiasNode({ id, selected, data, type }) {
1834
- const [scale, setScale] = (0, import_react29.useState)(data.scale);
1835
- const [bias, setBias] = (0, import_react29.useState)(data.bias);
1836
- const incoming = (0, import_hooks23.useIncomingComputedData)(id);
1837
- const updateNodeData = (0, import_hooks23.useUpdateNodeData)();
1838
- const updateComputedData = (0, import_hooks23.useUpdateNodeComputedData)();
1839
- (0, import_react29.useEffect)(() => {
1840
- if (incoming?.length > 0) {
1841
- const module2 = new import_libnoise_simplex_ts16.ScaleBias(incoming[0].module, scale, bias);
1842
- updateComputedData(id, { module: module2 });
1843
- }
1844
- updateNodeData(id, { scale, bias });
1845
- }, [incoming, scale, bias]);
1846
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_layout22.NodeContainer, { id, selected, data, type, children: [
1847
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_core12.Stack, { children: [
1848
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_core12.Group, { children: [
1849
- "Scale:",
1850
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1851
- import_core12.NumberInput,
1852
- {
1853
- size: "xs",
1854
- w: 100,
1855
- value: scale,
1856
- onChange: (e) => setScale(Number(e)),
1857
- step: 0.1
1858
- }
1859
- )
1860
- ] }),
1861
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_core12.Group, { children: [
1862
- "Bias:",
1863
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
1864
- import_core12.NumberInput,
1865
- {
1866
- size: "xs",
1867
- w: 100,
1868
- value: bias,
1869
- onChange: (e) => setBias(Number(e)),
1870
- step: 0.1
1871
- }
1872
- )
1873
- ] })
1874
- ] }),
1875
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_layout22.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
1876
- ] });
1877
- }
1878
- var noise_scale_bias_node_default = NoiseScaleBiasNode;
1879
-
1880
- // src/nodes/modifiers/noise-terrace-node.tsx
1881
- var import_layout23 = require("@awesome-flow/core/layout");
1882
- var import_core13 = require("@mantine/core");
1883
- var import_hooks24 = require("@awesome-flow/core/hooks");
1884
- var import_react30 = require("react");
1885
- var import_libnoise_simplex_ts17 = require("libnoise-simplex-ts");
1886
- var import_icons_react3 = require("@tabler/icons-react");
1887
- var import_hooks25 = require("@mantine/hooks");
1888
- var import_abstract3 = require("@awesome-flow/core/abstract");
1889
- var import_jsx_runtime23 = require("react/jsx-runtime");
1890
- function NoiseTerraceNode({ id, selected, data, type }) {
1891
- const incoming = (0, import_hooks24.useIncomingComputedData)(id);
1892
- const updateNodeData = (0, import_hooks24.useUpdateNodeData)();
1893
- const updateComputedData = (0, import_hooks24.useUpdateNodeComputedData)();
1894
- const [values, setValues] = (0, import_react30.useState)([]);
1895
- const form = useForm({
1896
- mode: "uncontrolled",
1897
- initialValues: {
1898
- points: []
1899
- },
1900
- validateInputOnChange: [`points.${FORM_INDEX}.input`],
1901
- clearInputErrorOnChange: true,
1902
- onValuesChange: (0, import_react30.useCallback)((values2) => {
1903
- if (form.isValid()) {
1904
- const points = values2.points.map((v) => v.value);
1905
- setValues(points);
1906
- updateNodeData(id, { points });
1907
- }
1908
- form.validate();
1909
- }, [])
1910
- });
1911
- (0, import_react30.useEffect)(() => {
1912
- const points = data.points?.length ? data.points.map((v) => ({ value: v, key: (0, import_hooks25.randomId)() })) : [1, 2].map(() => ({ value: 0, key: (0, import_hooks25.randomId)() }));
1913
- form.initialize({ points });
1914
- }, []);
1915
- (0, import_react30.useEffect)(() => {
1916
- if (incoming?.length && values?.length >= 2) {
1917
- const module2 = new import_libnoise_simplex_ts17.Terrace(incoming[0].module, values);
1918
- updateComputedData(id, { module: module2 });
1919
- }
1920
- }, [values, incoming]);
1921
- const fields = form.getValues().points.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_core13.Group, { mt: "xs", children: [
1922
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1923
- import_core13.NumberInput,
1924
- {
1925
- size: "xs",
1926
- placeholder: "Input Value",
1927
- ...form.getInputProps(`points.${index}.value`),
1928
- step: 0.1
1929
- },
1930
- form.key(`points.${index}.value`)
1931
- ),
1932
- data.state === import_abstract3.NodeState.edit && values.length > 2 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1933
- import_core13.ActionIcon,
1934
- {
1935
- color: "red",
1936
- variant: "outline",
1937
- size: "sm",
1938
- onClick: () => form.removeListItem("points", index),
1939
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_icons_react3.IconX, { size: "1rem" })
1940
- }
1941
- )
1942
- ] }, item.key));
1943
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_layout23.NodeContainer, { id, selected, type, data, children: [
1944
- fields,
1945
- data.state === import_abstract3.NodeState.edit && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
1946
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_core13.Space, { h: 10 }),
1947
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1948
- import_core13.Button,
1949
- {
1950
- variant: "outline",
1951
- size: "xs",
1952
- fullWidth: true,
1953
- onClick: () => form.insertListItem("points", { value: 0, key: (0, import_hooks25.randomId)() }),
1954
- children: "Add control point"
1955
- }
1956
- )
1957
- ] }),
1958
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_layout23.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
1959
- ] });
1960
- }
1961
- var noise_terrace_node_default = NoiseTerraceNode;
1962
-
1963
- // src/nodes/selectors/noise-blend-node.tsx
1964
- var import_layout24 = require("@awesome-flow/core/layout");
1965
- var import_react31 = require("react");
1966
- var import_hooks26 = require("@awesome-flow/core/hooks");
1967
- var import_libnoise_simplex_ts18 = require("libnoise-simplex-ts");
1968
- var import_components8 = require("@awesome-flow/core/components");
1969
- var import_jsx_runtime24 = require("react/jsx-runtime");
1970
- function NoiseBlendNode({ id, selected, data, type }) {
1971
- const updateComputedData = (0, import_hooks26.useUpdateNodeComputedData)();
1972
- const onDataUpdated = (0, import_react31.useCallback)(
1973
- (incomingData) => {
1974
- const incomingSources = incomingData["source" /* source */];
1975
- const incomingControl = incomingData["control" /* control */];
1976
- if (incomingSources?.length >= 2 && incomingControl?.length) {
1977
- const module2 = new import_libnoise_simplex_ts18.Blend(
1978
- incomingSources[0].module,
1979
- incomingSources[1].module,
1980
- incomingControl[0].module
1981
- );
1982
- updateComputedData(id, { module: module2 });
1983
- }
1984
- },
1985
- []
1986
- );
1987
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_layout24.NodeContainer, { id, selected, data, type, children: [
1988
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
1989
- import_components8.HandlesIncomingDataStatus,
1990
- {
1991
- nodeId: id,
1992
- handles: data.handles,
1993
- handleKey: "dataId",
1994
- onDataUpdated,
1995
- type: "target",
1996
- resetComputedData: true
1997
- }
1998
- ),
1999
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_layout24.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2000
- ] });
2001
- }
2002
- var noise_blend_node_default = NoiseBlendNode;
2003
-
2004
- // src/nodes/selectors/noise-select-node.tsx
2005
- var import_layout25 = require("@awesome-flow/core/layout");
2006
- var import_react32 = require("react");
2007
- var import_hooks27 = require("@awesome-flow/core/hooks");
2008
- var import_libnoise_simplex_ts19 = require("libnoise-simplex-ts");
2009
- var import_core14 = require("@mantine/core");
2010
- var import_components9 = require("@awesome-flow/core/components");
2011
- var import_jsx_runtime25 = require("react/jsx-runtime");
2012
- function NoiseSelectNode({ id, selected, data, type }) {
2013
- const [edgeFalloff, setEdgeFalloff] = (0, import_react32.useState)(data.edgeFalloff);
2014
- const [lowerBound, setLowerBound] = (0, import_react32.useState)(data.lowerBound);
2015
- const [upperBound, setUpperBound] = (0, import_react32.useState)(data.upperBound);
2016
- const updateNodeData = (0, import_hooks27.useUpdateNodeData)();
2017
- const updateComputedData = (0, import_hooks27.useUpdateNodeComputedData)();
2018
- (0, import_react32.useEffect)(() => {
2019
- updateNodeData(id, { edgeFalloff, lowerBound, upperBound });
2020
- }, [edgeFalloff, lowerBound, upperBound]);
2021
- const onDataUpdated = (0, import_react32.useCallback)(
2022
- (incomingData) => {
2023
- const incomingSources = incomingData["source" /* source */];
2024
- const incomingControl = incomingData["control" /* control */];
2025
- if (incomingSources?.length >= 2 && incomingControl?.length) {
2026
- const module2 = new import_libnoise_simplex_ts19.Select(
2027
- incomingSources[0].module,
2028
- incomingSources[1].module,
2029
- incomingControl[0].module,
2030
- edgeFalloff,
2031
- lowerBound,
2032
- upperBound
2033
- );
2034
- updateComputedData(id, { module: module2 });
2035
- }
2036
- },
2037
- []
2038
- );
2039
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_layout25.NodeContainer, { id, selected, data, type, children: [
2040
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_core14.Stack, { children: [
2041
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_core14.Group, { children: [
2042
- "Edge Falloff:",
2043
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2044
- import_core14.NumberInput,
2045
- {
2046
- size: "xs",
2047
- w: 100,
2048
- value: edgeFalloff,
2049
- onChange: (e) => setEdgeFalloff(Number(e)),
2050
- step: 0.1
2051
- }
2052
- )
2053
- ] }),
2054
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_core14.Group, { children: [
2055
- "Lower Bound:",
2056
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2057
- import_core14.NumberInput,
2058
- {
2059
- size: "xs",
2060
- w: 100,
2061
- value: lowerBound,
2062
- onChange: (e) => setLowerBound(Number(e)),
2063
- step: 0.1
2064
- }
2065
- )
2066
- ] }),
2067
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_core14.Group, { children: [
2068
- "Upper Bound:",
2069
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2070
- import_core14.NumberInput,
2071
- {
2072
- size: "xs",
2073
- w: 100,
2074
- value: upperBound,
2075
- onChange: (e) => setUpperBound(Number(e)),
2076
- step: 0.1
2077
- }
2078
- )
2079
- ] }),
2080
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
2081
- import_components9.HandlesIncomingDataStatus,
2082
- {
2083
- nodeId: id,
2084
- handles: data.handles,
2085
- handleKey: "dataId",
2086
- onDataUpdated,
2087
- type: "target",
2088
- resetComputedData: true
2089
- }
2090
- )
2091
- ] }),
2092
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_layout25.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2093
- ] });
2094
- }
2095
- var noise_select_node_default = NoiseSelectNode;
2096
-
2097
- // src/nodes/transformers/noise-displace-node.tsx
2098
- var import_layout26 = require("@awesome-flow/core/layout");
2099
- var import_react33 = require("react");
2100
- var import_hooks28 = require("@awesome-flow/core/hooks");
2101
- var import_libnoise_simplex_ts20 = require("libnoise-simplex-ts");
2102
- var import_components10 = require("@awesome-flow/core/components");
2103
- var import_jsx_runtime26 = require("react/jsx-runtime");
2104
- function NoiseDisplaceNode({ id, selected, data, type }) {
2105
- const updateComputedData = (0, import_hooks28.useUpdateNodeComputedData)();
2106
- const onDataUpdated = (0, import_react33.useCallback)(
2107
- (handleData) => {
2108
- const sourceModule = handleData["source" /* sourceModule */];
2109
- const xModule = handleData["x-module" /* xModule */];
2110
- const yModule = handleData["y-module" /* yModule */];
2111
- const zModule = handleData["z-module" /* zModule */];
2112
- if (sourceModule && xModule && yModule && zModule) {
2113
- const module2 = new import_libnoise_simplex_ts20.Displace(
2114
- sourceModule[0].module,
2115
- xModule[0].module,
2116
- yModule[0].module,
2117
- zModule[0].module
2118
- );
2119
- updateComputedData(id, { module: module2 });
2120
- }
2121
- },
2122
- []
2123
- );
2124
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_layout26.NodeContainer, { id, selected, data, type, children: [
2125
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
2126
- import_components10.HandlesIncomingDataStatus,
2127
- {
2128
- nodeId: id,
2129
- handles: data.handles,
2130
- handleKey: "dataId",
2131
- onDataUpdated,
2132
- type: "target",
2133
- resetComputedData: true
2134
- }
2135
- ),
2136
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_layout26.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2137
- ] });
2138
- }
2139
- var noise_displace_node_default = NoiseDisplaceNode;
2140
-
2141
- // src/nodes/transformers/noise-rotate-point-node.tsx
2142
- var import_layout27 = require("@awesome-flow/core/layout");
2143
- var import_react34 = require("react");
2144
- var import_hooks29 = require("@awesome-flow/core/hooks");
2145
- var import_core15 = require("@mantine/core");
2146
- var import_libnoise_simplex_ts21 = require("libnoise-simplex-ts");
2147
- var import_jsx_runtime27 = require("react/jsx-runtime");
2148
- function NoiseRotatePointNode({
2149
- id,
2150
- selected,
2151
- data,
2152
- type
2153
- }) {
2154
- const [xAngle, setXAngle] = (0, import_react34.useState)(data.xAngle);
2155
- const [yAngle, setYAngle] = (0, import_react34.useState)(data.yAngle);
2156
- const [zAngle, setZAngle] = (0, import_react34.useState)(data.zAngle);
2157
- const incoming = (0, import_hooks29.useIncomingComputedData)(id);
2158
- const updateNodeData = (0, import_hooks29.useUpdateNodeData)();
2159
- const updateComputedData = (0, import_hooks29.useUpdateNodeComputedData)();
2160
- (0, import_react34.useEffect)(() => {
2161
- if (incoming?.length) {
2162
- const module2 = new import_libnoise_simplex_ts21.RotatePoint(incoming[0].module, xAngle, yAngle, zAngle);
2163
- updateComputedData(id, { module: module2 });
2164
- }
2165
- updateNodeData(id, { xAngle, yAngle, zAngle });
2166
- }, [id, updateComputedData, updateNodeData, incoming, xAngle, yAngle, zAngle]);
2167
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_layout27.NodeContainer, { id, selected, data, type, children: [
2168
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_core15.Stack, { children: [
2169
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_core15.Group, { children: [
2170
- "X Angle:",
2171
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2172
- import_core15.NumberInput,
2173
- {
2174
- size: "xs",
2175
- w: 100,
2176
- value: xAngle,
2177
- onChange: (e) => setXAngle(Number(e)),
2178
- step: 0.01
2179
- }
2180
- )
2181
- ] }),
2182
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_core15.Group, { children: [
2183
- "Y Angle:",
2184
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2185
- import_core15.NumberInput,
2186
- {
2187
- size: "xs",
2188
- w: 100,
2189
- value: yAngle,
2190
- onChange: (e) => setYAngle(Number(e)),
2191
- step: 0.01
2192
- }
2193
- )
2194
- ] }),
2195
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_core15.Group, { children: [
2196
- "Z Angle:",
2197
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
2198
- import_core15.NumberInput,
2199
- {
2200
- size: "xs",
2201
- w: 100,
2202
- value: zAngle,
2203
- onChange: (e) => setZAngle(Number(e)),
2204
- step: 0.01
2205
- }
2206
- )
2207
- ] })
2208
- ] }),
2209
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_layout27.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2210
- ] });
2211
- }
2212
- var noise_rotate_point_node_default = NoiseRotatePointNode;
2213
-
2214
- // src/nodes/transformers/noise-scale-point-node.tsx
2215
- var import_layout28 = require("@awesome-flow/core/layout");
2216
- var import_react35 = require("react");
2217
- var import_hooks30 = require("@awesome-flow/core/hooks");
2218
- var import_core16 = require("@mantine/core");
2219
- var import_libnoise_simplex_ts22 = require("libnoise-simplex-ts");
2220
- var import_jsx_runtime28 = require("react/jsx-runtime");
2221
- function NoiseScalePointNode({
2222
- id,
2223
- selected,
2224
- data,
2225
- type
2226
- }) {
2227
- const [xScale, setXScale] = (0, import_react35.useState)(data.xScale);
2228
- const [yScale, setYScale] = (0, import_react35.useState)(data.yScale);
2229
- const [zScale, setZScale] = (0, import_react35.useState)(data.zScale);
2230
- const incoming = (0, import_hooks30.useIncomingComputedData)(id);
2231
- const updateNodeData = (0, import_hooks30.useUpdateNodeData)();
2232
- const updateComputedData = (0, import_hooks30.useUpdateNodeComputedData)();
2233
- (0, import_react35.useEffect)(() => {
2234
- if (incoming?.length) {
2235
- const module2 = new import_libnoise_simplex_ts22.ScalePoint(incoming[0].module, xScale, yScale, zScale);
2236
- updateComputedData(id, { module: module2 });
2237
- }
2238
- updateNodeData(id, { xScale, yScale, zScale });
2239
- }, [id, incoming, updateComputedData, updateNodeData, xScale, yScale, zScale]);
2240
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_layout28.NodeContainer, { id, selected, data, type, children: [
2241
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_core16.Stack, { children: [
2242
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_core16.Group, { children: [
2243
- "X Scale:",
2244
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2245
- import_core16.NumberInput,
2246
- {
2247
- size: "xs",
2248
- w: 100,
2249
- value: xScale,
2250
- onChange: (e) => setXScale(Number(e)),
2251
- step: 0.01
2252
- }
2253
- )
2254
- ] }),
2255
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_core16.Group, { children: [
2256
- "Y Scale:",
2257
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2258
- import_core16.NumberInput,
2259
- {
2260
- size: "xs",
2261
- w: 100,
2262
- value: yScale,
2263
- onChange: (e) => setYScale(Number(e)),
2264
- step: 0.01
2265
- }
2266
- )
2267
- ] }),
2268
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_core16.Group, { children: [
2269
- "Z Scale:",
2270
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
2271
- import_core16.NumberInput,
2272
- {
2273
- size: "xs",
2274
- w: 100,
2275
- value: zScale,
2276
- onChange: (e) => setZScale(Number(e)),
2277
- step: 0.01
2278
- }
2279
- )
2280
- ] })
2281
- ] }),
2282
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_layout28.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2283
- ] });
2284
- }
2285
- var noise_scale_point_node_default = NoiseScalePointNode;
2286
-
2287
- // src/nodes/transformers/noise-translate-point-node.tsx
2288
- var import_layout29 = require("@awesome-flow/core/layout");
2289
- var import_react36 = require("react");
2290
- var import_hooks31 = require("@awesome-flow/core/hooks");
2291
- var import_core17 = require("@mantine/core");
2292
- var import_libnoise_simplex_ts23 = require("libnoise-simplex-ts");
2293
- var import_jsx_runtime29 = require("react/jsx-runtime");
2294
- function NoiseTranslatePointNode({
2295
- id,
2296
- selected,
2297
- data,
2298
- type
2299
- }) {
2300
- const [translateX, setTranslateX] = (0, import_react36.useState)(data.translateX);
2301
- const [translateY, setTranslateY] = (0, import_react36.useState)(data.translateY);
2302
- const [translateZ, setTranslateZ] = (0, import_react36.useState)(data.translateZ);
2303
- const incoming = (0, import_hooks31.useIncomingComputedData)(id);
2304
- const updateNodeData = (0, import_hooks31.useUpdateNodeData)();
2305
- const updateComputedData = (0, import_hooks31.useUpdateNodeComputedData)();
2306
- (0, import_react36.useEffect)(() => {
2307
- if (incoming?.length) {
2308
- const module2 = new import_libnoise_simplex_ts23.TranslatePoint(incoming[0].module, translateX, translateY, translateZ);
2309
- updateComputedData(id, { module: module2 });
2310
- }
2311
- updateNodeData(id, { translateX, translateY, translateZ });
2312
- }, [id, incoming, translateX, translateY, translateZ, updateComputedData, updateNodeData]);
2313
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_layout29.NodeContainer, { id, selected, data, type, children: [
2314
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core17.Stack, { children: [
2315
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core17.Group, { children: [
2316
- "Translate X:",
2317
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2318
- import_core17.NumberInput,
2319
- {
2320
- size: "xs",
2321
- w: 100,
2322
- value: translateX,
2323
- onChange: (e) => setTranslateX(Number(e)),
2324
- step: 1
2325
- }
2326
- )
2327
- ] }),
2328
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core17.Group, { children: [
2329
- "Translate Y:",
2330
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2331
- import_core17.NumberInput,
2332
- {
2333
- size: "xs",
2334
- w: 100,
2335
- value: translateY,
2336
- onChange: (e) => setTranslateY(Number(e)),
2337
- step: 1
2338
- }
2339
- )
2340
- ] }),
2341
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_core17.Group, { children: [
2342
- "Translate Z:",
2343
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
2344
- import_core17.NumberInput,
2345
- {
2346
- size: "xs",
2347
- w: 100,
2348
- value: translateZ,
2349
- onChange: (e) => setTranslateZ(Number(e)),
2350
- step: 1
2351
- }
2352
- )
2353
- ] })
2354
- ] }),
2355
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_layout29.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2356
- ] });
2357
- }
2358
- var noise_translate_point_node_default = NoiseTranslatePointNode;
2359
-
2360
- // src/nodes/transformers/noise-turbulence-node .tsx
2361
- var import_layout30 = require("@awesome-flow/core/layout");
2362
- var import_react37 = require("react");
2363
- var import_hooks32 = require("@awesome-flow/core/hooks");
2364
- var import_libnoise_simplex_ts24 = require("libnoise-simplex-ts");
2365
- var import_components11 = require("@awesome-flow/core/components");
2366
- var import_jsx_runtime30 = require("react/jsx-runtime");
2367
- function NoiseTurbulenceNode({
2368
- id,
2369
- selected,
2370
- data,
2371
- type
2372
- }) {
2373
- const [properties, setProperties] = (0, import_react37.useState)(null);
2374
- const incoming = (0, import_hooks32.useIncomingComputedData)(id);
2375
- const updateComputedData = (0, import_hooks32.useUpdateNodeComputedData)();
2376
- const onPropertiesChange = (0, import_react37.useCallback)((props) => {
2377
- setProperties(props);
2378
- }, []);
2379
- (0, import_react37.useEffect)(() => {
2380
- if (incoming?.length && properties) {
2381
- const module2 = new import_libnoise_simplex_ts24.Turbulence(
2382
- incoming[0].module,
2383
- properties.frequency.value,
2384
- properties.power.value,
2385
- properties.roughness.value,
2386
- properties.seed.value
2387
- );
2388
- updateComputedData(id, { module: module2 });
2389
- }
2390
- }, [id, incoming, properties]);
2391
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_layout30.NodeContainer, { id, selected, data, type, children: [
2392
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components11.NodePropertyVariables, { data, nodeId: id, onPropertiesChange }),
2393
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_layout30.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
2394
- ] });
2395
- }
2396
- var noise_turbulence_node_default = NoiseTurbulenceNode;
2397
-
2398
- // src/templates/generators/noise-checkerboard-template.ts
2399
- var import_system = require("@xyflow/system");
2400
-
2401
- // src/abstract/templates.ts
2402
- var NoiseTemplateGroup = /* @__PURE__ */ ((NoiseTemplateGroup2) => {
2403
- NoiseTemplateGroup2["positions"] = "Positions";
2404
- NoiseTemplateGroup2["output"] = "Output";
2405
- NoiseTemplateGroup2["noiseGenerators"] = "Noise Generators";
2406
- NoiseTemplateGroup2["noiseModifiers"] = "Noise Modifiers";
2407
- NoiseTemplateGroup2["noiseSelectors"] = "Noise Selectors";
2408
- NoiseTemplateGroup2["noiseTransformers"] = "Noise Transformers";
2409
- return NoiseTemplateGroup2;
2410
- })(NoiseTemplateGroup || {});
2411
-
2412
- // src/templates/generators/noise-checkerboard-template.ts
2413
- var NoiseCheckerboardNodeTemplateFactory = class {
2414
- template = {
2415
- type: "noise-checkerboard" /* noiseCheckerboard */,
2416
- group: "Noise Generators" /* noiseGenerators */,
2417
- data: {
2418
- title: "Checkerboard Noise"
2419
- },
2420
- handles: [
2421
- {
2422
- position: import_system.Position.Right,
2423
- dataType: "module" /* module */,
2424
- connection: "source"
2425
- }
2426
- ]
2427
- };
2428
- };
2429
-
2430
- // src/templates/generators/noise-const-template.ts
2431
- var import_system2 = require("@xyflow/system");
2432
- var NoiseConstNodeTemplateFactory = class {
2433
- template = {
2434
- type: "noise-constant" /* noiseConst */,
2435
- group: "Noise Generators" /* noiseGenerators */,
2436
- data: {
2437
- title: "Const Value Noise",
2438
- noise: 0,
2439
- min: -1,
2440
- max: 1
2441
- },
2442
- handles: [
2443
- {
2444
- position: import_system2.Position.Right,
2445
- dataType: "module" /* module */,
2446
- connection: "source"
2447
- }
2448
- ]
2449
- };
2450
- };
2451
-
2452
- // src/templates/generators/noise-cylinders-template.ts
2453
- var import_abstract6 = require("@awesome-flow/core/abstract");
2454
- var import_system3 = require("@xyflow/system");
2455
- var NoiseCylindersNodeTemplateFactory = class {
2456
- template = {
2457
- type: "noise-cylinders" /* noiseCylinders */,
2458
- group: "Noise Generators" /* noiseGenerators */,
2459
- data: {
2460
- title: "Cylinders Noise",
2461
- frequency: 0.1
2462
- },
2463
- handles: [
2464
- {
2465
- position: import_system3.Position.Left,
2466
- dataType: import_abstract6.CoreHandleType.variableProperty,
2467
- connection: "target"
2468
- },
2469
- {
2470
- position: import_system3.Position.Right,
2471
- dataType: "module" /* module */,
2472
- connection: "source"
2473
- }
2474
- ]
2475
- };
2476
- };
2477
-
2478
- // src/templates/generators/noise-perlin-template.ts
2479
- var import_abstract7 = require("@awesome-flow/core/abstract");
2480
- var import_system4 = require("@xyflow/system");
2481
- var NoisePerlinNodeTemplateFactory = class {
2482
- template = {
2483
- type: "noise-perlin" /* noisePerlin */,
2484
- group: "Noise Generators" /* noiseGenerators */,
2485
- data: {
2486
- title: "Perlin Noise",
2487
- frequency: 0.1,
2488
- lacunarity: 2,
2489
- octaves: 5,
2490
- persistence: 0.5,
2491
- seed: 0
2492
- },
2493
- handles: [
2494
- {
2495
- position: import_system4.Position.Left,
2496
- dataType: import_abstract7.CoreHandleType.variableProperty,
2497
- connection: "target"
2498
- },
2499
- {
2500
- position: import_system4.Position.Right,
2501
- dataType: "module" /* module */,
2502
- connection: "source"
2503
- }
2504
- ]
2505
- };
2506
- };
2507
-
2508
- // src/templates/generators/noise-ridgedmulti-template.ts
2509
- var import_abstract8 = require("@awesome-flow/core/abstract");
2510
- var import_system5 = require("@xyflow/system");
2511
- var NoiseRidgedMultiNodeTemplateFactory = class {
2512
- template = {
2513
- type: "noise-ridged-multi" /* noiseRidgedMulti */,
2514
- group: "Noise Generators" /* noiseGenerators */,
2515
- data: {
2516
- title: "Ridged Multi Noise",
2517
- frequency: 0.1,
2518
- lacunarity: 2,
2519
- octaves: 6,
2520
- offset: 1,
2521
- gain: 2,
2522
- seed: 0
2523
- },
2524
- handles: [
2525
- {
2526
- position: import_system5.Position.Left,
2527
- dataType: import_abstract8.CoreHandleType.variableProperty,
2528
- connection: "target"
2529
- },
2530
- {
2531
- position: import_system5.Position.Right,
2532
- dataType: "module" /* module */,
2533
- connection: "source"
2534
- }
2535
- ]
2536
- };
2537
- };
2538
-
2539
- // src/templates/generators/noise-spheres-template.ts
2540
- var import_abstract9 = require("@awesome-flow/core/abstract");
2541
- var import_system6 = require("@xyflow/system");
2542
- var NoiseSpheresNodeTemplateFactory = class {
2543
- template = {
2544
- type: "noise-spheres" /* noiseSpheres */,
2545
- group: "Noise Generators" /* noiseGenerators */,
2546
- data: {
2547
- title: "Spheres Noise",
2548
- frequency: 0.1
2549
- },
2550
- handles: [
2551
- {
2552
- position: import_system6.Position.Left,
2553
- dataType: import_abstract9.CoreHandleType.variableProperty,
2554
- connection: "target"
2555
- },
2556
- {
2557
- position: import_system6.Position.Right,
2558
- dataType: "module" /* module */,
2559
- connection: "source"
2560
- }
2561
- ]
2562
- };
2563
- };
2564
-
2565
- // src/templates/generators/noise-voronoi-template.ts
2566
- var import_abstract10 = require("@awesome-flow/core/abstract");
2567
- var import_system7 = require("@xyflow/system");
2568
- var NoiseVoronoiNodeTemplateFactory = class {
2569
- template = {
2570
- type: "noise-voronoi" /* noiseVoronoi */,
2571
- group: "Noise Generators" /* noiseGenerators */,
2572
- data: {
2573
- title: "Voronoi Noise",
2574
- frequency: 0.1,
2575
- displacement: 1,
2576
- distance: true,
2577
- seed: 0
2578
- },
2579
- handles: [
2580
- {
2581
- position: import_system7.Position.Left,
2582
- dataType: import_abstract10.CoreHandleType.variableProperty,
2583
- connection: "target"
2584
- },
2585
- {
2586
- position: import_system7.Position.Right,
2587
- dataType: "module" /* module */,
2588
- connection: "source"
2589
- }
2590
- ]
2591
- };
2592
- };
2593
-
2594
- // src/templates/generators/position-const-template.ts
2595
- var import_system8 = require("@xyflow/system");
2596
- var PositionConstNodeTemplateFactory = class {
2597
- template = {
2598
- type: "position" /* position */,
2599
- group: "Positions" /* positions */,
2600
- data: {
2601
- title: "Position Output",
2602
- position: { x: 0, y: 0, z: 0 }
2603
- },
2604
- handles: [
2605
- {
2606
- position: import_system8.Position.Right,
2607
- dataType: "position" /* position */,
2608
- connection: "source"
2609
- }
2610
- ]
2611
- };
2612
- };
2613
-
2614
- // src/templates/generators/position-grid-template.ts
2615
- var import_system9 = require("@xyflow/system");
2616
- var PositionGridNodeTemplateFactory = class {
2617
- template = {
2618
- type: "grid" /* grid */,
2619
- group: "Positions" /* positions */,
2620
- data: {
2621
- title: "Grid Output",
2622
- center: { x: 0, y: 0, z: 0 },
2623
- radius: 1
2624
- },
2625
- handles: [
2626
- {
2627
- position: import_system9.Position.Right,
2628
- dataType: "position" /* position */,
2629
- connection: "source"
2630
- }
2631
- ]
2632
- };
2633
- };
2634
-
2635
- // src/templates/modifiers/noise-normalize-template.ts
2636
- var import_utils = require("@awesome-flow/core/utils");
2637
- var import_system10 = require("@xyflow/system");
2638
- var NoiseNormalizeNodeTemplateFactory = class {
2639
- template = {
2640
- id: import_utils.IDGenerator.template(),
2641
- type: "noise-normalize" /* noiseNormalize */,
2642
- group: "Noise Modifiers" /* noiseModifiers */,
2643
- data: {
2644
- title: "Normalize Noise",
2645
- intervalStart: -1,
2646
- intervalEnd: 1
2647
- },
2648
- handles: [
2649
- {
2650
- position: import_system10.Position.Left,
2651
- dataType: "module" /* module */,
2652
- connection: "target",
2653
- maxConnections: 1
2654
- },
2655
- {
2656
- position: import_system10.Position.Right,
2657
- dataType: "module" /* module */,
2658
- connection: "source"
2659
- }
2660
- ]
2661
- };
2662
- };
2663
-
2664
- // src/templates/output/noise-logger-template.ts
2665
- var import_system11 = require("@xyflow/system");
2666
- var NoiseLoggerNodeTemplateFactory = class {
2667
- template = {
2668
- type: "noise-logger" /* noiseLogger */,
2669
- group: "Output" /* output */,
2670
- data: {
2671
- title: "Noise Logger"
2672
- },
2673
- handles: [
2674
- {
2675
- position: import_system11.Position.Left,
2676
- dataType: "noise" /* noise */,
2677
- connection: "target"
2678
- }
2679
- ]
2680
- };
2681
- };
2682
-
2683
- // src/templates/output/noise-raw-texture-template.ts
2684
- var import_system12 = require("@xyflow/system");
2685
- var NoiseRawTextureTemplateFactory = class {
2686
- template = {
2687
- type: "texture-data" /* textureData */,
2688
- group: "Output" /* output */,
2689
- data: {
2690
- title: "Texture Data"
2691
- },
2692
- handles: [
2693
- {
2694
- position: import_system12.Position.Left,
2695
- dataType: "noise" /* noise */,
2696
- connection: "target",
2697
- maxConnections: 1
2698
- },
2699
- {
2700
- position: import_system12.Position.Right,
2701
- dataType: "texture" /* texture */,
2702
- connection: "source"
2703
- }
2704
- ]
2705
- };
2706
- };
2707
-
2708
- // src/templates/output/position-logger-template.ts
2709
- var import_system13 = require("@xyflow/system");
2710
- var PositionLoggerNodeTemplateFactory = class {
2711
- template = {
2712
- type: "position-logger" /* positionLogger */,
2713
- group: "Positions" /* positions */,
2714
- data: {
2715
- title: "Position Logger"
2716
- },
2717
- handles: [
2718
- {
2719
- position: import_system13.Position.Left,
2720
- dataType: "position" /* position */,
2721
- connection: "target"
2722
- }
2723
- ]
2724
- };
2725
- };
2726
-
2727
- // src/templates/modifiers/noise-combine-template.ts
2728
- var import_system14 = require("@xyflow/system");
2729
- var NoiseCombineNodeTemplateFactory = class {
2730
- template = {
2731
- type: "noise-combiner" /* noiseCombine */,
2732
- group: "Noise Modifiers" /* noiseModifiers */,
2733
- data: {
2734
- title: "Combine Noise",
2735
- operation: "add" /* add */
2736
- },
2737
- handles: [
2738
- {
2739
- position: import_system14.Position.Left,
2740
- dataType: "module" /* module */,
2741
- connection: "target",
2742
- maxConnections: 2
2743
- },
2744
- {
2745
- position: import_system14.Position.Right,
2746
- dataType: "module" /* module */,
2747
- connection: "source"
2748
- }
2749
- ]
2750
- };
2751
- };
2752
-
2753
- // src/templates/modifiers/noise-clamp-template.ts
2754
- var import_system15 = require("@xyflow/system");
2755
- var NoiseClampNodeTemplateFactory = class {
2756
- template = {
2757
- type: "noise-clamp" /* noiseClamp */,
2758
- group: "Noise Modifiers" /* noiseModifiers */,
2759
- data: {
2760
- title: "Clamp Noise",
2761
- lowerBound: -1,
2762
- upperBound: 1
2763
- },
2764
- handles: [
2765
- {
2766
- position: import_system15.Position.Left,
2767
- dataType: "module" /* module */,
2768
- connection: "target",
2769
- maxConnections: 1
2770
- },
2771
- {
2772
- position: import_system15.Position.Right,
2773
- dataType: "module" /* module */,
2774
- connection: "source"
2775
- }
2776
- ]
2777
- };
2778
- };
2779
-
2780
- // src/templates/modifiers/noise-abs-template.ts
2781
- var import_system16 = require("@xyflow/system");
2782
- var NoiseAbsNodeTemplateFactory = class {
2783
- template = {
2784
- type: "noise-abs" /* noiseAbs */,
2785
- group: "Noise Modifiers" /* noiseModifiers */,
2786
- data: {
2787
- title: "Abs Noise"
2788
- },
2789
- handles: [
2790
- {
2791
- position: import_system16.Position.Left,
2792
- dataType: "module" /* module */,
2793
- connection: "target",
2794
- maxConnections: 1
2795
- },
2796
- {
2797
- position: import_system16.Position.Right,
2798
- dataType: "module" /* module */,
2799
- connection: "source"
2800
- }
2801
- ]
2802
- };
2803
- };
2804
-
2805
- // src/templates/output/noise-output-template.ts
2806
- var import_system17 = require("@xyflow/system");
2807
- var NoiseOutputNodeTemplateFactory = class {
2808
- template = {
2809
- type: "noise-output" /* noiseOutput */,
2810
- group: "Output" /* output */,
2811
- data: {
2812
- title: "Noise Output"
2813
- },
2814
- handles: [
2815
- {
2816
- position: import_system17.Position.Left,
2817
- dataType: "position" /* position */,
2818
- connection: "target"
2819
- },
2820
- {
2821
- position: import_system17.Position.Left,
2822
- dataType: "module" /* module */,
2823
- connection: "target",
2824
- maxConnections: 1
2825
- },
2826
- {
2827
- position: import_system17.Position.Right,
2828
- dataType: "noise" /* noise */,
2829
- connection: "source"
2830
- }
2831
- ]
2832
- };
2833
- };
2834
-
2835
- // src/templates/modifiers/noise-curve-template.ts
2836
- var import_system18 = require("@xyflow/system");
2837
- var NoiseCurveNodeTemplateFactory = class {
2838
- template = {
2839
- type: "noise-curve" /* noiseCurve */,
2840
- group: "Noise Modifiers" /* noiseModifiers */,
2841
- data: {
2842
- title: "Noise Curve",
2843
- points: []
2844
- },
2845
- handles: [
2846
- {
2847
- position: import_system18.Position.Left,
2848
- dataType: "module" /* module */,
2849
- connection: "target",
2850
- maxConnections: 1
2851
- },
2852
- // {
2853
- // position: Position.Left,
2854
- // dataType: CoreHandleType.variableProperty,
2855
- // connection: 'target',
2856
- // },
2857
- {
2858
- position: import_system18.Position.Right,
2859
- dataType: "module" /* module */,
2860
- connection: "source"
2861
- }
2862
- ]
2863
- };
2864
- };
2865
-
2866
- // src/templates/modifiers/noise-exponent-template.ts
2867
- var import_system19 = require("@xyflow/system");
2868
- var NoiseExponentNodeTemplateFactory = class {
2869
- template = {
2870
- type: "noise-exponent" /* noiseExponent */,
2871
- group: "Noise Modifiers" /* noiseModifiers */,
2872
- data: {
2873
- title: "Noise Exponent",
2874
- exponent: 1
2875
- },
2876
- handles: [
2877
- {
2878
- position: import_system19.Position.Left,
2879
- dataType: "module" /* module */,
2880
- connection: "target",
2881
- maxConnections: 1
2882
- },
2883
- {
2884
- position: import_system19.Position.Right,
2885
- dataType: "module" /* module */,
2886
- connection: "source"
2887
- }
2888
- ]
2889
- };
2890
- };
2891
-
2892
- // src/templates/modifiers/noise-invert-template.ts
2893
- var import_system20 = require("@xyflow/system");
2894
- var NoiseInvertNodeTemplateFactory = class {
2895
- template = {
2896
- type: "noise-invert" /* noiseInvert */,
2897
- group: "Noise Modifiers" /* noiseModifiers */,
2898
- data: {
2899
- title: "Invert Noise"
2900
- },
2901
- handles: [
2902
- {
2903
- position: import_system20.Position.Left,
2904
- dataType: "module" /* module */,
2905
- connection: "target",
2906
- maxConnections: 1
2907
- },
2908
- {
2909
- position: import_system20.Position.Right,
2910
- dataType: "module" /* module */,
2911
- connection: "source"
2912
- }
2913
- ]
2914
- };
2915
- };
2916
-
2917
- // src/templates/modifiers/noise-scalebias-template.ts
2918
- var import_system21 = require("@xyflow/system");
2919
- var NoiseScaleBiasNodeTemplateFactory = class {
2920
- template = {
2921
- type: "noise-scale-bias" /* noiseScaleBias */,
2922
- group: "Noise Modifiers" /* noiseModifiers */,
2923
- data: {
2924
- title: "Scale/Bias Noise",
2925
- scale: 1,
2926
- bias: 0
2927
- },
2928
- handles: [
2929
- {
2930
- position: import_system21.Position.Left,
2931
- dataType: "module" /* module */,
2932
- connection: "target",
2933
- maxConnections: 1
2934
- },
2935
- {
2936
- position: import_system21.Position.Right,
2937
- dataType: "module" /* module */,
2938
- connection: "source"
2939
- }
2940
- ]
2941
- };
2942
- };
2943
-
2944
- // src/templates/modifiers/noise-terrace-template.ts
2945
- var import_system22 = require("@xyflow/system");
2946
- var NoiseTerraceNodeTemplateFactory = class {
2947
- template = {
2948
- type: "noise-terrace" /* noiseTerrace */,
2949
- group: "Noise Modifiers" /* noiseModifiers */,
2950
- data: {
2951
- title: "Noise Terrace",
2952
- points: []
2953
- },
2954
- handles: [
2955
- {
2956
- position: import_system22.Position.Left,
2957
- dataType: "module" /* module */,
2958
- connection: "target",
2959
- maxConnections: 1
2960
- },
2961
- {
2962
- position: import_system22.Position.Right,
2963
- dataType: "module" /* module */,
2964
- connection: "source"
2965
- }
2966
- ]
2967
- };
2968
- };
2969
-
2970
- // src/templates/selectors/noise-blend-template.ts
2971
- var import_system23 = require("@xyflow/system");
2972
- var NoiseBlendNodeTemplateFactory = class {
2973
- template = {
2974
- type: "noise-blend" /* noiseBlend */,
2975
- group: "Noise Selectors" /* noiseSelectors */,
2976
- data: {
2977
- title: "Noise Blend"
2978
- },
2979
- handles: [
2980
- {
2981
- position: import_system23.Position.Left,
2982
- dataType: "module" /* module */,
2983
- connection: "target",
2984
- label: "Source Modules",
2985
- dataId: "source" /* source */,
2986
- maxConnections: 2,
2987
- minConnections: 2
2988
- },
2989
- {
2990
- position: import_system23.Position.Left,
2991
- dataType: "module" /* module */,
2992
- dataId: "control" /* control */,
2993
- connection: "target",
2994
- label: "Control Module",
2995
- maxConnections: 1
2996
- },
2997
- {
2998
- position: import_system23.Position.Right,
2999
- dataType: "module" /* module */,
3000
- dataId: "output" /* output */,
3001
- connection: "source"
3002
- }
3003
- ]
3004
- };
3005
- };
3006
-
3007
- // src/templates/selectors/noise-select-template.ts
3008
- var import_system24 = require("@xyflow/system");
3009
- var NoiseSelectNodeTemplateFactory = class {
3010
- template = {
3011
- type: "noise-select" /* noiseSelect */,
3012
- group: "Noise Selectors" /* noiseSelectors */,
3013
- data: {
3014
- title: "Noise Select",
3015
- edgeFalloff: 0,
3016
- lowerBound: -1,
3017
- upperBound: 1
3018
- },
3019
- handles: [
3020
- {
3021
- position: import_system24.Position.Left,
3022
- dataType: "module" /* module */,
3023
- dataId: "source" /* source */,
3024
- connection: "target",
3025
- label: "Source Modules",
3026
- maxConnections: 2,
3027
- minConnections: 2
3028
- },
3029
- {
3030
- position: import_system24.Position.Left,
3031
- dataType: "module" /* module */,
3032
- dataId: "control" /* control */,
3033
- connection: "target",
3034
- label: "Control Module",
3035
- maxConnections: 1
3036
- },
3037
- {
3038
- position: import_system24.Position.Right,
3039
- dataType: "module" /* module */,
3040
- dataId: "output" /* output */,
3041
- connection: "source"
3042
- }
3043
- ]
3044
- };
3045
- };
3046
-
3047
- // src/templates/transformers/noise-displace-template.ts
3048
- var import_system25 = require("@xyflow/system");
3049
- var NoiseDisplaceNodeTemplateFactory = class {
3050
- template = {
3051
- type: "noise-displace" /* noiseDisplace */,
3052
- group: "Noise Transformers" /* noiseTransformers */,
3053
- data: {
3054
- title: "Noise Displace"
3055
- },
3056
- handles: [
3057
- {
3058
- position: import_system25.Position.Left,
3059
- connection: "target",
3060
- label: "Source Module",
3061
- dataType: "module" /* module */,
3062
- dataId: "source" /* sourceModule */,
3063
- maxConnections: 1
3064
- },
3065
- {
3066
- position: import_system25.Position.Left,
3067
- connection: "target",
3068
- label: "X Module",
3069
- dataType: "module" /* module */,
3070
- dataId: "x-module" /* xModule */,
3071
- maxConnections: 1
3072
- },
3073
- {
3074
- position: import_system25.Position.Left,
3075
- connection: "target",
3076
- label: "Y Module",
3077
- dataType: "module" /* module */,
3078
- dataId: "y-module" /* yModule */,
3079
- maxConnections: 1
3080
- },
3081
- {
3082
- position: import_system25.Position.Left,
3083
- connection: "target",
3084
- label: "Z Module",
3085
- dataType: "module" /* module */,
3086
- dataId: "z-module" /* zModule */,
3087
- maxConnections: 1
3088
- },
3089
- {
3090
- position: import_system25.Position.Right,
3091
- dataType: "module" /* module */,
3092
- dataId: "output" /* output */,
3093
- connection: "source"
3094
- }
3095
- ]
3096
- };
3097
- };
3098
-
3099
- // src/templates/transformers/noise-rotate-point-template.ts
3100
- var import_system26 = require("@xyflow/system");
3101
- var NoiseRotatePointNodeTemplateFactory = class {
3102
- template = {
3103
- type: "noise-rotate-point" /* noiseRotatePoint */,
3104
- group: "Noise Transformers" /* noiseTransformers */,
3105
- data: {
3106
- title: "Noise Rotate Point",
3107
- xAngle: 0,
3108
- yAngle: 0,
3109
- zAngle: 0
3110
- },
3111
- handles: [
3112
- {
3113
- position: import_system26.Position.Left,
3114
- dataType: "module" /* module */,
3115
- connection: "target",
3116
- label: "Source Module",
3117
- maxConnections: 1
3118
- },
3119
- {
3120
- position: import_system26.Position.Right,
3121
- dataType: "module" /* module */,
3122
- connection: "source"
3123
- }
3124
- ]
3125
- };
3126
- };
3127
-
3128
- // src/templates/transformers/noise-scale-point-template.ts
3129
- var import_system27 = require("@xyflow/system");
3130
- var NoiseScalePointNodeTemplateFactory = class {
3131
- template = {
3132
- type: "noise-scale-point" /* noiseScalePoint */,
3133
- group: "Noise Transformers" /* noiseTransformers */,
3134
- data: {
3135
- title: "Noise Scale Point",
3136
- xScale: 1,
3137
- yScale: 1,
3138
- zScale: 1
3139
- },
3140
- handles: [
3141
- {
3142
- position: import_system27.Position.Left,
3143
- dataType: "module" /* module */,
3144
- connection: "target",
3145
- label: "Source Module",
3146
- maxConnections: 1
3147
- },
3148
- {
3149
- position: import_system27.Position.Right,
3150
- dataType: "module" /* module */,
3151
- connection: "source"
3152
- }
3153
- ]
3154
- };
3155
- };
3156
-
3157
- // src/templates/transformers/noise-translate-point-template.ts
3158
- var import_system28 = require("@xyflow/system");
3159
- var NoiseTranslatePointNodeTemplateFactory = class {
3160
- template = {
3161
- type: "noise-translate-point" /* noiseTranslatePoint */,
3162
- group: "Noise Transformers" /* noiseTransformers */,
3163
- data: {
3164
- title: "Noise Translate Point",
3165
- translateX: 0,
3166
- translateY: 0,
3167
- translateZ: 0
3168
- },
3169
- handles: [
3170
- {
3171
- position: import_system28.Position.Left,
3172
- dataType: "module" /* module */,
3173
- connection: "target",
3174
- label: "Source Module",
3175
- maxConnections: 1
3176
- },
3177
- {
3178
- position: import_system28.Position.Right,
3179
- dataType: "module" /* module */,
3180
- connection: "source"
3181
- }
3182
- ]
3183
- };
3184
- };
3185
-
3186
- // src/templates/transformers/noise-turbulence-template.ts
3187
- var import_abstract30 = require("@awesome-flow/core/abstract");
3188
- var import_system29 = require("@xyflow/system");
3189
- var NoiseTurbulenceNodeTemplateFactory = class {
3190
- template = {
3191
- type: "noise-turbulence" /* noiseTurbulence */,
3192
- group: "Noise Transformers" /* noiseTransformers */,
3193
- data: {
3194
- title: "Noise Turbulence",
3195
- frequency: 1,
3196
- power: 1,
3197
- roughness: 1,
3198
- seed: 0
3199
- },
3200
- handles: [
3201
- {
3202
- position: import_system29.Position.Left,
3203
- dataType: "module" /* module */,
3204
- connection: "target",
3205
- label: "Source Module",
3206
- maxConnections: 1
3207
- },
3208
- {
3209
- position: import_system29.Position.Left,
3210
- dataType: import_abstract30.CoreHandleType.variableProperty,
3211
- label: "Variable Properties",
3212
- connection: "target"
3213
- },
3214
- {
3215
- position: import_system29.Position.Right,
3216
- dataType: "module" /* module */,
3217
- connection: "source"
3218
- }
3219
- ]
3220
- };
3221
- };
3222
-
3223
- // src/templates/generators/noise-billow-template.ts
3224
- var import_abstract32 = require("@awesome-flow/core/abstract");
3225
- var import_utils2 = require("@awesome-flow/core/utils");
3226
- var import_system30 = require("@xyflow/system");
3227
- var NoiseBillowNodeTemplateFactory = class {
3228
- template = {
3229
- id: import_utils2.IDGenerator.template(),
3230
- type: "noise-billow" /* noiseBillow */,
3231
- group: "Noise Generators" /* noiseGenerators */,
3232
- data: {
3233
- title: "Billow Noise",
3234
- frequency: 0.1,
3235
- lacunarity: 2,
3236
- octaves: 5,
3237
- persistence: 0.5,
3238
- seed: 0
3239
- },
3240
- handles: [
3241
- {
3242
- position: import_system30.Position.Left,
3243
- dataType: import_abstract32.CoreHandleType.variableProperty,
3244
- connection: "target"
3245
- },
3246
- {
3247
- position: import_system30.Position.Right,
3248
- dataType: "module" /* module */,
3249
- connection: "source"
3250
- }
3251
- ]
3252
- };
3253
- };
3254
-
3255
- // src/templates/groups/module-group-template.ts
3256
- var import_abstract33 = require("@awesome-flow/core/abstract");
3257
- var import_utils3 = require("@awesome-flow/core/utils");
3258
- var import_system31 = require("@xyflow/system");
3259
- var ModuleGroupNodeTemplateFactory = class {
3260
- template = {
3261
- id: import_utils3.IDGenerator.template(),
3262
- type: "group-module" /* groupModule */,
3263
- group: import_abstract33.CoreTemplateGroup.groups,
3264
- data: {
3265
- title: "Modules Group",
3266
- isGroup: true,
3267
- initialSize: {
3268
- width: 300,
3269
- height: 200
3270
- },
3271
- collapsedSize: {
3272
- width: 300,
3273
- height: 80
3274
- }
3275
- },
3276
- handles: [
3277
- {
3278
- position: import_system31.Position.Bottom,
3279
- dataType: "module" /* module */,
3280
- connection: "target",
3281
- maxConnections: 1,
3282
- hideOnCollapse: true
3283
- },
3284
- {
3285
- position: import_system31.Position.Right,
3286
- dataType: "module" /* module */,
3287
- connection: "source"
3288
- }
3289
- ]
3290
- };
3291
- };
3292
-
3293
- // src/nodes/groups/module-group-node.tsx
3294
- var import_layout31 = require("@awesome-flow/core/layout");
3295
- var import_react38 = require("@xyflow/react");
3296
- var import_react39 = require("react");
3297
- var import_shallow = require("zustand/shallow");
3298
- var import_core18 = require("@mantine/core");
3299
- var import_hooks33 = require("@awesome-flow/core/hooks");
3300
- var import_jsx_runtime31 = require("react/jsx-runtime");
3301
- function ModuleGroupNode({
3302
- id,
3303
- selected,
3304
- data,
3305
- type,
3306
- width,
3307
- height
3308
- }) {
3309
- const updateNodeInternals = (0, import_react38.useUpdateNodeInternals)();
3310
- const triggerNodeChanges = (0, import_react38.useStore)((s) => s.triggerNodeChanges);
3311
- const { groupNodes, setGroupCollapsed } = (0, import_hooks33.useFlowStore)(
3312
- (0, import_react39.useCallback)(
3313
- (state) => ({ groupNodes: state.groups[id], setGroupCollapsed: state.setGroupCollapsed }),
3314
- []
3315
- )
3316
- );
3317
- const intersectingNode = (0, import_hooks33.useInteractiveStore)(
3318
- (0, import_react39.useCallback)((state) => state.nodeIntersectionTargets[id], [id]),
3319
- import_shallow.shallow
3320
- );
3321
- (0, import_react39.useEffect)(() => {
3322
- updateNodeInternals(id);
3323
- }, [width, height]);
3324
- (0, import_react39.useEffect)(() => {
3325
- triggerNodeChanges([
3326
- {
3327
- id,
3328
- type: "select",
3329
- selected: !!intersectingNode
3330
- }
3331
- ]);
3332
- }, [intersectingNode]);
3333
- const onCollapsed = (0, import_react39.useCallback)((collapsed) => {
3334
- setGroupCollapsed(id, collapsed);
3335
- }, []);
3336
- const size = (0, import_react39.useMemo)(() => {
3337
- return {
3338
- width: data.initialSize?.width || 100,
3339
- height: data.initialSize?.height || 50
3340
- };
3341
- }, [data.initialSize]);
3342
- const incomingModules = (0, import_hooks33.useIncomingComputedData)(id);
3343
- const updateComputedData = (0, import_hooks33.useUpdateNodeComputedData)();
3344
- (0, import_react39.useEffect)(() => {
3345
- if (incomingModules?.length) {
3346
- const { module: module2 } = incomingModules[0];
3347
- updateComputedData(id, { module: module2 });
3348
- }
3349
- }, [incomingModules]);
3350
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
3351
- import_layout31.NodeContainer,
3352
- {
3353
- id,
3354
- selected,
3355
- data,
3356
- title: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_core18.Group, { justify: "space-between", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_core18.Group, { gap: "xs", children: [
3357
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_core18.Badge, { size: "xs", variant: "outline", radius: "xs", color: "gray", children: groupNodes?.length || 0 }),
3358
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_layout31.NodeCollapse, { nodeId: id, isCollapsed: data.isCollapsed, onCollapsed })
3359
- ] }) }),
3360
- type,
3361
- children: [
3362
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
3363
- import_react38.NodeResizer,
3364
- {
3365
- nodeId: id,
3366
- minWidth: size.width,
3367
- minHeight: size.height,
3368
- isVisible: selected && !data.isCollapsed
3369
- }
3370
- ),
3371
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_layout31.NodeTrackConnections, { handles: data.handles, nodeId: id, type: "target" })
3372
- ]
3373
- }
3374
- );
3375
- }
3376
- var module_group_node_default = ModuleGroupNode;
3377
-
3378
- // src/abstract/node-types.ts
3379
- var NoiseNodeType = /* @__PURE__ */ ((NoiseNodeType2) => {
3380
- NoiseNodeType2["position"] = "position";
3381
- NoiseNodeType2["grid"] = "grid";
3382
- NoiseNodeType2["textureData"] = "texture-data";
3383
- NoiseNodeType2["groupModule"] = "group-module";
3384
- NoiseNodeType2["positionLogger"] = "position-logger";
3385
- NoiseNodeType2["noiseLogger"] = "noise-logger";
3386
- NoiseNodeType2["noiseOutput"] = "noise-output";
3387
- NoiseNodeType2["noiseConst"] = "noise-constant";
3388
- NoiseNodeType2["noiseBillow"] = "noise-billow";
3389
- NoiseNodeType2["noiseCheckerboard"] = "noise-checkerboard";
3390
- NoiseNodeType2["noiseNormalize"] = "noise-normalize";
3391
- NoiseNodeType2["noiseCylinders"] = "noise-cylinders";
3392
- NoiseNodeType2["noisePerlin"] = "noise-perlin";
3393
- NoiseNodeType2["noiseRidgedMulti"] = "noise-ridged-multi";
3394
- NoiseNodeType2["noiseSpheres"] = "noise-spheres";
3395
- NoiseNodeType2["noiseVoronoi"] = "noise-voronoi";
3396
- NoiseNodeType2["noiseCombine"] = "noise-combiner";
3397
- NoiseNodeType2["noiseClamp"] = "noise-clamp";
3398
- NoiseNodeType2["noiseAbs"] = "noise-abs";
3399
- NoiseNodeType2["noiseCurve"] = "noise-curve";
3400
- NoiseNodeType2["noiseExponent"] = "noise-exponent";
3401
- NoiseNodeType2["noiseInvert"] = "noise-invert";
3402
- NoiseNodeType2["noiseScaleBias"] = "noise-scale-bias";
3403
- NoiseNodeType2["noiseTerrace"] = "noise-terrace";
3404
- NoiseNodeType2["noiseBlend"] = "noise-blend";
3405
- NoiseNodeType2["noiseSelect"] = "noise-select";
3406
- NoiseNodeType2["noiseDisplace"] = "noise-displace";
3407
- NoiseNodeType2["noiseRotatePoint"] = "noise-rotate-point";
3408
- NoiseNodeType2["noiseScalePoint"] = "noise-scale-point";
3409
- NoiseNodeType2["noiseTranslatePoint"] = "noise-translate-point";
3410
- NoiseNodeType2["noiseTurbulence"] = "noise-turbulence";
3411
- return NoiseNodeType2;
3412
- })(NoiseNodeType || {});
3413
- var noiseNodeTypes = {
3414
- ["group-module" /* groupModule */]: module_group_node_default,
3415
- ["position" /* position */]: position_const_node_default,
3416
- ["grid" /* grid */]: position_grid_node_default,
3417
- ["noise-output" /* noiseOutput */]: noise_output_node_default,
3418
- ["texture-data" /* textureData */]: noise_raw_texture_node_default,
3419
- ["noise-logger" /* noiseLogger */]: noise_logger_node_default,
3420
- ["position-logger" /* positionLogger */]: positions_logger_node_default,
3421
- ["noise-constant" /* noiseConst */]: noise_const_node_default,
3422
- ["noise-billow" /* noiseBillow */]: noise_billow_node_default,
3423
- ["noise-checkerboard" /* noiseCheckerboard */]: noise_checkerboard_node_default,
3424
- ["noise-cylinders" /* noiseCylinders */]: noise_cylinders_node_default,
3425
- ["noise-perlin" /* noisePerlin */]: noise_perlin_node_default,
3426
- ["noise-ridged-multi" /* noiseRidgedMulti */]: noise_ridgedmulti_node_default,
3427
- ["noise-spheres" /* noiseSpheres */]: noise_spheres_node_default,
3428
- ["noise-voronoi" /* noiseVoronoi */]: noise_voronoi_node_default,
3429
- ["noise-combiner" /* noiseCombine */]: noise_combine_node_default,
3430
- ["noise-clamp" /* noiseClamp */]: noise_clamp_node_default,
3431
- ["noise-abs" /* noiseAbs */]: noise_abs_node_default,
3432
- ["noise-normalize" /* noiseNormalize */]: noise_normalize_node_default,
3433
- ["noise-curve" /* noiseCurve */]: noise_curve_node_default,
3434
- ["noise-exponent" /* noiseExponent */]: noise_exponent_node_default,
3435
- ["noise-invert" /* noiseInvert */]: noise_invert_node_default,
3436
- ["noise-scale-bias" /* noiseScaleBias */]: noise_scale_bias_node_default,
3437
- ["noise-terrace" /* noiseTerrace */]: noise_terrace_node_default,
3438
- ["noise-blend" /* noiseBlend */]: noise_blend_node_default,
3439
- ["noise-select" /* noiseSelect */]: noise_select_node_default,
3440
- ["noise-displace" /* noiseDisplace */]: noise_displace_node_default,
3441
- ["noise-rotate-point" /* noiseRotatePoint */]: noise_rotate_point_node_default,
3442
- ["noise-scale-point" /* noiseScalePoint */]: noise_scale_point_node_default,
3443
- ["noise-translate-point" /* noiseTranslatePoint */]: noise_translate_point_node_default,
3444
- ["noise-turbulence" /* noiseTurbulence */]: noise_turbulence_node_default
3445
- };
3446
- var noiseNodeTemplates = {
3447
- ["noise-output" /* noiseOutput */]: new NoiseOutputNodeTemplateFactory(),
3448
- ["noise-billow" /* noiseBillow */]: new NoiseBillowNodeTemplateFactory(),
3449
- ["noise-checkerboard" /* noiseCheckerboard */]: new NoiseCheckerboardNodeTemplateFactory(),
3450
- ["noise-normalize" /* noiseNormalize */]: new NoiseNormalizeNodeTemplateFactory(),
3451
- ["noise-logger" /* noiseLogger */]: new NoiseLoggerNodeTemplateFactory(),
3452
- ["noise-constant" /* noiseConst */]: new NoiseConstNodeTemplateFactory(),
3453
- ["position" /* position */]: new PositionConstNodeTemplateFactory(),
3454
- ["position-logger" /* positionLogger */]: new PositionLoggerNodeTemplateFactory(),
3455
- ["grid" /* grid */]: new PositionGridNodeTemplateFactory(),
3456
- ["texture-data" /* textureData */]: new NoiseRawTextureTemplateFactory(),
3457
- ["noise-cylinders" /* noiseCylinders */]: new NoiseCylindersNodeTemplateFactory(),
3458
- ["noise-perlin" /* noisePerlin */]: new NoisePerlinNodeTemplateFactory(),
3459
- ["noise-ridged-multi" /* noiseRidgedMulti */]: new NoiseRidgedMultiNodeTemplateFactory(),
3460
- ["noise-spheres" /* noiseSpheres */]: new NoiseSpheresNodeTemplateFactory(),
3461
- ["noise-voronoi" /* noiseVoronoi */]: new NoiseVoronoiNodeTemplateFactory(),
3462
- ["noise-combiner" /* noiseCombine */]: new NoiseCombineNodeTemplateFactory(),
3463
- ["noise-clamp" /* noiseClamp */]: new NoiseClampNodeTemplateFactory(),
3464
- ["noise-abs" /* noiseAbs */]: new NoiseAbsNodeTemplateFactory(),
3465
- ["noise-curve" /* noiseCurve */]: new NoiseCurveNodeTemplateFactory(),
3466
- ["noise-exponent" /* noiseExponent */]: new NoiseExponentNodeTemplateFactory(),
3467
- ["noise-invert" /* noiseInvert */]: new NoiseInvertNodeTemplateFactory(),
3468
- ["noise-scale-bias" /* noiseScaleBias */]: new NoiseScaleBiasNodeTemplateFactory(),
3469
- ["noise-terrace" /* noiseTerrace */]: new NoiseTerraceNodeTemplateFactory(),
3470
- ["noise-blend" /* noiseBlend */]: new NoiseBlendNodeTemplateFactory(),
3471
- ["noise-select" /* noiseSelect */]: new NoiseSelectNodeTemplateFactory(),
3472
- ["noise-displace" /* noiseDisplace */]: new NoiseDisplaceNodeTemplateFactory(),
3473
- ["noise-rotate-point" /* noiseRotatePoint */]: new NoiseRotatePointNodeTemplateFactory(),
3474
- ["noise-scale-point" /* noiseScalePoint */]: new NoiseScalePointNodeTemplateFactory(),
3475
- ["noise-translate-point" /* noiseTranslatePoint */]: new NoiseTranslatePointNodeTemplateFactory(),
3476
- ["noise-turbulence" /* noiseTurbulence */]: new NoiseTurbulenceNodeTemplateFactory(),
3477
- ["group-module" /* groupModule */]: new ModuleGroupNodeTemplateFactory()
3478
- };
3479
- // Annotate the CommonJS export names for ESM import in node:
3480
- 0 && (module.exports = {
3481
- DisplacementHandle,
3482
- NoiseCombineType,
3483
- NoiseHandleType,
3484
- NoiseNodeType,
3485
- NoiseSourceControlHandle,
3486
- NoiseTemplateGroup,
3487
- noiseCombineModuleMap,
3488
- noiseNodeTemplates,
3489
- noiseNodeTypes
3490
- });
29
+ exports.DisplacementHandle = _chunkRKTZQUWRcjs.DisplacementHandle; exports.NoiseCombineType = _chunkTZCT2GZVcjs.NoiseCombineType; exports.NoiseHandleType = _chunkRKTZQUWRcjs.NoiseHandleType; exports.NoiseNodeType = _chunkACWBUUZ7cjs.NoiseNodeType; exports.NoiseSourceControlHandle = _chunkRKTZQUWRcjs.NoiseSourceControlHandle; exports.NoiseTemplateGroup = _chunkACWBUUZ7cjs.NoiseTemplateGroup; exports.noiseCombineModuleMap = _chunkTZCT2GZVcjs.noiseCombineModuleMap; exports.noiseNodeTemplates = _chunkACWBUUZ7cjs.noiseNodeTemplates; exports.noiseNodeTypes = _chunkACWBUUZ7cjs.noiseNodeTypes;