@nodaro/prompts 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +318 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +594 -25
- package/dist/index.d.ts +594 -25
- package/dist/index.js +306 -14
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/assemble-image-input.test.ts +93 -3
- package/src/__tests__/assemble-video-input.test.ts +301 -0
- package/src/__tests__/direction-hint-token-safety.test.ts +113 -0
- package/src/__tests__/direction-registry.test.ts +393 -0
- package/src/__tests__/image-convergence-image.test.ts +370 -0
- package/src/__tests__/read-node-direction.test.ts +154 -0
- package/src/assemble-image-input.ts +45 -46
- package/src/assemble-video-input.ts +89 -0
- package/src/direction-registry.ts +354 -0
- package/src/index.ts +8 -2
- package/src/prompt-builder.ts +188 -1
- package/src/prompt-hint-join.ts +30 -0
- package/src/read-node-direction.ts +174 -0
package/dist/index.cjs
CHANGED
|
@@ -10477,6 +10477,55 @@ function resolveLocationMentionsHybrid(prompt, tokens, refs, existingUrls) {
|
|
|
10477
10477
|
}
|
|
10478
10478
|
return { prompt: resolvedPrompt, additionalUrls, mentionedLocationSlugs, lockLines, elementDirectives };
|
|
10479
10479
|
}
|
|
10480
|
+
function resolveImageMentionsHybrid(prompt, tokens, refs, existingUrls) {
|
|
10481
|
+
const bySlug = /* @__PURE__ */ new Map();
|
|
10482
|
+
for (const r of refs) {
|
|
10483
|
+
const slug = shared.imageMentionSlugForRef(r);
|
|
10484
|
+
if (!slug) continue;
|
|
10485
|
+
if (!bySlug.has(slug)) bySlug.set(slug, r);
|
|
10486
|
+
}
|
|
10487
|
+
const additionalUrls = [];
|
|
10488
|
+
const refByUrl = /* @__PURE__ */ new Map();
|
|
10489
|
+
const lockOverrideByUrl = /* @__PURE__ */ new Map();
|
|
10490
|
+
const matched = [];
|
|
10491
|
+
for (const t of tokens) {
|
|
10492
|
+
const match = bySlug.get(t.imageSlug);
|
|
10493
|
+
if (!match || !match.url) continue;
|
|
10494
|
+
additionalUrls.push(match.url);
|
|
10495
|
+
refByUrl.set(match.url, match);
|
|
10496
|
+
if (t.lock !== void 0) lockOverrideByUrl.set(match.url, t.lock);
|
|
10497
|
+
const role = (t.role ?? "").trim() || shared.resolveDefaultRole(match.defaultRole, match.defaultUsageMode, match.source);
|
|
10498
|
+
matched.push({ token: t.token, offset: t.offset, url: match.url, role });
|
|
10499
|
+
}
|
|
10500
|
+
const slotByUrl = /* @__PURE__ */ new Map();
|
|
10501
|
+
for (const u of [...existingUrls, ...additionalUrls]) {
|
|
10502
|
+
if (!slotByUrl.has(u)) slotByUrl.set(u, slotByUrl.size + 1);
|
|
10503
|
+
}
|
|
10504
|
+
const bindingFor = (url2) => {
|
|
10505
|
+
const slot = slotByUrl.get(url2);
|
|
10506
|
+
return slot ? `reference image ${slotToLetter(slot)}` : "the reference image";
|
|
10507
|
+
};
|
|
10508
|
+
let resolvedPrompt = prompt;
|
|
10509
|
+
for (const m of [...matched].sort((a, b) => b.offset - a.offset)) {
|
|
10510
|
+
const phrase = shared.roleToPhrase(m.role, bindingFor(m.url));
|
|
10511
|
+
resolvedPrompt = resolvedPrompt.slice(0, m.offset) + phrase + resolvedPrompt.slice(m.offset + m.token.length);
|
|
10512
|
+
}
|
|
10513
|
+
const lockLines = [];
|
|
10514
|
+
const elementDirectives = [];
|
|
10515
|
+
const seenUrls = /* @__PURE__ */ new Set();
|
|
10516
|
+
for (const m of matched) {
|
|
10517
|
+
if (seenUrls.has(m.url)) continue;
|
|
10518
|
+
seenUrls.add(m.url);
|
|
10519
|
+
const ref = refByUrl.get(m.url);
|
|
10520
|
+
if (!ref) continue;
|
|
10521
|
+
const binding = bindingFor(m.url);
|
|
10522
|
+
const lock = buildIdentityLockLine(withForcedIdentityLock(ref, lockOverrideByUrl.get(m.url)), binding);
|
|
10523
|
+
if (lock) lockLines.push(lock);
|
|
10524
|
+
const inject = ref.elementInjection?.trim();
|
|
10525
|
+
if (inject) elementDirectives.push(inject);
|
|
10526
|
+
}
|
|
10527
|
+
return { prompt: resolvedPrompt, additionalUrls, lockLines, elementDirectives };
|
|
10528
|
+
}
|
|
10480
10529
|
function buildCanonicalFallback(refs, mentionedSlugs, startIndex) {
|
|
10481
10530
|
const directiveLines = [];
|
|
10482
10531
|
const urls = [];
|
|
@@ -10859,7 +10908,9 @@ function buildImagePromptInternal(config2, marks) {
|
|
|
10859
10908
|
connectedReferences.map((r) => r.locationSlug).filter((s) => typeof s === "string" && s.length > 0)
|
|
10860
10909
|
)
|
|
10861
10910
|
);
|
|
10862
|
-
|
|
10911
|
+
const knownImageSlugs = shared.knownImageSlugsFromRefs(connectedReferences);
|
|
10912
|
+
const hasImageMentionTokens = isHybrid && knownImageSlugs.length > 0 && shared.findImageMentionTokens(config2.prompt, knownImageSlugs).length > 0;
|
|
10913
|
+
if (knownCharacterSlugs.length > 0 || hasExtraRefs || knownLocationSlugs.length > 0 || hasImageMentionTokens) {
|
|
10863
10914
|
const mentionTokens = knownCharacterSlugs.length > 0 ? shared.findCharacterMentionTokens(config2.prompt, knownCharacterSlugs) : [];
|
|
10864
10915
|
let hybridLockLines = [];
|
|
10865
10916
|
let hybridElementDirectives = [];
|
|
@@ -10913,6 +10964,24 @@ function buildImagePromptInternal(config2, marks) {
|
|
|
10913
10964
|
if (r.locationVariantBucket) return false;
|
|
10914
10965
|
return !mentionedLocationSlugs.has(r.locationSlug);
|
|
10915
10966
|
});
|
|
10967
|
+
let hybridImageLockLines = [];
|
|
10968
|
+
let hybridImageElementDirectives = [];
|
|
10969
|
+
if (hasImageMentionTokens) {
|
|
10970
|
+
const imageTokens = shared.findImageMentionTokens(resolved.prompt, knownImageSlugs);
|
|
10971
|
+
if (imageTokens.length > 0) {
|
|
10972
|
+
const hi = resolveImageMentionsHybrid(
|
|
10973
|
+
resolved.prompt,
|
|
10974
|
+
imageTokens,
|
|
10975
|
+
connectedReferences,
|
|
10976
|
+
[...referenceImageUrls || [], ...resolved.additionalUrls]
|
|
10977
|
+
);
|
|
10978
|
+
resolved.prompt = hi.prompt;
|
|
10979
|
+
resolved.additionalUrls = [...resolved.additionalUrls, ...hi.additionalUrls];
|
|
10980
|
+
hybridImageLockLines = hi.lockLines;
|
|
10981
|
+
hybridImageElementDirectives = hi.elementDirectives;
|
|
10982
|
+
if (hi.additionalUrls.length > 0) hybridBodyConverged = true;
|
|
10983
|
+
}
|
|
10984
|
+
}
|
|
10916
10985
|
const prefixDedupedLength = [
|
|
10917
10986
|
...referenceImageUrls || [],
|
|
10918
10987
|
...resolved.additionalUrls
|
|
@@ -10993,12 +11062,14 @@ ${promptForNext}`;
|
|
|
10993
11062
|
const allLockLines = [.../* @__PURE__ */ new Set([
|
|
10994
11063
|
...hybridLockLines,
|
|
10995
11064
|
...hybridLocationLockLines,
|
|
11065
|
+
...hybridImageLockLines,
|
|
10996
11066
|
...canonical.lockLines,
|
|
10997
11067
|
...extrasRendered.lockLines
|
|
10998
11068
|
])];
|
|
10999
11069
|
const trailingLines = [
|
|
11000
11070
|
...hybridElementDirectives,
|
|
11001
11071
|
...hybridLocationElementDirectives,
|
|
11072
|
+
...hybridImageElementDirectives,
|
|
11002
11073
|
...canonical.phrases,
|
|
11003
11074
|
...canonical.elementDirectives,
|
|
11004
11075
|
...extrasRendered.bodyLines,
|
|
@@ -11622,6 +11693,132 @@ function renderLens(l) {
|
|
|
11622
11693
|
return bits.length > 0 ? `Lens: ${bits.join(", ")}.` : "";
|
|
11623
11694
|
}
|
|
11624
11695
|
|
|
11696
|
+
// src/direction-registry.ts
|
|
11697
|
+
var perId = (full, compact) => (ids, mode) => {
|
|
11698
|
+
const out = [];
|
|
11699
|
+
for (const id of ids) {
|
|
11700
|
+
const frag = mode === "compact" ? compact(id) : full(id);
|
|
11701
|
+
if (frag.length > 0) out.push(frag);
|
|
11702
|
+
}
|
|
11703
|
+
return out;
|
|
11704
|
+
};
|
|
11705
|
+
var viaListBuilder = (build) => (ids, mode) => build(ids.length === 1 ? ids[0] : [...ids], mode).filter((s) => s.length > 0);
|
|
11706
|
+
var viaStringBuilder = (build) => (ids, mode) => {
|
|
11707
|
+
const s = build(ids.length === 1 ? ids[0] : [...ids], mode);
|
|
11708
|
+
return s.length > 0 ? [s] : [];
|
|
11709
|
+
};
|
|
11710
|
+
var viaMood = (ids, mode) => buildMoodHints({ mood: ids.length === 1 ? ids[0] : [...ids] }, mode).filter(
|
|
11711
|
+
(s) => s.length > 0
|
|
11712
|
+
);
|
|
11713
|
+
var framing = perId(getFramingPromptHint, getFramingTerm);
|
|
11714
|
+
var lighting = perId(getLightingPromptHint, getLightingTerm);
|
|
11715
|
+
var exposure = perId(getExposurePromptHint, getExposureTerm);
|
|
11716
|
+
var temporal = perId(getTemporalPromptHint, getTemporalTerm);
|
|
11717
|
+
var DIRECTION_FIELDS = [
|
|
11718
|
+
{ key: "cameraMotion", surface: "video", family: "motion", maxPicks: 1, render: perId(getCameraMotionPromptHint, getCameraMotionTerm) },
|
|
11719
|
+
// Composition (the Framing catalog, one row per category).
|
|
11720
|
+
{ key: "shotSize", surface: "both", family: "look", maxPicks: 1, render: framing },
|
|
11721
|
+
{ key: "angle", surface: "both", family: "look", maxPicks: 1, render: framing },
|
|
11722
|
+
{ key: "coverage", surface: "both", family: "look", maxPicks: 1, render: framing },
|
|
11723
|
+
{ key: "composition", surface: "both", family: "look", maxPicks: 2, render: framing },
|
|
11724
|
+
{ key: "vantage", surface: "both", family: "look", maxPicks: 1, render: framing },
|
|
11725
|
+
{ key: "pose", surface: "both", family: "look", maxPicks: 1, render: perId(getPosePromptHint, getPoseTerm) },
|
|
11726
|
+
{ key: "compositionEffect", surface: "both", family: "look", maxPicks: 1, render: perId(getCompositionEffectPromptHint, getCompositionEffectTerm) },
|
|
11727
|
+
// Camera.
|
|
11728
|
+
{ key: "cameraFormat", surface: "both", family: "look", maxPicks: 1, render: perId(getCameraFormatPromptHint, getCameraFormatTerm) },
|
|
11729
|
+
{ key: "lens", surface: "both", family: "look", maxPicks: 1, render: perId(getLensPromptHint, getLensTerm) },
|
|
11730
|
+
// Exposure (stills only — a video's exposure rides its own temporal levers).
|
|
11731
|
+
{ key: "aperture", surface: "image", family: "look", maxPicks: 1, render: exposure },
|
|
11732
|
+
{ key: "shutterSpeed", surface: "image", family: "look", maxPicks: 1, render: exposure },
|
|
11733
|
+
{ key: "isoValue", surface: "image", family: "look", maxPicks: 1, render: exposure },
|
|
11734
|
+
// Light (the Lighting catalog, one row per category).
|
|
11735
|
+
{ key: "timeOfDay", surface: "both", family: "look", maxPicks: 1, render: lighting },
|
|
11736
|
+
{ key: "lightingStyle", surface: "both", family: "look", maxPicks: 2, render: lighting },
|
|
11737
|
+
{ key: "lightingDirection", surface: "both", family: "look", maxPicks: 1, render: lighting },
|
|
11738
|
+
{ key: "lightingRatio", surface: "both", family: "look", maxPicks: 1, render: lighting },
|
|
11739
|
+
{ key: "colorTemperature", surface: "both", family: "look", maxPicks: 1, render: lighting },
|
|
11740
|
+
{ key: "colorLook", surface: "both", family: "look", maxPicks: 1, render: perId(getColorLookPromptHint, getColorLookTerm) },
|
|
11741
|
+
{ key: "atmosphere", surface: "both", family: "look", maxPicks: 2, render: viaListBuilder(buildAtmosphereHints) },
|
|
11742
|
+
{ key: "postProcess", surface: "image", family: "look", maxPicks: 2, render: viaListBuilder(buildPostProcessHints) },
|
|
11743
|
+
// Style.
|
|
11744
|
+
{ key: "style", surface: "both", family: "look", maxPicks: 1, render: perId(getStylePromptHint, getStyleTerm) },
|
|
11745
|
+
{ key: "mood", surface: "both", family: "look", maxPicks: 2, render: viaMood },
|
|
11746
|
+
{ key: "aesthetic", surface: "both", family: "look", maxPicks: 2, render: viaStringBuilder(buildAestheticHints) },
|
|
11747
|
+
{ key: "photoGenre", surface: "image", family: "look", maxPicks: 1, render: perId(getPhotoGenrePromptHint, getPhotoGenreTerm) },
|
|
11748
|
+
{ key: "photographer", surface: "image", family: "look", maxPicks: 2, render: viaStringBuilder(buildPhotographerHints) },
|
|
11749
|
+
{ key: "renderQuality", surface: "image", family: "look", maxPicks: 1, render: perId(getRenderQualityPromptHint, getRenderQualityTerm) },
|
|
11750
|
+
// Scene.
|
|
11751
|
+
{ key: "setting", surface: "both", family: "look", maxPicks: 1, render: perId(getSettingPromptHint, getSettingTerm) },
|
|
11752
|
+
{ key: "era", surface: "both", family: "look", maxPicks: 1, render: perId(getEraPromptHint, getEraTerm) },
|
|
11753
|
+
{ key: "backdrop", surface: "both", family: "look", maxPicks: 1, render: perId(getBackdropPromptHint, getBackdropTerm) },
|
|
11754
|
+
// Motion & time.
|
|
11755
|
+
{ key: "actionFx", surface: "video", family: "motion", maxPicks: 2, render: viaListBuilder(buildActionFxHints) },
|
|
11756
|
+
{ key: "temporalSpeed", surface: "video", family: "motion", maxPicks: 1, render: temporal },
|
|
11757
|
+
{ key: "temporalFreeze", surface: "video", family: "motion", maxPicks: 1, render: temporal },
|
|
11758
|
+
{ key: "temporalDirection", surface: "video", family: "motion", maxPicks: 1, render: temporal },
|
|
11759
|
+
{ key: "temporalShutter", surface: "video", family: "motion", maxPicks: 1, render: temporal },
|
|
11760
|
+
{ key: "transition", surface: "video", family: "motion", maxPicks: 2, render: perId(getTransitionPromptHint, getTransitionTerm) },
|
|
11761
|
+
{ key: "loopSubject", surface: "video", family: "motion", maxPicks: 1, render: perId(getLoopSubjectPromptHint, getLoopSubjectTerm) },
|
|
11762
|
+
// ── LEGACY BLOCK — see the table doc above. Placed LAST, in today's exact
|
|
11763
|
+
// `composePromptText` order, so every pre-registry caller is byte-identical.
|
|
11764
|
+
{ key: "framingId", surface: "both", family: "look", maxPicks: 1, render: framing },
|
|
11765
|
+
{ key: "framingAngleId", surface: "both", family: "look", maxPicks: 1, render: framing },
|
|
11766
|
+
{ key: "lightingId", surface: "both", family: "look", maxPicks: 1, render: lighting },
|
|
11767
|
+
{ key: "lensId", surface: "both", family: "look", maxPicks: 1, render: perId(getLensPromptHint, getLensTerm) },
|
|
11768
|
+
{ key: "cameraFormatId", surface: "both", family: "look", maxPicks: 1, render: perId(getCameraFormatPromptHint, getCameraFormatTerm) }
|
|
11769
|
+
];
|
|
11770
|
+
var DIRECTION_KEYS = DIRECTION_FIELDS.map((f) => f.key);
|
|
11771
|
+
var IMAGE_HINT_MODE_DEFAULT = "full";
|
|
11772
|
+
var VIDEO_HINT_MODE_DEFAULT = { look: "full", motion: "compact" };
|
|
11773
|
+
function modeForFamily(mode, family) {
|
|
11774
|
+
return typeof mode === "string" ? mode : family === "motion" ? mode.motion : mode.look;
|
|
11775
|
+
}
|
|
11776
|
+
var DIRECTION_ARRAY_CEILING = 8;
|
|
11777
|
+
var DIRECTION_ID_MAX_CHARS = 100;
|
|
11778
|
+
function normalizeDirectionIds(value, maxPicks) {
|
|
11779
|
+
const ids = [];
|
|
11780
|
+
if (typeof value === "string") {
|
|
11781
|
+
if (value) ids.push(value);
|
|
11782
|
+
} else if (Array.isArray(value)) {
|
|
11783
|
+
for (const v of value) {
|
|
11784
|
+
if (ids.length >= maxPicks) break;
|
|
11785
|
+
if (typeof v === "string" && v && !ids.includes(v)) ids.push(v);
|
|
11786
|
+
}
|
|
11787
|
+
}
|
|
11788
|
+
return ids.slice(0, maxPicks);
|
|
11789
|
+
}
|
|
11790
|
+
function directionFieldsForSurface(surface) {
|
|
11791
|
+
return DIRECTION_FIELDS.filter((f) => f.surface === "both" || f.surface === surface);
|
|
11792
|
+
}
|
|
11793
|
+
function renderDirectionHints(direction, opts) {
|
|
11794
|
+
if (!direction) return [];
|
|
11795
|
+
const mode = opts.mode ?? "full";
|
|
11796
|
+
const out = [];
|
|
11797
|
+
const seen = /* @__PURE__ */ new Set();
|
|
11798
|
+
for (const spec of DIRECTION_FIELDS) {
|
|
11799
|
+
if (spec.surface !== "both" && spec.surface !== opts.surface) continue;
|
|
11800
|
+
const ids = normalizeDirectionIds(
|
|
11801
|
+
direction[spec.key],
|
|
11802
|
+
spec.maxPicks
|
|
11803
|
+
);
|
|
11804
|
+
if (ids.length === 0) continue;
|
|
11805
|
+
for (const hint of spec.render(ids, modeForFamily(mode, spec.family))) {
|
|
11806
|
+
if (hint.length > 0 && !seen.has(hint)) {
|
|
11807
|
+
seen.add(hint);
|
|
11808
|
+
out.push(hint);
|
|
11809
|
+
}
|
|
11810
|
+
}
|
|
11811
|
+
}
|
|
11812
|
+
return out;
|
|
11813
|
+
}
|
|
11814
|
+
|
|
11815
|
+
// src/prompt-hint-join.ts
|
|
11816
|
+
var PROMPT_HINT_SEPARATOR = ". ";
|
|
11817
|
+
function joinPromptHints(userPrompt, hints) {
|
|
11818
|
+
if (hints.length === 0) return userPrompt;
|
|
11819
|
+
return [userPrompt.trim(), ...hints].filter((p) => p.length > 0).join(PROMPT_HINT_SEPARATOR);
|
|
11820
|
+
}
|
|
11821
|
+
|
|
11625
11822
|
// src/ref-binding.ts
|
|
11626
11823
|
function identityRefsSentence(firstOrdinal, lastOrdinal) {
|
|
11627
11824
|
return firstOrdinal === lastOrdinal ? `${REF_BINDING.ordinal(firstOrdinal)} is an identity reference for this shot's subjects \u2014 match its subject's exact appearance; it is not a frame.` : `${REF_BINDING.ordinal(firstOrdinal)} through ${REF_BINDING.ordinal(lastOrdinal)} are identity references for this shot's subjects \u2014 match each subject's exact appearance; they are not frames.`;
|
|
@@ -12209,15 +12406,10 @@ function assembleSunoInput(input) {
|
|
|
12209
12406
|
// src/assemble-image-input.ts
|
|
12210
12407
|
function composePromptText(userPrompt, direction, structured) {
|
|
12211
12408
|
const hints = [
|
|
12212
|
-
|
|
12213
|
-
getFramingPromptHint(direction?.framingAngleId),
|
|
12214
|
-
getLightingPromptHint(direction?.lightingId),
|
|
12215
|
-
getLensPromptHint(direction?.lensId),
|
|
12216
|
-
getCameraFormatPromptHint(direction?.cameraFormatId),
|
|
12409
|
+
...renderDirectionHints(direction, { surface: "image", mode: IMAGE_HINT_MODE_DEFAULT }),
|
|
12217
12410
|
structured ? renderStructuredFields(structured) : ""
|
|
12218
12411
|
].filter((p) => p.length > 0);
|
|
12219
|
-
|
|
12220
|
-
return [userPrompt.trim(), ...hints].filter((p) => p.length > 0).join(". ");
|
|
12412
|
+
return joinPromptHints(userPrompt, hints);
|
|
12221
12413
|
}
|
|
12222
12414
|
function assembleImageInput(input) {
|
|
12223
12415
|
const prompt = composePromptText(input.userPrompt, input.direction, input.structured);
|
|
@@ -12252,6 +12444,106 @@ function assembleImageInput(input) {
|
|
|
12252
12444
|
}
|
|
12253
12445
|
return result;
|
|
12254
12446
|
}
|
|
12447
|
+
|
|
12448
|
+
// src/assemble-video-input.ts
|
|
12449
|
+
function composeVideoPromptText(userPrompt, direction, structured, opts) {
|
|
12450
|
+
const hints = [
|
|
12451
|
+
...renderDirectionHints(direction, {
|
|
12452
|
+
surface: "video",
|
|
12453
|
+
mode: opts?.hintMode ?? VIDEO_HINT_MODE_DEFAULT
|
|
12454
|
+
}),
|
|
12455
|
+
structured ? renderStructuredFields(structured) : ""
|
|
12456
|
+
].filter((p) => p.length > 0);
|
|
12457
|
+
if (hints.length === 0) return userPrompt;
|
|
12458
|
+
return joinPromptHints(userPrompt ?? "", hints);
|
|
12459
|
+
}
|
|
12460
|
+
|
|
12461
|
+
// src/read-node-direction.ts
|
|
12462
|
+
function readDirectionFields(value) {
|
|
12463
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
12464
|
+
const src = value;
|
|
12465
|
+
const out = {};
|
|
12466
|
+
for (const spec of DIRECTION_FIELDS) {
|
|
12467
|
+
const v = src[spec.key];
|
|
12468
|
+
if (typeof v === "string") {
|
|
12469
|
+
if (v.length > 0 && v.length <= DIRECTION_ID_MAX_CHARS) out[spec.key] = v;
|
|
12470
|
+
} else if (Array.isArray(v)) {
|
|
12471
|
+
const kept = [];
|
|
12472
|
+
for (const x of v) {
|
|
12473
|
+
if (kept.length >= DIRECTION_ARRAY_CEILING) break;
|
|
12474
|
+
if (typeof x === "string" && x.length > 0 && x.length <= DIRECTION_ID_MAX_CHARS) {
|
|
12475
|
+
kept.push(x);
|
|
12476
|
+
}
|
|
12477
|
+
}
|
|
12478
|
+
if (kept.length > 0) out[spec.key] = kept;
|
|
12479
|
+
}
|
|
12480
|
+
}
|
|
12481
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
12482
|
+
}
|
|
12483
|
+
var GENDERS = ["man", "woman", "child", "non-binary"];
|
|
12484
|
+
var MAX_STRUCTURED_VALUE_CHARS = 200;
|
|
12485
|
+
var PERSON_FIELDS2 = {
|
|
12486
|
+
age: "number",
|
|
12487
|
+
gender: "gender",
|
|
12488
|
+
hair: "string",
|
|
12489
|
+
eyes: "string",
|
|
12490
|
+
expression: "string",
|
|
12491
|
+
profession: "string",
|
|
12492
|
+
warriorType: "string"
|
|
12493
|
+
};
|
|
12494
|
+
var STYLING_FIELDS2 = {
|
|
12495
|
+
mood: "string",
|
|
12496
|
+
lighting: "string",
|
|
12497
|
+
aesthetic: "string",
|
|
12498
|
+
colorLook: "string"
|
|
12499
|
+
};
|
|
12500
|
+
var SETTING_FIELDS = {
|
|
12501
|
+
era: "string",
|
|
12502
|
+
atmosphere: "string",
|
|
12503
|
+
backdrop: "string"
|
|
12504
|
+
};
|
|
12505
|
+
var CAMERA_FIELDS = {
|
|
12506
|
+
framing: "string",
|
|
12507
|
+
motion: "string",
|
|
12508
|
+
format: "string"
|
|
12509
|
+
};
|
|
12510
|
+
var LENS_FIELDS = { focalLength: "string", aperture: "string" };
|
|
12511
|
+
var STRUCTURED_GROUPS = {
|
|
12512
|
+
person: PERSON_FIELDS2,
|
|
12513
|
+
styling: STYLING_FIELDS2,
|
|
12514
|
+
setting: SETTING_FIELDS,
|
|
12515
|
+
camera: CAMERA_FIELDS,
|
|
12516
|
+
lens: LENS_FIELDS
|
|
12517
|
+
};
|
|
12518
|
+
function readField(v, kind) {
|
|
12519
|
+
if (kind === "number") return typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
12520
|
+
if (typeof v !== "string" || v.length === 0 || v.length > MAX_STRUCTURED_VALUE_CHARS) {
|
|
12521
|
+
return void 0;
|
|
12522
|
+
}
|
|
12523
|
+
if (kind === "gender") return GENDERS.includes(v) ? v : void 0;
|
|
12524
|
+
return v;
|
|
12525
|
+
}
|
|
12526
|
+
function readStructuredFields(value) {
|
|
12527
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
12528
|
+
const src = value;
|
|
12529
|
+
const out = {};
|
|
12530
|
+
for (const group of Object.keys(STRUCTURED_GROUPS)) {
|
|
12531
|
+
const raw = src[group];
|
|
12532
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) continue;
|
|
12533
|
+
const rawRec = raw;
|
|
12534
|
+
const kept = {};
|
|
12535
|
+
for (const [field, kind] of Object.entries(
|
|
12536
|
+
STRUCTURED_GROUPS[group]
|
|
12537
|
+
)) {
|
|
12538
|
+
const v = readField(rawRec[field], kind);
|
|
12539
|
+
if (v !== void 0) kept[field] = v;
|
|
12540
|
+
}
|
|
12541
|
+
if (Object.keys(kept).length > 0) out[group] = kept;
|
|
12542
|
+
}
|
|
12543
|
+
const mood = readField(src.mood, "string");
|
|
12544
|
+
if (mood !== void 0) out.mood = mood;
|
|
12545
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
12546
|
+
}
|
|
12255
12547
|
var clean = (u) => {
|
|
12256
12548
|
const t = u?.trim();
|
|
12257
12549
|
return t && t.length > 0 ? t : void 0;
|
|
@@ -33268,8 +33560,8 @@ var SINGLE_PICKER_WIRING = [
|
|
|
33268
33560
|
{ kind: "single", nodeType: "furniture", label: "Furniture", valueField: "furniture", defaultValue: "sofa", catalogId: "furniture", entries: mapCat(shared.FURNITURE, "subcategory"), groupOrder: shared.FURNITURE_SUBCATEGORY_ORDER, groupLabels: shared.FURNITURE_SUBCATEGORY_LABELS },
|
|
33269
33561
|
{ kind: "single", nodeType: "held-prop", label: "Held Prop", valueField: "heldProp", defaultValue: "smartphone", catalogId: "held-prop", entries: mapCat(HELD_PROPS, "category"), groupOrder: HELD_PROP_CATEGORY_ORDER, groupLabels: HELD_PROP_CATEGORY_LABELS }
|
|
33270
33562
|
];
|
|
33271
|
-
var
|
|
33272
|
-
var
|
|
33563
|
+
var STYLING_FIELDS3 = STYLING_DIMENSION_ORDER.map((d) => STYLING_FIELD_BY_DIMENSION[d]);
|
|
33564
|
+
var PERSON_FIELDS3 = PERSON_DIMENSION_ORDER.map((d) => PERSON_FIELD_BY_DIMENSION[d]);
|
|
33273
33565
|
var LIGHTING_FIELDS2 = LIGHTING_CATEGORY_ORDER.map((c) => LIGHTING_FIELD_BY_CATEGORY[c]);
|
|
33274
33566
|
var TEMPORAL_FIELD_BY_CATEGORY2 = {
|
|
33275
33567
|
speed: "temporalSpeed",
|
|
@@ -33305,7 +33597,7 @@ var MULTI_PICKER_WIRING = [
|
|
|
33305
33597
|
kind: "multi",
|
|
33306
33598
|
nodeType: "person",
|
|
33307
33599
|
label: "Person",
|
|
33308
|
-
fields:
|
|
33600
|
+
fields: PERSON_FIELDS3,
|
|
33309
33601
|
catalogId: "person",
|
|
33310
33602
|
catalogEntries: flatCat(PEOPLE),
|
|
33311
33603
|
fieldOptions: optionsByDiscriminator(PEOPLE, (e) => e.dimension, PERSON_FIELD_BY_DIMENSION)
|
|
@@ -33314,7 +33606,7 @@ var MULTI_PICKER_WIRING = [
|
|
|
33314
33606
|
kind: "multi",
|
|
33315
33607
|
nodeType: "styling",
|
|
33316
33608
|
label: "Styling",
|
|
33317
|
-
fields:
|
|
33609
|
+
fields: STYLING_FIELDS3,
|
|
33318
33610
|
catalogId: "styling",
|
|
33319
33611
|
catalogEntries: flatCat(STYLINGS),
|
|
33320
33612
|
fieldOptions: optionsByDiscriminator(STYLINGS, (e) => e.dimension, STYLING_FIELD_BY_DIMENSION)
|
|
@@ -33496,6 +33788,10 @@ exports.COMPOSITION_EFFECTS = COMPOSITION_EFFECTS;
|
|
|
33496
33788
|
exports.COMPOSITION_EFFECT_IDS = COMPOSITION_EFFECT_IDS;
|
|
33497
33789
|
exports.DEFAULT_IDENTITY_LOCK = DEFAULT_IDENTITY_LOCK;
|
|
33498
33790
|
exports.DEFAULT_TEMPLATES = DEFAULT_TEMPLATES;
|
|
33791
|
+
exports.DIRECTION_ARRAY_CEILING = DIRECTION_ARRAY_CEILING;
|
|
33792
|
+
exports.DIRECTION_FIELDS = DIRECTION_FIELDS;
|
|
33793
|
+
exports.DIRECTION_ID_MAX_CHARS = DIRECTION_ID_MAX_CHARS;
|
|
33794
|
+
exports.DIRECTION_KEYS = DIRECTION_KEYS;
|
|
33499
33795
|
exports.ERAS = ERAS;
|
|
33500
33796
|
exports.ERA_CATEGORY_LABELS = ERA_CATEGORY_LABELS;
|
|
33501
33797
|
exports.ERA_CATEGORY_ORDER = ERA_CATEGORY_ORDER;
|
|
@@ -33518,6 +33814,7 @@ exports.HELD_PROPS = HELD_PROPS;
|
|
|
33518
33814
|
exports.HELD_PROP_CATEGORY_LABELS = HELD_PROP_CATEGORY_LABELS;
|
|
33519
33815
|
exports.HELD_PROP_CATEGORY_ORDER = HELD_PROP_CATEGORY_ORDER;
|
|
33520
33816
|
exports.HELD_PROP_IDS = HELD_PROP_IDS;
|
|
33817
|
+
exports.IMAGE_HINT_MODE_DEFAULT = IMAGE_HINT_MODE_DEFAULT;
|
|
33521
33818
|
exports.IMAGE_REFERENCE_PROMPT_DOCTRINE = IMAGE_REFERENCE_PROMPT_DOCTRINE;
|
|
33522
33819
|
exports.IMAGE_WIZARD_CATEGORIES = IMAGE_WIZARD_CATEGORIES;
|
|
33523
33820
|
exports.INSTRUMENTATION_DEFAULT_DATA = INSTRUMENTATION_DEFAULT_DATA;
|
|
@@ -33595,6 +33892,7 @@ exports.POST_PROCESS_EFFECT_IDS = POST_PROCESS_EFFECT_IDS;
|
|
|
33595
33892
|
exports.PRODUCTION_STYLES = PRODUCTION_STYLES;
|
|
33596
33893
|
exports.PROMPT_AFFIX_CORE_FIELD_OVERRIDES = PROMPT_AFFIX_CORE_FIELD_OVERRIDES;
|
|
33597
33894
|
exports.PROMPT_AFFIX_NODE_TYPES = PROMPT_AFFIX_NODE_TYPES;
|
|
33895
|
+
exports.PROMPT_HINT_SEPARATOR = PROMPT_HINT_SEPARATOR;
|
|
33598
33896
|
exports.PROVIDER_CAPABILITIES = PROVIDER_CAPABILITIES;
|
|
33599
33897
|
exports.PROVIDER_PROMPT_DOCTRINES = PROVIDER_PROMPT_DOCTRINES;
|
|
33600
33898
|
exports.REFERENCE_IMAGE_ROLES = REFERENCE_IMAGE_ROLES;
|
|
@@ -33634,6 +33932,7 @@ exports.TRANSITION_DURATIONS = TRANSITION_DURATIONS;
|
|
|
33634
33932
|
exports.TRANSITION_IDS = TRANSITION_IDS;
|
|
33635
33933
|
exports.TRANSITION_INTENSITIES = TRANSITION_INTENSITIES;
|
|
33636
33934
|
exports.TRANSITION_POSITIONS = TRANSITION_POSITIONS;
|
|
33935
|
+
exports.VIDEO_HINT_MODE_DEFAULT = VIDEO_HINT_MODE_DEFAULT;
|
|
33637
33936
|
exports.VIDEO_WIZARD_CATEGORIES = VIDEO_WIZARD_CATEGORIES;
|
|
33638
33937
|
exports.VOCAL_PRESENCE = VOCAL_PRESENCE;
|
|
33639
33938
|
exports.VOCAL_PRESENCE_INSTRUMENTAL_ID = VOCAL_PRESENCE_INSTRUMENTAL_ID;
|
|
@@ -33731,10 +34030,12 @@ exports.composeNegative = composeNegative;
|
|
|
33731
34030
|
exports.composePickerCatalogs = composePickerCatalogs;
|
|
33732
34031
|
exports.composeSoundHintFromConnections = composeSoundHintFromConnections;
|
|
33733
34032
|
exports.composeTransitionHintFromConnections = composeTransitionHintFromConnections;
|
|
34033
|
+
exports.composeVideoPromptText = composeVideoPromptText;
|
|
33734
34034
|
exports.computeLlmChatFields = computeLlmChatFields;
|
|
33735
34035
|
exports.computeNodePrompt = computeNodePrompt;
|
|
33736
34036
|
exports.computePackSidecarCoverage = computePackSidecarCoverage;
|
|
33737
34037
|
exports.deriveTerm = deriveTerm;
|
|
34038
|
+
exports.directionFieldsForSurface = directionFieldsForSurface;
|
|
33738
34039
|
exports.expandImagePositionRefs = expandImagePositionRefs;
|
|
33739
34040
|
exports.expandImageRefTokens = expandImageRefTokens;
|
|
33740
34041
|
exports.filmStillPrefix = filmStillPrefix;
|
|
@@ -33925,9 +34226,11 @@ exports.isInstrumentalVocal = isInstrumentalVocal;
|
|
|
33925
34226
|
exports.isSuspiciousDerivedTerm = isSuspiciousDerivedTerm;
|
|
33926
34227
|
exports.isVantageFraming = isVantageFraming;
|
|
33927
34228
|
exports.isWizardSupported = isWizardSupported;
|
|
34229
|
+
exports.joinPromptHints = joinPromptHints;
|
|
33928
34230
|
exports.joinPromptParts = joinPromptParts;
|
|
33929
34231
|
exports.listPickerCatalogs = listPickerCatalogs;
|
|
33930
34232
|
exports.migratePersonValue = migratePersonValue;
|
|
34233
|
+
exports.modeForFamily = modeForFamily;
|
|
33931
34234
|
exports.nodeHasInlinePrompt = nodeHasInlinePrompt;
|
|
33932
34235
|
exports.nodeHasPromptField = nodeHasPromptField;
|
|
33933
34236
|
exports.nodeSupportsPromptAffixes = nodeSupportsPromptAffixes;
|
|
@@ -33939,9 +34242,12 @@ exports.promptAffixCoreField = promptAffixCoreField;
|
|
|
33939
34242
|
exports.promptBindsFirstFrame = promptBindsFirstFrame;
|
|
33940
34243
|
exports.promptFieldCarriesAffixes = promptFieldCarriesAffixes;
|
|
33941
34244
|
exports.promptPartSeparator = promptPartSeparator;
|
|
34245
|
+
exports.readDirectionFields = readDirectionFields;
|
|
34246
|
+
exports.readStructuredFields = readStructuredFields;
|
|
33942
34247
|
exports.referenceRulesBlock = referenceRulesBlock;
|
|
33943
34248
|
exports.registerCatalogPack = registerCatalogPack;
|
|
33944
34249
|
exports.registerPersonPack = registerPersonPack;
|
|
34250
|
+
exports.renderDirectionHints = renderDirectionHints;
|
|
33945
34251
|
exports.renderStructuredFields = renderStructuredFields;
|
|
33946
34252
|
exports.resetCatalogPacks = resetCatalogPacks;
|
|
33947
34253
|
exports.resetPersonPacks = resetPersonPacks;
|