@nodaro/shared 3.27.0 → 3.30.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.
package/dist/index.cjs CHANGED
@@ -2191,6 +2191,45 @@ var VIDEO_MODELS = {
2191
2191
  { identifier: "volcengine-lipsync:300s", credits: 6e3, note: "5-min ceiling" }
2192
2192
  ]
2193
2193
  },
2194
+ // ── Video Depth ── (video-depth node; billed per duration bucket via
2195
+ // videoDepthCreditId in video-depth.ts — `<provider>:<bucket>s`, bare row =
2196
+ // the 300 s ceiling, same shape as volcengine-lipsync.)
2197
+ "video-depth-anything": {
2198
+ id: "video-depth-anything",
2199
+ kind: "video",
2200
+ modes: ["video-depth"],
2201
+ family: "Depth Anything",
2202
+ label: "Video Depth Anything",
2203
+ series: "Depth Anything",
2204
+ description: "Temporally consistent depth video from any clip. Grayscale or colormapped, up to 2,400 frames or 300 seconds.",
2205
+ useCases: ["depth", "video-to-video", "compositing"],
2206
+ pricing: [
2207
+ { identifier: "video-depth-anything", credits: 6e3, note: "5-min ceiling (no duration given)" },
2208
+ { identifier: "video-depth-anything:15s", credits: 300 },
2209
+ { identifier: "video-depth-anything:30s", credits: 600 },
2210
+ { identifier: "video-depth-anything:60s", credits: 1200 },
2211
+ { identifier: "video-depth-anything:120s", credits: 2400 },
2212
+ { identifier: "video-depth-anything:300s", credits: 6e3, note: "5-min ceiling" }
2213
+ ]
2214
+ },
2215
+ "depth-anything-frames": {
2216
+ id: "depth-anything-frames",
2217
+ kind: "video",
2218
+ modes: ["video-depth"],
2219
+ family: "Depth Anything",
2220
+ label: "Depth Anything (per frame)",
2221
+ series: "Depth Anything",
2222
+ description: "Depth Anything v1 run on each frame. Grayscale or inferno colormap; may flicker between frames. Up to 80 s.",
2223
+ useCases: ["depth", "video-to-video"],
2224
+ pricing: [
2225
+ { identifier: "depth-anything-frames", credits: 600, note: "5-min ceiling (no duration given)" },
2226
+ { identifier: "depth-anything-frames:15s", credits: 30 },
2227
+ { identifier: "depth-anything-frames:30s", credits: 60 },
2228
+ { identifier: "depth-anything-frames:60s", credits: 120 },
2229
+ { identifier: "depth-anything-frames:120s", credits: 240 },
2230
+ { identifier: "depth-anything-frames:300s", credits: 600, note: "5-min ceiling" }
2231
+ ]
2232
+ },
2194
2233
  // ── Gemini video analysis ── (Gemini-only; billed per duration bucket — the
2195
2234
  // structural credit formula lives in video-analysis-pricing.ts. Composite id
2196
2235
  // shape `video-analysis:<model>:<bucket>s` mirrors volcengine-lipsync: bare
@@ -5744,8 +5783,17 @@ function speedRampCreditId(quality) {
5744
5783
  function applyEdlCreditId(quality) {
5745
5784
  return quality === "proxy" ? "apply-edl:proxy" : "apply-edl";
5746
5785
  }
5747
- function speakerViewCreditId(quality) {
5748
- return quality === "proxy" ? "speaker-view:proxy" : "speaker-view";
5786
+ var SPEAKER_VIEW_PRICE_TIERS = ["standard", "complex"];
5787
+ var SPEAKER_VIEW_CREDIT_IDS = Object.freeze([
5788
+ "speaker-view",
5789
+ "speaker-view:proxy",
5790
+ "speaker-view:complex",
5791
+ "speaker-view:complex:proxy"
5792
+ ]);
5793
+ function speakerViewCreditId(quality, tier) {
5794
+ const proxy = quality === "proxy";
5795
+ if (tier === "standard") return proxy ? "speaker-view:proxy" : "speaker-view";
5796
+ return proxy ? "speaker-view:complex:proxy" : "speaker-view:complex";
5749
5797
  }
5750
5798
  function sunoCreditType(model, operation) {
5751
5799
  if (!SUNO_VERSION_PRICED_OPERATIONS.includes(operation)) {
@@ -6016,6 +6064,44 @@ function speechCredits(chars, perUnitCredits) {
6016
6064
  return speechPriceUnits(chars) * perUnitCredits;
6017
6065
  }
6018
6066
 
6067
+ // src/credit-estimators/pitch-tempo.ts
6068
+ var PITCH_TEMPO_PRICING = {
6069
+ /** The rate row: credits per started minute. Never reserved by itself. */
6070
+ RATE_CREDIT_ID: "pitch-tempo",
6071
+ /** The longest input a run accepts, in seconds (the route refuses longer). */
6072
+ MAX_DURATION_SEC: 1800,
6073
+ /** The most minutes a `pitch-tempo:<N>m` id can carry. */
6074
+ MAX_MINUTES: 30,
6075
+ /** The rate row's launch value (admin-retunable in /admin/models). */
6076
+ CREDITS_PER_MINUTE_DEFAULT: 20
6077
+ };
6078
+ var PITCH_TEMPO_LIMITS = {
6079
+ SEMITONES_MIN: -12,
6080
+ SEMITONES_MAX: 12,
6081
+ TEMPO_MIN: 0.5,
6082
+ TEMPO_MAX: 2
6083
+ };
6084
+ function pitchTempoStartedMinutes(durationSec) {
6085
+ if (typeof durationSec !== "number" || !Number.isFinite(durationSec) || durationSec <= 0) return 1;
6086
+ return Math.min(PITCH_TEMPO_PRICING.MAX_MINUTES, Math.max(1, Math.ceil(durationSec / 60)));
6087
+ }
6088
+ function pitchTempoCreditId(durationSec) {
6089
+ return `pitch-tempo:${pitchTempoStartedMinutes(durationSec)}m`;
6090
+ }
6091
+ function parsePitchTempoCreditId(id) {
6092
+ const m = /^pitch-tempo:(\d+)m$/.exec(id);
6093
+ if (!m) return void 0;
6094
+ const minutes = Number(m[1]);
6095
+ if (!Number.isInteger(minutes) || minutes < 1 || minutes > PITCH_TEMPO_PRICING.MAX_MINUTES) return void 0;
6096
+ return { minutes };
6097
+ }
6098
+ function pitchTempoBaseCredits(ratePerMinute, minutes) {
6099
+ return Math.max(1, Math.ceil(ratePerMinute * minutes));
6100
+ }
6101
+ function semitonesToPitchRatio(semitones) {
6102
+ return 2 ** (semitones / 12);
6103
+ }
6104
+
6019
6105
  // src/video-duration.ts
6020
6106
  function extractVideoDurationFromNode(data) {
6021
6107
  if (!data) return void 0;
@@ -6137,6 +6223,7 @@ var VIDEO_PRODUCER_TYPES = /* @__PURE__ */ new Set([
6137
6223
  "speech-to-video",
6138
6224
  "motion-transfer",
6139
6225
  "video-upscale",
6226
+ "video-depth",
6140
6227
  "extend-video",
6141
6228
  // face-swap output is video (writes generatedVideoUrl, per-result `url`).
6142
6229
  // Frontend execution-graph already includes it in VIDEO_SOURCE_TYPES; this
@@ -6162,6 +6249,9 @@ var VIDEO_PRODUCER_TYPES = /* @__PURE__ */ new Set([
6162
6249
  "speed-ramp",
6163
6250
  "loop-video",
6164
6251
  "fade-video",
6252
+ // Video Mask emits its mask as a video; Mask Composite its composite.
6253
+ "video-mask",
6254
+ "mask-composite",
6165
6255
  "transcode-video",
6166
6256
  "manual-edit",
6167
6257
  // Remove Audio: strips the audio track, emits a silent video.
@@ -6195,6 +6285,10 @@ var DYNAMIC_PRODUCER_TYPES = /* @__PURE__ */ new Set([
6195
6285
  "list",
6196
6286
  "sub-workflow",
6197
6287
  "adjust-volume",
6288
+ // Pitch & Tempo: audio in → audio out, video in → video out (picture
6289
+ // copied). Dual-mode like adjust-volume; stays in AUDIO_PRODUCER_TYPES as
6290
+ // its default.
6291
+ "pitch-tempo",
6198
6292
  // Dual-mode: audio in → audio out; video in → video out (+ revoiced audio).
6199
6293
  // Listed here so canvas validators accept its output on BOTH audio and video
6200
6294
  // input handles (it also stays in AUDIO_PRODUCER_TYPES as its default).
@@ -6254,6 +6348,7 @@ var AUDIO_PRODUCER_TYPES = /* @__PURE__ */ new Set([
6254
6348
  "combine-audio",
6255
6349
  "adjust-volume",
6256
6350
  "audio-fx",
6351
+ "pitch-tempo",
6257
6352
  "reference-audio",
6258
6353
  "audio-isolation",
6259
6354
  "text-to-dialogue",
@@ -6409,11 +6504,12 @@ function canonicalizeOverrideKeys(nodeType, overrides) {
6409
6504
  // src/render-nodes.ts
6410
6505
  var RENDER_JSON_HANDLE = "json";
6411
6506
  var outputSettingMedium = (data) => data.output === "audio" ? "audio" : "video";
6412
- var descriptor = (d) => Object.freeze({ ...d, transcriptOutput: Object.freeze({ ...d.transcriptOutput }) });
6507
+ var descriptor = (d) => Object.freeze({ ...d, creditIds: Object.freeze([...d.creditIds]), transcriptOutput: Object.freeze({ ...d.transcriptOutput }) });
6413
6508
  var RENDER_NODE_TYPES = Object.freeze({
6414
6509
  "apply-edl": descriptor({
6415
6510
  mediumOf: outputSettingMedium,
6416
6511
  creditId: (quality) => applyEdlCreditId(quality),
6512
+ creditIds: ["apply-edl", "apply-edl:proxy"],
6417
6513
  clockMapFrom: "input",
6418
6514
  ownerOnlyListing: true,
6419
6515
  latestBatch: true,
@@ -6427,7 +6523,8 @@ var RENDER_NODE_TYPES = Object.freeze({
6427
6523
  // `transcript` pip (decided 2026-10-08) — what a caption step reads.
6428
6524
  "speaker-view": descriptor({
6429
6525
  mediumOf: () => "video",
6430
- creditId: (quality) => speakerViewCreditId(quality),
6526
+ creditId: (quality, _output, priceTier) => speakerViewCreditId(quality, priceTier),
6527
+ creditIds: SPEAKER_VIEW_CREDIT_IDS,
6431
6528
  clockMapFrom: "output-json",
6432
6529
  ownerOnlyListing: true,
6433
6530
  latestBatch: true,
@@ -6747,7 +6844,8 @@ var MEDIA_PRODUCING_TYPES = /* @__PURE__ */ new Set([
6747
6844
  "extend-video",
6748
6845
  "lip-sync",
6749
6846
  "motion-transfer",
6750
- "video-upscale"
6847
+ "video-upscale",
6848
+ "video-depth"
6751
6849
  ]);
6752
6850
  var IMAGE_OUTPUT_TYPES = /* @__PURE__ */ new Set([
6753
6851
  "generate-image",
@@ -6779,6 +6877,7 @@ var VIDEO_OUTPUT_TYPES = /* @__PURE__ */ new Set([
6779
6877
  "lip-sync",
6780
6878
  "motion-transfer",
6781
6879
  "video-upscale",
6880
+ "video-depth",
6782
6881
  "add-captions",
6783
6882
  "social-media-format",
6784
6883
  // A render (Apply EDL) renders an EDL into video OR audio. Its medium is
@@ -6802,6 +6901,7 @@ var AUDIO_OUTPUT_TYPES = /* @__PURE__ */ new Set([
6802
6901
  "mix-audio",
6803
6902
  "adjust-volume",
6804
6903
  "audio-fx",
6904
+ "pitch-tempo",
6805
6905
  "trim-audio",
6806
6906
  "audio-isolation",
6807
6907
  "audio-separation",
@@ -9760,6 +9860,8 @@ var NON_PROMPT_TEXT_LANES = {
9760
9860
  script: ["ai-avatar"],
9761
9861
  transcript: ["add-captions", "apply-edl", "edit-plan", "camera-switch", "speaker-view", "speaker-frames"],
9762
9862
  edl: ["apply-edl", "camera-switch", "speaker-view"],
9863
+ // Speaker View's face tracks (Speaker Frames' descriptor): framing data, never a prompt.
9864
+ tracks: ["speaker-view"],
9763
9865
  silence: ["edit-plan"],
9764
9866
  offsets: ["edit-plan"],
9765
9867
  qrText: ["image-overlay"],
@@ -10187,6 +10289,89 @@ function buildLipSyncCreditId(provider, audioDurationSec) {
10187
10289
  return `${provider}:${pickLipSyncBucket(requested)}s`;
10188
10290
  }
10189
10291
 
10292
+ // src/video-depth.ts
10293
+ var VIDEO_DEPTH_PROVIDERS = ["video-depth-anything", "depth-anything-frames"];
10294
+ var FAL_VIDEO_DEPTH_PROVIDERS = /* @__PURE__ */ new Set(["video-depth-anything"]);
10295
+ var REPLICATE_VIDEO_DEPTH_PROVIDERS = /* @__PURE__ */ new Set(["depth-anything-frames"]);
10296
+ function resolveVideoDepthProvider(raw) {
10297
+ return typeof raw === "string" && VIDEO_DEPTH_PROVIDERS.includes(raw) ? raw : VIDEO_DEPTH_PROVIDERS[0];
10298
+ }
10299
+ var VIDEO_DEPTH_MODEL_SIZES = ["small", "base", "large"];
10300
+ function resolveVideoDepthModelSize(raw) {
10301
+ return typeof raw === "string" && VIDEO_DEPTH_MODEL_SIZES.includes(raw) ? raw : "large";
10302
+ }
10303
+ var VIDEO_DEPTH_COLORMAPS = ["grayscale", "turbo", "inferno", "magma", "viridis"];
10304
+ var VIDEO_DEPTH_RESOLUTIONS = ["auto", "360p", "480p", "720p", "1080p"];
10305
+ var ALL_LEVERS = /* @__PURE__ */ new Set(["colormap", "resolution", "sideBySide"]);
10306
+ var COLORMAP_ONLY = /* @__PURE__ */ new Set(["colormap"]);
10307
+ var NO_LEVERS = /* @__PURE__ */ new Set();
10308
+ function videoDepthLevers(provider) {
10309
+ if (FAL_VIDEO_DEPTH_PROVIDERS.has(provider)) return ALL_LEVERS;
10310
+ if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) return COLORMAP_ONLY;
10311
+ return NO_LEVERS;
10312
+ }
10313
+ var REPLICATE_COLORMAPS = ["grayscale", "inferno"];
10314
+ function videoDepthColormaps(provider) {
10315
+ if (FAL_VIDEO_DEPTH_PROVIDERS.has(provider)) return VIDEO_DEPTH_COLORMAPS;
10316
+ if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) return REPLICATE_COLORMAPS;
10317
+ return [];
10318
+ }
10319
+ function resolveVideoDepthColormap(provider, requested) {
10320
+ if (!videoDepthLevers(provider).has("colormap")) return void 0;
10321
+ const offered = videoDepthColormaps(provider);
10322
+ return typeof requested === "string" && offered.includes(requested) ? requested : "grayscale";
10323
+ }
10324
+ function videoDepthNeedsGrayscalePass(provider, colormap) {
10325
+ return REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider) && resolveVideoDepthColormap(provider, colormap) === "grayscale";
10326
+ }
10327
+ var VIDEO_DEPTH_LIMITS = {
10328
+ /** fal `max_frames` ceiling. */
10329
+ FAL_MAX_FRAMES: 2400,
10330
+ /** Longest clip the fal lane accepts, whatever its frame rate: the top price bucket (a low-fps clip under the frame limit can otherwise run past every price row). */
10331
+ FAL_MAX_SECONDS: 300,
10332
+ /** Frame rate assumed when the clip reports none (variable-rate or missing). */
10333
+ ASSUMED_FPS: 30,
10334
+ /** Longest clip the Replicate lane accepts. */
10335
+ REPLICATE_MAX_SECONDS: 80
10336
+ };
10337
+ var fmt = (n) => n.toLocaleString("en-US");
10338
+ function checkVideoDepthLength(provider, probe) {
10339
+ if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) {
10340
+ if (probe.durationSec <= VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS) return { ok: true };
10341
+ return {
10342
+ ok: false,
10343
+ message: `Video is ${Math.ceil(probe.durationSec)} s. This provider accepts at most ${VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS} s.`
10344
+ };
10345
+ }
10346
+ if (probe.durationSec > VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS) {
10347
+ return {
10348
+ ok: false,
10349
+ message: `Video is ${Math.ceil(probe.durationSec)} s. This provider accepts at most ${VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS} s. Trim the clip and run again.`
10350
+ };
10351
+ }
10352
+ const assumed = !(typeof probe.fps === "number" && probe.fps > 0);
10353
+ const fps = assumed ? VIDEO_DEPTH_LIMITS.ASSUMED_FPS : probe.fps;
10354
+ const frames = Math.ceil(probe.durationSec * fps - 1e-9);
10355
+ if (frames <= VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES) return { ok: true };
10356
+ const maxSec = Math.floor(VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES / fps);
10357
+ return {
10358
+ ok: false,
10359
+ message: `Video is ${fmt(frames)} frames; the limit is ${fmt(VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES)} (about ${maxSec} s at ${Math.round(fps)} fps${assumed ? ", assumed 30 fps because the clip reports no frame rate" : ""}). Trim the clip and run again.`
10360
+ };
10361
+ }
10362
+ var VIDEO_DEPTH_BUCKETS = [15, 30, 60, 120, 300];
10363
+ function videoDepthMaxSeconds(provider) {
10364
+ return REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider) ? VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS : VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS;
10365
+ }
10366
+ function videoDepthCreditId(provider, durationSec) {
10367
+ const top = VIDEO_DEPTH_BUCKETS[VIDEO_DEPTH_BUCKETS.length - 1];
10368
+ const maxSec = videoDepthMaxSeconds(provider);
10369
+ const reachableCeiling = VIDEO_DEPTH_BUCKETS.find((b) => b >= maxSec) ?? top;
10370
+ const known = typeof durationSec === "number" && Number.isFinite(durationSec) && durationSec > 0 && durationSec <= maxSec;
10371
+ const bucket = known ? VIDEO_DEPTH_BUCKETS.find((b) => durationSec <= b) ?? top : reachableCeiling;
10372
+ return `${provider}:${bucket}s`;
10373
+ }
10374
+
10190
10375
  // src/ai-avatar-pricing.ts
10191
10376
  var AI_AVATAR_MAX_DURATION_SEC = 900;
10192
10377
  var AI_AVATAR_DURATION_BUCKETS = [5, 10, 15, 30, 60, 120, 240, 360, 600, 900];
@@ -11139,6 +11324,8 @@ var NODE_MAPPABLE_FIELDS = {
11139
11324
  // Span-replace sibling of generate-video-pro — prompt only, no
11140
11325
  // negativePrompt field on the node.
11141
11326
  "edit-video-pro": ["prompt"],
11327
+ // The subject to track — a {Label} reference or a mapping writes it.
11328
+ "video-mask": ["prompt"],
11142
11329
  "video-analysis": ["analysisFocus", "youtubeUrl"],
11143
11330
  "video-to-video": ["prompt"],
11144
11331
  // + the two neighbour-text fields (continuity across clips): a wired Text node can feed
@@ -11707,7 +11894,7 @@ function formatterFor(timezone) {
11707
11894
  const known = canonicalZone.get(spelled);
11708
11895
  if (known) return formatters.get(known) ?? null;
11709
11896
  try {
11710
- const fmt = new Intl.DateTimeFormat("en-US", {
11897
+ const fmt2 = new Intl.DateTimeFormat("en-US", {
11711
11898
  timeZone: spelled,
11712
11899
  hourCycle: "h23",
11713
11900
  year: "numeric",
@@ -11716,11 +11903,11 @@ function formatterFor(timezone) {
11716
11903
  hour: "2-digit",
11717
11904
  minute: "2-digit"
11718
11905
  });
11719
- const canonical = fmt.resolvedOptions().timeZone;
11720
- if (!formatters.has(canonical)) formatters.set(canonical, fmt);
11906
+ const canonical = fmt2.resolvedOptions().timeZone;
11907
+ if (!formatters.has(canonical)) formatters.set(canonical, fmt2);
11721
11908
  if (canonicalZone.size >= MAX_ZONE_SPELLINGS) canonicalZone.clear();
11722
11909
  canonicalZone.set(spelled, canonical);
11723
- return formatters.get(canonical) ?? fmt;
11910
+ return formatters.get(canonical) ?? fmt2;
11724
11911
  } catch {
11725
11912
  return null;
11726
11913
  }
@@ -11737,10 +11924,10 @@ function localFromComponents(year, month, day, hour, minute) {
11737
11924
  return { year, month, day, hour: hour === 24 ? 0 : hour, minute, weekday, epochDay };
11738
11925
  }
11739
11926
  function localTimeIn(date, timezone) {
11740
- const fmt = formatterFor(timezone);
11741
- if (!fmt) return localFromComponents(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes());
11927
+ const fmt2 = formatterFor(timezone);
11928
+ if (!fmt2) return localFromComponents(date.getUTCFullYear(), date.getUTCMonth() + 1, date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes());
11742
11929
  const parts = {};
11743
- for (const p of fmt.formatToParts(date)) {
11930
+ for (const p of fmt2.formatToParts(date)) {
11744
11931
  if (p.type === "literal") continue;
11745
11932
  parts[p.type] = parseInt(p.value, 10);
11746
11933
  }
@@ -18310,6 +18497,7 @@ var ENUM_TARGETS = [
18310
18497
  [TEXT_TO_VIDEO_PROVIDERS, "generate-video"],
18311
18498
  [UPSCALE_IMAGE_PROVIDERS, "upscale-image"],
18312
18499
  [VIDEO_UPSCALE_PROVIDERS, "video-upscale"],
18500
+ [VIDEO_DEPTH_PROVIDERS, "video-depth"],
18313
18501
  [MODIFY_IMAGE_PROVIDERS, "modify-image"],
18314
18502
  [IMAGE_EDIT_PROVIDERS, "modify-image"],
18315
18503
  [VIDEO_TO_VIDEO_PROVIDERS, "video-to-video"],
@@ -19035,6 +19223,83 @@ function videoOverlayCompositionKey(c) {
19035
19223
  return JSON.stringify(canonicalValue(parts));
19036
19224
  }
19037
19225
 
19226
+ // src/video-mask.ts
19227
+ var VIDEO_MASK_PROVIDERS = ["sam-3.1", "sam-3"];
19228
+ var DEFAULT_VIDEO_MASK_PROVIDER = "sam-3.1";
19229
+ var VIDEO_MASK_DEFAULTS = {
19230
+ threshold: 0.5,
19231
+ provider: "sam-3.1"
19232
+ };
19233
+ var VIDEO_MASK_LIMITS = {
19234
+ /** The longest input clip a run accepts, in seconds of PRICED length (see `videoMaskBilledSeconds`). */
19235
+ MAX_BILLED_SEC: 300,
19236
+ /** Frame rate the price rows assume. A faster clip is priced proportionally longer. */
19237
+ FPS_BASIS: 30,
19238
+ /** Subject description length cap. */
19239
+ PROMPT_MAX_LENGTH: 500,
19240
+ /** Detection confidence bounds (the model's own range, narrowed to useful values). */
19241
+ THRESHOLD_MIN: 0.05,
19242
+ THRESHOLD_MAX: 0.95,
19243
+ THRESHOLD_STEP: 0.05,
19244
+ /** Default detection confidence. Lower finds more (and less precise) regions. */
19245
+ THRESHOLD_DEFAULT: VIDEO_MASK_DEFAULTS.threshold
19246
+ };
19247
+ var VIDEO_MASK_BUCKETS_SEC = [5, 10, 15, 30, 60, 90, 120, 180, 240, 300];
19248
+ function videoMaskCreditIds(provider = DEFAULT_VIDEO_MASK_PROVIDER) {
19249
+ return VIDEO_MASK_BUCKETS_SEC.map((sec2) => `${provider}-video:${sec2}s`);
19250
+ }
19251
+ function videoMaskBilledSeconds(durationSec, fps) {
19252
+ const rate = typeof fps === "number" && Number.isFinite(fps) && fps > 0 ? fps : VIDEO_MASK_LIMITS.FPS_BASIS;
19253
+ return durationSec * Math.max(1, rate / VIDEO_MASK_LIMITS.FPS_BASIS);
19254
+ }
19255
+ function videoMaskCreditId(billedSec, provider = DEFAULT_VIDEO_MASK_PROVIDER) {
19256
+ const ids = videoMaskCreditIds(provider);
19257
+ if (typeof billedSec !== "number" || !Number.isFinite(billedSec) || billedSec <= 0) return ids[ids.length - 1];
19258
+ const i = VIDEO_MASK_BUCKETS_SEC.findIndex((b) => billedSec <= b);
19259
+ return ids[i === -1 ? ids.length - 1 : i];
19260
+ }
19261
+ function resolveVideoMaskProvider(value) {
19262
+ return VIDEO_MASK_PROVIDERS.includes(value) ? value : DEFAULT_VIDEO_MASK_PROVIDER;
19263
+ }
19264
+
19265
+ // src/mask-composite.ts
19266
+ var MASK_COMPOSITE_BACKGROUND_FITS = ["cover", "contain", "stretch"];
19267
+ var MASK_COMPOSITE_AUDIO_SOURCES = ["foreground", "background", "mix", "none"];
19268
+ var MASK_COMPOSITE_BOUNDS = {
19269
+ /** Edge softening, pixels of blur radius on the mask (0 = hard edge). */
19270
+ FEATHER_MIN: 0,
19271
+ FEATHER_MAX: 20,
19272
+ /** Grow (+) or shrink (−) the white region, pixels. */
19273
+ GROW_MIN: -10,
19274
+ GROW_MAX: 10,
19275
+ /** The longest foreground a run accepts, seconds. */
19276
+ MAX_DURATION_SEC: 300
19277
+ };
19278
+ var MASK_COMPOSITE_UNIT_SEC = 5;
19279
+ function maskCompositeUnits(durationSec) {
19280
+ const sec2 = typeof durationSec === "number" && Number.isFinite(durationSec) && durationSec > 0 ? Math.min(durationSec, MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC) : MASK_COMPOSITE_BOUNDS.MAX_DURATION_SEC;
19281
+ return Math.max(1, Math.ceil(sec2 / MASK_COMPOSITE_UNIT_SEC - 1e-6));
19282
+ }
19283
+ var MASK_COMPOSITE_DEFAULTS = {
19284
+ invertMask: false,
19285
+ feather: 2,
19286
+ grow: 0,
19287
+ backgroundFit: "cover",
19288
+ audioSource: "foreground"
19289
+ };
19290
+ var clampInt2 = (v, min, max, fallback) => typeof v === "number" && Number.isFinite(v) ? Math.min(max, Math.max(min, Math.round(v))) : fallback;
19291
+ function resolveMaskCompositeSettings(data) {
19292
+ const d = MASK_COMPOSITE_DEFAULTS;
19293
+ const b = MASK_COMPOSITE_BOUNDS;
19294
+ return {
19295
+ invertMask: typeof data.invertMask === "boolean" ? data.invertMask : d.invertMask,
19296
+ feather: clampInt2(data.feather, b.FEATHER_MIN, b.FEATHER_MAX, d.feather),
19297
+ grow: clampInt2(data.grow, b.GROW_MIN, b.GROW_MAX, d.grow),
19298
+ backgroundFit: MASK_COMPOSITE_BACKGROUND_FITS.includes(data.backgroundFit) ? data.backgroundFit : d.backgroundFit,
19299
+ audioSource: MASK_COMPOSITE_AUDIO_SOURCES.includes(data.audioSource) ? data.audioSource : d.audioSource
19300
+ };
19301
+ }
19302
+
19038
19303
  // src/entity-image-handle.ts
19039
19304
  var ENTITY_IMAGE_HANDLE_TYPES = /* @__PURE__ */ new Set([
19040
19305
  "character",
@@ -24553,6 +24818,7 @@ exports.DEFAULT_VIDEO_ANALYSIS_MODEL = DEFAULT_VIDEO_ANALYSIS_MODEL;
24553
24818
  exports.DEFAULT_VIDEO_ANALYSIS_TIER = DEFAULT_VIDEO_ANALYSIS_TIER;
24554
24819
  exports.DEFAULT_VIDEO_CLIP_COST = DEFAULT_VIDEO_CLIP_COST;
24555
24820
  exports.DEFAULT_VIDEO_DURATION_SEC = DEFAULT_VIDEO_DURATION_SEC;
24821
+ exports.DEFAULT_VIDEO_MASK_PROVIDER = DEFAULT_VIDEO_MASK_PROVIDER;
24556
24822
  exports.DEFAULT_VIDEO_OVERLAY_LAYER = DEFAULT_VIDEO_OVERLAY_LAYER;
24557
24823
  exports.DEFAULT_VIDEO_PROVIDER = DEFAULT_VIDEO_PROVIDER;
24558
24824
  exports.DEFAULT_VOICE_CHANGER_MODEL = DEFAULT_VOICE_CHANGER_MODEL;
@@ -24600,6 +24866,7 @@ exports.EntityStaleEventSchema = EntityStaleEventSchema;
24600
24866
  exports.EntityStateChangeEventSchema = EntityStateChangeEventSchema;
24601
24867
  exports.FACE_SWAP_PROVIDERS = FACE_SWAP_PROVIDERS;
24602
24868
  exports.FAL_LIP_SYNC_PROVIDERS = FAL_LIP_SYNC_PROVIDERS;
24869
+ exports.FAL_VIDEO_DEPTH_PROVIDERS = FAL_VIDEO_DEPTH_PROVIDERS;
24603
24870
  exports.FAN_IN_TARGETS = FAN_IN_TARGETS;
24604
24871
  exports.FAN_OUT_ALL_OR_NOTHING_TYPES = FAN_OUT_ALL_OR_NOTHING_TYPES;
24605
24872
  exports.FAN_OUT_EACH_HANDLES = FAN_OUT_EACH_HANDLES;
@@ -24731,6 +24998,11 @@ exports.LocationImageCriticVerdictSchema = LocationImageCriticVerdictSchema;
24731
24998
  exports.LocationMetadataSchema = LocationMetadataSchema;
24732
24999
  exports.LocationsCoverageCriticIssueSchema = LocationsCoverageCriticIssueSchema;
24733
25000
  exports.LocationsCoverageCriticVerdictSchema = LocationsCoverageCriticVerdictSchema;
25001
+ exports.MASK_COMPOSITE_AUDIO_SOURCES = MASK_COMPOSITE_AUDIO_SOURCES;
25002
+ exports.MASK_COMPOSITE_BACKGROUND_FITS = MASK_COMPOSITE_BACKGROUND_FITS;
25003
+ exports.MASK_COMPOSITE_BOUNDS = MASK_COMPOSITE_BOUNDS;
25004
+ exports.MASK_COMPOSITE_DEFAULTS = MASK_COMPOSITE_DEFAULTS;
25005
+ exports.MASK_COMPOSITE_UNIT_SEC = MASK_COMPOSITE_UNIT_SEC;
24734
25006
  exports.MATCH_CUT_BREAK_GATE = MATCH_CUT_BREAK_GATE;
24735
25007
  exports.MAX_CUSTOM_ENTRIES_PER_BOARD = MAX_CUSTOM_ENTRIES_PER_BOARD;
24736
25008
  exports.MAX_IMAGE_PROMPT_CHARS_BY_PROVIDER = MAX_IMAGE_PROMPT_CHARS_BY_PROVIDER;
@@ -24845,6 +25117,8 @@ exports.PIPELINE_PINNABLE_VIDEO_MODELS = PIPELINE_PINNABLE_VIDEO_MODELS;
24845
25117
  exports.PIPELINE_STAGE_NAMES = PIPELINE_STAGE_NAMES;
24846
25118
  exports.PIPELINE_STAGE_TIMEOUT_MS = PIPELINE_STAGE_TIMEOUT_MS;
24847
25119
  exports.PIPELINE_TYPES = PIPELINE_TYPES;
25120
+ exports.PITCH_TEMPO_LIMITS = PITCH_TEMPO_LIMITS;
25121
+ exports.PITCH_TEMPO_PRICING = PITCH_TEMPO_PRICING;
24848
25122
  exports.PLACEHOLDER_CHARACTER_NAME = PLACEHOLDER_CHARACTER_NAME;
24849
25123
  exports.PLATFORM_LABELS = PLATFORM_LABELS;
24850
25124
  exports.PLATFORM_SPECS = PLATFORM_SPECS;
@@ -24916,6 +25190,7 @@ exports.RENDER_VIDEO_CREDIT_ID = RENDER_VIDEO_CREDIT_ID;
24916
25190
  exports.REPEATABLE_NODE_TYPES = REPEATABLE_NODE_TYPES;
24917
25191
  exports.REPEAT_PLACEHOLDER = REPEAT_PLACEHOLDER;
24918
25192
  exports.REPLICATE_LIP_SYNC_PROVIDERS = REPLICATE_LIP_SYNC_PROVIDERS;
25193
+ exports.REPLICATE_VIDEO_DEPTH_PROVIDERS = REPLICATE_VIDEO_DEPTH_PROVIDERS;
24919
25194
  exports.RESERVED_TEMPLATE_VARS = RESERVED_TEMPLATE_VARS;
24920
25195
  exports.RUN_CONTINUATION_CODES = RUN_CONTINUATION_CODES;
24921
25196
  exports.RUN_OVERRIDE_CLEARED_FIELDS = RUN_OVERRIDE_CLEARED_FIELDS;
@@ -25052,6 +25327,8 @@ exports.SPEAKER_TRACKS_MAX_BOXES_PER_SOURCE = SPEAKER_TRACKS_MAX_BOXES_PER_SOURC
25052
25327
  exports.SPEAKER_TRACKS_MAX_BYTES = SPEAKER_TRACKS_MAX_BYTES;
25053
25328
  exports.SPEAKER_TRACKS_VERSION = SPEAKER_TRACKS_VERSION;
25054
25329
  exports.SPEAKER_TRACK_ATTRIBUTION_METHODS = SPEAKER_TRACK_ATTRIBUTION_METHODS;
25330
+ exports.SPEAKER_VIEW_CREDIT_IDS = SPEAKER_VIEW_CREDIT_IDS;
25331
+ exports.SPEAKER_VIEW_PRICE_TIERS = SPEAKER_VIEW_PRICE_TIERS;
25055
25332
  exports.SPEECH_FLOOR_UNITS = SPEECH_FLOOR_UNITS;
25056
25333
  exports.SPEECH_PRICE_UNIT_CHARS = SPEECH_PRICE_UNIT_CHARS;
25057
25334
  exports.SPEECH_UNIT_CREDIT_SUFFIX = SPEECH_UNIT_CREDIT_SUFFIX;
@@ -25196,6 +25473,12 @@ exports.VIDEO_CRITIC_MAX_RETRIES = VIDEO_CRITIC_MAX_RETRIES;
25196
25473
  exports.VIDEO_CRITIC_METADATA_KEYS = VIDEO_CRITIC_METADATA_KEYS;
25197
25474
  exports.VIDEO_CRITIC_MIN_ADHERENCE_SCORE = VIDEO_CRITIC_MIN_ADHERENCE_SCORE;
25198
25475
  exports.VIDEO_CRITIC_RESERVED_CREDITS_PER_SHOT = VIDEO_CRITIC_RESERVED_CREDITS_PER_SHOT;
25476
+ exports.VIDEO_DEPTH_BUCKETS = VIDEO_DEPTH_BUCKETS;
25477
+ exports.VIDEO_DEPTH_COLORMAPS = VIDEO_DEPTH_COLORMAPS;
25478
+ exports.VIDEO_DEPTH_LIMITS = VIDEO_DEPTH_LIMITS;
25479
+ exports.VIDEO_DEPTH_MODEL_SIZES = VIDEO_DEPTH_MODEL_SIZES;
25480
+ exports.VIDEO_DEPTH_PROVIDERS = VIDEO_DEPTH_PROVIDERS;
25481
+ exports.VIDEO_DEPTH_RESOLUTIONS = VIDEO_DEPTH_RESOLUTIONS;
25199
25482
  exports.VIDEO_DURATION_AUTO = VIDEO_DURATION_AUTO;
25200
25483
  exports.VIDEO_DURATION_TIERS = VIDEO_DURATION_TIERS;
25201
25484
  exports.VIDEO_GEN_COLLAPSED_T2V_IDS = VIDEO_GEN_COLLAPSED_T2V_IDS;
@@ -25204,6 +25487,9 @@ exports.VIDEO_INPUT_LIP_SYNC_PROVIDERS = VIDEO_INPUT_LIP_SYNC_PROVIDERS;
25204
25487
  exports.VIDEO_LINK_AUDIO_CONSUMER_TYPES = VIDEO_LINK_AUDIO_CONSUMER_TYPES;
25205
25488
  exports.VIDEO_LINK_DERIVED_FIELDS = VIDEO_LINK_DERIVED_FIELDS;
25206
25489
  exports.VIDEO_LINK_TOLERANT_CONSUMER_TYPES = VIDEO_LINK_TOLERANT_CONSUMER_TYPES;
25490
+ exports.VIDEO_MASK_DEFAULTS = VIDEO_MASK_DEFAULTS;
25491
+ exports.VIDEO_MASK_LIMITS = VIDEO_MASK_LIMITS;
25492
+ exports.VIDEO_MASK_PROVIDERS = VIDEO_MASK_PROVIDERS;
25207
25493
  exports.VIDEO_MODEL_CAPS = VIDEO_MODEL_CAPS;
25208
25494
  exports.VIDEO_MODE_ALIASES = VIDEO_MODE_ALIASES;
25209
25495
  exports.VIDEO_ONLY_PARAMETER_NODE_TYPES = VIDEO_ONLY_PARAMETER_NODE_TYPES;
@@ -25344,6 +25630,7 @@ exports.characterMentionableAssetArrays = characterMentionableAssetArrays;
25344
25630
  exports.characterSheetRefItems = characterSheetRefItems;
25345
25631
  exports.characterVariantAssetArrays = characterVariantAssetArrays;
25346
25632
  exports.checkRefVideoDurations = checkRefVideoDurations;
25633
+ exports.checkVideoDepthLength = checkVideoDepthLength;
25347
25634
  exports.cinematicCreditId = cinematicCreditId;
25348
25635
  exports.clampCameraSwitchSetting = clampCameraSwitchSetting;
25349
25636
  exports.clampChars = clampChars;
@@ -25670,6 +25957,7 @@ exports.ltxRetakeDurationSec = ltxRetakeDurationSec;
25670
25957
  exports.mapAspectRatio = mapAspectRatio;
25671
25958
  exports.mapQuality = mapQuality;
25672
25959
  exports.mapShotIntentToProviderDirectives = mapShotIntentToProviderDirectives;
25960
+ exports.maskCompositeUnits = maskCompositeUnits;
25673
25961
  exports.matchVariant = matchVariant;
25674
25962
  exports.matchesCron = matchesCron;
25675
25963
  exports.matchesCronField = matchesCronField;
@@ -25755,6 +26043,7 @@ exports.parseListExpression = parseListExpression;
25755
26043
  exports.parseLocationMentionToken = parseLocationMentionToken;
25756
26044
  exports.parseNodePresetExport = parseNodePresetExport;
25757
26045
  exports.parseNodeRef = parseNodeRef;
26046
+ exports.parsePitchTempoCreditId = parsePitchTempoCreditId;
25758
26047
  exports.parseScene3DCameraTrackJson = parseScene3DCameraTrackJson;
25759
26048
  exports.parseScene3DPlanV2Json = parseScene3DPlanV2Json;
25760
26049
  exports.parseSpeakerEmphasisStyle = parseSpeakerEmphasisStyle;
@@ -25766,6 +26055,9 @@ exports.pickLipSyncBucket = pickLipSyncBucket;
25766
26055
  exports.pickSocialPosts = pickSocialPosts;
25767
26056
  exports.pickSwitchXFrameTier = pickSwitchXFrameTier;
25768
26057
  exports.pickVideoAnalysisBucket = pickVideoAnalysisBucket;
26058
+ exports.pitchTempoBaseCredits = pitchTempoBaseCredits;
26059
+ exports.pitchTempoCreditId = pitchTempoCreditId;
26060
+ exports.pitchTempoStartedMinutes = pitchTempoStartedMinutes;
25769
26061
  exports.planClipKeyAt = planClipKeyAt;
25770
26062
  exports.planFanOut = planFanOut;
25771
26063
  exports.planFeedEmission = planFeedEmission;
@@ -25856,6 +26148,7 @@ exports.resolveLlmCreditId = resolveLlmCreditId;
25856
26148
  exports.resolveLocationFields = resolveLocationFields;
25857
26149
  exports.resolveLocationPresetCatalog = resolveLocationPresetCatalog;
25858
26150
  exports.resolveLottieOverlaySrc = resolveLottieOverlaySrc;
26151
+ exports.resolveMaskCompositeSettings = resolveMaskCompositeSettings;
25859
26152
  exports.resolveMetaAdsScrapeCreditId = resolveMetaAdsScrapeCreditId;
25860
26153
  exports.resolveMusicProvider = resolveMusicProvider;
25861
26154
  exports.resolveNodeRefs = resolveNodeRefs;
@@ -25876,7 +26169,11 @@ exports.resolveSwitchXCreditId = resolveSwitchXCreditId;
25876
26169
  exports.resolveTemplateCategory = resolveTemplateCategory;
25877
26170
  exports.resolveTopazUpscale = resolveTopazUpscale;
25878
26171
  exports.resolveVideoAnalysisModel = resolveVideoAnalysisModel;
26172
+ exports.resolveVideoDepthColormap = resolveVideoDepthColormap;
26173
+ exports.resolveVideoDepthModelSize = resolveVideoDepthModelSize;
26174
+ exports.resolveVideoDepthProvider = resolveVideoDepthProvider;
25879
26175
  exports.resolveVideoLinkOutput = resolveVideoLinkOutput;
26176
+ exports.resolveVideoMaskProvider = resolveVideoMaskProvider;
25880
26177
  exports.resolveVideoModeForInputs = resolveVideoModeForInputs;
25881
26178
  exports.resolveVideoOverlayGeometry = resolveVideoOverlayGeometry;
25882
26179
  exports.resolveVideoProviderForMode = resolveVideoProviderForMode;
@@ -25983,6 +26280,7 @@ exports.selectByPredicate = selectByPredicate;
25983
26280
  exports.selectListItems = selectListItems;
25984
26281
  exports.selectLoraRoutingForMentions = selectLoraRoutingForMentions;
25985
26282
  exports.selectRandom = selectRandom;
26283
+ exports.semitonesToPitchRatio = semitonesToPitchRatio;
25986
26284
  exports.setRegisteredPersonPackFields = setRegisteredPersonPackFields;
25987
26285
  exports.settingsInputAccepts = settingsInputAccepts;
25988
26286
  exports.settingsInputFields = settingsInputFields;
@@ -26119,12 +26417,19 @@ exports.videoCharacterVoiceCap = videoCharacterVoiceCap;
26119
26417
  exports.videoCharacterVoiceKey = videoCharacterVoiceKey;
26120
26418
  exports.videoCharacterVoiceProblem = videoCharacterVoiceProblem;
26121
26419
  exports.videoDefaultDurationSec = videoDefaultDurationSec;
26420
+ exports.videoDepthColormaps = videoDepthColormaps;
26421
+ exports.videoDepthCreditId = videoDepthCreditId;
26422
+ exports.videoDepthLevers = videoDepthLevers;
26423
+ exports.videoDepthNeedsGrayscalePass = videoDepthNeedsGrayscalePass;
26122
26424
  exports.videoLinkDownloadedFile = videoLinkDownloadedFile;
26123
26425
  exports.videoLinkInputProblem = videoLinkInputProblem;
26124
26426
  exports.videoLinkNeedOf = videoLinkNeedOf;
26125
26427
  exports.videoLinkNeedsDownload = videoLinkNeedsDownload;
26126
26428
  exports.videoLinkPageUrl = videoLinkPageUrl;
26127
26429
  exports.videoLinkRunNeeds = videoLinkRunNeeds;
26430
+ exports.videoMaskBilledSeconds = videoMaskBilledSeconds;
26431
+ exports.videoMaskCreditId = videoMaskCreditId;
26432
+ exports.videoMaskCreditIds = videoMaskCreditIds;
26128
26433
  exports.videoModelCanSpeakDialogue = videoModelCanSpeakDialogue;
26129
26434
  exports.videoModelSupportsAudio = videoModelSupportsAudio;
26130
26435
  exports.videoNegativeSuffix = videoNegativeSuffix;