@genfeedai/workflow-ui 0.1.2 → 0.1.4

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 (84) hide show
  1. package/dist/canvas.d.mts +16 -2
  2. package/dist/canvas.mjs +10 -8
  3. package/dist/chunk-6PSJTBNV.mjs +638 -0
  4. package/dist/chunk-7H3WJJYS.mjs +52 -0
  5. package/dist/{chunk-HCXI63ME.mjs → chunk-AUQGOJOQ.mjs} +27 -4
  6. package/dist/{chunk-AOTUCJMA.mjs → chunk-GWBGK3KL.mjs} +2 -2
  7. package/dist/chunk-JTPADIUO.mjs +130 -0
  8. package/dist/{chunk-SQK4JDYY.mjs → chunk-LT3ZJJL6.mjs} +9 -2
  9. package/dist/{chunk-7P2JWDC7.mjs → chunk-O5II6BOJ.mjs} +1198 -254
  10. package/dist/{chunk-AUZR6REQ.mjs → chunk-OQREHJXK.mjs} +1 -1
  11. package/dist/chunk-OY7BRSGG.mjs +60 -0
  12. package/dist/{chunk-E3YBVMYZ.mjs → chunk-PANZDSP6.mjs} +274 -305
  13. package/dist/chunk-PCIWWD37.mjs +90 -0
  14. package/dist/{chunk-RIGVIEYB.mjs → chunk-R727OFBR.mjs} +11 -1
  15. package/dist/chunk-ZD2BADZO.mjs +1294 -0
  16. package/dist/contextMenuStore-DMg0hJQ1.d.mts +22 -0
  17. package/dist/hooks.d.mts +53 -244
  18. package/dist/hooks.mjs +6 -6
  19. package/dist/index.d.mts +11 -7
  20. package/dist/index.mjs +13 -11
  21. package/dist/lib.d.mts +250 -4
  22. package/dist/lib.mjs +562 -2
  23. package/dist/nodes.d.mts +3 -1
  24. package/dist/nodes.mjs +6 -6
  25. package/dist/panels.mjs +3 -4
  26. package/dist/{promptLibraryStore-zqb59nsu.d.mts → promptLibraryStore-Bgw5LzvD.d.mts} +33 -5
  27. package/dist/provider.d.mts +2 -2
  28. package/dist/provider.mjs +0 -1
  29. package/dist/stores.d.mts +4 -3
  30. package/dist/stores.mjs +3 -40
  31. package/dist/toolbar.d.mts +3 -1
  32. package/dist/toolbar.mjs +5 -4
  33. package/dist/{types-ipAnBzAJ.d.mts → types-CF6DPx0P.d.mts} +8 -3
  34. package/dist/ui.d.mts +1 -1
  35. package/dist/ui.mjs +0 -1
  36. package/dist/{hooks.d.ts → useCommentNavigation-NzJjkaj2.d.mts} +15 -2
  37. package/dist/workflowStore-UAAKOOIK.mjs +2 -0
  38. package/package.json +32 -26
  39. package/dist/canvas.d.ts +0 -27
  40. package/dist/canvas.js +0 -45
  41. package/dist/chunk-3SPPKCWR.js +0 -458
  42. package/dist/chunk-3TMV3K34.js +0 -534
  43. package/dist/chunk-3YFFDHC5.js +0 -300
  44. package/dist/chunk-4MZ62VMF.js +0 -37
  45. package/dist/chunk-5HJFQVUR.js +0 -61
  46. package/dist/chunk-5LQ4QBR5.js +0 -2
  47. package/dist/chunk-6DOEUDD5.js +0 -254
  48. package/dist/chunk-AXFOCPPP.js +0 -998
  49. package/dist/chunk-BMFRA6GK.js +0 -1546
  50. package/dist/chunk-E323WAZG.mjs +0 -272
  51. package/dist/chunk-ECD5J2BA.js +0 -6022
  52. package/dist/chunk-EMGXUNBL.js +0 -120
  53. package/dist/chunk-EMUMKW5C.js +0 -107
  54. package/dist/chunk-FOMOOERN.js +0 -2
  55. package/dist/chunk-IASLG6IA.mjs +0 -118
  56. package/dist/chunk-IHF35QZD.js +0 -1095
  57. package/dist/chunk-JLWKW3G5.js +0 -2
  58. package/dist/chunk-KDIWRSYV.js +0 -375
  59. package/dist/chunk-L5TF4EHW.mjs +0 -1
  60. package/dist/chunk-RJ262NXS.js +0 -24
  61. package/dist/chunk-RXNEDWK2.js +0 -141
  62. package/dist/chunk-SEV2DWKF.js +0 -744
  63. package/dist/chunk-ZJWP5KGZ.mjs +0 -33
  64. package/dist/hooks.js +0 -56
  65. package/dist/index.d.ts +0 -29
  66. package/dist/index.js +0 -180
  67. package/dist/lib.d.ts +0 -164
  68. package/dist/lib.js +0 -144
  69. package/dist/nodes.d.ts +0 -128
  70. package/dist/nodes.js +0 -151
  71. package/dist/panels.d.ts +0 -22
  72. package/dist/panels.js +0 -21
  73. package/dist/promptLibraryStore-BZnfmEkc.d.ts +0 -464
  74. package/dist/provider.d.ts +0 -29
  75. package/dist/provider.js +0 -17
  76. package/dist/stores.d.ts +0 -96
  77. package/dist/stores.js +0 -113
  78. package/dist/toolbar.d.ts +0 -73
  79. package/dist/toolbar.js +0 -34
  80. package/dist/types-ipAnBzAJ.d.ts +0 -46
  81. package/dist/ui.d.ts +0 -67
  82. package/dist/ui.js +0 -84
  83. package/dist/workflowStore-7SDJC4UR.mjs +0 -3
  84. package/dist/workflowStore-LNJQ5RZG.js +0 -12
package/dist/canvas.d.mts CHANGED
@@ -1,12 +1,15 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { NodeTypes, EdgeProps } from '@xyflow/react';
3
+ import { WorkflowNode } from '@genfeedai/types';
3
4
  import * as react from 'react';
4
5
 
5
6
  interface WorkflowCanvasProps {
6
7
  /** Override default node types. Pass merged core + cloud nodeTypes here. */
7
8
  nodeTypes?: NodeTypes;
9
+ /** Optional callback for download-as-ZIP of selected nodes */
10
+ onDownloadAsZip?: (nodes: WorkflowNode[]) => void;
8
11
  }
9
- declare function WorkflowCanvas({ nodeTypes: nodeTypesProp }?: WorkflowCanvasProps): react_jsx_runtime.JSX.Element;
12
+ declare function WorkflowCanvas({ nodeTypes: nodeTypesProp, onDownloadAsZip }?: WorkflowCanvasProps): react_jsx_runtime.JSX.Element;
10
13
 
11
14
  interface HelperLinesProps {
12
15
  draggingNodeId: string | null;
@@ -24,4 +27,15 @@ declare function ShortcutHelpModal(): react_jsx_runtime.JSX.Element | null;
24
27
  declare function PauseEdgeComponent({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, data, }: EdgeProps): react_jsx_runtime.JSX.Element;
25
28
  declare const PauseEdge: react.MemoExoticComponent<typeof PauseEdgeComponent>;
26
29
 
27
- export { GroupOverlay, HelperLines, NodeSearch, PauseEdge, ShortcutHelpModal, WorkflowCanvas };
30
+ declare function ConnectionDropMenuComponent(): react_jsx_runtime.JSX.Element | null;
31
+ declare const ConnectionDropMenu: react.MemoExoticComponent<typeof ConnectionDropMenuComponent>;
32
+
33
+ declare function EditableEdgeComponent({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, data, selected, }: EdgeProps): react_jsx_runtime.JSX.Element;
34
+ declare const EditableEdge: react.MemoExoticComponent<typeof EditableEdgeComponent>;
35
+
36
+ declare function EdgeToolbarComponent(): react_jsx_runtime.JSX.Element | null;
37
+ declare const EdgeToolbar: react.MemoExoticComponent<typeof EdgeToolbarComponent>;
38
+
39
+ declare function ReferenceEdge({ id, sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, style, markerEnd, source, target, }: EdgeProps): react_jsx_runtime.JSX.Element;
40
+
41
+ export { ConnectionDropMenu, EdgeToolbar, EditableEdge, GroupOverlay, HelperLines, NodeSearch, PauseEdge, ReferenceEdge, ShortcutHelpModal, WorkflowCanvas };
package/dist/canvas.mjs CHANGED
@@ -1,16 +1,18 @@
1
- export { GroupOverlay, HelperLines, NodeSearch, PauseEdge, ShortcutHelpModal, WorkflowCanvas } from './chunk-7P2JWDC7.mjs';
2
- import './chunk-E3YBVMYZ.mjs';
1
+ export { ConnectionDropMenu, EdgeToolbar, EditableEdge, GroupOverlay, HelperLines, NodeSearch, PauseEdge, ReferenceEdge, ShortcutHelpModal, WorkflowCanvas } from './chunk-O5II6BOJ.mjs';
2
+ import './chunk-PANZDSP6.mjs';
3
3
  import './chunk-ZJD5WMR3.mjs';
4
- import './chunk-E323WAZG.mjs';
5
- import './chunk-IASLG6IA.mjs';
6
- import './chunk-AOTUCJMA.mjs';
4
+ import './chunk-6PSJTBNV.mjs';
5
+ import './chunk-JTPADIUO.mjs';
6
+ import './chunk-OY7BRSGG.mjs';
7
+ import './chunk-ZD2BADZO.mjs';
8
+ import './chunk-GWBGK3KL.mjs';
7
9
  import './chunk-7SKSRSS7.mjs';
8
10
  import './chunk-EFXQT23N.mjs';
9
11
  import './chunk-CV4M7CNU.mjs';
12
+ import './chunk-PCIWWD37.mjs';
10
13
  import './chunk-LDN7IX4Y.mjs';
11
- import './chunk-SQK4JDYY.mjs';
12
- import './chunk-RIGVIEYB.mjs';
14
+ import './chunk-LT3ZJJL6.mjs';
15
+ import './chunk-R727OFBR.mjs';
13
16
  import './chunk-MLJJBBTB.mjs';
14
17
  import './chunk-FT33LFII.mjs';
15
18
  import './chunk-VRN3UWE5.mjs';
16
- import './chunk-ZJWP5KGZ.mjs';
@@ -0,0 +1,638 @@
1
+ import { memo, useRef, useState, useCallback } from 'react';
2
+ import { jsxs, jsx } from 'react/jsx-runtime';
3
+
4
+ // src/lib/mediaExtraction.ts
5
+ function getMediaFromNode(nodeType, data) {
6
+ switch (nodeType) {
7
+ case "imageGen": {
8
+ const imgData = data;
9
+ const urls = imgData.outputImages?.length ? imgData.outputImages : [];
10
+ return {
11
+ url: imgData.outputImage,
12
+ urls,
13
+ type: imgData.outputImage || urls.length ? "image" : null
14
+ };
15
+ }
16
+ case "videoGen": {
17
+ const vidData = data;
18
+ return { url: vidData.outputVideo, type: vidData.outputVideo ? "video" : null };
19
+ }
20
+ case "imageInput": {
21
+ const inputData = data;
22
+ return { url: inputData.image, type: inputData.image ? "image" : null };
23
+ }
24
+ case "videoInput": {
25
+ const vidInputData = data;
26
+ return { url: vidInputData.video, type: vidInputData.video ? "video" : null };
27
+ }
28
+ case "motionControl": {
29
+ const mcData = data;
30
+ return { url: mcData.outputVideo, type: mcData.outputVideo ? "video" : null };
31
+ }
32
+ case "download": {
33
+ const outData = data;
34
+ if (outData.inputVideo) {
35
+ return { url: outData.inputVideo, type: "video" };
36
+ }
37
+ if (outData.inputImage) {
38
+ return { url: outData.inputImage, type: "image" };
39
+ }
40
+ return { url: null, type: null };
41
+ }
42
+ default:
43
+ return { url: null, type: null };
44
+ }
45
+ }
46
+
47
+ // src/lib/schemaHandles.ts
48
+ var HANDLE_FIELDS = /* @__PURE__ */ new Set([
49
+ // Text inputs
50
+ "prompt",
51
+ "negative_prompt",
52
+ "subject_reference",
53
+ // Image inputs (single)
54
+ "image",
55
+ "image_input",
56
+ "start_image",
57
+ "first_frame_image",
58
+ "end_image",
59
+ "last_frame",
60
+ "mask",
61
+ "mask_image",
62
+ "control_image",
63
+ "init_image",
64
+ "subject_image",
65
+ "face_image",
66
+ "style_image",
67
+ "pose_image",
68
+ "image_url",
69
+ "tail_image_url",
70
+ // Image inputs (array)
71
+ "reference_images",
72
+ // Video inputs
73
+ "video",
74
+ "video_url",
75
+ // Audio inputs
76
+ "audio",
77
+ "audio_url"
78
+ ]);
79
+ var FIELD_TO_HANDLE_TYPE = {
80
+ // Text fields
81
+ prompt: "text",
82
+ negative_prompt: "text",
83
+ subject_reference: "text",
84
+ // Image fields (single)
85
+ image: "image",
86
+ image_input: "image",
87
+ start_image: "image",
88
+ first_frame_image: "image",
89
+ end_image: "image",
90
+ last_frame: "image",
91
+ mask: "image",
92
+ mask_image: "image",
93
+ control_image: "image",
94
+ init_image: "image",
95
+ subject_image: "image",
96
+ face_image: "image",
97
+ style_image: "image",
98
+ pose_image: "image",
99
+ image_url: "image",
100
+ tail_image_url: "image",
101
+ // Image fields (array)
102
+ reference_images: "image",
103
+ // Video fields
104
+ video: "video",
105
+ video_url: "video",
106
+ // Audio fields
107
+ audio: "audio",
108
+ audio_url: "audio"
109
+ };
110
+ function generateHandlesFromSchema(inputSchema, staticHandles) {
111
+ if (!inputSchema) return staticHandles;
112
+ const schema = inputSchema;
113
+ if (!schema.properties) return staticHandles;
114
+ const staticIds = new Set(staticHandles.map((h) => h.id));
115
+ const dynamicHandles = [];
116
+ for (const [fieldName, prop] of Object.entries(schema.properties)) {
117
+ if (!HANDLE_FIELDS.has(fieldName) || staticIds.has(fieldName)) continue;
118
+ const handleType = FIELD_TO_HANDLE_TYPE[fieldName];
119
+ if (!handleType) continue;
120
+ const label = prop.title || fieldName.replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
121
+ dynamicHandles.push({
122
+ id: fieldName,
123
+ type: handleType,
124
+ label,
125
+ multiple: prop.type === "array",
126
+ required: schema.required?.includes(fieldName),
127
+ fromSchema: true
128
+ });
129
+ }
130
+ return [...staticHandles, ...dynamicHandles];
131
+ }
132
+ function isSchemaHandle(handle) {
133
+ return handle.fromSchema === true;
134
+ }
135
+
136
+ // src/lib/models/registry.ts
137
+ var IMAGE_MODELS = [
138
+ { value: "nano-banana", label: "Nano Banana", apiId: "google/nano-banana" },
139
+ { value: "nano-banana-pro", label: "Nano Banana Pro", apiId: "google/nano-banana-pro" }
140
+ ];
141
+ var IMAGE_MODEL_MAP = Object.fromEntries(
142
+ IMAGE_MODELS.map((m) => [m.apiId, m.value])
143
+ );
144
+ var IMAGE_MODEL_ID_MAP = Object.fromEntries(
145
+ IMAGE_MODELS.map((m) => [m.value, m.apiId])
146
+ );
147
+ var DEFAULT_IMAGE_MODEL = "nano-banana-pro";
148
+ var VIDEO_MODELS = [
149
+ {
150
+ value: "veo-3.1-fast",
151
+ label: "Veo 3.1 Fast",
152
+ description: "Fast",
153
+ apiId: "google/veo-3.1-fast"
154
+ },
155
+ { value: "veo-3.1", label: "Veo 3.1", description: "High quality", apiId: "google/veo-3.1" }
156
+ ];
157
+ var VIDEO_MODEL_MAP = Object.fromEntries(
158
+ VIDEO_MODELS.map((m) => [m.apiId, m.value])
159
+ );
160
+ var VIDEO_MODEL_ID_MAP = Object.fromEntries(
161
+ VIDEO_MODELS.map((m) => [m.value, m.apiId])
162
+ );
163
+ var DEFAULT_VIDEO_MODEL = "veo-3.1-fast";
164
+ var LIPSYNC_MODELS = [
165
+ { value: "bytedance/omni-human", label: "OmniHuman (Image)", supportsImage: true },
166
+ { value: "veed/fabric-1.0", label: "VEED Fabric (Image)", supportsImage: true },
167
+ { value: "sync/lipsync-2-pro", label: "Sync Labs Pro (Video)", supportsImage: false },
168
+ { value: "sync/lipsync-2", label: "Sync Labs (Video)", supportsImage: false },
169
+ { value: "pixverse/lipsync", label: "Pixverse", supportsImage: true }
170
+ ];
171
+ var LIPSYNC_SYNC_MODES = [
172
+ { value: "loop", label: "Loop" },
173
+ { value: "bounce", label: "Bounce" },
174
+ { value: "cut_off", label: "Cut Off" },
175
+ { value: "silence", label: "Silence" },
176
+ { value: "remap", label: "Remap" }
177
+ ];
178
+ var DEFAULT_LIPSYNC_MODEL = "bytedance/omni-human";
179
+ var LLM_MODELS = [
180
+ {
181
+ value: "meta-llama-3.1-405b-instruct",
182
+ label: "Llama 3.1 405B",
183
+ apiId: "meta/meta-llama-3.1-405b-instruct"
184
+ },
185
+ {
186
+ value: "claude-4.5-sonnet",
187
+ label: "Claude 4.5 Sonnet",
188
+ apiId: "anthropic/claude-4.5-sonnet"
189
+ }
190
+ ];
191
+ var LLM_MODEL_MAP = Object.fromEntries(
192
+ LLM_MODELS.map((m) => [m.apiId, m.value])
193
+ );
194
+ var LLM_MODEL_ID_MAP = Object.fromEntries(
195
+ LLM_MODELS.map((m) => [m.value, m.apiId])
196
+ );
197
+ var DEFAULT_LLM_MODEL = "meta-llama-3.1-405b-instruct";
198
+ function getImageModelLabel(model) {
199
+ return IMAGE_MODELS.find((m) => m.value === model)?.label ?? model;
200
+ }
201
+ function getVideoModelLabel(model) {
202
+ return VIDEO_MODELS.find((m) => m.value === model)?.label ?? model;
203
+ }
204
+ function getLipSyncModelLabel(model) {
205
+ return LIPSYNC_MODELS.find((m) => m.value === model)?.label ?? model;
206
+ }
207
+ function getLLMModelLabel(model) {
208
+ return LLM_MODELS.find((m) => m.value === model)?.label ?? model;
209
+ }
210
+ function lipSyncModelSupportsImage(model) {
211
+ return LIPSYNC_MODELS.find((m) => m.value === model)?.supportsImage ?? false;
212
+ }
213
+
214
+ // src/lib/easing.ts
215
+ var EASING_PRESETS = {
216
+ // Linear - no easing
217
+ linear: [0, 0, 1, 1],
218
+ // Standard easing functions
219
+ easeIn: [0.42, 0, 1, 1],
220
+ easeOut: [0, 0, 0.58, 1],
221
+ easeInOut: [0.42, 0, 0.58, 1],
222
+ // Quadratic easing
223
+ easeInQuad: [0.55, 0.085, 0.68, 0.53],
224
+ easeOutQuad: [0.25, 0.46, 0.45, 0.94],
225
+ easeInOutQuad: [0.455, 0.03, 0.515, 0.955],
226
+ // Cubic easing
227
+ easeInCubic: [0.55, 0.055, 0.675, 0.19],
228
+ easeOutCubic: [0.215, 0.61, 0.355, 1],
229
+ easeInOutCubic: [0.645, 0.045, 0.355, 1],
230
+ // Exponential easing
231
+ easeInExpo: [0.95, 0.05, 0.795, 0.035],
232
+ easeOutExpo: [0.19, 1, 0.22, 1],
233
+ easeInOutExpo: [1, 0, 0, 1]
234
+ };
235
+ var DEFAULT_CUSTOM_BEZIER = [0.42, 0, 0.58, 1];
236
+ var PRESET_BEZIERS = {
237
+ easeInExpoOutCubic: [0.85, 0, 0.15, 1],
238
+ easeInOutExpo: [0.87, 0, 0.13, 1],
239
+ easeInQuartOutQuad: [0.8, 0, 0.2, 1],
240
+ easeInOutCubic: [0.65, 0, 0.35, 1],
241
+ easeInOutSine: [0.37, 0, 0.63, 1]
242
+ };
243
+ var EASING_BEZIER_MAP = {
244
+ ...PRESET_BEZIERS,
245
+ linear: [0, 0, 1, 1],
246
+ easeInSine: [0.12, 0, 0.39, 0],
247
+ easeOutSine: [0.61, 1, 0.88, 1],
248
+ easeInQuad: [0.11, 0, 0.5, 0],
249
+ easeOutQuad: [0.5, 1, 0.89, 1],
250
+ easeInOutQuad: [0.45, 0, 0.55, 1],
251
+ easeInCubic: [0.32, 0, 0.67, 0],
252
+ easeOutCubic: [0.33, 1, 0.68, 1],
253
+ easeInQuart: [0.5, 0, 0.75, 0],
254
+ easeOutQuart: [0.25, 1, 0.5, 1],
255
+ easeInOutQuart: [0.76, 0, 0.24, 1],
256
+ easeInQuint: [0.64, 0, 0.78, 0],
257
+ easeOutQuint: [0.22, 1, 0.36, 1],
258
+ easeInOutQuint: [0.83, 0, 0.17, 1],
259
+ easeInExpo: [0.7, 0, 0.84, 0],
260
+ easeOutExpo: [0.16, 1, 0.3, 1],
261
+ easeInCirc: [0.55, 0, 1, 0.45],
262
+ easeOutCirc: [0, 0.55, 0.45, 1],
263
+ easeInOutCirc: [0.85, 0, 0.15, 1]
264
+ };
265
+ function getPresetBezier(preset) {
266
+ const handles = preset ? PRESET_BEZIERS[preset] : null;
267
+ const source = handles ?? DEFAULT_CUSTOM_BEZIER;
268
+ return [...source];
269
+ }
270
+ function getEasingBezier(name) {
271
+ const handles = name ? EASING_BEZIER_MAP[name] : null;
272
+ const source = handles ?? DEFAULT_CUSTOM_BEZIER;
273
+ return [...source];
274
+ }
275
+ function createAsymmetricEase(easeIn, easeOut) {
276
+ return (t) => {
277
+ if (t <= 0.5) {
278
+ return 0.5 * easeIn(t * 2);
279
+ }
280
+ return 0.5 + 0.5 * easeOut((t - 0.5) * 2);
281
+ };
282
+ }
283
+ var baseEasing = {
284
+ linear: (t) => t,
285
+ easeInQuad: (t) => t * t,
286
+ easeOutQuad: (t) => t * (2 - t),
287
+ easeInOutQuad: (t) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t,
288
+ easeInCubic: (t) => t * t * t,
289
+ easeOutCubic: (t) => {
290
+ const t1 = t - 1;
291
+ return t1 * t1 * t1 + 1;
292
+ },
293
+ easeInOutCubic: (t) => t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2,
294
+ easeInQuart: (t) => t * t * t * t,
295
+ easeOutQuart: (t) => {
296
+ const t1 = t - 1;
297
+ return 1 - t1 * t1 * t1 * t1;
298
+ },
299
+ easeInOutQuart: (t) => t < 0.5 ? 8 * t * t * t * t : 1 - (-2 * t + 2) ** 4 / 2,
300
+ easeInQuint: (t) => t * t * t * t * t,
301
+ easeOutQuint: (t) => {
302
+ const t1 = t - 1;
303
+ return 1 + t1 * t1 * t1 * t1 * t1;
304
+ },
305
+ easeInOutQuint: (t) => t < 0.5 ? 16 * t * t * t * t * t : 1 - (-2 * t + 2) ** 5 / 2,
306
+ easeInSine: (t) => 1 - Math.cos(t * Math.PI / 2),
307
+ easeOutSine: (t) => Math.sin(t * Math.PI / 2),
308
+ easeInOutSine: (t) => -(Math.cos(Math.PI * t) - 1) / 2,
309
+ easeInExpo: (t) => t === 0 ? 0 : 2 ** (10 * t - 10),
310
+ easeOutExpo: (t) => t === 1 ? 1 : 1 - 2 ** (-10 * t),
311
+ easeInOutExpo: (t) => t === 0 ? 0 : t === 1 ? 1 : t < 0.5 ? 2 ** (20 * t - 10) / 2 : (2 - 2 ** (-20 * t + 10)) / 2,
312
+ easeInCirc: (t) => 1 - Math.sqrt(1 - t ** 2),
313
+ easeOutCirc: (t) => Math.sqrt(1 - (t - 1) ** 2),
314
+ easeInOutCirc: (t) => t < 0.5 ? (1 - Math.sqrt(1 - (2 * t) ** 2)) / 2 : (Math.sqrt(1 - (-2 * t + 2) ** 2) + 1) / 2
315
+ };
316
+ var hybridEasing = {
317
+ easeInExpoOutCubic: createAsymmetricEase(baseEasing.easeInExpo, baseEasing.easeOutCubic),
318
+ easeInQuartOutQuad: createAsymmetricEase(baseEasing.easeInQuart, baseEasing.easeOutQuad)
319
+ };
320
+ var easing = {
321
+ ...baseEasing,
322
+ ...hybridEasing
323
+ };
324
+ function createBezierEasing(p1x, p1y, p2x, p2y) {
325
+ const clamp = (value) => Math.min(1, Math.max(0, value));
326
+ const x1 = clamp(p1x);
327
+ const y1 = clamp(p1y);
328
+ const x2 = clamp(p2x);
329
+ const y2 = clamp(p2y);
330
+ const cx = 3 * x1;
331
+ const bx = 3 * (x2 - x1) - cx;
332
+ const ax = 1 - cx - bx;
333
+ const cy = 3 * y1;
334
+ const by = 3 * (y2 - y1) - cy;
335
+ const ay = 1 - cy - by;
336
+ const sampleCurveX = (t) => ((ax * t + bx) * t + cx) * t;
337
+ const sampleCurveY = (t) => ((ay * t + by) * t + cy) * t;
338
+ const sampleDerivativeX = (t) => (3 * ax * t + 2 * bx) * t + cx;
339
+ const solveCurveX = (x) => {
340
+ let t2 = x;
341
+ const epsilon = 1e-6;
342
+ for (let i = 0; i < 8; i++) {
343
+ const x2err = sampleCurveX(t2) - x;
344
+ if (Math.abs(x2err) < epsilon) return t2;
345
+ const d2 = sampleDerivativeX(t2);
346
+ if (Math.abs(d2) < epsilon) break;
347
+ t2 -= x2err / d2;
348
+ }
349
+ let t0 = 0;
350
+ let t1 = 1;
351
+ t2 = x;
352
+ while (t0 < t1) {
353
+ const x2err = sampleCurveX(t2);
354
+ if (Math.abs(x2err - x) < epsilon) return t2;
355
+ if (x > x2err) t0 = t2;
356
+ else t1 = t2;
357
+ t2 = (t1 + t0) / 2;
358
+ }
359
+ return t2;
360
+ };
361
+ return (t) => {
362
+ const clamped = clamp(t);
363
+ return sampleCurveY(solveCurveX(clamped));
364
+ };
365
+ }
366
+ function getEasingFunction(name) {
367
+ const func = easing[name];
368
+ if (!func) return easing.linear;
369
+ return func;
370
+ }
371
+ function getAllEasingNames() {
372
+ return Object.keys(easing);
373
+ }
374
+ function evaluateBezier(t, curve) {
375
+ const [x1, y1, x2, y2] = curve;
376
+ const epsilon = 1e-6;
377
+ let guess = t;
378
+ for (let i = 0; i < 8; i++) {
379
+ const x = 3 * (1 - guess) * (1 - guess) * guess * x1 + 3 * (1 - guess) * guess * guess * x2 + guess * guess * guess - t;
380
+ if (Math.abs(x) < epsilon) break;
381
+ const dx = 3 * (1 - guess) * (1 - guess) * x1 + 6 * (1 - guess) * guess * (x2 - x1) + 3 * guess * guess * (1 - x2);
382
+ guess -= x / dx;
383
+ }
384
+ return 3 * (1 - guess) * (1 - guess) * guess * y1 + 3 * (1 - guess) * guess * guess * y2 + guess * guess * guess;
385
+ }
386
+ function applySpeedCurve(duration, curve, sampleRate = 60) {
387
+ const timestamps = [];
388
+ for (let i = 0; i <= sampleRate; i++) {
389
+ const t = i / sampleRate;
390
+ const easedT = evaluateBezier(t, curve);
391
+ timestamps.push(easedT * duration);
392
+ }
393
+ return timestamps;
394
+ }
395
+ var EASING_DISPLAY_NAMES = {
396
+ linear: "Linear",
397
+ easeIn: "Ease In",
398
+ easeOut: "Ease Out",
399
+ easeInOut: "Ease In Out",
400
+ easeInQuad: "Ease In Quadratic",
401
+ easeOutQuad: "Ease Out Quadratic",
402
+ easeInOutQuad: "Ease In Out Quadratic",
403
+ easeInCubic: "Ease In Cubic",
404
+ easeOutCubic: "Ease Out Cubic",
405
+ easeInOutCubic: "Ease In Out Cubic",
406
+ easeInQuart: "Ease In Quartic",
407
+ easeOutQuart: "Ease Out Quartic",
408
+ easeInOutQuart: "Ease In Out Quartic",
409
+ easeInQuint: "Ease In Quintic",
410
+ easeOutQuint: "Ease Out Quintic",
411
+ easeInOutQuint: "Ease In Out Quintic",
412
+ easeInSine: "Ease In Sine",
413
+ easeOutSine: "Ease Out Sine",
414
+ easeInOutSine: "Ease In Out Sine",
415
+ easeInExpo: "Ease In Exponential",
416
+ easeOutExpo: "Ease Out Exponential",
417
+ easeInOutExpo: "Ease In Out Exponential",
418
+ easeInCirc: "Ease In Circular",
419
+ easeOutCirc: "Ease Out Circular",
420
+ easeInOutCirc: "Ease In Out Circular",
421
+ easeInExpoOutCubic: "Expo In \u2192 Cubic Out",
422
+ easeInQuartOutQuad: "Quart In \u2192 Quad Out"
423
+ };
424
+ function getEasingDisplayName(preset) {
425
+ return EASING_DISPLAY_NAMES[preset] || preset;
426
+ }
427
+ var PADDING = 16;
428
+ var POINT_RADIUS = 8;
429
+ function CubicBezierEditorComponent({
430
+ value,
431
+ onChange,
432
+ onCommit,
433
+ disabled = false,
434
+ width = 240,
435
+ height = 240
436
+ }) {
437
+ const svgRef = useRef(null);
438
+ const [dragging, setDragging] = useState(null);
439
+ const plotW = width - PADDING * 2;
440
+ const plotH = height - PADDING * 2;
441
+ const toSVG = useCallback(
442
+ (x, y) => [
443
+ PADDING + x * plotW,
444
+ PADDING + (1 - y) * plotH
445
+ ],
446
+ [plotW, plotH]
447
+ );
448
+ const fromSVG = useCallback(
449
+ (svgX, svgY) => {
450
+ const x = Math.max(0, Math.min(1, (svgX - PADDING) / plotW));
451
+ const y = Math.max(-0.5, Math.min(1.5, 1 - (svgY - PADDING) / plotH));
452
+ return [x, y];
453
+ },
454
+ [plotW, plotH]
455
+ );
456
+ const getSVGPoint = useCallback(
457
+ (e) => {
458
+ const svg = svgRef.current;
459
+ if (!svg) return [0, 0];
460
+ const rect = svg.getBoundingClientRect();
461
+ return [e.clientX - rect.left, e.clientY - rect.top];
462
+ },
463
+ []
464
+ );
465
+ const handlePointerDown = useCallback(
466
+ (point) => (e) => {
467
+ if (disabled) return;
468
+ e.preventDefault();
469
+ e.stopPropagation();
470
+ setDragging(point);
471
+ e.target.setPointerCapture(e.pointerId);
472
+ },
473
+ [disabled]
474
+ );
475
+ const handlePointerMove = useCallback(
476
+ (e) => {
477
+ if (!dragging || disabled) return;
478
+ const [svgX, svgY] = getSVGPoint(e);
479
+ const [x, y] = fromSVG(svgX, svgY);
480
+ const next = [...value];
481
+ if (dragging === 1) {
482
+ next[0] = x;
483
+ next[1] = y;
484
+ } else {
485
+ next[2] = x;
486
+ next[3] = y;
487
+ }
488
+ onChange(next);
489
+ },
490
+ [dragging, disabled, getSVGPoint, fromSVG, value, onChange]
491
+ );
492
+ const handlePointerUp = useCallback(() => {
493
+ if (dragging) {
494
+ setDragging(null);
495
+ onCommit?.(value);
496
+ }
497
+ }, [dragging, onCommit, value]);
498
+ const [p0x, p0y] = toSVG(0, 0);
499
+ const [p1x, p1y] = toSVG(value[0], value[1]);
500
+ const [p2x, p2y] = toSVG(value[2], value[3]);
501
+ const [p3x, p3y] = toSVG(1, 1);
502
+ const curvePath = `M ${p0x} ${p0y} C ${p1x} ${p1y}, ${p2x} ${p2y}, ${p3x} ${p3y}`;
503
+ const linearPath = `M ${p0x} ${p0y} L ${p3x} ${p3y}`;
504
+ const gridLines = [];
505
+ for (let i = 0; i <= 4; i++) {
506
+ const t = i / 4;
507
+ const [gx] = toSVG(t, 0);
508
+ const [, gy] = toSVG(0, t);
509
+ gridLines.push(
510
+ /* @__PURE__ */ jsx(
511
+ "line",
512
+ {
513
+ x1: gx,
514
+ y1: PADDING,
515
+ x2: gx,
516
+ y2: height - PADDING,
517
+ stroke: "var(--border)",
518
+ strokeWidth: 1,
519
+ strokeDasharray: i === 0 || i === 4 ? void 0 : "2 4"
520
+ },
521
+ `v-${i}`
522
+ ),
523
+ /* @__PURE__ */ jsx(
524
+ "line",
525
+ {
526
+ x1: PADDING,
527
+ y1: gy,
528
+ x2: width - PADDING,
529
+ y2: gy,
530
+ stroke: "var(--border)",
531
+ strokeWidth: 1,
532
+ strokeDasharray: i === 0 || i === 4 ? void 0 : "2 4"
533
+ },
534
+ `h-${i}`
535
+ )
536
+ );
537
+ }
538
+ return /* @__PURE__ */ jsxs("div", { className: "nodrag space-y-2", children: [
539
+ /* @__PURE__ */ jsxs(
540
+ "svg",
541
+ {
542
+ ref: svgRef,
543
+ width,
544
+ height,
545
+ className: `bg-[var(--background)] rounded border border-[var(--border)] ${disabled ? "opacity-50 pointer-events-none" : "cursor-crosshair"}`,
546
+ onPointerMove: handlePointerMove,
547
+ onPointerUp: handlePointerUp,
548
+ onPointerLeave: handlePointerUp,
549
+ children: [
550
+ gridLines,
551
+ /* @__PURE__ */ jsx(
552
+ "path",
553
+ {
554
+ d: linearPath,
555
+ fill: "none",
556
+ stroke: "var(--muted-foreground)",
557
+ strokeWidth: 1,
558
+ strokeDasharray: "4 4",
559
+ opacity: 0.3
560
+ }
561
+ ),
562
+ /* @__PURE__ */ jsx(
563
+ "line",
564
+ {
565
+ x1: p0x,
566
+ y1: p0y,
567
+ x2: p1x,
568
+ y2: p1y,
569
+ stroke: "var(--primary)",
570
+ strokeWidth: 1,
571
+ opacity: 0.5
572
+ }
573
+ ),
574
+ /* @__PURE__ */ jsx(
575
+ "line",
576
+ {
577
+ x1: p3x,
578
+ y1: p3y,
579
+ x2: p2x,
580
+ y2: p2y,
581
+ stroke: "var(--primary)",
582
+ strokeWidth: 1,
583
+ opacity: 0.5
584
+ }
585
+ ),
586
+ /* @__PURE__ */ jsx("path", { d: curvePath, fill: "none", stroke: "var(--primary)", strokeWidth: 2.5 }),
587
+ /* @__PURE__ */ jsx("circle", { cx: p0x, cy: p0y, r: 3, fill: "var(--foreground)" }),
588
+ /* @__PURE__ */ jsx("circle", { cx: p3x, cy: p3y, r: 3, fill: "var(--foreground)" }),
589
+ /* @__PURE__ */ jsx(
590
+ "circle",
591
+ {
592
+ cx: p1x,
593
+ cy: p1y,
594
+ r: POINT_RADIUS,
595
+ fill: "var(--primary)",
596
+ stroke: "var(--background)",
597
+ strokeWidth: 2,
598
+ className: disabled ? "" : "cursor-grab active:cursor-grabbing",
599
+ onPointerDown: handlePointerDown(1)
600
+ }
601
+ ),
602
+ /* @__PURE__ */ jsx(
603
+ "circle",
604
+ {
605
+ cx: p2x,
606
+ cy: p2y,
607
+ r: POINT_RADIUS,
608
+ fill: "var(--accent)",
609
+ stroke: "var(--background)",
610
+ strokeWidth: 2,
611
+ className: disabled ? "" : "cursor-grab active:cursor-grabbing",
612
+ onPointerDown: handlePointerDown(2)
613
+ }
614
+ )
615
+ ]
616
+ }
617
+ ),
618
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-[10px] text-[var(--muted-foreground)] font-mono px-1", children: [
619
+ /* @__PURE__ */ jsxs("span", { children: [
620
+ "P1: (",
621
+ value[0].toFixed(2),
622
+ ", ",
623
+ value[1].toFixed(2),
624
+ ")"
625
+ ] }),
626
+ /* @__PURE__ */ jsxs("span", { children: [
627
+ "P2: (",
628
+ value[2].toFixed(2),
629
+ ", ",
630
+ value[3].toFixed(2),
631
+ ")"
632
+ ] })
633
+ ] })
634
+ ] });
635
+ }
636
+ var CubicBezierEditor = memo(CubicBezierEditorComponent);
637
+
638
+ export { CubicBezierEditor, DEFAULT_CUSTOM_BEZIER, DEFAULT_IMAGE_MODEL, DEFAULT_LIPSYNC_MODEL, DEFAULT_LLM_MODEL, DEFAULT_VIDEO_MODEL, EASING_BEZIER_MAP, EASING_PRESETS, IMAGE_MODELS, IMAGE_MODEL_ID_MAP, IMAGE_MODEL_MAP, LIPSYNC_MODELS, LIPSYNC_SYNC_MODES, LLM_MODELS, LLM_MODEL_ID_MAP, LLM_MODEL_MAP, PRESET_BEZIERS, VIDEO_MODELS, VIDEO_MODEL_ID_MAP, VIDEO_MODEL_MAP, applySpeedCurve, createAsymmetricEase, createBezierEasing, easing, evaluateBezier, generateHandlesFromSchema, getAllEasingNames, getEasingBezier, getEasingDisplayName, getEasingFunction, getImageModelLabel, getLLMModelLabel, getLipSyncModelLabel, getMediaFromNode, getPresetBezier, getVideoModelLabel, isSchemaHandle, lipSyncModelSupportsImage };