@genfeedai/workflow-ui 0.2.2 → 0.2.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 (47) hide show
  1. package/README.md +11 -33
  2. package/dist/canvas.d.ts +22 -22
  3. package/dist/canvas.mjs +16 -17
  4. package/dist/{chunk-WBR34V4L.mjs → chunk-2FUPL67V.mjs} +1593 -1045
  5. package/dist/{chunk-4VEN4UN7.mjs → chunk-53XDE62A.mjs} +818 -623
  6. package/dist/{chunk-PCIWWD37.mjs → chunk-7LV4UAUS.mjs} +19 -19
  7. package/dist/{chunk-7SKSRSS7.mjs → chunk-B4EAAKYF.mjs} +16 -16
  8. package/dist/{chunk-ZJD5WMR3.mjs → chunk-C6MQBJFC.mjs} +45 -13
  9. package/dist/{chunk-7H3WJJYS.mjs → chunk-ESVULCFY.mjs} +12 -6
  10. package/dist/{chunk-GWBGK3KL.mjs → chunk-FWJIAW2E.mjs} +82 -47
  11. package/dist/{chunk-R727OFBR.mjs → chunk-GPYIIWD5.mjs} +404 -350
  12. package/dist/{chunk-OQREHJXK.mjs → chunk-IYFWAJBB.mjs} +208 -203
  13. package/dist/{chunk-2JQSKIWR.mjs → chunk-MGLAKMDP.mjs} +24 -23
  14. package/dist/{chunk-LT3ZJJL6.mjs → chunk-OJWVEEMM.mjs} +497 -399
  15. package/dist/{chunk-ZD2BADZO.mjs → chunk-ORVDYXDP.mjs} +221 -175
  16. package/dist/{chunk-CV4M7CNU.mjs → chunk-QQVHGJ2G.mjs} +149 -142
  17. package/dist/{chunk-6PSJTBNV.mjs → chunk-U4QPE4CY.mjs} +387 -347
  18. package/dist/{chunk-EFXQT23N.mjs → chunk-VVQ4CH77.mjs} +5 -5
  19. package/dist/{chunk-VRN3UWE5.mjs → chunk-XRC3O5GK.mjs} +73 -73
  20. package/dist/{chunk-FT33LFII.mjs → chunk-YUIK4AHM.mjs} +1 -1
  21. package/dist/{chunk-JT4Y5H3U.mjs → chunk-ZSITTZ4S.mjs} +630 -569
  22. package/dist/hooks.d.ts +37 -37
  23. package/dist/hooks.mjs +10 -10
  24. package/dist/index.d.ts +26 -11
  25. package/dist/index.mjs +99 -20
  26. package/dist/lib.d.ts +203 -203
  27. package/dist/lib.mjs +228 -199
  28. package/dist/nodes.d.ts +2 -2
  29. package/dist/nodes.mjs +12 -13
  30. package/dist/panels.d.ts +2 -3
  31. package/dist/panels.mjs +3 -3
  32. package/dist/provider.d.ts +2 -2
  33. package/dist/provider.mjs +2 -2
  34. package/dist/stores.d.ts +5 -5
  35. package/dist/stores.mjs +5 -5
  36. package/dist/toolbar.d.ts +42 -24
  37. package/dist/toolbar.mjs +4 -5
  38. package/dist/ui.d.ts +2 -2
  39. package/dist/ui.mjs +2 -2
  40. package/dist/{useCommentNavigation-BakbiiIc.d.ts → useRequiredInputs-ByoIS-fT.d.ts} +160 -160
  41. package/dist/{promptLibraryStore-Dl3Q3cP6.d.ts → workflowStore-Bsz0nd5c.d.ts} +368 -368
  42. package/dist/workflowStore-N2F7WIG3.mjs +2 -0
  43. package/package.json +79 -77
  44. package/src/styles/workflow-ui.css +56 -19
  45. package/dist/chunk-OY7BRSGG.mjs +0 -60
  46. package/dist/workflowStore-UAAKOOIK.mjs +0 -2
  47. package/dist/{types-IEKYuYhu.d.ts → types-CRXJnajq.d.ts} +1 -1
package/dist/lib.mjs CHANGED
@@ -1,136 +1,71 @@
1
- import { easing, getEasingFunction } from './chunk-6PSJTBNV.mjs';
2
- 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 } from './chunk-6PSJTBNV.mjs';
3
- export { calculateWorkflowCost, formatCost } from './chunk-2JQSKIWR.mjs';
4
- import './chunk-OY7BRSGG.mjs';
5
- export { CONNECTION_FIELDS, extractEnumValues, getImageDimensions, getSchemaDefaults, getVideoMetadata, supportsImageInput, validateRequiredSchemaFields } from './chunk-EFXQT23N.mjs';
1
+ export { calculateWorkflowCost, formatCost } from './chunk-MGLAKMDP.mjs';
2
+ import { easing, getEasingFunction } from './chunk-U4QPE4CY.mjs';
3
+ 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 } from './chunk-U4QPE4CY.mjs';
4
+ export { CONNECTION_FIELDS, extractEnumValues, getImageDimensions, getSchemaDefaults, getVideoMetadata, supportsImageInput, validateRequiredSchemaFields } from './chunk-VVQ4CH77.mjs';
6
5
 
7
- // src/lib/speedCurve.ts
8
- var INVERSE_TOLERANCE = 1e-6;
9
- var INVERSE_MAX_ITERATIONS = 32;
10
- var MONOTONICITY_SAMPLES = 256;
11
- var MONOTONICITY_TOLERANCE = 1e-6;
12
- var inverseCache = /* @__PURE__ */ new WeakMap();
13
- var monotonicityCache = /* @__PURE__ */ new WeakMap();
14
- function isMonotonicIncreasing(func) {
15
- const cached = monotonicityCache.get(func);
16
- if (cached !== void 0) {
17
- return cached;
18
- }
19
- let prev = func(0);
20
- for (let i = 1; i <= MONOTONICITY_SAMPLES; i++) {
21
- const value = func(i / MONOTONICITY_SAMPLES);
22
- if (value + MONOTONICITY_TOLERANCE < prev) {
23
- monotonicityCache.set(func, false);
24
- return false;
25
- }
26
- prev = value;
27
- }
28
- monotonicityCache.set(func, true);
29
- return true;
6
+ // src/lib/deduplicatedFetch.ts
7
+ var inFlightRequests = /* @__PURE__ */ new Map();
8
+ var responseCache = /* @__PURE__ */ new Map();
9
+ var CACHE_TTL = 5e3;
10
+ var pendingTimeouts = /* @__PURE__ */ new Map();
11
+ function getCacheKey(url, headers) {
12
+ if (!headers) return url;
13
+ const headerObj = headers instanceof Headers ? Object.fromEntries(headers.entries()) : Array.isArray(headers) ? Object.fromEntries(headers) : headers;
14
+ const sortedHeaders = Object.keys(headerObj).sort().map((k) => `${k}:${headerObj[k]}`).join("|");
15
+ return `${url}|${sortedHeaders}`;
30
16
  }
31
- function invertEasingValue(target, func) {
32
- if (target <= INVERSE_TOLERANCE) {
33
- return 0;
34
- }
35
- if (target >= 1 - INVERSE_TOLERANCE) {
36
- return 1;
17
+ async function deduplicatedFetch(url, options) {
18
+ const cacheKey = getCacheKey(url, options?.headers);
19
+ const cached = responseCache.get(cacheKey);
20
+ if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
21
+ return new Response(cached.bodyText, {
22
+ headers: cached.headers,
23
+ status: cached.status
24
+ });
37
25
  }
38
- let low = 0;
39
- let high = 1;
40
- let mid = 0.5;
41
- for (let i = 0; i < INVERSE_MAX_ITERATIONS; i++) {
42
- mid = (low + high) / 2;
43
- const value = func(mid);
44
- const diff = value - target;
45
- if (Math.abs(diff) <= INVERSE_TOLERANCE) {
46
- break;
47
- }
48
- if (diff < 0) {
49
- low = mid;
50
- } else {
51
- high = mid;
26
+ const existingRequest = inFlightRequests.get(cacheKey);
27
+ if (existingRequest) {
28
+ await existingRequest;
29
+ const cachedData = responseCache.get(cacheKey);
30
+ if (cachedData) {
31
+ return new Response(cachedData.bodyText, {
32
+ headers: cachedData.headers,
33
+ status: cachedData.status
34
+ });
52
35
  }
36
+ return new Response(JSON.stringify({ error: "Cache miss" }), {
37
+ status: 500
38
+ });
53
39
  }
54
- return Math.min(1, Math.max(0, mid));
55
- }
56
- function getInverseEasing(func) {
57
- if (inverseCache.has(func)) {
58
- return inverseCache.get(func);
59
- }
60
- if (!isMonotonicIncreasing(func)) {
61
- inverseCache.set(func, null);
62
- return null;
63
- }
64
- const inverse = (value) => {
65
- const clamped = Math.max(0, Math.min(1, value));
66
- return invertEasingValue(clamped, func);
67
- };
68
- inverseCache.set(func, inverse);
69
- return inverse;
70
- }
71
- function mapTimeWithEasing(normalizedTime, func) {
72
- const inverse = getInverseEasing(func);
73
- if (!inverse) {
74
- return func(normalizedTime);
75
- }
76
- return inverse(normalizedTime);
77
- }
78
- function warpTime(originalTime, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
79
- const easingFunc = typeof easingFunction === "string" ? getEasingFunction(easingFunction) : easingFunction;
80
- const t = originalTime / inputDuration;
81
- const clamped = Math.max(0, Math.min(1, t));
82
- const eased = mapTimeWithEasing(clamped, easingFunc);
83
- return eased * outputDuration;
84
- }
85
- function calculateWarpedDuration(originalStart, originalDuration, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
86
- const warpedStart = warpTime(originalStart, inputDuration, outputDuration, easingFunction);
87
- const warpedEnd = warpTime(
88
- originalStart + originalDuration,
89
- inputDuration,
90
- outputDuration,
91
- easingFunction
92
- );
93
- return warpedEnd - warpedStart;
94
- }
95
- function validateWarpFunction(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, tolerance = 1e-3) {
96
- const errors = [];
97
- const startWarp = warpTime(0, inputDuration, outputDuration, easingFunction);
98
- if (Math.abs(startWarp - 0) > tolerance) {
99
- errors.push(`Start point should be 0, got ${startWarp}`);
100
- }
101
- const endWarp = warpTime(inputDuration, inputDuration, outputDuration, easingFunction);
102
- if (Math.abs(endWarp - outputDuration) > tolerance) {
103
- errors.push(`End point should be ${outputDuration}, got ${endWarp}`);
104
- }
105
- let prevWarp = 0;
106
- for (let t = 0; t <= inputDuration; t += inputDuration / 100) {
107
- const warp = warpTime(t, inputDuration, outputDuration, easingFunction);
108
- if (warp < prevWarp) {
109
- errors.push(`Monotonicity violation at t=${t.toFixed(2)}: ${warp} < ${prevWarp}`);
110
- break;
40
+ const requestPromise = fetch(url, options).then(async (response) => {
41
+ try {
42
+ const bodyText = await response.clone().text();
43
+ responseCache.set(cacheKey, {
44
+ bodyText,
45
+ headers: Object.fromEntries(response.headers.entries()),
46
+ status: response.status,
47
+ timestamp: Date.now()
48
+ });
49
+ } catch {
111
50
  }
112
- prevWarp = warp;
113
- }
114
- return { valid: errors.length === 0, errors };
51
+ return response;
52
+ }).finally(() => {
53
+ const timeoutId = setTimeout(() => {
54
+ inFlightRequests.delete(cacheKey);
55
+ pendingTimeouts.delete(cacheKey);
56
+ }, 50);
57
+ pendingTimeouts.set(cacheKey, timeoutId);
58
+ });
59
+ inFlightRequests.set(cacheKey, requestPromise);
60
+ return requestPromise;
115
61
  }
116
- function analyzeWarpCurve(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, samples = 100) {
117
- const speedMultipliers = [];
118
- const averageSpeed = inputDuration / outputDuration;
119
- for (let i = 0; i < samples; i++) {
120
- const t1 = i / samples * inputDuration;
121
- const t2 = (i + 1) / samples * inputDuration;
122
- const warp1 = warpTime(t1, inputDuration, outputDuration, easingFunction);
123
- const warp2 = warpTime(t2, inputDuration, outputDuration, easingFunction);
124
- const inputSegmentDuration = t2 - t1;
125
- const outputSegmentDuration = warp2 - warp1;
126
- const absoluteSpeed = inputSegmentDuration / (outputSegmentDuration + 1e-10);
127
- const speedMultiplier = absoluteSpeed / averageSpeed;
128
- speedMultipliers.push(speedMultiplier);
62
+ function clearFetchCache() {
63
+ responseCache.clear();
64
+ inFlightRequests.clear();
65
+ for (const timeoutId of pendingTimeouts.values()) {
66
+ clearTimeout(timeoutId);
129
67
  }
130
- const minSpeed = Math.min(...speedMultipliers);
131
- const maxSpeed = Math.max(...speedMultipliers);
132
- const avgSpeed = speedMultipliers.reduce((a, b) => a + b, 0) / speedMultipliers.length;
133
- return { speedMultipliers, minSpeed, maxSpeed, avgSpeed };
68
+ pendingTimeouts.clear();
134
69
  }
135
70
 
136
71
  // src/lib/gridSplitter.ts
@@ -189,14 +124,14 @@ function createGridForDimensions(width, height, rows, cols) {
189
124
  for (let row = 0; row < rows; row++) {
190
125
  for (let col = 0; col < cols; col++) {
191
126
  cells.push({
192
- x: Math.round(col * cellWidth),
193
- y: Math.round(row * cellHeight),
127
+ height: Math.round(cellHeight),
194
128
  width: Math.round(cellWidth),
195
- height: Math.round(cellHeight)
129
+ x: Math.round(col * cellWidth),
130
+ y: Math.round(row * cellHeight)
196
131
  });
197
132
  }
198
133
  }
199
- return { rows, cols, cells, confidence: 1 };
134
+ return { cells, cols, confidence: 1, rows };
200
135
  }
201
136
  async function detectGridWithDimensions(imageDataUrl, rows, cols) {
202
137
  return new Promise((resolve, reject) => {
@@ -239,11 +174,11 @@ function getGridCandidates(width, height) {
239
174
  const gridSymmetry = 1 - Math.abs(rows - cols) / Math.max(rows, cols);
240
175
  const score = cellARScore * 0.45 + layoutScore * 0.25 + cellCountScore * 0.15 + gridSymmetry * 0.15;
241
176
  candidates.push({
242
- rows,
243
- cols,
244
- cellWidth,
245
- cellHeight,
246
177
  cellAspectRatio,
178
+ cellHeight,
179
+ cellWidth,
180
+ cols,
181
+ rows,
247
182
  score
248
183
  });
249
184
  }
@@ -253,8 +188,16 @@ function getGridCandidates(width, height) {
253
188
  function analyzeGridFromImageData(imageData) {
254
189
  const { width, height, data } = imageData;
255
190
  const candidates = getGridCandidates(width, height);
256
- const verticalEdgeStrength = calculateVerticalEdgeProfile(data, width, height);
257
- const horizontalEdgeStrength = calculateHorizontalEdgeProfile(data, width, height);
191
+ const verticalEdgeStrength = calculateVerticalEdgeProfile(
192
+ data,
193
+ width,
194
+ height
195
+ );
196
+ const horizontalEdgeStrength = calculateHorizontalEdgeProfile(
197
+ data,
198
+ width,
199
+ height
200
+ );
258
201
  let bestCandidate = candidates[0];
259
202
  let bestCombinedScore = -Infinity;
260
203
  for (const candidate of candidates.slice(0, 8)) {
@@ -272,7 +215,12 @@ function analyzeGridFromImageData(imageData) {
272
215
  bestCandidate = candidate;
273
216
  }
274
217
  }
275
- const result = createGridForDimensions(width, height, bestCandidate.rows, bestCandidate.cols);
218
+ const result = createGridForDimensions(
219
+ width,
220
+ height,
221
+ bestCandidate.rows,
222
+ bestCandidate.cols
223
+ );
276
224
  result.confidence = bestCombinedScore;
277
225
  return result;
278
226
  }
@@ -321,7 +269,10 @@ function scoreGridByEdges(rows, cols, width, height, verticalProfile, horizontal
321
269
  const horizontalBaseline = horizontalSum / horizontalProfile.length;
322
270
  let totalRatio = 0;
323
271
  let divisions = 0;
324
- const searchWindow = Math.max(3, Math.floor(Math.min(width / cols, height / rows) * 0.03));
272
+ const searchWindow = Math.max(
273
+ 3,
274
+ Math.floor(Math.min(width / cols, height / rows) * 0.03)
275
+ );
325
276
  if (cols > 1) {
326
277
  const cellWidth = width / cols;
327
278
  for (let i = 1; i < cols; i++) {
@@ -418,7 +369,7 @@ function getImageDimensions2(base64DataUrl) {
418
369
  }
419
370
  const img = new Image();
420
371
  img.onload = () => {
421
- resolve({ width: img.naturalWidth, height: img.naturalHeight });
372
+ resolve({ height: img.naturalHeight, width: img.naturalWidth });
422
373
  };
423
374
  img.onerror = () => {
424
375
  resolve(null);
@@ -434,7 +385,7 @@ function getVideoDimensions(videoUrl) {
434
385
  }
435
386
  const video = document.createElement("video");
436
387
  video.onloadedmetadata = () => {
437
- resolve({ width: video.videoWidth, height: video.videoHeight });
388
+ resolve({ height: video.videoHeight, width: video.videoWidth });
438
389
  };
439
390
  video.onerror = () => {
440
391
  resolve(null);
@@ -449,7 +400,7 @@ var MAX_HEIGHT = 600;
449
400
  var NODE_CHROME_HEIGHT = 100;
450
401
  function calculateNodeSize(aspectRatio, baseWidth = 300) {
451
402
  if (!aspectRatio || aspectRatio <= 0 || !Number.isFinite(aspectRatio)) {
452
- return { width: 300, height: 300 };
403
+ return { height: 300, width: 300 };
453
404
  }
454
405
  let width = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, baseWidth));
455
406
  let contentHeight = width / aspectRatio;
@@ -477,87 +428,165 @@ function calculateNodeSize(aspectRatio, baseWidth = 300) {
477
428
  totalHeight = Math.max(MIN_HEIGHT, Math.min(MAX_HEIGHT, totalHeight));
478
429
  }
479
430
  return {
480
- width: Math.round(width),
481
- height: Math.round(totalHeight)
431
+ height: Math.round(totalHeight),
432
+ width: Math.round(width)
482
433
  };
483
434
  }
484
435
  function calculateNodeSizePreservingHeight(aspectRatio, currentHeight) {
485
436
  if (!aspectRatio || aspectRatio <= 0 || !Number.isFinite(aspectRatio)) {
486
- return { width: 300, height: currentHeight ?? 300 };
437
+ return { height: currentHeight ?? 300, width: 300 };
487
438
  }
488
439
  if (currentHeight !== void 0 && currentHeight >= MIN_HEIGHT && currentHeight <= MAX_HEIGHT) {
489
440
  const contentHeight = currentHeight - NODE_CHROME_HEIGHT;
490
441
  let width = contentHeight * aspectRatio;
491
442
  width = Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, width));
492
443
  return {
493
- width: Math.round(width),
494
- height: Math.round(currentHeight)
444
+ height: Math.round(currentHeight),
445
+ width: Math.round(width)
495
446
  };
496
447
  }
497
448
  return calculateNodeSize(aspectRatio);
498
449
  }
499
450
 
500
- // src/lib/deduplicatedFetch.ts
501
- var inFlightRequests = /* @__PURE__ */ new Map();
502
- var responseCache = /* @__PURE__ */ new Map();
503
- var CACHE_TTL = 5e3;
504
- var pendingTimeouts = /* @__PURE__ */ new Map();
505
- function getCacheKey(url, headers) {
506
- if (!headers) return url;
507
- const headerObj = headers instanceof Headers ? Object.fromEntries(headers.entries()) : Array.isArray(headers) ? Object.fromEntries(headers) : headers;
508
- const sortedHeaders = Object.keys(headerObj).sort().map((k) => `${k}:${headerObj[k]}`).join("|");
509
- return `${url}|${sortedHeaders}`;
451
+ // src/lib/speedCurve.ts
452
+ var INVERSE_TOLERANCE = 1e-6;
453
+ var INVERSE_MAX_ITERATIONS = 32;
454
+ var MONOTONICITY_SAMPLES = 256;
455
+ var MONOTONICITY_TOLERANCE = 1e-6;
456
+ var inverseCache = /* @__PURE__ */ new WeakMap();
457
+ var monotonicityCache = /* @__PURE__ */ new WeakMap();
458
+ function isMonotonicIncreasing(func) {
459
+ const cached = monotonicityCache.get(func);
460
+ if (cached !== void 0) {
461
+ return cached;
462
+ }
463
+ let prev = func(0);
464
+ for (let i = 1; i <= MONOTONICITY_SAMPLES; i++) {
465
+ const value = func(i / MONOTONICITY_SAMPLES);
466
+ if (value + MONOTONICITY_TOLERANCE < prev) {
467
+ monotonicityCache.set(func, false);
468
+ return false;
469
+ }
470
+ prev = value;
471
+ }
472
+ monotonicityCache.set(func, true);
473
+ return true;
510
474
  }
511
- async function deduplicatedFetch(url, options) {
512
- const cacheKey = getCacheKey(url, options?.headers);
513
- const cached = responseCache.get(cacheKey);
514
- if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
515
- return new Response(cached.bodyText, {
516
- status: cached.status,
517
- headers: cached.headers
518
- });
475
+ function invertEasingValue(target, func) {
476
+ if (target <= INVERSE_TOLERANCE) {
477
+ return 0;
519
478
  }
520
- const existingRequest = inFlightRequests.get(cacheKey);
521
- if (existingRequest) {
522
- await existingRequest;
523
- const cachedData = responseCache.get(cacheKey);
524
- if (cachedData) {
525
- return new Response(cachedData.bodyText, {
526
- status: cachedData.status,
527
- headers: cachedData.headers
528
- });
479
+ if (target >= 1 - INVERSE_TOLERANCE) {
480
+ return 1;
481
+ }
482
+ let low = 0;
483
+ let high = 1;
484
+ let mid = 0.5;
485
+ for (let i = 0; i < INVERSE_MAX_ITERATIONS; i++) {
486
+ mid = (low + high) / 2;
487
+ const value = func(mid);
488
+ const diff = value - target;
489
+ if (Math.abs(diff) <= INVERSE_TOLERANCE) {
490
+ break;
491
+ }
492
+ if (diff < 0) {
493
+ low = mid;
494
+ } else {
495
+ high = mid;
529
496
  }
530
- return new Response(JSON.stringify({ error: "Cache miss" }), { status: 500 });
531
497
  }
532
- const requestPromise = fetch(url, options).then(async (response) => {
533
- try {
534
- const bodyText = await response.clone().text();
535
- responseCache.set(cacheKey, {
536
- status: response.status,
537
- headers: Object.fromEntries(response.headers.entries()),
538
- bodyText,
539
- timestamp: Date.now()
540
- });
541
- } catch {
498
+ return Math.min(1, Math.max(0, mid));
499
+ }
500
+ function getInverseEasing(func) {
501
+ if (inverseCache.has(func)) {
502
+ return inverseCache.get(func);
503
+ }
504
+ if (!isMonotonicIncreasing(func)) {
505
+ inverseCache.set(func, null);
506
+ return null;
507
+ }
508
+ const inverse = (value) => {
509
+ const clamped = Math.max(0, Math.min(1, value));
510
+ return invertEasingValue(clamped, func);
511
+ };
512
+ inverseCache.set(func, inverse);
513
+ return inverse;
514
+ }
515
+ function mapTimeWithEasing(normalizedTime, func) {
516
+ const inverse = getInverseEasing(func);
517
+ if (!inverse) {
518
+ return func(normalizedTime);
519
+ }
520
+ return inverse(normalizedTime);
521
+ }
522
+ function warpTime(originalTime, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
523
+ const easingFunc = typeof easingFunction === "string" ? getEasingFunction(easingFunction) : easingFunction;
524
+ const t = originalTime / inputDuration;
525
+ const clamped = Math.max(0, Math.min(1, t));
526
+ const eased = mapTimeWithEasing(clamped, easingFunc);
527
+ return eased * outputDuration;
528
+ }
529
+ function calculateWarpedDuration(originalStart, originalDuration, inputDuration = 5, outputDuration = 1.5, easingFunction = easing.easeInOutCubic) {
530
+ const warpedStart = warpTime(
531
+ originalStart,
532
+ inputDuration,
533
+ outputDuration,
534
+ easingFunction
535
+ );
536
+ const warpedEnd = warpTime(
537
+ originalStart + originalDuration,
538
+ inputDuration,
539
+ outputDuration,
540
+ easingFunction
541
+ );
542
+ return warpedEnd - warpedStart;
543
+ }
544
+ function validateWarpFunction(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, tolerance = 1e-3) {
545
+ const errors = [];
546
+ const startWarp = warpTime(0, inputDuration, outputDuration, easingFunction);
547
+ if (Math.abs(startWarp - 0) > tolerance) {
548
+ errors.push(`Start point should be 0, got ${startWarp}`);
549
+ }
550
+ const endWarp = warpTime(
551
+ inputDuration,
552
+ inputDuration,
553
+ outputDuration,
554
+ easingFunction
555
+ );
556
+ if (Math.abs(endWarp - outputDuration) > tolerance) {
557
+ errors.push(`End point should be ${outputDuration}, got ${endWarp}`);
558
+ }
559
+ let prevWarp = 0;
560
+ for (let t = 0; t <= inputDuration; t += inputDuration / 100) {
561
+ const warp = warpTime(t, inputDuration, outputDuration, easingFunction);
562
+ if (warp < prevWarp) {
563
+ errors.push(
564
+ `Monotonicity violation at t=${t.toFixed(2)}: ${warp} < ${prevWarp}`
565
+ );
566
+ break;
542
567
  }
543
- return response;
544
- }).finally(() => {
545
- const timeoutId = setTimeout(() => {
546
- inFlightRequests.delete(cacheKey);
547
- pendingTimeouts.delete(cacheKey);
548
- }, 50);
549
- pendingTimeouts.set(cacheKey, timeoutId);
550
- });
551
- inFlightRequests.set(cacheKey, requestPromise);
552
- return requestPromise;
568
+ prevWarp = warp;
569
+ }
570
+ return { errors, valid: errors.length === 0 };
553
571
  }
554
- function clearFetchCache() {
555
- responseCache.clear();
556
- inFlightRequests.clear();
557
- for (const timeoutId of pendingTimeouts.values()) {
558
- clearTimeout(timeoutId);
572
+ function analyzeWarpCurve(easingFunction = easing.easeInOutCubic, inputDuration = 5, outputDuration = 1.5, samples = 100) {
573
+ const speedMultipliers = [];
574
+ const averageSpeed = inputDuration / outputDuration;
575
+ for (let i = 0; i < samples; i++) {
576
+ const t1 = i / samples * inputDuration;
577
+ const t2 = (i + 1) / samples * inputDuration;
578
+ const warp1 = warpTime(t1, inputDuration, outputDuration, easingFunction);
579
+ const warp2 = warpTime(t2, inputDuration, outputDuration, easingFunction);
580
+ const inputSegmentDuration = t2 - t1;
581
+ const outputSegmentDuration = warp2 - warp1;
582
+ const absoluteSpeed = inputSegmentDuration / (outputSegmentDuration + 1e-10);
583
+ const speedMultiplier = absoluteSpeed / averageSpeed;
584
+ speedMultipliers.push(speedMultiplier);
559
585
  }
560
- pendingTimeouts.clear();
586
+ const minSpeed = Math.min(...speedMultipliers);
587
+ const maxSpeed = Math.max(...speedMultipliers);
588
+ const avgSpeed = speedMultipliers.reduce((a, b) => a + b, 0) / speedMultipliers.length;
589
+ return { avgSpeed, maxSpeed, minSpeed, speedMultipliers };
561
590
  }
562
591
 
563
592
  export { analyzeWarpCurve, calculateNodeSize, calculateNodeSizePreservingHeight, calculateWarpedDuration, clearFetchCache, createGridForDimensions, deduplicatedFetch, detectAndSplitGrid, detectGrid, detectGridWithDimensions, getGridCandidates, getImageDimensions2 as getImageDimensionsFromDataUrl, getVideoDimensions as getVideoDimensionsFromUrl, splitImage, splitWithDimensions, validateWarpFunction, warpTime };
package/dist/nodes.d.ts CHANGED
@@ -41,8 +41,6 @@ interface BaseNodeProps extends NodeProps {
41
41
  declare function BaseNodeComponent({ id, type, data, selected, children, headerActions, title, titleElement, hideStatusIndicator, width, height, disabledInputs, }: BaseNodeProps): react_jsx_runtime.JSX.Element | null;
42
42
  declare const BaseNode: react.MemoExoticComponent<typeof BaseNodeComponent>;
43
43
 
44
- declare function NodeDetailModal(): react_jsx_runtime.JSX.Element | null;
45
-
46
44
  declare function WorkflowInputNodeComponent(props: NodeProps): react_jsx_runtime.JSX.Element;
47
45
  declare const WorkflowInputNode: react.MemoExoticComponent<typeof WorkflowInputNodeComponent>;
48
46
 
@@ -84,6 +82,8 @@ declare const PromptNode: react.MemoExoticComponent<typeof PromptNodeComponent>;
84
82
  declare function VideoInputNodeComponent(props: NodeProps): react_jsx_runtime.JSX.Element;
85
83
  declare const VideoInputNode: react.MemoExoticComponent<typeof VideoInputNodeComponent>;
86
84
 
85
+ declare function NodeDetailModal(): react_jsx_runtime.JSX.Element | null;
86
+
87
87
  declare function DownloadNodeComponent(props: NodeProps): react_jsx_runtime.JSX.Element;
88
88
  declare const DownloadNode: react.MemoExoticComponent<typeof DownloadNodeComponent>;
89
89
  /** @deprecated Use DownloadNode instead */
package/dist/nodes.mjs CHANGED
@@ -1,14 +1,13 @@
1
- export { AnimationNode, AnnotationNode, AudioInputNode, BaseNode, DownloadNode, ImageCompareNode, ImageGenNode, ImageGridSplitNode, ImageInputNode, LLMNode, LipSyncNode, MotionControlNode, NodeDetailModal, OutputGalleryNode, OutputNode, PromptConstructorNode, PromptNode, ReframeNode, ResizeNode, SubtitleNode, TextToSpeechNode, TranscribeNode, UpscaleNode, VideoFrameExtractNode, VideoGenNode, VideoInputNode, VideoStitchNode, VideoTrimNode, VoiceChangeNode, WorkflowInputNode, WorkflowOutputNode, WorkflowRefNode, nodeTypes, setWorkflowRefApi } from './chunk-WBR34V4L.mjs';
2
- import './chunk-ZJD5WMR3.mjs';
3
- import './chunk-6PSJTBNV.mjs';
4
- import './chunk-OY7BRSGG.mjs';
5
- import './chunk-GWBGK3KL.mjs';
6
- import './chunk-7SKSRSS7.mjs';
7
- import './chunk-EFXQT23N.mjs';
8
- import './chunk-CV4M7CNU.mjs';
9
- import './chunk-LDN7IX4Y.mjs';
10
- import './chunk-LT3ZJJL6.mjs';
11
- import './chunk-R727OFBR.mjs';
1
+ export { AnimationNode, AnnotationNode, AudioInputNode, BaseNode, DownloadNode, ImageCompareNode, ImageGenNode, ImageGridSplitNode, ImageInputNode, LLMNode, LipSyncNode, MotionControlNode, NodeDetailModal, OutputGalleryNode, OutputNode, PromptConstructorNode, PromptNode, ReframeNode, ResizeNode, SubtitleNode, TextToSpeechNode, TranscribeNode, UpscaleNode, VideoFrameExtractNode, VideoGenNode, VideoInputNode, VideoStitchNode, VideoTrimNode, VoiceChangeNode, WorkflowInputNode, WorkflowOutputNode, WorkflowRefNode, nodeTypes, setWorkflowRefApi } from './chunk-2FUPL67V.mjs';
2
+ import './chunk-C6MQBJFC.mjs';
3
+ import './chunk-FWJIAW2E.mjs';
4
+ import './chunk-B4EAAKYF.mjs';
5
+ import './chunk-U4QPE4CY.mjs';
6
+ import './chunk-VVQ4CH77.mjs';
12
7
  import './chunk-MLJJBBTB.mjs';
13
- import './chunk-FT33LFII.mjs';
14
- import './chunk-VRN3UWE5.mjs';
8
+ import './chunk-YUIK4AHM.mjs';
9
+ import './chunk-QQVHGJ2G.mjs';
10
+ import './chunk-LDN7IX4Y.mjs';
11
+ import './chunk-OJWVEEMM.mjs';
12
+ import './chunk-GPYIIWD5.mjs';
13
+ import './chunk-XRC3O5GK.mjs';
package/dist/panels.d.ts CHANGED
@@ -2,6 +2,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
3
  import { HTMLAttributes, ReactNode } from 'react';
4
4
 
5
+ declare function DebugPanel(): react_jsx_runtime.JSX.Element;
6
+
5
7
  declare function NodePalette(): react_jsx_runtime.JSX.Element;
6
8
 
7
9
  interface PanelContainerProps extends HTMLAttributes<HTMLDivElement> {
@@ -16,7 +18,4 @@ interface PanelContainerProps extends HTMLAttributes<HTMLDivElement> {
16
18
  */
17
19
  declare const PanelContainer: react.ForwardRefExoticComponent<PanelContainerProps & react.RefAttributes<HTMLDivElement>>;
18
20
 
19
- declare function DebugPanelComponent(): react_jsx_runtime.JSX.Element;
20
- declare const DebugPanel: react.MemoExoticComponent<typeof DebugPanelComponent>;
21
-
22
21
  export { DebugPanel, NodePalette, PanelContainer };
package/dist/panels.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { DebugPanel, NodePalette, PanelContainer } from './chunk-OQREHJXK.mjs';
2
- import './chunk-LT3ZJJL6.mjs';
3
- import './chunk-R727OFBR.mjs';
1
+ export { DebugPanel, NodePalette, PanelContainer } from './chunk-IYFWAJBB.mjs';
2
+ import './chunk-OJWVEEMM.mjs';
3
+ import './chunk-GPYIIWD5.mjs';
@@ -1,7 +1,7 @@
1
+ import { W as WorkflowUIConfig } from './types-CRXJnajq.js';
2
+ export { F as FileUploadService, M as ModelBrowserModalProps, b as ModelSchemaService, P as PromptLibraryService, a as PromptPickerProps, c as WorkflowsApiService } from './types-CRXJnajq.js';
1
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
4
  import { ReactNode } from 'react';
3
- import { W as WorkflowUIConfig } from './types-IEKYuYhu.js';
4
- export { F as FileUploadService, M as ModelBrowserModalProps, b as ModelSchemaService, P as PromptLibraryService, a as PromptPickerProps, c as WorkflowsApiService } from './types-IEKYuYhu.js';
5
5
  import '@genfeedai/types';
6
6
 
7
7
  /**
package/dist/provider.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import './chunk-MLJJBBTB.mjs';
2
- export { WorkflowUIProvider, useWorkflowUIConfig } from './chunk-FT33LFII.mjs';
3
- import './chunk-VRN3UWE5.mjs';
2
+ export { WorkflowUIProvider, useWorkflowUIConfig } from './chunk-YUIK4AHM.mjs';
3
+ import './chunk-XRC3O5GK.mjs';
package/dist/stores.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { W as WorkflowStore } from './promptLibraryStore-Dl3Q3cP6.js';
2
- export { A as AnnotationShape, a as AnnotationTool, b as ArrowShape, B as BaseShape, C as CircleShape, D as DebugPayload, c as DefaultModelSettings, E as ExecutionStore, F as FreehandShape, J as Job, M as ModalType, N as NodeDetailTab, P as PROVIDER_INFO, d as ProviderConfig, e as ProviderSettings, R as RecentModel, f as RectangleShape, T as TextShape, g as ToolOptions, h as WorkflowData, i as WorkflowState, j as configurePromptLibrary, u as useAnnotationStore, k as useExecutionStore, l as usePromptEditorStore, m as usePromptLibraryStore, n as useSettingsStore, o as useUIStore, p as useWorkflowStore } from './promptLibraryStore-Dl3Q3cP6.js';
1
+ import { W as WorkflowStore } from './workflowStore-Bsz0nd5c.js';
2
+ export { A as AnnotationShape, a as AnnotationTool, b as ArrowShape, B as BaseShape, C as CircleShape, D as DebugPayload, c as DefaultModelSettings, E as ExecutionStore, F as FreehandShape, J as Job, M as ModalType, N as NodeDetailTab, P as PROVIDER_INFO, d as ProviderConfig, e as ProviderSettings, R as RecentModel, f as RectangleShape, T as TextShape, g as ToolOptions, h as WorkflowData, i as WorkflowState, j as configurePromptLibrary, u as useAnnotationStore, k as useExecutionStore, l as usePromptEditorStore, m as usePromptLibraryStore, n as useSettingsStore, o as useUIStore, p as useWorkflowStore } from './workflowStore-Bsz0nd5c.js';
3
+ export { C as ContextMenuType, u as useContextMenuStore } from './contextMenuStore-DMg0hJQ1.js';
3
4
  import * as _xyflow_react from '@xyflow/react';
4
5
  import * as _genfeedai_types from '@genfeedai/types';
5
- export { C as ContextMenuType, u as useContextMenuStore } from './contextMenuStore-DMg0hJQ1.js';
6
6
  import 'zustand';
7
- import 'zundo';
8
- import './types-IEKYuYhu.js';
7
+ import './types-CRXJnajq.js';
9
8
  import 'react';
9
+ import 'zundo';
10
10
 
11
11
  /**
12
12
  * Stable Zustand Selectors
package/dist/stores.mjs CHANGED
@@ -1,6 +1,6 @@
1
- export { useAnnotationStore, usePromptEditorStore } from './chunk-CV4M7CNU.mjs';
2
- export { createSelectGroupByNodeId, createSelectIsNodeSelected, createSelectNodeById, selectAddNode, selectAddNodesAndEdges, selectCreateGroup, selectDeleteGroup, selectDuplicateNode, selectEdgeStyle, selectEdges, selectFindCompatibleHandle, selectGetConnectedNodeIds, selectGetNodeById, selectGroups, selectIsDirty, selectIsLoading, selectIsSaving, selectIsValidConnection, selectNavigationTargetId, selectNodes, selectOnConnect, selectOnEdgesChange, selectOnNodesChange, selectRemoveEdge, selectRemoveNode, selectSelectedNodeIds, selectSetDirty, selectSetSelectedNodeIds, selectToggleNodeLock, selectUnlockAllNodes, selectUpdateNodeData, selectWorkflowId, selectWorkflowName, useContextMenuStore } from './chunk-PCIWWD37.mjs';
1
+ export { createSelectGroupByNodeId, createSelectIsNodeSelected, createSelectNodeById, selectAddNode, selectAddNodesAndEdges, selectCreateGroup, selectDeleteGroup, selectDuplicateNode, selectEdgeStyle, selectEdges, selectFindCompatibleHandle, selectGetConnectedNodeIds, selectGetNodeById, selectGroups, selectIsDirty, selectIsLoading, selectIsSaving, selectIsValidConnection, selectNavigationTargetId, selectNodes, selectOnConnect, selectOnEdgesChange, selectOnNodesChange, selectRemoveEdge, selectRemoveNode, selectSelectedNodeIds, selectSetDirty, selectSetSelectedNodeIds, selectToggleNodeLock, selectUnlockAllNodes, selectUpdateNodeData, selectWorkflowId, selectWorkflowName, useContextMenuStore } from './chunk-7LV4UAUS.mjs';
2
+ export { useAnnotationStore, usePromptEditorStore } from './chunk-QQVHGJ2G.mjs';
3
3
  import './chunk-LDN7IX4Y.mjs';
4
- export { PROVIDER_INFO, useExecutionStore, useSettingsStore, useUIStore } from './chunk-LT3ZJJL6.mjs';
5
- export { useWorkflowStore } from './chunk-R727OFBR.mjs';
6
- export { configurePromptLibrary, usePromptLibraryStore } from './chunk-VRN3UWE5.mjs';
4
+ export { PROVIDER_INFO, useExecutionStore, useSettingsStore, useUIStore } from './chunk-OJWVEEMM.mjs';
5
+ export { useWorkflowStore } from './chunk-GPYIIWD5.mjs';
6
+ export { configurePromptLibrary, usePromptLibraryStore } from './chunk-XRC3O5GK.mjs';