@nodaro/shared 3.63.0 → 3.64.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/{chunk-AE3AAJ4O.js → chunk-36VWLB4J.js} +3 -3
- package/dist/{chunk-AE3AAJ4O.js.map → chunk-36VWLB4J.js.map} +1 -1
- package/dist/{chunk-HWQ2SYNA.js → chunk-3AYM47GW.js} +5 -5
- package/dist/{chunk-HWQ2SYNA.js.map → chunk-3AYM47GW.js.map} +1 -1
- package/dist/{chunk-CZ5IQB3L.js → chunk-3KTWYYCN.js} +8 -5
- package/dist/chunk-3KTWYYCN.js.map +1 -0
- package/dist/{chunk-4MMZD63H.js → chunk-4IUE2JB7.js} +3 -3
- package/dist/{chunk-4MMZD63H.js.map → chunk-4IUE2JB7.js.map} +1 -1
- package/dist/{chunk-M5OCFGHF.cjs → chunk-5OBTGNUQ.cjs} +296 -25
- package/dist/chunk-5OBTGNUQ.cjs.map +1 -0
- package/dist/{chunk-ZPE2ZTJ4.cjs → chunk-67CMMTLN.cjs} +4 -4
- package/dist/{chunk-ZPE2ZTJ4.cjs.map → chunk-67CMMTLN.cjs.map} +1 -1
- package/dist/{chunk-WRSWH7US.cjs → chunk-6BRWPJPP.cjs} +17 -2
- package/dist/chunk-6BRWPJPP.cjs.map +1 -0
- package/dist/{chunk-HBXF6RUU.js → chunk-6YIV37V7.js} +4 -4
- package/dist/{chunk-HBXF6RUU.js.map → chunk-6YIV37V7.js.map} +1 -1
- package/dist/{chunk-F6WGGYQW.cjs → chunk-7AJGUI7L.cjs} +37 -15
- package/dist/chunk-7AJGUI7L.cjs.map +1 -0
- package/dist/{chunk-KCZHQH2O.js → chunk-7KQ6W5DS.js} +4 -4
- package/dist/{chunk-KCZHQH2O.js.map → chunk-7KQ6W5DS.js.map} +1 -1
- package/dist/{chunk-TM5JYSJF.cjs → chunk-ACZZHHFZ.cjs} +72 -33
- package/dist/chunk-ACZZHHFZ.cjs.map +1 -0
- package/dist/{chunk-Y35JQPT6.cjs → chunk-AZNZ5WNZ.cjs} +42 -42
- package/dist/{chunk-Y35JQPT6.cjs.map → chunk-AZNZ5WNZ.cjs.map} +1 -1
- package/dist/{chunk-HSHCCBIV.js → chunk-BQYCZLMF.js} +16 -3
- package/dist/chunk-BQYCZLMF.js.map +1 -0
- package/dist/{chunk-GMBDLNLD.cjs → chunk-CHS2SIP6.cjs} +183 -60
- package/dist/chunk-CHS2SIP6.cjs.map +1 -0
- package/dist/{chunk-77WU3V3J.cjs → chunk-CHTZZRAL.cjs} +6 -6
- package/dist/{chunk-77WU3V3J.cjs.map → chunk-CHTZZRAL.cjs.map} +1 -1
- package/dist/{chunk-WZVIBAKN.cjs → chunk-D4KWNDPH.cjs} +12 -12
- package/dist/{chunk-WZVIBAKN.cjs.map → chunk-D4KWNDPH.cjs.map} +1 -1
- package/dist/{chunk-PSKZKLDG.js → chunk-DZ4IOP3Q.js} +288 -26
- package/dist/chunk-DZ4IOP3Q.js.map +1 -0
- package/dist/{chunk-XGVJGNZW.cjs → chunk-EXEVT6D2.cjs} +15 -5
- package/dist/chunk-EXEVT6D2.cjs.map +1 -0
- package/dist/{chunk-X5BAFW3Q.cjs → chunk-FHGRKQVZ.cjs} +8 -8
- package/dist/{chunk-X5BAFW3Q.cjs.map → chunk-FHGRKQVZ.cjs.map} +1 -1
- package/dist/{chunk-GSKLPI3J.cjs → chunk-GTWUS6MQ.cjs} +118 -61
- package/dist/chunk-GTWUS6MQ.cjs.map +1 -0
- package/dist/{chunk-Q6IES3U2.js → chunk-H5KHWTAE.js} +5 -2
- package/dist/chunk-H5KHWTAE.js.map +1 -0
- package/dist/{chunk-V5EEQR2U.cjs → chunk-HDPJNNMF.cjs} +21 -21
- package/dist/{chunk-V5EEQR2U.cjs.map → chunk-HDPJNNMF.cjs.map} +1 -1
- package/dist/{chunk-6M563QE6.js → chunk-IYSOVS7O.js} +55 -23
- package/dist/chunk-IYSOVS7O.js.map +1 -0
- package/dist/{chunk-XGGZWA4A.cjs → chunk-J6B7J73J.cjs} +52 -49
- package/dist/chunk-J6B7J73J.cjs.map +1 -0
- package/dist/{chunk-MD4XHED4.js → chunk-KB2SQAR3.js} +3 -3
- package/dist/{chunk-MD4XHED4.js.map → chunk-KB2SQAR3.js.map} +1 -1
- package/dist/{chunk-BLJUCPMV.cjs → chunk-KSHAAPQF.cjs} +5 -2
- package/dist/chunk-KSHAAPQF.cjs.map +1 -0
- package/dist/{chunk-6TGB7ECA.cjs → chunk-O4RPXBDZ.cjs} +12 -8
- package/dist/chunk-O4RPXBDZ.cjs.map +1 -0
- package/dist/{chunk-YUER7TJG.js → chunk-OBOOHG3N.js} +13 -4
- package/dist/chunk-OBOOHG3N.js.map +1 -0
- package/dist/{chunk-6BZC2ZHC.cjs → chunk-OOZW2MM6.cjs} +9 -9
- package/dist/{chunk-6BZC2ZHC.cjs.map → chunk-OOZW2MM6.cjs.map} +1 -1
- package/dist/{chunk-A2PX5IRC.cjs → chunk-PERUFUVH.cjs} +13 -13
- package/dist/{chunk-A2PX5IRC.cjs.map → chunk-PERUFUVH.cjs.map} +1 -1
- package/dist/{chunk-3K24DWOH.js → chunk-PJJAZQVZ.js} +3 -3
- package/dist/{chunk-3K24DWOH.js.map → chunk-PJJAZQVZ.js.map} +1 -1
- package/dist/{chunk-EPXGG27L.js → chunk-Q2Y4JHF7.js} +5 -5
- package/dist/{chunk-EPXGG27L.js.map → chunk-Q2Y4JHF7.js.map} +1 -1
- package/dist/{chunk-KMGCHV6O.js → chunk-QYU7J5EQ.js} +37 -15
- package/dist/chunk-QYU7J5EQ.js.map +1 -0
- package/dist/{chunk-IY3Y462W.js → chunk-S3UGLZSF.js} +3 -3
- package/dist/{chunk-IY3Y462W.js.map → chunk-S3UGLZSF.js.map} +1 -1
- package/dist/{chunk-34QLPTSA.js → chunk-SHH2T4CR.js} +3 -3
- package/dist/{chunk-34QLPTSA.js.map → chunk-SHH2T4CR.js.map} +1 -1
- package/dist/{chunk-L2TVY6XN.cjs → chunk-SPAHI7DY.cjs} +4 -4
- package/dist/{chunk-L2TVY6XN.cjs.map → chunk-SPAHI7DY.cjs.map} +1 -1
- package/dist/{chunk-YX6TFX7H.js → chunk-SXHHLZ22.js} +66 -11
- package/dist/chunk-SXHHLZ22.js.map +1 -0
- package/dist/{chunk-LMAQUR55.cjs → chunk-T2OVDF2M.cjs} +6 -6
- package/dist/{chunk-LMAQUR55.cjs.map → chunk-T2OVDF2M.cjs.map} +1 -1
- package/dist/{chunk-2QKF7M2Z.js → chunk-TAPBDT47.js} +3 -3
- package/dist/{chunk-2QKF7M2Z.js.map → chunk-TAPBDT47.js.map} +1 -1
- package/dist/{chunk-BMJVKYVB.js → chunk-TPQJKS7D.js} +109 -7
- package/dist/chunk-TPQJKS7D.js.map +1 -0
- package/dist/{chunk-63H4C56Q.cjs → chunk-TQW3R44P.cjs} +8 -8
- package/dist/{chunk-63H4C56Q.cjs.map → chunk-TQW3R44P.cjs.map} +1 -1
- package/dist/{chunk-4DVWXEB6.js → chunk-TTGZ2L3O.js} +3 -3
- package/dist/{chunk-4DVWXEB6.js.map → chunk-TTGZ2L3O.js.map} +1 -1
- package/dist/{chunk-XBTYGQ6Z.js → chunk-VPTA4Z7G.js} +8 -5
- package/dist/chunk-VPTA4Z7G.js.map +1 -0
- package/dist/{chunk-6XUG4L7X.cjs → chunk-VZ6TE23U.cjs} +6 -6
- package/dist/{chunk-6XUG4L7X.cjs.map → chunk-VZ6TE23U.cjs.map} +1 -1
- package/dist/{chunk-LH72PQO2.cjs → chunk-W6VJAUGM.cjs} +114 -45
- package/dist/chunk-W6VJAUGM.cjs.map +1 -0
- package/dist/{chunk-OV3JTKBY.js → chunk-W7KHHNZR.js} +74 -17
- package/dist/chunk-W7KHHNZR.js.map +1 -0
- package/dist/{chunk-2PU3AGGS.cjs → chunk-YQV53HRR.cjs} +7 -7
- package/dist/{chunk-2PU3AGGS.cjs.map → chunk-YQV53HRR.cjs.map} +1 -1
- package/dist/{chunk-FXGNRYQQ.js → chunk-ZI3QDUHO.js} +3 -3
- package/dist/{chunk-FXGNRYQQ.js.map → chunk-ZI3QDUHO.js.map} +1 -1
- package/dist/entries/apps.cjs +43 -42
- package/dist/entries/apps.js +8 -7
- package/dist/entries/captions.cjs +38 -30
- package/dist/entries/captions.d.cts +47 -1
- package/dist/entries/captions.d.ts +47 -1
- package/dist/entries/captions.js +1 -1
- package/dist/entries/credits.cjs +303 -191
- package/dist/entries/credits.d.cts +219 -15
- package/dist/entries/credits.d.ts +219 -15
- package/dist/entries/credits.js +11 -11
- package/dist/entries/llm-models.cjs +62 -62
- package/dist/entries/llm-models.d.cts +29 -7
- package/dist/entries/llm-models.d.ts +29 -7
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/model-catalog.cjs +149 -109
- package/dist/entries/model-catalog.d.cts +64 -7
- package/dist/entries/model-catalog.d.ts +64 -7
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +394 -346
- package/dist/entries/models.d.cts +4 -4
- package/dist/entries/models.d.ts +4 -4
- package/dist/entries/models.js +5 -5
- package/dist/entries/nodes.cjs +220 -211
- package/dist/entries/nodes.d.cts +46 -3
- package/dist/entries/nodes.d.ts +46 -3
- package/dist/entries/nodes.js +10 -9
- package/dist/entries/pipeline.cjs +156 -152
- package/dist/entries/pipeline.d.cts +13 -3
- package/dist/entries/pipeline.d.ts +13 -3
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/social.cjs +177 -177
- package/dist/entries/social.js +2 -2
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +145 -145
- package/dist/entries/video.js +6 -6
- package/dist/entries/workflow.cjs +150 -150
- package/dist/entries/workflow.d.cts +1 -1
- package/dist/entries/workflow.d.ts +1 -1
- package/dist/entries/workflow.js +2 -2
- package/dist/index.cjs +1879 -1659
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +25 -25
- package/dist/{model-catalog-C_Eo35tL.d.cts → model-catalog-Cf9fkEUp.d.cts} +15 -2
- package/dist/{model-catalog-C_Eo35tL.d.ts → model-catalog-Cf9fkEUp.d.ts} +15 -2
- package/dist/{model-constants-DWcxOmaY.d.cts → model-constants-BxjiWVQ9.d.ts} +89 -19
- package/dist/{model-constants-Bg4ccSQb.d.ts → model-constants-C_Nyft_i.d.cts} +89 -19
- package/package.json +1 -1
- package/src/__tests__/add-captions-nemotron-pricing.test.ts +111 -0
- package/src/__tests__/extend-providers.test.ts +266 -26
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +1 -1
- package/src/__tests__/fixtures/measured-input-quote-parity.json +1435 -0
- package/src/__tests__/fixtures/planned-length-quote-parity.json +1866 -0
- package/src/__tests__/fixtures/video-utility-quote-parity.json +2343 -0
- package/src/__tests__/flux-3-klein.test.ts +203 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +3 -1
- package/src/__tests__/llm-models.test.ts +7 -9
- package/src/__tests__/llm-price-key.test.ts +12 -0
- package/src/__tests__/model-makers.test.ts +3 -0
- package/src/__tests__/node-runtime-keys.test.ts +7 -0
- package/src/__tests__/normalize-node-params.test.ts +147 -1
- package/src/__tests__/retired-lip-sync-providers.test.ts +43 -0
- package/src/__tests__/seedance-extend-source-credit-id.test.ts +89 -0
- package/src/__tests__/sequence-execution.test.ts +22 -1
- package/src/__tests__/suno-credit-type.test.ts +21 -2
- package/src/__tests__/transcribe-capabilities.test.ts +4 -2
- package/src/__tests__/video-analysis-catalog-sync.test.ts +4 -2
- package/src/__tests__/video-analysis-pricing.test.ts +10 -9
- package/src/caption-styles.ts +62 -0
- package/src/credit-estimators/add-captions-nemotron.ts +73 -0
- package/src/credit-estimators/index.ts +10 -0
- package/src/credit-identifiers.ts +249 -13
- package/src/entries/captions.ts +2 -0
- package/src/entries/credits.ts +25 -1
- package/src/entries/model-catalog.ts +13 -0
- package/src/entries/models.ts +15 -0
- package/src/entries/nodes.ts +2 -0
- package/src/entries/pipeline.ts +1 -1
- package/src/flux-3-klein.ts +69 -0
- package/src/input-image-pricing.ts +23 -6
- package/src/llm-models.ts +60 -16
- package/src/model-catalog.ts +280 -25
- package/src/model-constants.ts +146 -17
- package/src/node-default-mappings.ts +3 -0
- package/src/node-runtime-keys.ts +3 -0
- package/src/normalize-node-params.ts +123 -2
- package/src/seedance-extend-rate.ts +116 -0
- package/src/sequence-execution.ts +24 -0
- package/src/transcribe-preflight.ts +23 -0
- package/src/video-analysis-pricing.ts +28 -15
- package/dist/chunk-6M563QE6.js.map +0 -1
- package/dist/chunk-6TGB7ECA.cjs.map +0 -1
- package/dist/chunk-BLJUCPMV.cjs.map +0 -1
- package/dist/chunk-BMJVKYVB.js.map +0 -1
- package/dist/chunk-CZ5IQB3L.js.map +0 -1
- package/dist/chunk-F6WGGYQW.cjs.map +0 -1
- package/dist/chunk-GMBDLNLD.cjs.map +0 -1
- package/dist/chunk-GSKLPI3J.cjs.map +0 -1
- package/dist/chunk-HSHCCBIV.js.map +0 -1
- package/dist/chunk-KMGCHV6O.js.map +0 -1
- package/dist/chunk-LH72PQO2.cjs.map +0 -1
- package/dist/chunk-M5OCFGHF.cjs.map +0 -1
- package/dist/chunk-OV3JTKBY.js.map +0 -1
- package/dist/chunk-PSKZKLDG.js.map +0 -1
- package/dist/chunk-Q6IES3U2.js.map +0 -1
- package/dist/chunk-TM5JYSJF.cjs.map +0 -1
- package/dist/chunk-WRSWH7US.cjs.map +0 -1
- package/dist/chunk-XBTYGQ6Z.js.map +0 -1
- package/dist/chunk-XGGZWA4A.cjs.map +0 -1
- package/dist/chunk-XGVJGNZW.cjs.map +0 -1
- package/dist/chunk-YUER7TJG.js.map +0 -1
- package/dist/chunk-YX6TFX7H.js.map +0 -1
|
@@ -32,6 +32,19 @@ function captionRoutesToRemotion(input) {
|
|
|
32
32
|
if (!input.text) return true;
|
|
33
33
|
return false;
|
|
34
34
|
}
|
|
35
|
+
function isStaticTextCaptionSource(input) {
|
|
36
|
+
if (input.segments && input.segments.length > 0) return false;
|
|
37
|
+
if (isKineticCaptionStyle(input.style)) return false;
|
|
38
|
+
if (input.captions && input.captions.length > 0) return false;
|
|
39
|
+
if (input.transcript !== void 0 && input.transcript !== null) return false;
|
|
40
|
+
return typeof input.text === "string" && /\S/.test(input.text);
|
|
41
|
+
}
|
|
42
|
+
function captionsNeedTranscription(input) {
|
|
43
|
+
const hasSegments = !!(input.segments && input.segments.length > 0);
|
|
44
|
+
const hasTranscript = input.transcript !== void 0 && input.transcript !== null;
|
|
45
|
+
const someSegmentNeedsShared = hasSegments && input.segments.some((s) => !(s.text || s.captions && s.captions.length > 0));
|
|
46
|
+
return !isStaticTextCaptionSource(input) && !input.captions?.length && !hasTranscript && input.auto_transcribe !== false && (!hasSegments || someSegmentNeedsShared);
|
|
47
|
+
}
|
|
35
48
|
var CAPTION_MAX_WORDS_PER_LINE_MIN = 1;
|
|
36
49
|
var CAPTION_MAX_WORDS_PER_LINE_MAX = 20;
|
|
37
50
|
var CAPTION_LEVER_BOUNDS = {
|
|
@@ -250,6 +263,6 @@ function styleCaptionPlan(raw, nodeData, styler) {
|
|
|
250
263
|
return { segments };
|
|
251
264
|
}
|
|
252
265
|
|
|
253
|
-
export { ALL_CAPTION_STYLES, CAPTION_LEVER_BOUNDS, CAPTION_LOOKS, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MAX, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_SEGMENT_SCHEMA_KEYS, DEFAULT_CAPTION_LOOK, DEFAULT_SUBTITLE_LOOK, KINETIC_CAPTION_STYLES, KINETIC_ONLY_CAPTION_LEVER_KEYS, STATIC_CAPTION_STYLES, SUPPORTED_FONT_NAMES, autoStrokeWidth, captionFontWeightSchema, captionInputSchema, captionPlanBodyLevers, captionRoutesToRemotion, captionSegmentInputSchema, findSegmentOverlap, isBareDashToken, isKineticCaptionStyle, nonBlankCaptionText, normalizeCaptionNumericLevers, parseCaptionPlan, resolveCaptionLevers, resolveCaptionLook, styleCaptionPlan, trimEdgeDashTokens };
|
|
254
|
-
//# sourceMappingURL=chunk-
|
|
255
|
-
//# sourceMappingURL=chunk-
|
|
266
|
+
export { ALL_CAPTION_STYLES, CAPTION_LEVER_BOUNDS, CAPTION_LOOKS, CAPTION_LOOK_IDS, CAPTION_MAX_WORDS_PER_LINE_MAX, CAPTION_MAX_WORDS_PER_LINE_MIN, CAPTION_SEGMENT_SCHEMA_KEYS, DEFAULT_CAPTION_LOOK, DEFAULT_SUBTITLE_LOOK, KINETIC_CAPTION_STYLES, KINETIC_ONLY_CAPTION_LEVER_KEYS, STATIC_CAPTION_STYLES, SUPPORTED_FONT_NAMES, autoStrokeWidth, captionFontWeightSchema, captionInputSchema, captionPlanBodyLevers, captionRoutesToRemotion, captionSegmentInputSchema, captionsNeedTranscription, findSegmentOverlap, isBareDashToken, isKineticCaptionStyle, isStaticTextCaptionSource, nonBlankCaptionText, normalizeCaptionNumericLevers, parseCaptionPlan, resolveCaptionLevers, resolveCaptionLook, styleCaptionPlan, trimEdgeDashTokens };
|
|
267
|
+
//# sourceMappingURL=chunk-BQYCZLMF.js.map
|
|
268
|
+
//# sourceMappingURL=chunk-BQYCZLMF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/caption-styles.ts","../src/caption-plan.ts","../src/supported-fonts.ts","../src/caption-segment-schema.ts","../src/caption-edge-dash.ts","../src/add-captions-plan.ts"],"names":[],"mappings":";;;AAcO,IAAM,qBAAA,GAAwB,CAAC,UAAU;AACzC,IAAM,sBAAA,GAAyB;AAAA,EACpC,gBAAA;AAAA,EACA,SAAA;AAAA,EACA,cAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF;AACO,IAAM,kBAAA,GAAqB,CAAC,GAAG,qBAAA,EAAuB,GAAG,sBAAsB;AAMtF,IAAM,WAAA,GAAc,IAAI,GAAA,CAAY,sBAAsB,CAAA;AAEnD,SAAS,sBAAsB,KAAA,EAAgE;AACpG,EAAA,OAAO,UA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AAA,EAAI;AACzD,EAAA,OAAO,EAAE,QAAA,EAAS;AACpB","file":"chunk-BQYCZLMF.js","sourcesContent":["import type { SupportedFontName } from \"./supported-fonts.js\"\n\n/**\n * Caption styles for the add-captions node. Static path uses FFmpeg drawtext;\n * kinetic styles render via Remotion (BurnCaptions composition).\n *\n * Single source of truth — imported by:\n * - backend route Zod (add-captions.ts)\n * - backend worker handler (ffmpeg.ts)\n * - backend MCP tool (verbs-video.ts)\n * - backend plan schema (plan-schemas.ts)\n * - frontend node config + cost helper\n * - packages/remotion overlay dispatcher\n */\nexport const STATIC_CAPTION_STYLES = [\"subtitle\"] as const\nexport const KINETIC_CAPTION_STYLES = [\n \"word-highlight\",\n \"karaoke\",\n \"tiktok-words\",\n \"word-pop\",\n \"bouncy\",\n] as const\nexport const ALL_CAPTION_STYLES = [...STATIC_CAPTION_STYLES, ...KINETIC_CAPTION_STYLES] as const\n\nexport type StaticCaptionStyle = (typeof STATIC_CAPTION_STYLES)[number]\nexport type KineticCaptionStyle = (typeof KINETIC_CAPTION_STYLES)[number]\nexport type CaptionStyle = (typeof ALL_CAPTION_STYLES)[number]\n\nconst KINETIC_SET = new Set<string>(KINETIC_CAPTION_STYLES)\n\nexport function isKineticCaptionStyle(style: string | undefined | null): style is KineticCaptionStyle {\n return style !== null && style !== undefined && KINETIC_SET.has(style)\n}\n\n// ── Named \"looks\" ──────────────────────────────────────────────────────────\n// A look is a bundle of visual levers so a caption reads well with one field\n// instead of eight. Shared because the ids are wire contract (route Zod, MCP\n// schema, SDK type) and the value table is consumed by BOTH the worker (render)\n// and the canvas preview — deliberately given away, not creative doctrine.\nexport const CAPTION_LOOK_IDS = [\"outline\", \"clean\"] as const\nexport type CaptionLookId = (typeof CAPTION_LOOK_IDS)[number]\n\n/** What an unset `look` means on a KINETIC style. ONE-LINE FLIP: set to \"clean\"\n * to make an unset caption render as the pre-look-system lever set (face pinned)\n * instead. */\nexport const DEFAULT_CAPTION_LOOK: CaptionLookId = \"outline\"\n\n/** What an unset `look` means on the static `subtitle` style: the plain read —\n * a pinned neutral sans, no outline, no casing. A subtitle must never be left\n * with NO face: the Remotion render would fall back to headless Chrome's default\n * SERIF, so adding e.g. a stroke to a subtitle would silently flip its font away\n * from the sans the plain FFmpeg subtitle draws. */\nexport const DEFAULT_SUBTITLE_LOOK: CaptionLookId = \"clean\"\n\n/**\n * The lever field names that are MEANINGLESS on a `subtitle` render and so are\n * rejected on it: `highlightColor` (subtitle has no per-word spoken cursor to\n * colour) and `animate` (subtitle has no motion to switch off). The STYLING\n * levers (look/fontFamily/fontWeight/strokeColor/strokeWidth/uppercase/positionY)\n * are NOT here any more — a `subtitle` carrying any of them now routes to the\n * Remotion renderer (see `captionRoutesToRemotion`), which applies them exactly\n * as it does for the kinetic styles. Single source of truth for the route's\n * reject-on-subtitle guard and the frontend's \"don't send a stale lever\" strip.\n * `color`/`backgroundColor` are deliberately absent — FFmpeg subtitle honours\n * those too.\n */\nexport const KINETIC_ONLY_CAPTION_LEVER_KEYS = [\n \"highlightColor\",\n \"animate\",\n] as const\nexport type KineticOnlyCaptionLeverKey = (typeof KINETIC_ONLY_CAPTION_LEVER_KEYS)[number]\n\n/**\n * Does an add-captions request need the Remotion renderer, vs the cheap static\n * FFmpeg drawtext path? A caption routes to Remotion when it needs anything the\n * one-fixed-string drawtext pass cannot do:\n * - per-segment treatments (`segments`),\n * - a kinetic style,\n * - any STYLING lever (look/font/weight/stroke/uppercase/position_y/\n * max_words_per_line) — FFmpeg drawtext can't apply a webfont face, weight,\n * outline, casing, a free vertical position, or line grouping,\n * - TIMED captions (a wired `transcript` or an explicit `captions[]` array),\n * - auto-transcription, i.e. no `text` to burn as one static block.\n * Plain-`text` `subtitle` with no lever stays on FFmpeg (unchanged, cheap).\n *\n * SINGLE SOURCE for BOTH the worker dispatch (handleAddCaptions) AND the credit\n * id (buildAddCaptionsCreditId) so the renderer and the price never drift: a\n * Remotion render bills as `add-captions:kinetic`, a plain drawtext burn as\n * `add-captions`.\n */\nexport function captionRoutesToRemotion(input: {\n style?: string | null\n text?: string | null\n segments?: readonly unknown[] | null\n transcript?: unknown\n captions?: readonly unknown[] | null\n look?: unknown\n fontFamily?: unknown\n fontWeight?: unknown\n strokeColor?: unknown\n strokeWidth?: unknown\n uppercase?: unknown\n positionY?: unknown\n maxWordsPerLine?: unknown\n}): boolean {\n if (input.segments && input.segments.length > 0) return true\n if (isKineticCaptionStyle(input.style)) return true\n // From here the style is `subtitle` (or unset → the subtitle default).\n // `null` is \"not set\", exactly like `undefined`: stored node JSON (an agent's\n // write, an import, a cleared field) carries nulls, and a null lever that\n // counted as a lever would route a plain subtitle to Remotion — and its price\n // — for a lever nobody chose.\n const isSet = (v: unknown): boolean => v !== undefined && v !== null\n const hasStylingLever =\n isSet(input.look) ||\n isSet(input.fontFamily) ||\n isSet(input.fontWeight) ||\n isSet(input.strokeColor) ||\n isSet(input.strokeWidth) ||\n isSet(input.uppercase) ||\n isSet(input.positionY) ||\n isSet(input.maxWordsPerLine)\n if (hasStylingLever) return true\n if (input.transcript !== undefined && input.transcript !== null) return true\n if (input.captions && input.captions.length > 0) return true\n // No `text` to burn as one static block → the only caption source is\n // transcription, which produces TIMED captions the drawtext pass can't show.\n if (!input.text) return true\n return false\n}\n\n/**\n * Is this render's caption source a STATIC TEXT BLOCK — the caller's `text`,\n * burned once for the whole clip — rather than timed words?\n *\n * On `subtitle`, `text` IS the caption: one block, `\\n` a forced line break,\n * never transcribed over, whichever renderer draws it (the cheap FFmpeg drawtext\n * burn with no styling lever, the Remotion SubtitleOverlay with one). On a\n * KINETIC style the same `text` stays what it always was — a FALLBACK, spread\n * evenly across the clip as synthetic word timings when transcription returns\n * nothing.\n *\n * Source precedence is unchanged: `captions[]` > wired transcript > (`text` on\n * subtitle) > auto-transcription. `auto_transcribe` is deliberately NOT read: on\n * a subtitle the caller's text wins either way.\n *\n * Shared by the WORKER (which must not pay for a transcription it then discards)\n * and the ROUTE/DAG ingress, so the two cannot disagree about where the words\n * come from.\n */\nexport function isStaticTextCaptionSource(input: {\n style?: string | null\n text?: string | null\n captions?: readonly unknown[] | null\n transcript?: unknown\n segments?: readonly unknown[] | null\n}): boolean {\n if (input.segments && input.segments.length > 0) return false\n if (isKineticCaptionStyle(input.style)) return false\n if (input.captions && input.captions.length > 0) return false\n if (input.transcript !== undefined && input.transcript !== null) return false\n return typeof input.text === \"string\" && /\\S/.test(input.text)\n}\n\n/**\n * Whether an Add Captions render transcribes its audio: it carries no caption\n * source of its own — no captions, no wired transcript, no static text block —\n * auto-transcribe is not turned off, and its segments (when it has any) do not\n * all carry their own text or captions. The worker decides with it; the route's\n * credit guard asks it so a request is judged on its transcription model only\n * when one will run, and every place that prices a run on an engine charged by\n * the video's length (Nemotron 3.5 Transcribe) holds that price only when it does.\n */\nexport function captionsNeedTranscription(input: {\n style?: string | null\n text?: string | null\n captions?: readonly unknown[] | null\n transcript?: unknown\n segments?: ReadonlyArray<{ readonly text?: unknown; readonly captions?: readonly unknown[] | null }> | null\n auto_transcribe?: boolean | null\n}): boolean {\n const hasSegments = !!(input.segments && input.segments.length > 0)\n const hasTranscript = input.transcript !== undefined && input.transcript !== null\n const someSegmentNeedsShared = hasSegments && input.segments!.some((s) => !(s.text || (s.captions && s.captions.length > 0)))\n return (\n !isStaticTextCaptionSource(input) &&\n !input.captions?.length &&\n !hasTranscript &&\n input.auto_transcribe !== false &&\n (!hasSegments || someSegmentNeedsShared)\n )\n}\n\n/**\n * `maxWordsPerLine` — caps how many words a caption LINE (or tiktok-words page)\n * may hold, on top of the frame-width budget, sentence ends and pauses that\n * already close a line. 1–2 gives the punchy CapCut read; unset = fit the width.\n * Applies to every line/page-grouped render (word-highlight, karaoke, bouncy,\n * tiktok-words, and a Remotion-rendered subtitle); inert on word-pop (always one\n * word). Bounds single-sourced here for the route Zod, the plan schema, the MCP\n * schema, the CLI and the canvas panel.\n */\nexport const CAPTION_MAX_WORDS_PER_LINE_MIN = 1\nexport const CAPTION_MAX_WORDS_PER_LINE_MAX = 20\n\n/**\n * Numeric caption levers and their wire bounds — the SAME limits the route Zod\n * and the render-plan schema enforce. Single-sourced so the coercion below and\n * those schemas cannot disagree (a guard test pins the route to these).\n */\nexport const CAPTION_LEVER_BOUNDS = {\n fontSize: { min: 12, max: 200 },\n strokeWidth: { min: 0, max: 40 },\n positionY: { min: 0, max: 100 },\n fontWeight: { min: 100, max: 900 },\n maxWordsPerLine: { min: CAPTION_MAX_WORDS_PER_LINE_MIN, max: CAPTION_MAX_WORDS_PER_LINE_MAX },\n} as const\n\ntype CaptionNumericLeverKey = keyof typeof CAPTION_LEVER_BOUNDS\nconst CAPTION_NUMERIC_LEVER_KEYS = Object.keys(CAPTION_LEVER_BOUNDS) as CaptionNumericLeverKey[]\n\n/**\n * COERCE, never reject: bring the numeric caption levers of node data that\n * never passed a Zod (a workflow written by an agent, an import, a template, a\n * FieldMapping) into the range the render plan accepts. Without this an\n * out-of-range value only surfaces when the plan schema throws — mid-run, after\n * credits are reserved. A `null` / non-finite / non-numeric value is DROPPED (the\n * render default applies); an out-of-range one is clamped; `fontWeight` snaps to the\n * nearest 100 and `maxWordsPerLine` to a whole number. Pure; returns a copy and\n * leaves every other field untouched. Applied by payload-builder to the node's\n * top level and to each `segments[]` entry.\n */\nexport function normalizeCaptionNumericLevers<T extends Record<string, unknown>>(input: T): T {\n const out: Record<string, unknown> = { ...input }\n for (const key of CAPTION_NUMERIC_LEVER_KEYS) {\n if (!(key in out) || out[key] === undefined) continue\n // `null` is \"not set\": drop it rather than carry it — the render plan's\n // numeric schema rejects a null, mid-run, after credits are reserved.\n if (out[key] === null) {\n delete out[key]\n continue\n }\n const raw = typeof out[key] === \"string\" && (out[key] as string).trim() !== \"\" ? Number(out[key]) : out[key]\n if (typeof raw !== \"number\" || !Number.isFinite(raw)) {\n delete out[key]\n continue\n }\n const { min, max } = CAPTION_LEVER_BOUNDS[key]\n const shaped = key === \"fontWeight\" ? Math.round(raw / 100) * 100 : key === \"maxWordsPerLine\" ? Math.round(raw) : raw\n out[key] = Math.min(max, Math.max(min, shaped))\n }\n return out as T\n}\n\n/** The concrete levers a look (and any explicit override) resolves to. */\nexport interface CaptionLookLevers {\n fontFamily?: SupportedFontName\n fontWeight?: number\n color?: string\n backgroundColor?: string\n strokeColor?: string\n strokeWidth?: number\n highlightColor?: string\n uppercase?: boolean\n}\n\n/** Outline width = 10% of font size (min 2px). `paint-order: stroke fill` puts\n * half the stroke OUTSIDE the glyph, so the visible rim is ~5% of font size. */\nexport function autoStrokeWidth(fontSize: number): number {\n return Math.max(2, Math.round(fontSize * 0.1))\n}\n\n/** Each look is a function of font size (so the outline tracks the text size). */\nexport const CAPTION_LOOKS: Record<CaptionLookId, (fontSize: number) => CaptionLookLevers> = {\n // The TikTok / CapCut read: heavy geometric sans, caps, white on a thick black\n // outline, yellow spoken word.\n outline: (fs) => ({\n fontFamily: \"Montserrat\",\n fontWeight: 900,\n uppercase: true,\n color: \"#ffffff\",\n strokeColor: \"#000000\",\n strokeWidth: autoStrokeWidth(fs),\n highlightColor: \"#FFE600\",\n }),\n // The pre-look lever set with the face pinned (it never was): per-style weight,\n // soft shadow only, no casing, no outline.\n clean: () => ({ fontFamily: \"Inter\", color: \"#ffffff\" }),\n}\n\n/**\n * Resolve a look + explicit overrides into concrete levers. An explicit lever\n * always wins over the look; `strokeWidth: 0` explicitly means \"no outline\".\n * The plan then carries concrete levers only — nothing to resolve at render.\n */\nexport function resolveCaptionLook(\n look: CaptionLookId | undefined,\n explicit: CaptionLookLevers,\n fontSize: number,\n): CaptionLookLevers {\n // COERCE, never throw. The route Zod rejects a bad `look`, but the orchestrator /\n // authored-JSON / import / Copilot paths write `look` straight onto node data with\n // no validation (payload-builder passes `look: data.look` verbatim — the CLAUDE.md\n // pitfall 5b class). An unknown id here would throw AFTER a paid transcription and\n // fail the whole run, so an out-of-vocabulary look falls back to the default preset.\n const preset = CAPTION_LOOKS[look ?? DEFAULT_CAPTION_LOOK] ?? CAPTION_LOOKS[DEFAULT_CAPTION_LOOK]\n const out: CaptionLookLevers = { ...preset(fontSize) }\n for (const k of Object.keys(explicit) as (keyof CaptionLookLevers)[]) {\n if (explicit[k] !== undefined) (out[k] as CaptionLookLevers[typeof k]) = explicit[k]\n }\n return out\n}\n\n/**\n * Resolve the concrete render levers for a caption, applying the DEFAULT look the\n * way each STYLE expects: an unset `look` means `outline` on a kinetic style (the\n * TikTok/CapCut read) and `clean` on the static `subtitle` (the plain read — a\n * pinned neutral sans, no outline, no casing). So a subtitle that routes to\n * Remotion never inherits the outline house-style unless asked, AND is never left\n * with no face at all (which renders as headless Chrome's default serif). A named\n * look always wins; explicit levers override either. SINGLE SOURCE for the worker\n * top-level levers, the per-segment resolver, and the frontend config/preview\n * mirror, so the per-style default can't drift between them.\n */\nexport function resolveCaptionLevers(\n style: string | undefined | null,\n look: CaptionLookId | undefined,\n explicit: CaptionLookLevers,\n fontSize: number,\n): CaptionLookLevers {\n const effective = look ?? (isKineticCaptionStyle(style) ? DEFAULT_CAPTION_LOOK : DEFAULT_SUBTITLE_LOOK)\n return resolveCaptionLook(effective, explicit, fontSize)\n}\n","export interface CaptionWordTiming {\n readonly text: string\n readonly startMs: number\n readonly endMs: number\n}\n\n/**\n * A caption plan: the opening line, where it ends, and the timed words that\n * follow it. Times and words only — no styling travels on a plan; whoever\n * renders it applies the look. Times are milliseconds from the video's start.\n */\n/** The opening line and the body's words, timed. No styling. */\nexport interface CaptionPlan {\n readonly v: 1\n /** The opening line as written; sent as is, never trimmed. */\n readonly hookText: string\n /** Where the opening line ends; the body starts here. */\n readonly hookEndMs: number\n /** Where the body captions end, any tail included (the producer decides it). */\n readonly bodyEndMs: number\n /** The body's words, in milliseconds. */\n readonly captions: readonly CaptionWordTiming[]\n /** When known, the opening line and the body are clamped to it. */\n readonly videoDurationMs?: number\n /** Primary language tag: \"en\", \"he\", … */\n readonly language?: string\n}\n\nconst nonNegative = (v: unknown): v is number => typeof v === \"number\" && Number.isFinite(v) && v >= 0\n\n/**\n * A wired caption plan (object or JSON string) → the plan, or the first problem\n * named as \"Caption plan: <issue>.\" Only the CaptionPlan fields are kept.\n */\nexport function parseCaptionPlan(raw: unknown): { plan: CaptionPlan } | { error: string } {\n let value: unknown = raw\n if (typeof raw === \"string\") {\n try { value = JSON.parse(raw) } catch { return { error: \"Caption plan: not valid JSON.\" } }\n }\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { error: \"Caption plan: not an object.\" }\n const o = value as Record<string, unknown>\n if (o.v !== 1) return { error: \"Caption plan: v must be 1.\" }\n if (typeof o.hookText !== \"string\") return { error: \"Caption plan: hookText must be text.\" }\n for (const f of [\"hookEndMs\", \"bodyEndMs\"] as const) {\n if (!nonNegative(o[f])) return { error: `Caption plan: ${f} must be a non-negative number.` }\n }\n if (o.videoDurationMs !== undefined && !nonNegative(o.videoDurationMs)) {\n return { error: \"Caption plan: videoDurationMs must be a non-negative number.\" }\n }\n if (o.language !== undefined && typeof o.language !== \"string\") return { error: \"Caption plan: language must be text.\" }\n if (!Array.isArray(o.captions)) return { error: \"Caption plan: captions must be a list.\" }\n const captions: CaptionWordTiming[] = []\n for (let i = 0; i < o.captions.length; i++) {\n const c = o.captions[i] as Record<string, unknown> | null\n if (!c || typeof c !== \"object\" || typeof c.text !== \"string\" || !nonNegative(c.startMs) || !nonNegative(c.endMs)) {\n return { error: `Caption plan: captions[${i}] needs text, startMs and endMs.` }\n }\n if (c.endMs < c.startMs) return { error: `Caption plan: captions[${i}] ends before it starts.` }\n captions.push({ text: c.text, startMs: c.startMs, endMs: c.endMs })\n }\n return {\n plan: {\n v: 1,\n hookText: o.hookText,\n hookEndMs: o.hookEndMs as number,\n bodyEndMs: o.bodyEndMs as number,\n captions,\n ...(o.videoDurationMs !== undefined ? { videoDurationMs: o.videoDurationMs as number } : {}),\n ...(o.language !== undefined ? { language: o.language as string } : {}),\n },\n }\n}\n","/**\n * Canonical list of font display names supported by the Remotion renderer.\n *\n * Single source of truth shared by:\n * - the backend Zod schemas (`z.enum(SUPPORTED_FONT_NAMES)`), which CANNOT\n * import `@nodaro/remotion` (its font-registry pulls the render runtime +\n * `@remotion/google-fonts` side-effects into a validation path), and\n * - `packages/remotion/src/lib/font-registry.ts`, which loads each face and\n * is kept in lock-step with this tuple by a compile-time `satisfies` guard.\n *\n * Order/spelling MUST match the keys of the `fonts` object in font-registry.ts.\n */\nexport const SUPPORTED_FONT_NAMES = [\n \"Inter\",\n \"Roboto\",\n \"Open Sans\",\n \"Montserrat\",\n \"Poppins\",\n \"Raleway\",\n \"Nunito\",\n \"Lato\",\n \"Playfair Display\",\n \"Merriweather\",\n \"Lora\",\n \"EB Garamond\",\n \"Bebas Neue\",\n \"Oswald\",\n \"Anton\",\n \"Dancing Script\",\n \"Pacifico\",\n \"Caveat\",\n \"Roboto Mono\",\n \"Fira Code\",\n \"Rubik\",\n \"Heebo\",\n \"Cairo\",\n \"Tajawal\",\n] as const\n\nexport type SupportedFontName = (typeof SUPPORTED_FONT_NAMES)[number]\n","import { z } from \"zod\"\nimport {\n ALL_CAPTION_STYLES,\n CAPTION_LOOK_IDS,\n CAPTION_MAX_WORDS_PER_LINE_MAX,\n CAPTION_MAX_WORDS_PER_LINE_MIN,\n} from \"./caption-styles.js\"\nimport { SUPPORTED_FONT_NAMES } from \"./supported-fonts.js\"\n\n/**\n * The add-captions SEGMENT contract — one definition for the route's Zod, the\n * provider's overlap check and both workflow engines' pre-reservation check of a\n * caption plan's segments (a DAG payload never passes the route's validation).\n * Moved here from backend/src/routes/add-captions.ts so the copies can never differ.\n */\n\n/** Caption font weight: 100..900 on the 100 grid. */\nexport const captionFontWeightSchema = z.number().int().min(100).max(900).multipleOf(100)\n\n/** A text caption source must carry a visible glyph (whitespace synthesises to zero words). */\nexport const nonBlankCaptionText = z.string().min(1).refine((t) => /\\S/.test(t), { message: \"text must contain a non-whitespace character\" })\n\n/** One word-timed caption entry. */\nexport const captionInputSchema = z.object({\n text: z.string(),\n // startMs/endMs are the visibility window and drive the highlight; timestampMs\n // is the word timestamp used by tiktok-words token timing; confidence is\n // metadata, ignored by rendering. timestampMs/confidence default to null.\n startMs: z.number().min(0),\n endMs: z.number().min(0),\n timestampMs: z.number().min(0).nullable().default(null),\n confidence: z.number().min(0).max(1).nullable().default(null),\n})\n\n/**\n * One caption SEGMENT: a time range, optional levers (each inherits the top-level\n * value when omitted) and optional own words (`text` or `captions[]`; falls back\n * to the shared transcript filtered to the range). A segmented render is entirely\n * Remotion, so any `style` (incl. subtitle) and any look lever is valid on a segment.\n */\nexport const captionSegmentInputSchema = z.object({\n startMs: z.number().min(0),\n endMs: z.number().min(0),\n style: z.enum(ALL_CAPTION_STYLES).optional(),\n position: z.enum([\"bottom\", \"top\", \"center\"]).optional(),\n fontSize: z.number().min(12).max(200).optional(),\n color: z.string().optional(),\n backgroundColor: z.string().optional(),\n // A named look preset (outline/clean); explicit levers below override it.\n look: z.enum(CAPTION_LOOK_IDS).optional(),\n fontFamily: z.enum(SUPPORTED_FONT_NAMES).optional(),\n fontWeight: captionFontWeightSchema.optional(),\n strokeColor: z.string().optional(),\n strokeWidth: z.number().min(0).max(40).optional(),\n highlightColor: z.string().optional(),\n uppercase: z.boolean().optional(),\n positionY: z.number().min(0).max(100).optional(),\n animate: z.boolean().optional(),\n maxWordsPerLine: z.number().int().min(CAPTION_MAX_WORDS_PER_LINE_MIN).max(CAPTION_MAX_WORDS_PER_LINE_MAX).optional(),\n text: nonBlankCaptionText.optional(),\n captions: z.array(captionInputSchema).optional(),\n}).refine((s) => s.endMs > s.startMs, { message: \"segment endMs must be greater than startMs\" })\n\nexport type CaptionSegmentInput = z.infer<typeof captionSegmentInputSchema>\n\n/** Every field a segment may carry, in schema order. */\nexport const CAPTION_SEGMENT_SCHEMA_KEYS: readonly string[] = Object.keys(captionSegmentInputSchema.shape)\n\n/**\n * Segments must be sorted and non-overlapping. Returns the first offending pair\n * as the route's 400 text; null when none overlap (abutting is fine).\n * `startMs < endMs` per segment is enforced by the schema; this is the cross-segment rule.\n */\nexport function findSegmentOverlap(segments: readonly { startMs: number; endMs: number }[]): string | null {\n const sorted = [...segments].sort((a, b) => a.startMs - b.startMs)\n for (let i = 1; i < sorted.length; i++) {\n if (sorted[i]!.startMs < sorted[i - 1]!.endMs) {\n return `segments overlap: [${sorted[i - 1]!.startMs}, ${sorted[i - 1]!.endMs}) and [${sorted[i]!.startMs}, ${sorted[i]!.endMs})`\n }\n }\n return null\n}\n","/**\n * A caption line never starts or ends on a lone dash.\n *\n * A speech engine times a dash written between two spaces (\"Nodaro — every model\")\n * as a token of its own, and forced alignment keeps it. Inside a line the dash\n * reads as written; at a line's edge — the line breaks right after it, or the\n * next line opens with it — it reads as a stray mark. The display drops such a\n * token from the edge of the line it lands on; the words keep their own timings.\n *\n * One rule for every place that breaks captions into lines: the render's line\n * grouping (word-timed captions) and the wrap of a static text block.\n */\n\n/** Dash characters only: hyphen-minus, the Unicode hyphens and dashes (U+2010–U+2015), minus, the Hebrew maqaf, and their small/full-width forms. */\nconst BARE_DASH = /^[-‐-―−־﹘﹣-]+$/u\n\n/** True when the token, trimmed, is nothing but dash characters (\"—\", \"–\", \"-\"). A hyphenated word (\"ה-AI\", \"re-run\") is not. */\nexport function isBareDashToken(text: string): boolean {\n return BARE_DASH.test(text.trim())\n}\n\n/**\n * The items with every lone-dash token at either end removed (a copy; the input\n * is never mutated). A line holding nothing but dashes comes back empty — the\n * caller drops it rather than show it.\n */\nexport function trimEdgeDashTokens<T>(items: readonly T[], textOf: (item: T) => string): T[] {\n let start = 0\n let end = items.length\n while (start < end && isBareDashToken(textOf(items[start]!))) start++\n while (end > start && isBareDashToken(textOf(items[end - 1]!))) end--\n return items.slice(start, end)\n}\n","import { parseCaptionPlan, type CaptionPlan } from \"./caption-plan.js\"\nimport { captionSegmentInputSchema, findSegmentOverlap } from \"./caption-segment-schema.js\"\n\n/** The styling half, injected so this package never imports @nodaro/prompts (each engine passes hookPlateCaptionSegments). */\nexport interface CaptionPlanStyler {\n readonly segmentsFor: (\n plan: CaptionPlan,\n opts?: { bodyLevers?: Readonly<Record<string, unknown>> },\n ) => { segments: Record<string, unknown>[]; dropped: readonly string[] }\n readonly leverKeys: readonly string[]\n}\n\n/** The node's own caption levers (set, non-null) — the body's style. Undefined when it sets none (the helper then applies Body Captions). */\nexport function captionPlanBodyLevers(\n nodeData: Readonly<Record<string, unknown>>,\n leverKeys: readonly string[],\n): Record<string, unknown> | undefined {\n const levers: Record<string, unknown> = {}\n for (const k of leverKeys) {\n const v = nodeData[k]\n if (v !== undefined && v !== null) levers[k] = v\n }\n return Object.keys(levers).length > 0 ? levers : undefined\n}\n\n/**\n * A wired caption plan → the timed segments of ONE add-captions request, checked\n * with the route's own segment schema and overlap rule (a DAG payload never\n * passes the route, so both engines check here, before any reservation). The\n * plate is always Hook Plate plus the plan's language levers; the body is the\n * node's own style (the helper's rules, SP7 §4.6.3). `segments: []` = no\n * captions — the caller passes the video through.\n */\nexport function styleCaptionPlan(\n raw: unknown,\n nodeData: Readonly<Record<string, unknown>>,\n styler: CaptionPlanStyler,\n): { segments: Record<string, unknown>[] } | { error: string } {\n const parsed = parseCaptionPlan(raw)\n if (\"error\" in parsed) return { error: parsed.error }\n const bodyLevers = captionPlanBodyLevers(nodeData, styler.leverKeys)\n const styled = styler.segmentsFor(parsed.plan, bodyLevers ? { bodyLevers } : undefined).segments\n // The PARSED segments go on, never the helper's raw ones: the route's schema\n // fills each word entry's defaults (`timestampMs` / `confidence` → null), and a\n // DAG payload never passes the route, so returning the raw list sent a server\n // run word entries the add-captions route itself would have completed.\n const segments: Record<string, unknown>[] = []\n for (let i = 0; i < styled.length; i++) {\n const r = captionSegmentInputSchema.safeParse(styled[i])\n if (!r.success) return { error: `Caption plan: segment ${i + 1}: ${r.error.issues[0]?.message ?? \"invalid\"}.` }\n segments.push(r.data)\n }\n const overlap = findSegmentOverlap(segments as { startMs: number; endMs: number }[])\n if (overlap) return { error: `Caption plan: ${overlap}.` }\n return { segments }\n}\n"]}
|
|
@@ -1,64 +1,109 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkT3TOSWVH_cjs = require('./chunk-T3TOSWVH.cjs');
|
|
4
|
+
var chunkD4KWNDPH_cjs = require('./chunk-D4KWNDPH.cjs');
|
|
4
5
|
var chunkD34K455O_cjs = require('./chunk-D34K455O.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
6
|
+
var chunkW6VJAUGM_cjs = require('./chunk-W6VJAUGM.cjs');
|
|
7
|
+
var chunk5OBTGNUQ_cjs = require('./chunk-5OBTGNUQ.cjs');
|
|
8
|
+
|
|
9
|
+
// src/seedance-extend-rate.ts
|
|
10
|
+
var SEEDANCE_EXTEND_SENT_PRICED_PROVIDER = "seedance-2-5-extend";
|
|
11
|
+
var SEEDANCE_EXTEND_CONTEXT_MAX_SEC = 10;
|
|
12
|
+
var SEEDANCE_EXTEND_RATE_SECONDS = 2;
|
|
13
|
+
var SEEDANCE_EXTEND_RATE_CREDIT_IDS = {
|
|
14
|
+
"480p": "seedance-2-5-extend:480p:per-2s",
|
|
15
|
+
"720p": "seedance-2-5-extend:720p:per-2s",
|
|
16
|
+
"1080p": "seedance-2-5-extend:1080p:per-2s"
|
|
17
|
+
};
|
|
18
|
+
function isSeedanceExtendPricedBySecondsSent(provider) {
|
|
19
|
+
return provider === SEEDANCE_EXTEND_SENT_PRICED_PROVIDER;
|
|
20
|
+
}
|
|
21
|
+
function isSeedanceExtendRateCreditId(id) {
|
|
22
|
+
return typeof id === "string" && Object.values(SEEDANCE_EXTEND_RATE_CREDIT_IDS).includes(id);
|
|
23
|
+
}
|
|
24
|
+
function seedanceExtendAddedSec(provider, duration) {
|
|
25
|
+
const requested = typeof duration === "number" || typeof duration === "string" ? duration : void 0;
|
|
26
|
+
const offered = chunk5OBTGNUQ_cjs.MODEL_CATALOG[provider]?.durations ?? [];
|
|
27
|
+
const min = offered.length > 0 ? Math.min(...offered) : 1;
|
|
28
|
+
const max = offered.length > 0 ? Math.max(...offered) : Number.POSITIVE_INFINITY;
|
|
29
|
+
return Math.min(max, Math.max(min, Math.round(chunkW6VJAUGM_cjs.pricedOutputDurationSec(provider, requested))));
|
|
30
|
+
}
|
|
31
|
+
function knownSec(sec) {
|
|
32
|
+
return typeof sec === "number" && Number.isFinite(sec) && sec > 0 ? sec : void 0;
|
|
33
|
+
}
|
|
34
|
+
function seedanceExtendSourceSec(pictureSec) {
|
|
35
|
+
const whole = Math.floor(pictureSec);
|
|
36
|
+
return whole >= 1 && pictureSec - whole <= chunk5OBTGNUQ_cjs.CONTAINER_OVERHANG_SEC ? whole : pictureSec;
|
|
37
|
+
}
|
|
38
|
+
function seedanceExtendSentSec(sourcePictureSec) {
|
|
39
|
+
const known = knownSec(sourcePictureSec);
|
|
40
|
+
return known === void 0 ? SEEDANCE_EXTEND_CONTEXT_MAX_SEC : Math.min(SEEDANCE_EXTEND_CONTEXT_MAX_SEC, seedanceExtendSourceSec(known));
|
|
41
|
+
}
|
|
42
|
+
function seedanceExtendRefusesSource(sourcePictureSec) {
|
|
43
|
+
const known = knownSec(sourcePictureSec);
|
|
44
|
+
return known !== void 0 && known < chunkW6VJAUGM_cjs.SEEDANCE_2_R2V_MIN_REF_VIDEO_SEC;
|
|
45
|
+
}
|
|
46
|
+
function seedanceExtendUnits(sentSec, addedSec) {
|
|
47
|
+
return (sentSec + addedSec) / SEEDANCE_EXTEND_RATE_SECONDS;
|
|
48
|
+
}
|
|
7
49
|
|
|
8
50
|
// src/credit-identifiers.ts
|
|
9
51
|
function flux2MegapixelTier(model, resolution) {
|
|
10
52
|
const bare = (v) => v.replace(/\s*MP$/i, "").trim();
|
|
11
53
|
const raw = typeof resolution === "string" ? bare(resolution) : "";
|
|
12
54
|
if (raw === "") return "1";
|
|
13
|
-
const tier =
|
|
14
|
-
return tier ?? bare(
|
|
55
|
+
const tier = chunk5OBTGNUQ_cjs.FLUX2_RES_MP.find((t) => Number(t) === Number(raw));
|
|
56
|
+
return tier ?? bare(chunk5OBTGNUQ_cjs.defaultResolutionFor(model) ?? "1 MP");
|
|
15
57
|
}
|
|
16
58
|
function gptImage26CreditId(provider, quality, resolution, referenceImageCount, imageFormat) {
|
|
17
59
|
const q = chunkD34K455O_cjs.GPT_IMAGE_2_6_QUALITIES.includes(quality ?? "") ? quality : chunkD34K455O_cjs.GPT_IMAGE_2_6_DEFAULT_QUALITY;
|
|
18
60
|
const r = chunkD34K455O_cjs.GPT_IMAGE_2_6_RESOLUTIONS.includes(resolution ?? "") ? resolution : chunkD34K455O_cjs.GPT_IMAGE_2_6_DEFAULT_RESOLUTION;
|
|
19
61
|
const images = Math.trunc(referenceImageCount ?? 0);
|
|
20
|
-
const model = !chunkD34K455O_cjs.isGptImage26I2i(provider) && images > 0 ?
|
|
62
|
+
const model = !chunkD34K455O_cjs.isGptImage26I2i(provider) && images > 0 ? chunkW6VJAUGM_cjs.T2I_TO_I2I_VARIANT[provider] : provider;
|
|
21
63
|
const format = chunkD34K455O_cjs.gptImage26PricedFormat(imageFormat);
|
|
22
64
|
const base = format?.kind === "gif" ? `${model}:${q}:gif-${format.band}` : format?.kind === "svg" ? `${model}:${q}:${r}:svg-${format.level}` : `${model}:${q}:${r}`;
|
|
23
65
|
if (!chunkD34K455O_cjs.isGptImage26I2i(model)) return base;
|
|
24
66
|
return `${base}:${Math.min(Math.max(1, images), chunkD34K455O_cjs.GPT_IMAGE_2_6_MAX_INPUT_IMAGES)}ref`;
|
|
25
67
|
}
|
|
26
68
|
function seedream55CreditId(provider, resolution, referenceImageCount) {
|
|
27
|
-
const size =
|
|
69
|
+
const size = chunk5OBTGNUQ_cjs.seedream55Resolution(resolution);
|
|
28
70
|
const images = Math.trunc(referenceImageCount ?? 0);
|
|
29
|
-
const model = !
|
|
30
|
-
if (!
|
|
31
|
-
return `${model}:${size}:${Math.min(Math.max(1, images),
|
|
71
|
+
const model = !chunk5OBTGNUQ_cjs.isSeedream55I2i(provider) && images > 0 ? chunk5OBTGNUQ_cjs.SEEDREAM_5_5_I2I : provider;
|
|
72
|
+
if (!chunk5OBTGNUQ_cjs.isSeedream55I2i(model)) return `${model}:${size}`;
|
|
73
|
+
return `${model}:${size}:${Math.min(Math.max(1, images), chunk5OBTGNUQ_cjs.SEEDREAM_5_5_MAX_INPUT_IMAGES)}ref`;
|
|
32
74
|
}
|
|
33
75
|
function buildCreditModelIdentifier(provider, quality, resolution, renderingSpeed, targetResolution, referenceImageCount, imageFormat) {
|
|
34
|
-
if (
|
|
76
|
+
if (chunk5OBTGNUQ_cjs.isFlux2Model(provider)) {
|
|
35
77
|
return `${provider}:${flux2MegapixelTier(provider, resolution)}MP:${Math.min(referenceImageCount ?? 0, 8)}ref`;
|
|
36
78
|
}
|
|
37
79
|
if (chunkD34K455O_cjs.isGptImage26Tiered(provider)) {
|
|
38
80
|
return gptImage26CreditId(provider, quality, resolution, referenceImageCount, imageFormat);
|
|
39
81
|
}
|
|
40
|
-
if (
|
|
41
|
-
return
|
|
82
|
+
if (chunk5OBTGNUQ_cjs.isMinimaxH3Image(provider)) {
|
|
83
|
+
return chunk5OBTGNUQ_cjs.minimaxH3ImageCreditId(provider, resolution, referenceImageCount);
|
|
42
84
|
}
|
|
43
|
-
if (
|
|
85
|
+
if (chunk5OBTGNUQ_cjs.isSeedream55(provider)) {
|
|
44
86
|
return seedream55CreditId(provider, resolution, referenceImageCount);
|
|
45
87
|
}
|
|
46
|
-
if (
|
|
88
|
+
if (chunk5OBTGNUQ_cjs.isFlux3Klein(provider)) {
|
|
89
|
+
return chunk5OBTGNUQ_cjs.flux3KleinCreditId(provider, resolution, referenceImageCount);
|
|
90
|
+
}
|
|
91
|
+
if (chunkW6VJAUGM_cjs.HIGH_QUALITY_PROVIDERS.has(provider) && quality === "high") {
|
|
47
92
|
return `${provider}:high`;
|
|
48
93
|
}
|
|
49
|
-
if (
|
|
94
|
+
if (chunkW6VJAUGM_cjs.TWO_K_RESOLUTION_PROVIDERS.has(provider) && resolution === "2K") {
|
|
50
95
|
return `${provider}:2K`;
|
|
51
96
|
}
|
|
52
97
|
if (provider === "nano-banana-pro" && resolution === "4K") {
|
|
53
98
|
return `${provider}:4K`;
|
|
54
99
|
}
|
|
55
|
-
if (
|
|
100
|
+
if (chunkW6VJAUGM_cjs.RESOLUTION_2K_4K_TIERED_PROVIDERS.has(provider) && (resolution === "2K" || resolution === "4K")) {
|
|
56
101
|
return `${provider}:${resolution}`;
|
|
57
102
|
}
|
|
58
103
|
if (provider === "topaz-image-upscale" && targetResolution && targetResolution !== "2K") {
|
|
59
104
|
return `${provider}:${targetResolution}`;
|
|
60
105
|
}
|
|
61
|
-
if (
|
|
106
|
+
if (chunkW6VJAUGM_cjs.IDEOGRAM_PROVIDERS.has(provider)) {
|
|
62
107
|
if (renderingSpeed === "TURBO") return `${provider}:TURBO`;
|
|
63
108
|
if (renderingSpeed === "QUALITY") return `${provider}:QUALITY`;
|
|
64
109
|
}
|
|
@@ -66,10 +111,10 @@ function buildCreditModelIdentifier(provider, quality, resolution, renderingSpee
|
|
|
66
111
|
}
|
|
67
112
|
function normalizedImageGenModelId(opts) {
|
|
68
113
|
const provider = typeof opts.provider === "string" && opts.provider.length > 0 ? opts.provider : "nano-banana";
|
|
69
|
-
return opts.swapToI2i && opts.refCount > 0 ?
|
|
114
|
+
return opts.swapToI2i && opts.refCount > 0 ? chunkW6VJAUGM_cjs.T2I_TO_I2I_VARIANT[provider] ?? provider : provider;
|
|
70
115
|
}
|
|
71
116
|
function imageGenAutoAspectNeedsSourceImage(opts) {
|
|
72
|
-
const asks = (refCount) =>
|
|
117
|
+
const asks = (refCount) => chunk5OBTGNUQ_cjs.autoAspectNeedsSourceImage(normalizedImageGenModelId({ provider: opts.provider, refCount, swapToI2i: true }), opts.aspectRatio);
|
|
73
118
|
return opts.refCount === void 0 ? asks(0) || asks(1) : asks(opts.refCount);
|
|
74
119
|
}
|
|
75
120
|
function imageFormatInputOf(source) {
|
|
@@ -89,7 +134,7 @@ function imageFormatInputOf(source) {
|
|
|
89
134
|
function resolveNormalizedImageGen(opts) {
|
|
90
135
|
const str = (v) => typeof v === "string" && v.length > 0 ? v : void 0;
|
|
91
136
|
const modelId = normalizedImageGenModelId(opts);
|
|
92
|
-
const n =
|
|
137
|
+
const n = chunk5OBTGNUQ_cjs.normalizeModelInput(
|
|
93
138
|
modelId,
|
|
94
139
|
{
|
|
95
140
|
aspectRatio: str(opts.aspectRatio),
|
|
@@ -142,88 +187,90 @@ function ltxPricedTier(provider, resolution, duration) {
|
|
|
142
187
|
if (!bands) return void 0;
|
|
143
188
|
const band = bands[String(resolution)] ? String(resolution) : "1080p";
|
|
144
189
|
const allowed = bands[band];
|
|
145
|
-
const dur =
|
|
190
|
+
const dur = chunkW6VJAUGM_cjs.snapToNearestDuration(chunkW6VJAUGM_cjs.pricedOutputDurationSec(provider, duration), allowed);
|
|
146
191
|
return { band, duration: dur };
|
|
147
192
|
}
|
|
148
193
|
function wireNormalizedResolution(provider, resolution) {
|
|
149
|
-
if (
|
|
150
|
-
if (
|
|
151
|
-
if (
|
|
152
|
-
if (
|
|
153
|
-
if (
|
|
154
|
-
if (
|
|
194
|
+
if (chunkW6VJAUGM_cjs.isWan3Provider(provider)) return chunkW6VJAUGM_cjs.normalizeWan3Resolution(resolution).toLowerCase();
|
|
195
|
+
if (chunkW6VJAUGM_cjs.isViduQ4Provider(provider)) return chunkW6VJAUGM_cjs.normalizeViduQ4Resolution(resolution);
|
|
196
|
+
if (chunkW6VJAUGM_cjs.isKling4Provider(provider)) return chunkW6VJAUGM_cjs.normalizeKling4Resolution(resolution);
|
|
197
|
+
if (chunkW6VJAUGM_cjs.isKling4FlashProvider(provider)) return chunkW6VJAUGM_cjs.KLING_4_FLASH_RESOLUTION;
|
|
198
|
+
if (chunkW6VJAUGM_cjs.isGrokVideo15Provider(provider)) return chunkW6VJAUGM_cjs.normalizeGrokVideo15Resolution(resolution);
|
|
199
|
+
if (chunkW6VJAUGM_cjs.isPixverseV6MaxProvider(provider)) return chunkW6VJAUGM_cjs.normalizePixverseV6MaxQuality(resolution);
|
|
155
200
|
return resolution;
|
|
156
201
|
}
|
|
157
202
|
function buildVideoCreditModelIdentifier(rawProvider, duration, sound, nodeType, mode, resolution, hasVideoRef) {
|
|
158
203
|
const audio = typeof sound === "object" && sound !== null ? sound : { sound };
|
|
159
|
-
const provider =
|
|
160
|
-
if (
|
|
204
|
+
const provider = chunkW6VJAUGM_cjs.canonicalVideoProvider(rawProvider);
|
|
205
|
+
if (chunkW6VJAUGM_cjs.isTailExtendProvider(provider)) return tailExtendCreditId(provider, duration, resolution);
|
|
206
|
+
if (chunkW6VJAUGM_cjs.isPixverseExtendProvider(provider)) return pixverseExtendCreditId(duration, resolution, audio.generateAudio ?? audio.sound);
|
|
207
|
+
if (chunkW6VJAUGM_cjs.isGrokExtendProvider(provider)) return grokExtendCreditId(duration);
|
|
161
208
|
let effectiveProvider = provider;
|
|
162
209
|
if (nodeType === "text-to-video") {
|
|
163
210
|
const override = T2V_CREDIT_OVERRIDES[provider];
|
|
164
211
|
if (override) {
|
|
165
|
-
if (
|
|
212
|
+
if (chunkW6VJAUGM_cjs.DURATION_PRICED_PROVIDERS.has(override)) {
|
|
166
213
|
effectiveProvider = override;
|
|
167
214
|
} else {
|
|
168
215
|
return override;
|
|
169
216
|
}
|
|
170
217
|
}
|
|
171
218
|
}
|
|
172
|
-
if (
|
|
219
|
+
if (chunkW6VJAUGM_cjs.isVeoProvider(effectiveProvider)) {
|
|
173
220
|
if (resolution === "4k") return `${effectiveProvider}:4k`;
|
|
174
|
-
if (resolution === "1080p" &&
|
|
221
|
+
if (resolution === "1080p" && chunkW6VJAUGM_cjs.VEO_RESOLUTION_TIERED_PROVIDERS.has(effectiveProvider)) return `${effectiveProvider}:1080p`;
|
|
175
222
|
return effectiveProvider;
|
|
176
223
|
}
|
|
177
|
-
if (
|
|
224
|
+
if (chunkW6VJAUGM_cjs.isGeminiOmniProvider(effectiveProvider) && !chunkW6VJAUGM_cjs.isGeminiOmniPerSecondProvider(effectiveProvider)) {
|
|
178
225
|
if (hasVideoRef) {
|
|
179
226
|
return resolution === "4k" ? `${effectiveProvider}:4k:vref` : `${effectiveProvider}:vref`;
|
|
180
227
|
}
|
|
181
|
-
const d =
|
|
228
|
+
const d = chunkW6VJAUGM_cjs.pricedOutputDurationSec(effectiveProvider, duration);
|
|
182
229
|
return resolution === "4k" ? `${effectiveProvider}:4k:${d}` : `${effectiveProvider}:${d}`;
|
|
183
230
|
}
|
|
184
231
|
const ltxTier = ltxPricedTier(effectiveProvider, resolution, duration);
|
|
185
232
|
if (ltxTier) {
|
|
186
233
|
return `${effectiveProvider}:${ltxTier.band}:${ltxTier.duration}s`;
|
|
187
234
|
}
|
|
188
|
-
if (!
|
|
235
|
+
if (!chunkW6VJAUGM_cjs.DURATION_PRICED_PROVIDERS.has(effectiveProvider)) {
|
|
189
236
|
return effectiveProvider;
|
|
190
237
|
}
|
|
191
|
-
const durationSec =
|
|
192
|
-
const tiers =
|
|
238
|
+
const durationSec = chunkW6VJAUGM_cjs.pricedOutputDurationSec(effectiveProvider, duration);
|
|
239
|
+
const tiers = chunkW6VJAUGM_cjs.VIDEO_DURATION_TIERS[effectiveProvider];
|
|
193
240
|
if (!tiers) return effectiveProvider;
|
|
194
241
|
const tier = tiers.find((t) => durationSec <= t.maxSeconds) ?? tiers[tiers.length - 1];
|
|
195
242
|
let identifier = `${effectiveProvider}:${tier.suffix}`;
|
|
196
|
-
if (
|
|
243
|
+
if (chunkW6VJAUGM_cjs.MODE_ADDON_PROVIDERS.has(effectiveProvider) && (mode === "high" || mode === "pro")) {
|
|
197
244
|
identifier += ":high";
|
|
198
245
|
}
|
|
199
|
-
if (
|
|
200
|
-
const supported =
|
|
201
|
-
const requested = resolution ??
|
|
246
|
+
if (chunkW6VJAUGM_cjs.RESOLUTION_VIDEO_REF_PRICING.has(effectiveProvider)) {
|
|
247
|
+
const supported = chunk5OBTGNUQ_cjs.MODEL_CATALOG[effectiveProvider]?.resolutions ?? ["480p", "720p", "1080p"];
|
|
248
|
+
const requested = resolution ?? chunkW6VJAUGM_cjs.PRICING_DEFAULT_RESOLUTION[effectiveProvider];
|
|
202
249
|
const want = requested === "4k" ? "4k" : requested === "1080p" ? "1080p" : requested === "720p" ? "720p" : "480p";
|
|
203
250
|
const res = supported.includes(want) ? want : supported[supported.length - 1] ?? "480p";
|
|
204
251
|
identifier += `:${res}`;
|
|
205
252
|
if (hasVideoRef) identifier += "-ref";
|
|
206
253
|
}
|
|
207
|
-
const resTiers =
|
|
254
|
+
const resTiers = chunkW6VJAUGM_cjs.RESOLUTION_DURATION_PRICING[effectiveProvider];
|
|
208
255
|
if (resTiers) {
|
|
209
|
-
const declaredDefault =
|
|
256
|
+
const declaredDefault = chunkW6VJAUGM_cjs.PRICING_DEFAULT_RESOLUTION[effectiveProvider];
|
|
210
257
|
const fallback = declaredDefault && resTiers.includes(declaredDefault) ? declaredDefault : resTiers[0];
|
|
211
258
|
const requested = wireNormalizedResolution(effectiveProvider, resolution);
|
|
212
259
|
const res = requested && resTiers.includes(requested) ? requested : fallback;
|
|
213
260
|
identifier += `:${res}`;
|
|
214
|
-
if (hasVideoRef &&
|
|
261
|
+
if (hasVideoRef && chunkW6VJAUGM_cjs.VIDEO_REF_RATE_PROVIDERS.has(effectiveProvider)) identifier += "-ref";
|
|
215
262
|
}
|
|
216
|
-
if (
|
|
263
|
+
if (chunkW6VJAUGM_cjs.isMinimaxH3Provider(effectiveProvider) && chunkW6VJAUGM_cjs.normalizeMinimaxH3Resolution(resolution) === "768P") {
|
|
217
264
|
identifier += ":768p";
|
|
218
265
|
}
|
|
219
|
-
if (
|
|
266
|
+
if (chunkW6VJAUGM_cjs.AUDIO_ADDON_PROVIDERS.has(effectiveProvider) && chunkW6VJAUGM_cjs.videoAudioPricedOn(effectiveProvider, audio)) {
|
|
220
267
|
identifier += ":audio";
|
|
221
268
|
}
|
|
222
269
|
return identifier;
|
|
223
270
|
}
|
|
224
271
|
function videoGenerationCreditId(args) {
|
|
225
|
-
const { resolution } =
|
|
226
|
-
resolution: args.resolution ??
|
|
272
|
+
const { resolution } = chunk5OBTGNUQ_cjs.normalizeVideoRequestParams(args.provider, {
|
|
273
|
+
resolution: args.resolution ?? chunkD4KWNDPH_cjs.uiResolutionFill(args.provider),
|
|
227
274
|
draft: args.draft === true
|
|
228
275
|
});
|
|
229
276
|
return buildVideoCreditModelIdentifier(
|
|
@@ -239,7 +286,7 @@ function videoGenerationCreditId(args) {
|
|
|
239
286
|
function seedanceVideoEditCreditId(provider, resolution, draft) {
|
|
240
287
|
return videoGenerationCreditId({
|
|
241
288
|
provider,
|
|
242
|
-
duration:
|
|
289
|
+
duration: chunk5OBTGNUQ_cjs.VIDEO_DURATION_AUTO,
|
|
243
290
|
nodeType: "text-to-video",
|
|
244
291
|
resolution,
|
|
245
292
|
draft,
|
|
@@ -248,10 +295,60 @@ function seedanceVideoEditCreditId(provider, resolution, draft) {
|
|
|
248
295
|
}
|
|
249
296
|
var TAIL_EXTEND_DEFAULT_RESOLUTION = "720p";
|
|
250
297
|
function tailExtendResolution(provider, resolution) {
|
|
251
|
-
return typeof resolution === "string" &&
|
|
298
|
+
return typeof resolution === "string" && chunk5OBTGNUQ_cjs.MODEL_CATALOG[provider]?.resolutions?.includes(resolution) ? resolution : TAIL_EXTEND_DEFAULT_RESOLUTION;
|
|
299
|
+
}
|
|
300
|
+
function seedanceExtendRateCreditId(resolution) {
|
|
301
|
+
const res = tailExtendResolution(SEEDANCE_EXTEND_SENT_PRICED_PROVIDER, resolution);
|
|
302
|
+
return SEEDANCE_EXTEND_RATE_CREDIT_IDS[res] ?? SEEDANCE_EXTEND_RATE_CREDIT_IDS["720p"];
|
|
303
|
+
}
|
|
304
|
+
function seedanceExtendSourceCreditId(sourcePictureSec, duration, resolution) {
|
|
305
|
+
if (seedanceExtendRefusesSource(sourcePictureSec)) return void 0;
|
|
306
|
+
return seedanceExtendWholeRunCreditId(seedanceExtendSentSec(sourcePictureSec), duration, resolution);
|
|
307
|
+
}
|
|
308
|
+
function seedanceExtendWholeRunCreditId(sentSec, duration, resolution) {
|
|
309
|
+
const units = seedanceExtendUnits(sentSec, seedanceExtendAddedSec(SEEDANCE_EXTEND_SENT_PRICED_PROVIDER, duration));
|
|
310
|
+
return chunkT3TOSWVH_cjs.unitQuoteCreditId(seedanceExtendRateCreditId(resolution), units);
|
|
311
|
+
}
|
|
312
|
+
function seedanceExtendFullWindowCreditId(duration, resolution) {
|
|
313
|
+
return seedanceExtendWholeRunCreditId(seedanceExtendSentSec(void 0), duration, resolution);
|
|
252
314
|
}
|
|
253
315
|
function tailExtendCreditId(provider, duration, resolution) {
|
|
254
|
-
|
|
316
|
+
if (isSeedanceExtendPricedBySecondsSent(provider)) return seedanceExtendFullWindowCreditId(duration, resolution);
|
|
317
|
+
return `${provider}:${chunkW6VJAUGM_cjs.pricedOutputDurationSec(provider, duration)}s:${tailExtendResolution(provider, resolution)}`;
|
|
318
|
+
}
|
|
319
|
+
var PIXVERSE_EXTEND_DEFAULT_QUALITY = "720p";
|
|
320
|
+
function pixverseExtendQuality(resolution) {
|
|
321
|
+
if (resolution === "480p") return "540p";
|
|
322
|
+
return typeof resolution === "string" && chunk5OBTGNUQ_cjs.MODEL_CATALOG[chunkW6VJAUGM_cjs.PIXVERSE_V6_EXTEND_PROVIDER]?.resolutions?.includes(resolution) ? resolution : PIXVERSE_EXTEND_DEFAULT_QUALITY;
|
|
323
|
+
}
|
|
324
|
+
function pixverseExtendCreditId(duration, resolution, generateAudio) {
|
|
325
|
+
const seconds = chunkW6VJAUGM_cjs.pricedOutputDurationSec(chunkW6VJAUGM_cjs.PIXVERSE_V6_EXTEND_PROVIDER, duration);
|
|
326
|
+
return `${chunkW6VJAUGM_cjs.PIXVERSE_V6_EXTEND_PROVIDER}:${seconds}s:${pixverseExtendQuality(resolution)}${generateAudio === false ? "" : ":audio"}`;
|
|
327
|
+
}
|
|
328
|
+
function catalogExtendResolution(provider, resolution) {
|
|
329
|
+
return chunkW6VJAUGM_cjs.isPixverseExtendProvider(provider) ? pixverseExtendQuality(resolution) : tailExtendResolution(provider, resolution);
|
|
330
|
+
}
|
|
331
|
+
function catalogExtendCreditId(provider, duration, resolution, generateAudio) {
|
|
332
|
+
return chunkW6VJAUGM_cjs.isPixverseExtendProvider(provider) ? pixverseExtendCreditId(duration, resolution, generateAudio) : tailExtendCreditId(provider, duration, resolution);
|
|
333
|
+
}
|
|
334
|
+
function grokExtendSeconds(duration) {
|
|
335
|
+
const requested = typeof duration === "number" || typeof duration === "string" ? duration : void 0;
|
|
336
|
+
return chunkW6VJAUGM_cjs.pricedOutputDurationSec(chunkW6VJAUGM_cjs.GROK_EXTEND_PROVIDER, requested);
|
|
337
|
+
}
|
|
338
|
+
function grokExtendCreditId(duration, sourceResolution) {
|
|
339
|
+
const resolution = sourceResolution === "480p" ? "480p" : "720p";
|
|
340
|
+
return `${chunkW6VJAUGM_cjs.GROK_EXTEND_PROVIDER}:${grokExtendSeconds(duration)}s:${resolution}`;
|
|
341
|
+
}
|
|
342
|
+
var GROK_EXTEND_SOURCE_NODE_TYPES = /* @__PURE__ */ new Set(["generate-video", "text-to-video", "image-to-video"]);
|
|
343
|
+
function grokExtendWiredSourceResolution(nodeId, nodes, edges) {
|
|
344
|
+
if (nodeId === void 0 || !edges) return "720p";
|
|
345
|
+
const sources = edges.filter((e) => e.target === nodeId && (e.targetHandle == null || e.targetHandle === "video")).map((e) => nodes.find((n) => n.id !== void 0 && n.id === e.source));
|
|
346
|
+
if (sources.length === 0) return "720p";
|
|
347
|
+
const surely480p = sources.every((n) => {
|
|
348
|
+
const data = n?.data ?? {};
|
|
349
|
+
return n?.type !== void 0 && GROK_EXTEND_SOURCE_NODE_TYPES.has(n.type) && chunkW6VJAUGM_cjs.isGrokExtendSourceModel(data.provider) && typeof data.resolution === "string" && data.resolution.trim().toLowerCase() === "480p";
|
|
350
|
+
});
|
|
351
|
+
return surely480p ? "480p" : "720p";
|
|
255
352
|
}
|
|
256
353
|
function seedanceExtendResolution(provider, resolution) {
|
|
257
354
|
return tailExtendResolution(provider, resolution);
|
|
@@ -262,12 +359,12 @@ function seedanceExtendCreditId(provider, duration, resolution) {
|
|
|
262
359
|
function pricedVideoSelection(opts) {
|
|
263
360
|
const adjustments = [];
|
|
264
361
|
const ltx = ltxPricedTier(opts.provider, opts.resolution, opts.duration);
|
|
265
|
-
const resolution = opts.resolution ?? (ltx ? ltx.band :
|
|
362
|
+
const resolution = opts.resolution ?? (ltx ? ltx.band : chunkW6VJAUGM_cjs.PRICING_DEFAULT_RESOLUTION[opts.provider]);
|
|
266
363
|
const requested = typeof opts.duration === "string" ? parseInt(opts.duration, 10) : opts.duration;
|
|
267
364
|
const asked = requested !== void 0 && !Number.isNaN(requested);
|
|
268
|
-
const lengthPriced = !!ltx ||
|
|
365
|
+
const lengthPriced = !!ltx || chunkW6VJAUGM_cjs.DURATION_PRICED_PROVIDERS.has(opts.provider) || chunkW6VJAUGM_cjs.isGeminiOmniProvider(opts.provider);
|
|
269
366
|
if (!lengthPriced || !ltx && asked && requested <= 0) return { resolution, adjustments };
|
|
270
|
-
const duration = ltx ? ltx.duration :
|
|
367
|
+
const duration = ltx ? ltx.duration : chunkW6VJAUGM_cjs.pricedOutputDurationSec(opts.provider, opts.duration);
|
|
271
368
|
if (asked && requested !== duration) {
|
|
272
369
|
adjustments.push({
|
|
273
370
|
field: "duration",
|
|
@@ -288,7 +385,7 @@ var MOTION_MODELS_SENT_AS_NAMED = /* @__PURE__ */ new Set(["motion-transfer", "k
|
|
|
288
385
|
function motionTransferResolution(provider, resolution) {
|
|
289
386
|
const model = motionModelOf(provider);
|
|
290
387
|
if (MOTION_MODELS_SENT_AS_NAMED.has(model)) return { resolution, adjustments: [] };
|
|
291
|
-
const normalized =
|
|
388
|
+
const normalized = chunk5OBTGNUQ_cjs.normalizeModelInput(model, { resolution });
|
|
292
389
|
if (normalized.resolution === void 0) return { resolution, adjustments: [] };
|
|
293
390
|
return { resolution: normalized.resolution, adjustments: normalized.adjustments };
|
|
294
391
|
}
|
|
@@ -301,7 +398,7 @@ function motionCreditIdentifier(provider, resolution, videoDuration) {
|
|
|
301
398
|
}
|
|
302
399
|
const raw = videoDuration ?? 10;
|
|
303
400
|
const durationSec = Math.floor(Number.isNaN(raw) ? 10 : raw);
|
|
304
|
-
const tier =
|
|
401
|
+
const tier = chunkW6VJAUGM_cjs.MOTION_DURATION_TIERS.find((t) => durationSec <= t.maxSeconds) ?? chunkW6VJAUGM_cjs.MOTION_DURATION_TIERS[chunkW6VJAUGM_cjs.MOTION_DURATION_TIERS.length - 1];
|
|
305
402
|
const base = provider === "kling-3.0" ? "kling-3.0-motion" : "motion-transfer";
|
|
306
403
|
const resSuffix = resolution === "1080p" ? ":1080p" : "";
|
|
307
404
|
return `${base}${resSuffix}:${tier.suffix}`;
|
|
@@ -349,9 +446,18 @@ var SUNO_VERSION_CREDIT_KEYS = {
|
|
|
349
446
|
V6_WILD: "suno-v6_wild",
|
|
350
447
|
V6_MINI: "suno-v6_mini",
|
|
351
448
|
V5_5: "suno-v5_5",
|
|
352
|
-
V5: "suno-v5"
|
|
449
|
+
V5: "suno-v5",
|
|
450
|
+
// Their own rows since 2026-11-12, at the price their runs were charged
|
|
451
|
+
// under the operation's row before.
|
|
452
|
+
V4_5PLUS: "suno-v4_5plus",
|
|
453
|
+
V4_5ALL: "suno-v4_5all",
|
|
454
|
+
V4_5: "suno-v4_5"
|
|
353
455
|
};
|
|
354
456
|
|
|
457
|
+
exports.SEEDANCE_EXTEND_CONTEXT_MAX_SEC = SEEDANCE_EXTEND_CONTEXT_MAX_SEC;
|
|
458
|
+
exports.SEEDANCE_EXTEND_RATE_CREDIT_IDS = SEEDANCE_EXTEND_RATE_CREDIT_IDS;
|
|
459
|
+
exports.SEEDANCE_EXTEND_RATE_SECONDS = SEEDANCE_EXTEND_RATE_SECONDS;
|
|
460
|
+
exports.SEEDANCE_EXTEND_SENT_PRICED_PROVIDER = SEEDANCE_EXTEND_SENT_PRICED_PROVIDER;
|
|
355
461
|
exports.SPEAKER_VIEW_CREDIT_IDS = SPEAKER_VIEW_CREDIT_IDS;
|
|
356
462
|
exports.SPEAKER_VIEW_PRICE_TIERS = SPEAKER_VIEW_PRICE_TIERS;
|
|
357
463
|
exports.SUNO_SELECT_OPERATIONS = SUNO_SELECT_OPERATIONS;
|
|
@@ -361,15 +467,32 @@ exports.applyEdlCreditId = applyEdlCreditId;
|
|
|
361
467
|
exports.buildCreditModelIdentifier = buildCreditModelIdentifier;
|
|
362
468
|
exports.buildMotionCreditModelIdentifier = buildMotionCreditModelIdentifier;
|
|
363
469
|
exports.buildVideoCreditModelIdentifier = buildVideoCreditModelIdentifier;
|
|
470
|
+
exports.catalogExtendCreditId = catalogExtendCreditId;
|
|
471
|
+
exports.catalogExtendResolution = catalogExtendResolution;
|
|
472
|
+
exports.grokExtendCreditId = grokExtendCreditId;
|
|
473
|
+
exports.grokExtendSeconds = grokExtendSeconds;
|
|
474
|
+
exports.grokExtendWiredSourceResolution = grokExtendWiredSourceResolution;
|
|
364
475
|
exports.imageFormatInputOf = imageFormatInputOf;
|
|
365
476
|
exports.imageGenAutoAspectNeedsSourceImage = imageGenAutoAspectNeedsSourceImage;
|
|
477
|
+
exports.isSeedanceExtendPricedBySecondsSent = isSeedanceExtendPricedBySecondsSent;
|
|
478
|
+
exports.isSeedanceExtendRateCreditId = isSeedanceExtendRateCreditId;
|
|
366
479
|
exports.motionTransferResolution = motionTransferResolution;
|
|
367
480
|
exports.normalizedImageGenModelId = normalizedImageGenModelId;
|
|
481
|
+
exports.pixverseExtendCreditId = pixverseExtendCreditId;
|
|
482
|
+
exports.pixverseExtendQuality = pixverseExtendQuality;
|
|
368
483
|
exports.pricedVideoSelection = pricedVideoSelection;
|
|
369
484
|
exports.resolveImageGenCreditIdentifier = resolveImageGenCreditIdentifier;
|
|
370
485
|
exports.resolveNormalizedImageGen = resolveNormalizedImageGen;
|
|
486
|
+
exports.seedanceExtendAddedSec = seedanceExtendAddedSec;
|
|
371
487
|
exports.seedanceExtendCreditId = seedanceExtendCreditId;
|
|
488
|
+
exports.seedanceExtendFullWindowCreditId = seedanceExtendFullWindowCreditId;
|
|
489
|
+
exports.seedanceExtendRateCreditId = seedanceExtendRateCreditId;
|
|
490
|
+
exports.seedanceExtendRefusesSource = seedanceExtendRefusesSource;
|
|
372
491
|
exports.seedanceExtendResolution = seedanceExtendResolution;
|
|
492
|
+
exports.seedanceExtendSentSec = seedanceExtendSentSec;
|
|
493
|
+
exports.seedanceExtendSourceCreditId = seedanceExtendSourceCreditId;
|
|
494
|
+
exports.seedanceExtendSourceSec = seedanceExtendSourceSec;
|
|
495
|
+
exports.seedanceExtendUnits = seedanceExtendUnits;
|
|
373
496
|
exports.seedanceVideoEditCreditId = seedanceVideoEditCreditId;
|
|
374
497
|
exports.speakerViewCreditId = speakerViewCreditId;
|
|
375
498
|
exports.speedRampCreditId = speedRampCreditId;
|
|
@@ -377,5 +500,5 @@ exports.sunoCreditType = sunoCreditType;
|
|
|
377
500
|
exports.tailExtendCreditId = tailExtendCreditId;
|
|
378
501
|
exports.tailExtendResolution = tailExtendResolution;
|
|
379
502
|
exports.videoGenerationCreditId = videoGenerationCreditId;
|
|
380
|
-
//# sourceMappingURL=chunk-
|
|
381
|
-
//# sourceMappingURL=chunk-
|
|
503
|
+
//# sourceMappingURL=chunk-CHS2SIP6.cjs.map
|
|
504
|
+
//# sourceMappingURL=chunk-CHS2SIP6.cjs.map
|