@nodaro/shared 3.68.0 → 3.69.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-T4GIHHXY.cjs → chunk-25C2E2GI.cjs} +6 -6
- package/dist/{chunk-T4GIHHXY.cjs.map → chunk-25C2E2GI.cjs.map} +1 -1
- package/dist/{chunk-OXTF4Y3P.cjs → chunk-3AB3YIFM.cjs} +6 -6
- package/dist/{chunk-OXTF4Y3P.cjs.map → chunk-3AB3YIFM.cjs.map} +1 -1
- package/dist/{chunk-BCY3A62O.cjs → chunk-3OHRFSQL.cjs} +51 -49
- package/dist/{chunk-BCY3A62O.cjs.map → chunk-3OHRFSQL.cjs.map} +1 -1
- package/dist/{chunk-GNLA5NTT.cjs → chunk-4IMEJQVQ.cjs} +4 -4
- package/dist/{chunk-GNLA5NTT.cjs.map → chunk-4IMEJQVQ.cjs.map} +1 -1
- package/dist/{chunk-4XR66IWF.cjs → chunk-54E2JO4E.cjs} +51 -22
- package/dist/chunk-54E2JO4E.cjs.map +1 -0
- package/dist/{chunk-HTDKEYMY.cjs → chunk-5EQRIUGI.cjs} +139 -91
- package/dist/chunk-5EQRIUGI.cjs.map +1 -0
- package/dist/{chunk-AT53ZQUC.js → chunk-5WHU7CYE.js} +3 -3
- package/dist/{chunk-AT53ZQUC.js.map → chunk-5WHU7CYE.js.map} +1 -1
- package/dist/{chunk-BNR5FKL5.js → chunk-5ZCZL73I.js} +3 -3
- package/dist/{chunk-BNR5FKL5.js.map → chunk-5ZCZL73I.js.map} +1 -1
- package/dist/{chunk-WZG6GZIL.cjs → chunk-6QJHSN6J.cjs} +4 -4
- package/dist/{chunk-WZG6GZIL.cjs.map → chunk-6QJHSN6J.cjs.map} +1 -1
- package/dist/{chunk-OFQ6CU6S.js → chunk-7EQJIGVT.js} +3 -3
- package/dist/{chunk-OFQ6CU6S.js.map → chunk-7EQJIGVT.js.map} +1 -1
- package/dist/{chunk-XEPKONJC.js → chunk-7OSUEYZ4.js} +3 -3
- package/dist/{chunk-XEPKONJC.js.map → chunk-7OSUEYZ4.js.map} +1 -1
- package/dist/{chunk-3L7GMQ4M.cjs → chunk-7PC2YHBN.cjs} +54 -49
- package/dist/chunk-7PC2YHBN.cjs.map +1 -0
- package/dist/{chunk-BMDOPJBP.cjs → chunk-AGIG5HUU.cjs} +17 -17
- package/dist/{chunk-BMDOPJBP.cjs.map → chunk-AGIG5HUU.cjs.map} +1 -1
- package/dist/{chunk-5LWYX4GV.js → chunk-AH6OQXLW.js} +3 -3
- package/dist/{chunk-5LWYX4GV.js.map → chunk-AH6OQXLW.js.map} +1 -1
- package/dist/{chunk-BHL7TAQO.js → chunk-BDW25A7Y.js} +32 -9
- package/dist/chunk-BDW25A7Y.js.map +1 -0
- package/dist/{chunk-5J2LIQYU.js → chunk-DE55SA2X.js} +5 -5
- package/dist/{chunk-5J2LIQYU.js.map → chunk-DE55SA2X.js.map} +1 -1
- package/dist/{chunk-VBP4DH37.js → chunk-DNWFFVC6.js} +130 -15
- package/dist/chunk-DNWFFVC6.js.map +1 -0
- package/dist/{chunk-MVXZP6VB.js → chunk-FUYBUT65.js} +97 -2
- package/dist/chunk-FUYBUT65.js.map +1 -0
- package/dist/{chunk-SW5ZD7BO.js → chunk-G6AOKNAY.js} +3 -3
- package/dist/{chunk-SW5ZD7BO.js.map → chunk-G6AOKNAY.js.map} +1 -1
- package/dist/{chunk-EFYWV2V5.cjs → chunk-I6TBKTW3.cjs} +61 -61
- package/dist/{chunk-EFYWV2V5.cjs.map → chunk-I6TBKTW3.cjs.map} +1 -1
- package/dist/{chunk-3YWZ5SOZ.js → chunk-KLEKJUQI.js} +5 -5
- package/dist/{chunk-3YWZ5SOZ.js.map → chunk-KLEKJUQI.js.map} +1 -1
- package/dist/{chunk-OXBU5AGH.js → chunk-LSX2OFNB.js} +3 -3
- package/dist/{chunk-OXBU5AGH.js.map → chunk-LSX2OFNB.js.map} +1 -1
- package/dist/{chunk-66QSUUB4.cjs → chunk-LY6IR5LL.cjs} +12 -12
- package/dist/{chunk-66QSUUB4.cjs.map → chunk-LY6IR5LL.cjs.map} +1 -1
- package/dist/{chunk-5GG4CG4Y.js → chunk-LZPG4XHT.js} +3 -3
- package/dist/{chunk-5GG4CG4Y.js.map → chunk-LZPG4XHT.js.map} +1 -1
- package/dist/{chunk-PGDR7CO3.cjs → chunk-MGSGLRHZ.cjs} +8 -8
- package/dist/{chunk-PGDR7CO3.cjs.map → chunk-MGSGLRHZ.cjs.map} +1 -1
- package/dist/{chunk-Z77M7Q2R.js → chunk-ML55U7WM.js} +3 -3
- package/dist/{chunk-Z77M7Q2R.js.map → chunk-ML55U7WM.js.map} +1 -1
- package/dist/{chunk-IWUW3YPM.cjs → chunk-NTCSXKZ3.cjs} +5 -5
- package/dist/{chunk-IWUW3YPM.cjs.map → chunk-NTCSXKZ3.cjs.map} +1 -1
- package/dist/{chunk-SCDE676D.js → chunk-OEOOXL3F.js} +65 -23
- package/dist/chunk-OEOOXL3F.js.map +1 -0
- package/dist/{chunk-GF7ZA26H.js → chunk-OOUJZR4K.js} +4 -4
- package/dist/{chunk-GF7ZA26H.js.map → chunk-OOUJZR4K.js.map} +1 -1
- package/dist/{chunk-5IZHECUP.js → chunk-OZA4DE23.js} +3 -3
- package/dist/{chunk-5IZHECUP.js.map → chunk-OZA4DE23.js.map} +1 -1
- package/dist/{chunk-XNJDAW3M.js → chunk-PHQVAPSD.js} +7 -5
- package/dist/{chunk-XNJDAW3M.js.map → chunk-PHQVAPSD.js.map} +1 -1
- package/dist/{chunk-5NVGKXJV.cjs → chunk-PLANUXQL.cjs} +89 -3
- package/dist/chunk-PLANUXQL.cjs.map +1 -0
- package/dist/{chunk-PJAJCFLP.cjs → chunk-QNPYYSLT.cjs} +168 -44
- package/dist/chunk-QNPYYSLT.cjs.map +1 -0
- package/dist/{chunk-G2G7XGFU.cjs → chunk-RURPG6IS.cjs} +7 -7
- package/dist/{chunk-G2G7XGFU.cjs.map → chunk-RURPG6IS.cjs.map} +1 -1
- package/dist/{chunk-PAUWEWTY.js → chunk-TDU45K6Z.js} +12 -7
- package/dist/chunk-TDU45K6Z.js.map +1 -0
- package/dist/{chunk-X2YHKP4D.cjs → chunk-TWUFC32F.cjs} +8 -8
- package/dist/{chunk-X2YHKP4D.cjs.map → chunk-TWUFC32F.cjs.map} +1 -1
- package/dist/{chunk-F6XIH3TZ.cjs → chunk-UJREE6EQ.cjs} +9 -9
- package/dist/{chunk-F6XIH3TZ.cjs.map → chunk-UJREE6EQ.cjs.map} +1 -1
- package/dist/{chunk-37ZSFS6A.cjs → chunk-WML66SUV.cjs} +9 -9
- package/dist/{chunk-37ZSFS6A.cjs.map → chunk-WML66SUV.cjs.map} +1 -1
- package/dist/{chunk-M5QY464F.cjs → chunk-XZYZYWKG.cjs} +21 -21
- package/dist/{chunk-M5QY464F.cjs.map → chunk-XZYZYWKG.cjs.map} +1 -1
- package/dist/{chunk-3QJ3UR5Z.js → chunk-YT4ZTJVC.js} +9 -9
- package/dist/{chunk-3QJ3UR5Z.js.map → chunk-YT4ZTJVC.js.map} +1 -1
- package/dist/{chunk-V6OXSXIX.js → chunk-YVQFYW2U.js} +86 -4
- package/dist/chunk-YVQFYW2U.js.map +1 -0
- package/dist/{chunk-E62W5I6A.cjs → chunk-ZWEVRMFN.cjs} +97 -2
- package/dist/chunk-ZWEVRMFN.cjs.map +1 -0
- package/dist/entries/apps.cjs +42 -42
- package/dist/entries/apps.js +7 -7
- package/dist/entries/credits.cjs +273 -225
- package/dist/entries/credits.d.cts +152 -66
- package/dist/entries/credits.d.ts +152 -66
- package/dist/entries/credits.js +10 -10
- package/dist/entries/llm-models.cjs +84 -68
- package/dist/entries/llm-models.d.cts +36 -3
- package/dist/entries/llm-models.d.ts +36 -3
- package/dist/entries/llm-models.js +2 -2
- package/dist/entries/model-catalog.cjs +133 -133
- package/dist/entries/model-catalog.js +4 -4
- package/dist/entries/models.cjs +431 -395
- package/dist/entries/models.d.cts +2 -2
- package/dist/entries/models.d.ts +2 -2
- package/dist/entries/models.js +6 -6
- package/dist/entries/nodes.cjs +212 -212
- package/dist/entries/nodes.js +8 -8
- package/dist/entries/pipeline.cjs +153 -153
- package/dist/entries/pipeline.d.cts +1 -1
- package/dist/entries/pipeline.d.ts +1 -1
- 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 +152 -152
- package/dist/entries/video.d.cts +2 -1
- package/dist/entries/video.d.ts +2 -1
- package/dist/entries/video.js +6 -6
- package/dist/index.cjs +1697 -1597
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +21 -21
- package/dist/{model-constants-DZ3tPGFO.d.ts → model-constants-B5DNHIP8.d.ts} +156 -12
- package/dist/{model-constants-BstsUup6.d.cts → model-constants-CQr_d3Kw.d.cts} +156 -12
- package/package.json +1 -1
- package/src/__tests__/extend-providers.test.ts +43 -6
- package/src/__tests__/fixtures/measured-input-quote-parity.json +537 -1
- package/src/__tests__/fixtures/planned-length-quote-parity.json +46 -1
- package/src/__tests__/fixtures/probed-node-quote-parity.json +132 -0
- package/src/__tests__/fixtures/video-utility-quote-parity.json +112 -1
- package/src/__tests__/gemini-omni-extend.test.ts +110 -0
- package/src/__tests__/gvp-supported-providers.test.ts +3 -0
- package/src/__tests__/llm-models.test.ts +116 -2
- package/src/__tests__/llm-price-key.test.ts +2 -0
- package/src/__tests__/seedance-2-5-flash-catalog.test.ts +194 -0
- package/src/__tests__/video-character-refs.test.ts +48 -0
- package/src/credit-identifiers.ts +51 -32
- package/src/entries/credits.ts +17 -0
- package/src/entries/llm-models.ts +4 -0
- package/src/entries/models.ts +11 -0
- package/src/gemini-omni-extend-quote.ts +76 -0
- package/src/lip-sync-pricing.ts +1 -1
- package/src/llm-models.ts +117 -2
- package/src/model-catalog.ts +95 -0
- package/src/model-constants.ts +274 -11
- package/src/node-default-mappings.ts +2 -0
- package/src/seedance-extend-rate.ts +83 -20
- package/src/seedance-lip-sync.ts +68 -0
- package/src/video-character-refs.ts +26 -6
- package/dist/chunk-3L7GMQ4M.cjs.map +0 -1
- package/dist/chunk-4XR66IWF.cjs.map +0 -1
- package/dist/chunk-5NVGKXJV.cjs.map +0 -1
- package/dist/chunk-BHL7TAQO.js.map +0 -1
- package/dist/chunk-E62W5I6A.cjs.map +0 -1
- package/dist/chunk-HTDKEYMY.cjs.map +0 -1
- package/dist/chunk-MVXZP6VB.js.map +0 -1
- package/dist/chunk-PAUWEWTY.js.map +0 -1
- package/dist/chunk-PJAJCFLP.cjs.map +0 -1
- package/dist/chunk-SCDE676D.js.map +0 -1
- package/dist/chunk-V6OXSXIX.js.map +0 -1
- package/dist/chunk-VBP4DH37.js.map +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk44I73CQS_cjs = require('./chunk-44I73CQS.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var chunk25C2E2GI_cjs = require('./chunk-25C2E2GI.cjs');
|
|
5
|
+
var chunkQNPYYSLT_cjs = require('./chunk-QNPYYSLT.cjs');
|
|
6
|
+
var chunkZWEVRMFN_cjs = require('./chunk-ZWEVRMFN.cjs');
|
|
7
7
|
var chunk27HA6YOL_cjs = require('./chunk-27HA6YOL.cjs');
|
|
8
8
|
var zod = require('zod');
|
|
9
9
|
|
|
10
10
|
// src/video-character-refs.ts
|
|
11
11
|
var VIDEO_CHARACTER_REFS_WIRE_MAX = Math.max(
|
|
12
12
|
0,
|
|
13
|
-
...Object.values(
|
|
13
|
+
...Object.values(chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER).map((l) => l?.characters ?? 0)
|
|
14
14
|
);
|
|
15
15
|
var VIDEO_CHARACTER_EXTRA_IMAGES_MAX = 3;
|
|
16
16
|
var VIDEO_CHARACTER_DESCRIPTION_MAX = 2e3;
|
|
@@ -18,13 +18,13 @@ var VIDEO_CHARACTER_NAME_MAX = 100;
|
|
|
18
18
|
var VIDEO_CHARACTER_VOICE_DESCRIPTION_MAX = 2e3;
|
|
19
19
|
var VIDEO_CHARACTER_VOICE_EXAMPLE_MAX = 120;
|
|
20
20
|
function videoCharacterRefCap(provider) {
|
|
21
|
-
return provider ?
|
|
21
|
+
return provider ? chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER[provider]?.characters ?? 0 : 0;
|
|
22
22
|
}
|
|
23
23
|
function videoCharacterVideoCap(provider) {
|
|
24
|
-
return provider ?
|
|
24
|
+
return provider ? chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER[provider]?.videoCharacters ?? 0 : 0;
|
|
25
25
|
}
|
|
26
26
|
function videoCharacterVideoProviders() {
|
|
27
|
-
return Object.entries(
|
|
27
|
+
return Object.entries(chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER).filter(([, l]) => (l?.videoCharacters ?? 0) > 0).map(([id]) => id);
|
|
28
28
|
}
|
|
29
29
|
function characterVideoUrls(characterReferences) {
|
|
30
30
|
const out = [];
|
|
@@ -35,7 +35,7 @@ function characterVideoUrls(characterReferences) {
|
|
|
35
35
|
return out;
|
|
36
36
|
}
|
|
37
37
|
function videoCharacterClipsBilledAsReferenceVideo(provider) {
|
|
38
|
-
return provider ?
|
|
38
|
+
return provider ? chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER[provider]?.videoCharactersBillAsReferenceVideo === true : false;
|
|
39
39
|
}
|
|
40
40
|
function pricedReferenceVideoUrls(args) {
|
|
41
41
|
if (videoCharacterClipsBilledAsReferenceVideo(args.provider)) return args.referenceVideoUrls;
|
|
@@ -47,7 +47,7 @@ function seatCharacterVideos(args) {
|
|
|
47
47
|
const clips = characterVideoUrls(args.characterReferences);
|
|
48
48
|
const provider = args.provider ?? "the selected model";
|
|
49
49
|
const cap = videoCharacterVideoCap(args.provider);
|
|
50
|
-
const videosCap =
|
|
50
|
+
const videosCap = chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER[args.provider]?.videos ?? 0;
|
|
51
51
|
const overVideos = (count) => ({
|
|
52
52
|
ok: false,
|
|
53
53
|
code: "reference_videos_over_limit",
|
|
@@ -86,7 +86,10 @@ function seatCharacterVideos(args) {
|
|
|
86
86
|
return { ok: true, referenceVideoUrls: seated };
|
|
87
87
|
}
|
|
88
88
|
function videoCharacterVoiceCap(provider) {
|
|
89
|
-
return provider ?
|
|
89
|
+
return provider ? chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER[provider]?.voices ?? 0 : 0;
|
|
90
|
+
}
|
|
91
|
+
function videoCharacterVoiceProviders() {
|
|
92
|
+
return Object.entries(chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER).filter(([, l]) => (l?.voices ?? 0) > 0).map(([id]) => id);
|
|
90
93
|
}
|
|
91
94
|
function videoCharacterVoiceKey(ref) {
|
|
92
95
|
const voice = ref.voice;
|
|
@@ -102,7 +105,7 @@ function videoCharacterDistinctVoices(characterReferences) {
|
|
|
102
105
|
return keys.size;
|
|
103
106
|
}
|
|
104
107
|
function videoCharacterRefProviders() {
|
|
105
|
-
return Object.entries(
|
|
108
|
+
return Object.entries(chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER).filter(([, l]) => (l?.characters ?? 0) > 0).map(([id]) => id);
|
|
106
109
|
}
|
|
107
110
|
function videoCharacterRefUnits(characterReferences) {
|
|
108
111
|
let units = 0;
|
|
@@ -116,7 +119,7 @@ function videoCharacterVoiceProblem(args) {
|
|
|
116
119
|
if (cap === 0) {
|
|
117
120
|
return {
|
|
118
121
|
code: "character_voice_unsupported",
|
|
119
|
-
message: `A character voice is not supported by ${args.provider ?? "the selected model"}. Drop the voice, or pick a model that takes
|
|
122
|
+
message: `A character voice is not supported by ${args.provider ?? "the selected model"}. Drop the voice, or pick a model that takes one: ${videoCharacterVoiceProviders().join(", ")}.`
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
125
|
if (distinct > cap) {
|
|
@@ -143,7 +146,7 @@ function videoCharacterRefProblem(args) {
|
|
|
143
146
|
message: `${provider} accepts at most ${cap} character references; got ${characterReferences.length}.`
|
|
144
147
|
};
|
|
145
148
|
}
|
|
146
|
-
const limits =
|
|
149
|
+
const limits = chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER[provider];
|
|
147
150
|
const materials = limits?.materials;
|
|
148
151
|
if (materials !== void 0) {
|
|
149
152
|
const audioSeats = limits?.audioBindsToCharacters ? 0 : args.audioCount ?? 0;
|
|
@@ -156,10 +159,11 @@ function videoCharacterRefProblem(args) {
|
|
|
156
159
|
}
|
|
157
160
|
return videoCharacterVoiceProblem({ provider, characterReferences });
|
|
158
161
|
}
|
|
162
|
+
const outsideBudget = limits?.charactersOutsideImageBudget === true;
|
|
159
163
|
if (args.hasStartFrame) {
|
|
160
164
|
return {
|
|
161
165
|
code: "character_references_with_start_frame",
|
|
162
|
-
message: `${provider} does not yet support combining characterReferences with a start frame (imageUrl) \u2014 the frame and the characters would compete for the same input slots without a defined role. Drop the start frame (the character's portrait carries the face), or drop characterReferences.`
|
|
166
|
+
message: outsideBudget ? `Nodaro does not combine characterReferences with a start frame (imageUrl) on ${provider}. Drop the start frame (the character's portrait carries the face), or drop characterReferences.` : `${provider} does not yet support combining characterReferences with a start frame (imageUrl) \u2014 the frame and the characters would compete for the same input slots without a defined role. Drop the start frame (the character's portrait carries the face), or drop characterReferences.`
|
|
163
167
|
};
|
|
164
168
|
}
|
|
165
169
|
if (args.hasEndFrame) {
|
|
@@ -168,7 +172,8 @@ function videoCharacterRefProblem(args) {
|
|
|
168
172
|
message: `${provider} does not use an end frame (endFrameUrl) together with characterReferences. Drop the end frame, or drop characterReferences.`
|
|
169
173
|
};
|
|
170
174
|
}
|
|
171
|
-
|
|
175
|
+
if (outsideBudget) return videoCharacterVoiceProblem({ provider, characterReferences });
|
|
176
|
+
const budget = chunkQNPYYSLT_cjs.VIDEO_REF_LIMITS_BY_PROVIDER[provider]?.images ?? 7;
|
|
172
177
|
const used = args.imageCount + args.videoCount * 2 + videoCharacterRefUnits(characterReferences);
|
|
173
178
|
if (used > budget) {
|
|
174
179
|
return {
|
|
@@ -210,7 +215,7 @@ function characterGivesAnImage(data) {
|
|
|
210
215
|
return Object.values(arrays).some((items) => items.some((item) => !!item?.url && !!chunk27HA6YOL_cjs.characterMentionSlug(item.name ?? "")));
|
|
211
216
|
}
|
|
212
217
|
function wiredCharacterSubjectClips(consumerId, nodes, edges, provider) {
|
|
213
|
-
if (videoCharacterVideoCap(provider) === 0 || !
|
|
218
|
+
if (videoCharacterVideoCap(provider) === 0 || !chunkZWEVRMFN_cjs.hasFeature(provider, "character-subjects")) return [];
|
|
214
219
|
const clips = chunk27HA6YOL_cjs.wiredCharacterVideoUrls(consumerId, nodes, edges);
|
|
215
220
|
if (clips.size === 0) return [];
|
|
216
221
|
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
@@ -228,8 +233,8 @@ function wiredCharacterSubjectClips(consumerId, nodes, edges, provider) {
|
|
|
228
233
|
// src/video-overlay-geometry.ts
|
|
229
234
|
var evenFloor = (n) => Math.max(2, Math.floor(n / 2) * 2);
|
|
230
235
|
function videoOverlayCanvas(display, outputAspect) {
|
|
231
|
-
if (
|
|
232
|
-
const d =
|
|
236
|
+
if (chunk25C2E2GI_cjs.isVideoOverlayOutputAspect(outputAspect)) {
|
|
237
|
+
const d = chunkQNPYYSLT_cjs.ASPECT_RATIO_DIMENSIONS[outputAspect];
|
|
233
238
|
return { w: d.width, h: d.height };
|
|
234
239
|
}
|
|
235
240
|
if (!display || !(display.width > 0) || !(display.height > 0)) return null;
|
|
@@ -291,13 +296,13 @@ function videoOverlayLayoutPlacesBase(id) {
|
|
|
291
296
|
}
|
|
292
297
|
|
|
293
298
|
// src/video-overlay-validate.ts
|
|
294
|
-
var inTimeRange = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 && v <=
|
|
295
|
-
var BOUNDED_FIELDS = Object.keys(
|
|
299
|
+
var inTimeRange = (v) => typeof v === "number" && Number.isFinite(v) && v >= 0 && v <= chunk25C2E2GI_cjs.VIDEO_OVERLAY_MAX_TIME_SEC;
|
|
300
|
+
var BOUNDED_FIELDS = Object.keys(chunk25C2E2GI_cjs.VIDEO_OVERLAY_BOUNDS);
|
|
296
301
|
function outOfBounds(l) {
|
|
297
302
|
for (const f of BOUNDED_FIELDS) {
|
|
298
303
|
const v = l[f];
|
|
299
304
|
if (v === void 0 || v === null) continue;
|
|
300
|
-
const [min, max] =
|
|
305
|
+
const [min, max] = chunk25C2E2GI_cjs.VIDEO_OVERLAY_BOUNDS[f];
|
|
301
306
|
const integer = f === "zIndex";
|
|
302
307
|
if (typeof v !== "number" || !Number.isFinite(v) || v < min || v > max || integer && !Number.isInteger(v)) {
|
|
303
308
|
return { field: f, allowed: `${integer ? "integers " : ""}${min}..${max}` };
|
|
@@ -306,25 +311,25 @@ function outOfBounds(l) {
|
|
|
306
311
|
if (l.anchor != null && !chunk44I73CQS_cjs.OVERLAY_ANCHORS.includes(l.anchor)) {
|
|
307
312
|
return { field: "anchor", allowed: chunk44I73CQS_cjs.OVERLAY_ANCHORS.join(", ") };
|
|
308
313
|
}
|
|
309
|
-
if (l.fit != null && !
|
|
314
|
+
if (l.fit != null && !chunk25C2E2GI_cjs.isFit(l.fit)) return { field: "fit", allowed: chunk25C2E2GI_cjs.VIDEO_OVERLAY_FITS.join(", ") };
|
|
310
315
|
if (l.animate != null && typeof l.animate !== "boolean") return { field: "animate", allowed: "true, false" };
|
|
311
316
|
return null;
|
|
312
317
|
}
|
|
313
318
|
function soundOutOfBounds(sound) {
|
|
314
319
|
if (sound === void 0 || sound === null) return null;
|
|
315
|
-
const [min, max] =
|
|
320
|
+
const [min, max] = chunk25C2E2GI_cjs.VIDEO_OVERLAY_VOLUME_BOUNDS;
|
|
316
321
|
const v = typeof sound === "object" && !Array.isArray(sound) ? sound.volume : void 0;
|
|
317
322
|
return typeof v === "number" && Number.isFinite(v) && v >= min && v <= max ? null : { field: "sound.volume", allowed: `${min}..${max}` };
|
|
318
323
|
}
|
|
319
324
|
function baseBoxIssue(raw) {
|
|
320
|
-
const own =
|
|
321
|
-
const box = Object.fromEntries(
|
|
325
|
+
const own = chunk25C2E2GI_cjs.asLayer(raw) ?? {};
|
|
326
|
+
const box = Object.fromEntries(chunk25C2E2GI_cjs.VIDEO_OVERLAY_BOX_FIELDS.map((f) => [f, own[f]]));
|
|
322
327
|
if (box.anchor == null || box.width == null) return { ok: false, code: "incomplete_box", params: { field: "baseBox" } };
|
|
323
328
|
const bad = outOfBounds(box);
|
|
324
329
|
return bad ? { ok: false, code: "field_out_of_bounds", params: { ...bad, field: `baseBox.${bad.field}` } } : null;
|
|
325
330
|
}
|
|
326
331
|
function hasDrawableVideoOverlayBox(layer) {
|
|
327
|
-
const l =
|
|
332
|
+
const l = chunk25C2E2GI_cjs.asLayer(layer);
|
|
328
333
|
if (!l) return false;
|
|
329
334
|
if (!chunk44I73CQS_cjs.OVERLAY_ANCHORS.includes(l.anchor)) return false;
|
|
330
335
|
if (typeof l.width !== "number" || !Number.isFinite(l.width)) return false;
|
|
@@ -334,15 +339,15 @@ function validateVideoOverlayRequest(body) {
|
|
|
334
339
|
if (body.planError) return { ok: false, code: "invalid_layer_plan", params: {} };
|
|
335
340
|
const layers = Array.isArray(body.layers) ? body.layers : [];
|
|
336
341
|
if (layers.length === 0) return { ok: false, code: "no_layers", params: {} };
|
|
337
|
-
if (layers.length >
|
|
338
|
-
return { ok: false, code: "too_many_layers", params: { max:
|
|
342
|
+
if (layers.length > chunk25C2E2GI_cjs.VIDEO_OVERLAY_MAX_LAYERS) {
|
|
343
|
+
return { ok: false, code: "too_many_layers", params: { max: chunk25C2E2GI_cjs.VIDEO_OVERLAY_MAX_LAYERS, count: layers.length } };
|
|
339
344
|
}
|
|
340
|
-
const videoCount = layers.filter(
|
|
341
|
-
if (videoCount >
|
|
342
|
-
return { ok: false, code: "too_many_video_layers", params: { max:
|
|
345
|
+
const videoCount = layers.filter(chunk25C2E2GI_cjs.isVideoOverlayVideoLayer).length;
|
|
346
|
+
if (videoCount > chunk25C2E2GI_cjs.VIDEO_OVERLAY_MAX_VIDEO_LAYERS) {
|
|
347
|
+
return { ok: false, code: "too_many_video_layers", params: { max: chunk25C2E2GI_cjs.VIDEO_OVERLAY_MAX_VIDEO_LAYERS, count: videoCount } };
|
|
343
348
|
}
|
|
344
349
|
for (let i = 0; i < layers.length; i++) {
|
|
345
|
-
const l =
|
|
350
|
+
const l = chunk25C2E2GI_cjs.asLayer(layers[i]) ?? {};
|
|
346
351
|
const at = (code, params = {}) => ({
|
|
347
352
|
ok: false,
|
|
348
353
|
code,
|
|
@@ -351,25 +356,25 @@ function validateVideoOverlayRequest(body) {
|
|
|
351
356
|
...typeof l.planLayer === "number" ? { planLayer: l.planLayer } : {},
|
|
352
357
|
params
|
|
353
358
|
});
|
|
354
|
-
const boxFields =
|
|
355
|
-
if (!
|
|
359
|
+
const boxFields = chunk25C2E2GI_cjs.VIDEO_OVERLAY_BOX_FIELDS.filter((f) => l[f] !== void 0 && l[f] !== null);
|
|
360
|
+
if (!chunk25C2E2GI_cjs.isVideoOverlayPresetId(l.preset) && boxFields.length > 0 && (l.anchor == null || l.width == null)) return at("incomplete_box");
|
|
356
361
|
const bad = outOfBounds(l) ?? soundOutOfBounds(l.sound);
|
|
357
362
|
if (bad) return at("field_out_of_bounds", bad);
|
|
358
|
-
const hasVideo =
|
|
359
|
-
if (
|
|
360
|
-
if (!
|
|
363
|
+
const hasVideo = chunk25C2E2GI_cjs.nonEmpty(l.videoUrl);
|
|
364
|
+
if (chunk25C2E2GI_cjs.nonEmpty(l.imageUrl) && hasVideo) return at("layer_two_sources");
|
|
365
|
+
if (!chunk25C2E2GI_cjs.nonEmpty(l.imageUrl) && !hasVideo) return at("layer_without_image");
|
|
361
366
|
if (l.sound != null && !hasVideo) return at("sound_without_video");
|
|
362
|
-
if (!inTimeRange(l.start)) return at("time_out_of_range", { field: "start", max:
|
|
367
|
+
if (!inTimeRange(l.start)) return at("time_out_of_range", { field: "start", max: chunk25C2E2GI_cjs.VIDEO_OVERLAY_MAX_TIME_SEC });
|
|
363
368
|
if (l.end !== void 0 && l.end !== null) {
|
|
364
|
-
if (!inTimeRange(l.end)) return at("time_out_of_range", { field: "end", max:
|
|
369
|
+
if (!inTimeRange(l.end)) return at("time_out_of_range", { field: "end", max: chunk25C2E2GI_cjs.VIDEO_OVERLAY_MAX_TIME_SEC });
|
|
365
370
|
if (!(l.end > l.start)) return at("end_before_start", { start: l.start, end: l.end });
|
|
366
371
|
}
|
|
367
372
|
}
|
|
368
|
-
const hasAspect =
|
|
373
|
+
const hasAspect = chunk25C2E2GI_cjs.isVideoOverlayOutputAspect(body.outputAspect);
|
|
369
374
|
if (!hasAspect && (body.baseFit != null || body.backgroundColor != null)) {
|
|
370
375
|
return { ok: false, code: "fit_without_aspect", params: {} };
|
|
371
376
|
}
|
|
372
|
-
const stored =
|
|
377
|
+
const stored = chunk25C2E2GI_cjs.storedLayout(body.layout);
|
|
373
378
|
if (stored !== void 0 && !isVideoOverlayLayoutId(stored)) {
|
|
374
379
|
return { ok: false, code: "field_out_of_bounds", params: { field: "layout", allowed: VIDEO_OVERLAY_LAYOUT_IDS.join(", ") } };
|
|
375
380
|
}
|
|
@@ -378,7 +383,7 @@ function validateVideoOverlayRequest(body) {
|
|
|
378
383
|
const boxIssue = body.baseBox != null ? baseBoxIssue(body.baseBox) : null;
|
|
379
384
|
if (boxIssue) return boxIssue;
|
|
380
385
|
if (layout && !hasAspect && videoOverlayLayoutNeedsAspect(layout)) return { ok: false, code: "layout_needs_aspect", params: { layout } };
|
|
381
|
-
if (layout && videoOverlayLayoutNeedsVideoLayer(layout) && !layers.some(
|
|
386
|
+
if (layout && videoOverlayLayoutNeedsVideoLayer(layout) && !layers.some(chunk25C2E2GI_cjs.isVideoOverlayVideoLayer)) {
|
|
382
387
|
return { ok: false, code: "layout_needs_video_layer", params: { layout } };
|
|
383
388
|
}
|
|
384
389
|
if (body.baseBox != null && !hasAspect) return { ok: false, code: "base_box_needs_aspect", params: {} };
|
|
@@ -439,7 +444,7 @@ function sameShallow(a, b) {
|
|
|
439
444
|
}
|
|
440
445
|
function firstVideoLayerIndex(layers) {
|
|
441
446
|
if (!Array.isArray(layers)) return -1;
|
|
442
|
-
return
|
|
447
|
+
return chunk25C2E2GI_cjs.videoOverlayRenderOrder(layers).find((i) => chunk25C2E2GI_cjs.isVideoOverlayVideoLayer(layers[i])) ?? -1;
|
|
443
448
|
}
|
|
444
449
|
function expandBaseBox(raw) {
|
|
445
450
|
if (typeof raw !== "object" || Array.isArray(raw) || raw.anchor == null || raw.width == null) return raw;
|
|
@@ -457,10 +462,10 @@ function placeFirstVideoLayer(layout, layer) {
|
|
|
457
462
|
if (!acceptedAlone(layer)) return layer;
|
|
458
463
|
if (layout !== "pip") return layer.animate === false ? layer : { ...layer, animate: false };
|
|
459
464
|
const rest = { ...layer };
|
|
460
|
-
for (const f of
|
|
465
|
+
for (const f of chunk25C2E2GI_cjs.VIDEO_OVERLAY_BOX_FIELDS) delete rest[f];
|
|
461
466
|
delete rest.preset;
|
|
462
|
-
const corner =
|
|
463
|
-
const next =
|
|
467
|
+
const corner = chunk25C2E2GI_cjs.isVideoOverlayCorner(layer.corner) ? layer.corner : "bottom-right";
|
|
468
|
+
const next = chunk25C2E2GI_cjs.expandVideoOverlayLayer({ ...rest, ...pipBox(corner), animate: false });
|
|
464
469
|
return sameShallow(next, layer) ? layer : next;
|
|
465
470
|
}
|
|
466
471
|
function expandVideoOverlayLayout(req) {
|
|
@@ -1077,7 +1082,7 @@ function parseAspectToken(token) {
|
|
|
1077
1082
|
function resolveFrameFitAspect(args) {
|
|
1078
1083
|
const requested = args.requestedAspect?.trim();
|
|
1079
1084
|
if (requested && !OPEN_ASPECT_TOKENS.has(requested.toLowerCase())) return requested;
|
|
1080
|
-
const ratios = args.provider ?
|
|
1085
|
+
const ratios = args.provider ? chunkZWEVRMFN_cjs.getModel(args.provider)?.aspectRatios : void 0;
|
|
1081
1086
|
if (!ratios?.length || !(args.sourceWidth > 0) || !(args.sourceHeight > 0)) return void 0;
|
|
1082
1087
|
const source = args.sourceWidth / args.sourceHeight;
|
|
1083
1088
|
let best;
|
|
@@ -1239,5 +1244,5 @@ exports.videoOverlayLayoutNeedsVideoLayer = videoOverlayLayoutNeedsVideoLayer;
|
|
|
1239
1244
|
exports.videoOverlayLayoutPlacesBase = videoOverlayLayoutPlacesBase;
|
|
1240
1245
|
exports.windowAnalysisSchema = windowAnalysisSchema;
|
|
1241
1246
|
exports.wiredCharacterSubjectClips = wiredCharacterSubjectClips;
|
|
1242
|
-
//# sourceMappingURL=chunk-
|
|
1243
|
-
//# sourceMappingURL=chunk-
|
|
1247
|
+
//# sourceMappingURL=chunk-7PC2YHBN.cjs.map
|
|
1248
|
+
//# sourceMappingURL=chunk-7PC2YHBN.cjs.map
|