@nodaro/shared 2.27.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3372,7 +3372,13 @@ var ASPECT_RATIO_DIMENSIONS = {
3372
3372
  "16:9": { width: 1920, height: 1080 },
3373
3373
  "9:16": { width: 1080, height: 1920 },
3374
3374
  "1:1": { width: 1080, height: 1080 },
3375
- "4:5": { width: 1080, height: 1350 }
3375
+ "4:5": { width: 1080, height: 1350 },
3376
+ // Ultra-wide. 1680x720 rather than a 1920-wide pair because the Scene3D v2
3377
+ // admission bounds require even integers on both axes and 1920/(21/9) is
3378
+ // odd; 1680x720 is the pair the scene contract names as supported. Additive:
3379
+ // every consumer here is a keyed lookup with a fallback, and a node only
3380
+ // reaches this entry if its own aspect enum offers 21:9 (today, Pro 3D).
3381
+ "21:9": { width: 1680, height: 720 }
3376
3382
  };
3377
3383
  var MOTION_TRANSFER_PROVIDERS = [
3378
3384
  "kling",
@@ -4138,7 +4144,11 @@ var COMPOSER_PLAN_MAP = {
4138
4144
  // validated `Scene3DPlan` revision on their `composition` handle, so
4139
4145
  // render-video routes either one to the `3d-scene` renderer unchanged.
4140
4146
  "generate-3d-scene": { planType: "3d-scene", planField: "scenePlan" },
4141
- "edit-3d-scene": { planType: "3d-scene", planField: "scenePlan" }
4147
+ "edit-3d-scene": { planType: "3d-scene", planField: "scenePlan" },
4148
+ // 3D Render Pro authors the SAME `scenePlan` revision (v2) alongside its
4149
+ // MP4, so the render-only re-run reads it through this map exactly as it
4150
+ // reads a Basic revision — no second plan lane, no second render path.
4151
+ "pro-3d-render": { planType: "3d-scene", planField: "scenePlan" }
4142
4152
  };
4143
4153
  var COMPOSER_PLAN_FIELDS = [
4144
4154
  ...new Set(Object.values(COMPOSER_PLAN_MAP).map((m) => m.planField))
@@ -5016,6 +5026,157 @@ function resolveTopazUpscale(input) {
5016
5026
  };
5017
5027
  }
5018
5028
 
5029
+ // src/producer-types.ts
5030
+ var VIDEO_PRODUCER_TYPES = /* @__PURE__ */ new Set([
5031
+ "image-to-video",
5032
+ "video-to-video",
5033
+ "switchx",
5034
+ // Beeble SwitchX relight/composite
5035
+ "text-to-video",
5036
+ // Unified video node — emits videoUrl identically to i2v/t2v (its payload-builder
5037
+ // case dispatches dynamically to "image-to-video" or "text-to-video" jobName based
5038
+ // on whether a start frame is wired). Without this, getPrimaryOutput would fall
5039
+ // through to the imageUrl/videoUrl/audioUrl/text default and downstream consumers
5040
+ // could silently misroute the output.
5041
+ "generate-video",
5042
+ // Generate Video Pro — Seedance-2-family multi-segment stitch variant of
5043
+ // generate-video (same "emits videoUrl" contract; a trimmed provider +
5044
+ // handle set). Must mirror generate-video here or its output can't connect
5045
+ // downstream (the recurring "cannot connect the outputs" bug class).
5046
+ "generate-video-pro",
5047
+ // Edit Video Pro — Seedance-2-family span-replace sibling of generate-
5048
+ // video-pro (same "emits videoUrl" contract; source video + prompt in,
5049
+ // ONE video out). Must mirror generate-video-pro here or its output can't
5050
+ // connect downstream (the recurring "cannot connect the outputs" bug class).
5051
+ "edit-video-pro",
5052
+ "upload-video",
5053
+ "youtube-video",
5054
+ "combine-videos",
5055
+ "lip-sync",
5056
+ "speech-to-video",
5057
+ "motion-transfer",
5058
+ "video-upscale",
5059
+ "extend-video",
5060
+ // face-swap output is video (writes generatedVideoUrl, per-result `url`).
5061
+ // Frontend execution-graph already includes it in VIDEO_SOURCE_TYPES; this
5062
+ // entry brings the shared set in line so canvas typed-handle validation
5063
+ // doesn't reject face-swap → video-consumer edges that the orchestrator
5064
+ // would happily route at runtime.
5065
+ "face-swap",
5066
+ "video-retake",
5067
+ // video-sfx: adds an SFX track to a video → emits a video URL. Belongs here so
5068
+ // canvas handle validation accepts video-sfx → video-consumer edges and the
5069
+ // backend routes its output as video (it was previously relying on a fallback).
5070
+ "video-sfx",
5071
+ "suno-music-video",
5072
+ "merge-video-audio",
5073
+ "add-captions",
5074
+ "resize-video",
5075
+ "social-media-format",
5076
+ "trim-video",
5077
+ "render-video",
5078
+ "speed-ramp",
5079
+ "loop-video",
5080
+ "fade-video",
5081
+ "transcode-video",
5082
+ "manual-edit",
5083
+ // Remove Audio: strips the audio track, emits a silent video.
5084
+ "remove-audio",
5085
+ // AI Avatar (HeyGen): avatar + voice/audio → video.
5086
+ "ai-avatar",
5087
+ // Cinematic Avatar (HeyGen cinematic_avatar): prompt + 1–3 avatar looks → video.
5088
+ "cinematic-avatar",
5089
+ // Assemble Narrated Video: fits N (clip, voice) blocks into one MP4 → video.
5090
+ "assemble-narrated-video",
5091
+ // Still to Video: one still image + one audio track → MP4 (local FFmpeg,
5092
+ // no provider). Emits generatedVideoUrl like every other ffmpeg video node.
5093
+ "still-to-video",
5094
+ // Slideshow: 2-100 stills + one optional audio track → MP4 (local FFmpeg,
5095
+ // no provider). Same contract; images arrive via the image-collage lane.
5096
+ "slideshow",
5097
+ // GIF to Video: animated GIF → H.264 MP4 (local FFmpeg, no provider).
5098
+ // Emits generatedVideoUrl so it connects to any downstream video consumer
5099
+ // (e.g. a Seedance video-reference input) by an ordinary edge.
5100
+ "gif-to-video",
5101
+ // 3D Render Pro: authors a scene AND exports it in one operation, settling
5102
+ // with the standard `videoUrl` field. It is a video producer as much as it
5103
+ // is a composition producer — omitting it here is the "cannot connect the
5104
+ // outputs" bug, and its `composition` handle is typed separately.
5105
+ "pro-3d-render"
5106
+ ]);
5107
+ var DYNAMIC_PRODUCER_TYPES = /* @__PURE__ */ new Set([
5108
+ "list",
5109
+ "sub-workflow",
5110
+ "adjust-volume",
5111
+ // Dual-mode: audio in → audio out; video in → video out (+ revoiced audio).
5112
+ // Listed here so canvas validators accept its output on BOTH audio and video
5113
+ // input handles (it also stays in AUDIO_PRODUCER_TYPES as its default).
5114
+ "voice-changer",
5115
+ // voice-changer-pro (renamed from voice-recast in #3581) is a behavioral
5116
+ // twin of voice-changer — identical dual-mode output. Must mirror it in
5117
+ // EVERY producer set or its outputs can't connect (was the "cannot connect
5118
+ // the outputs of voice-changer-pro" bug). Guarded by producer-types.test.ts.
5119
+ "voice-changer-pro",
5120
+ // Dubbing joined the dual-mode family with the full-surface upgrade:
5121
+ // audio in → dubbed audio; video in (or a video sourceUrl) → dubbed VIDEO
5122
+ // (+ audio sidecar). Same wiring contract as voice-changer; stays in
5123
+ // AUDIO_PRODUCER_TYPES as its default. Explicitly asserted in
5124
+ // producer-types.test.ts (the suite does not fail on omission).
5125
+ "dubbing",
5126
+ "reduce",
5127
+ // Dual-output time chunker (UI label "Split into Chunks"; type id stays
5128
+ // "split-media"): video in → video chunks, audio in → audio chunks — two
5129
+ // independent lanes on two output handles. Like voice-changer, the canvas
5130
+ // validator only sees the source NODE type, not which handle a wire leaves,
5131
+ // so it lives here to be accepted on BOTH audio and video input handles. The
5132
+ // backend routes the correct lane by sourceHandle in getPrimaryOutput
5133
+ // (output-extractor.ts); the frontend does so in extractNodeOutput.
5134
+ "split-media"
5135
+ ]);
5136
+ var AUDIO_PRODUCER_TYPES = /* @__PURE__ */ new Set([
5137
+ "text-to-speech",
5138
+ "text-to-audio",
5139
+ "generate-music",
5140
+ "upload-audio",
5141
+ "suno-generate",
5142
+ "suno-cover",
5143
+ "suno-extend",
5144
+ "suno-separate",
5145
+ "audio-separation",
5146
+ "suno-mashup",
5147
+ "suno-replace-section",
5148
+ "suno-add-instrumental",
5149
+ "suno-add-vocals",
5150
+ "suno-convert-wav",
5151
+ "suno-upload-extend",
5152
+ "trim-audio",
5153
+ "mix-audio",
5154
+ "combine-audio",
5155
+ "adjust-volume",
5156
+ "audio-fx",
5157
+ "reference-audio",
5158
+ "audio-isolation",
5159
+ "text-to-dialogue",
5160
+ "voice-changer",
5161
+ // Twin of voice-changer (see DYNAMIC_PRODUCER_TYPES note). Audio is its
5162
+ // default output mode; video mode is handled via DYNAMIC membership.
5163
+ "voice-changer-pro",
5164
+ "dubbing",
5165
+ "voice-remix",
5166
+ "voice-design",
5167
+ // Extract Audio: demuxes a video's audio track to a standalone MP3.
5168
+ "extract-audio"
5169
+ ]);
5170
+ var FAN_OUT_EACH_TYPES = /* @__PURE__ */ new Set([
5171
+ "list",
5172
+ "split-text",
5173
+ "filter-list",
5174
+ "deduplicate",
5175
+ "merge-lists",
5176
+ "sort-list",
5177
+ "selector"
5178
+ ]);
5179
+
5019
5180
  // src/presentation-utils.ts
5020
5181
  var INPUT_NODE_TYPES = /* @__PURE__ */ new Set([
5021
5182
  "text-prompt",
@@ -5193,7 +5354,7 @@ function getOutputNodes(nodes, edges, curatedOnly = true) {
5193
5354
  if (n.data.presentationOutput === true) return true;
5194
5355
  if (n.data.presentationVisible === true) {
5195
5356
  if (NON_OUTPUT_TYPES.has(n.type)) return false;
5196
- return !nodesWithOutgoing.has(n.id) || MEDIA_PRODUCING_TYPES.has(n.type);
5357
+ return !nodesWithOutgoing.has(n.id) || isMediaProducingType(n.type);
5197
5358
  }
5198
5359
  return false;
5199
5360
  }
@@ -5206,8 +5367,15 @@ function getOutputType(nodeType) {
5206
5367
  if (VIDEO_OUTPUT_TYPES.has(nodeType)) return "video";
5207
5368
  if (AUDIO_OUTPUT_TYPES.has(nodeType)) return "audio";
5208
5369
  if (TEXT_OUTPUT_TYPES.has(nodeType)) return "text";
5370
+ if (VIDEO_PRODUCER_TYPES.has(nodeType)) return "video";
5371
+ if (AUDIO_PRODUCER_TYPES.has(nodeType)) return "audio";
5209
5372
  return "data";
5210
5373
  }
5374
+ function isMediaProducingType(nodeType) {
5375
+ if (MEDIA_PRODUCING_TYPES.has(nodeType)) return true;
5376
+ const output = getOutputType(nodeType);
5377
+ return output === "image" || output === "video" || output === "audio";
5378
+ }
5211
5379
  function getNodeResult(nodeData) {
5212
5380
  const previewItems = nodeData.previewItems;
5213
5381
  if (previewItems && previewItems.length > 0) {
@@ -8776,6 +8944,7 @@ var NODE_MAPPABLE_FIELDS = {
8776
8944
  "3d-title": ["titlePrompt"],
8777
8945
  "generate-3d-scene": ["scenePrompt"],
8778
8946
  "edit-3d-scene": ["editPrompt"],
8947
+ "pro-3d-render": ["scenePrompt"],
8779
8948
  "motion-graphics": ["motionPrompt"],
8780
8949
  "generate-script": ["styleGuide"],
8781
8950
  "speech-to-video": ["prompt", "negativePrompt"],
@@ -12913,154 +13082,8 @@ function resolveAudioCrossfadeCurve(id) {
12913
13082
  return CURVES_BY_ID.get(id)?.ffmpeg ?? "tri";
12914
13083
  }
12915
13084
 
12916
- // src/producer-types.ts
12917
- var VIDEO_PRODUCER_TYPES = /* @__PURE__ */ new Set([
12918
- "image-to-video",
12919
- "video-to-video",
12920
- "switchx",
12921
- // Beeble SwitchX relight/composite
12922
- "text-to-video",
12923
- // Unified video node — emits videoUrl identically to i2v/t2v (its payload-builder
12924
- // case dispatches dynamically to "image-to-video" or "text-to-video" jobName based
12925
- // on whether a start frame is wired). Without this, getPrimaryOutput would fall
12926
- // through to the imageUrl/videoUrl/audioUrl/text default and downstream consumers
12927
- // could silently misroute the output.
12928
- "generate-video",
12929
- // Generate Video Pro — Seedance-2-family multi-segment stitch variant of
12930
- // generate-video (same "emits videoUrl" contract; a trimmed provider +
12931
- // handle set). Must mirror generate-video here or its output can't connect
12932
- // downstream (the recurring "cannot connect the outputs" bug class).
12933
- "generate-video-pro",
12934
- // Edit Video Pro — Seedance-2-family span-replace sibling of generate-
12935
- // video-pro (same "emits videoUrl" contract; source video + prompt in,
12936
- // ONE video out). Must mirror generate-video-pro here or its output can't
12937
- // connect downstream (the recurring "cannot connect the outputs" bug class).
12938
- "edit-video-pro",
12939
- "upload-video",
12940
- "youtube-video",
12941
- "combine-videos",
12942
- "lip-sync",
12943
- "speech-to-video",
12944
- "motion-transfer",
12945
- "video-upscale",
12946
- "extend-video",
12947
- // face-swap output is video (writes generatedVideoUrl, per-result `url`).
12948
- // Frontend execution-graph already includes it in VIDEO_SOURCE_TYPES; this
12949
- // entry brings the shared set in line so canvas typed-handle validation
12950
- // doesn't reject face-swap → video-consumer edges that the orchestrator
12951
- // would happily route at runtime.
12952
- "face-swap",
12953
- "video-retake",
12954
- // video-sfx: adds an SFX track to a video → emits a video URL. Belongs here so
12955
- // canvas handle validation accepts video-sfx → video-consumer edges and the
12956
- // backend routes its output as video (it was previously relying on a fallback).
12957
- "video-sfx",
12958
- "suno-music-video",
12959
- "merge-video-audio",
12960
- "add-captions",
12961
- "resize-video",
12962
- "social-media-format",
12963
- "trim-video",
12964
- "render-video",
12965
- "speed-ramp",
12966
- "loop-video",
12967
- "fade-video",
12968
- "transcode-video",
12969
- "manual-edit",
12970
- // Remove Audio: strips the audio track, emits a silent video.
12971
- "remove-audio",
12972
- // AI Avatar (HeyGen): avatar + voice/audio → video.
12973
- "ai-avatar",
12974
- // Cinematic Avatar (HeyGen cinematic_avatar): prompt + 1–3 avatar looks → video.
12975
- "cinematic-avatar",
12976
- // Assemble Narrated Video: fits N (clip, voice) blocks into one MP4 → video.
12977
- "assemble-narrated-video",
12978
- // Still to Video: one still image + one audio track → MP4 (local FFmpeg,
12979
- // no provider). Emits generatedVideoUrl like every other ffmpeg video node.
12980
- "still-to-video",
12981
- // Slideshow: 2-100 stills + one optional audio track → MP4 (local FFmpeg,
12982
- // no provider). Same contract; images arrive via the image-collage lane.
12983
- "slideshow",
12984
- // GIF to Video: animated GIF → H.264 MP4 (local FFmpeg, no provider).
12985
- // Emits generatedVideoUrl so it connects to any downstream video consumer
12986
- // (e.g. a Seedance video-reference input) by an ordinary edge.
12987
- "gif-to-video"
12988
- ]);
12989
- var DYNAMIC_PRODUCER_TYPES = /* @__PURE__ */ new Set([
12990
- "list",
12991
- "sub-workflow",
12992
- "adjust-volume",
12993
- // Dual-mode: audio in → audio out; video in → video out (+ revoiced audio).
12994
- // Listed here so canvas validators accept its output on BOTH audio and video
12995
- // input handles (it also stays in AUDIO_PRODUCER_TYPES as its default).
12996
- "voice-changer",
12997
- // voice-changer-pro (renamed from voice-recast in #3581) is a behavioral
12998
- // twin of voice-changer — identical dual-mode output. Must mirror it in
12999
- // EVERY producer set or its outputs can't connect (was the "cannot connect
13000
- // the outputs of voice-changer-pro" bug). Guarded by producer-types.test.ts.
13001
- "voice-changer-pro",
13002
- // Dubbing joined the dual-mode family with the full-surface upgrade:
13003
- // audio in → dubbed audio; video in (or a video sourceUrl) → dubbed VIDEO
13004
- // (+ audio sidecar). Same wiring contract as voice-changer; stays in
13005
- // AUDIO_PRODUCER_TYPES as its default. Explicitly asserted in
13006
- // producer-types.test.ts (the suite does not fail on omission).
13007
- "dubbing",
13008
- "reduce",
13009
- // Dual-output time chunker (UI label "Split into Chunks"; type id stays
13010
- // "split-media"): video in → video chunks, audio in → audio chunks — two
13011
- // independent lanes on two output handles. Like voice-changer, the canvas
13012
- // validator only sees the source NODE type, not which handle a wire leaves,
13013
- // so it lives here to be accepted on BOTH audio and video input handles. The
13014
- // backend routes the correct lane by sourceHandle in getPrimaryOutput
13015
- // (output-extractor.ts); the frontend does so in extractNodeOutput.
13016
- "split-media"
13017
- ]);
13018
- var AUDIO_PRODUCER_TYPES = /* @__PURE__ */ new Set([
13019
- "text-to-speech",
13020
- "text-to-audio",
13021
- "generate-music",
13022
- "upload-audio",
13023
- "suno-generate",
13024
- "suno-cover",
13025
- "suno-extend",
13026
- "suno-separate",
13027
- "audio-separation",
13028
- "suno-mashup",
13029
- "suno-replace-section",
13030
- "suno-add-instrumental",
13031
- "suno-add-vocals",
13032
- "suno-convert-wav",
13033
- "suno-upload-extend",
13034
- "trim-audio",
13035
- "mix-audio",
13036
- "combine-audio",
13037
- "adjust-volume",
13038
- "audio-fx",
13039
- "reference-audio",
13040
- "audio-isolation",
13041
- "text-to-dialogue",
13042
- "voice-changer",
13043
- // Twin of voice-changer (see DYNAMIC_PRODUCER_TYPES note). Audio is its
13044
- // default output mode; video mode is handled via DYNAMIC membership.
13045
- "voice-changer-pro",
13046
- "dubbing",
13047
- "voice-remix",
13048
- "voice-design",
13049
- // Extract Audio: demuxes a video's audio track to a standalone MP3.
13050
- "extract-audio"
13051
- ]);
13052
- var FAN_OUT_EACH_TYPES = /* @__PURE__ */ new Set([
13053
- "list",
13054
- "split-text",
13055
- "filter-list",
13056
- "deduplicate",
13057
- "merge-lists",
13058
- "sort-list",
13059
- "selector"
13060
- ]);
13061
-
13062
- // src/suno-track-sources.ts
13063
- var SUNO_TRACK_SOURCE_TYPES = /* @__PURE__ */ new Set([
13085
+ // src/suno-track-sources.ts
13086
+ var SUNO_TRACK_SOURCE_TYPES = /* @__PURE__ */ new Set([
13064
13087
  "suno-generate",
13065
13088
  "suno-cover",
13066
13089
  "suno-extend",
@@ -14865,7 +14888,7 @@ function checkKeyframeTrack(frames, durationInFrames, path, issues) {
14865
14888
  previous = kf.frame;
14866
14889
  });
14867
14890
  }
14868
- function scene3DPlanIssues(plan) {
14891
+ function scene3DPlanV1Issues(plan) {
14869
14892
  const issues = [];
14870
14893
  const seconds = plan.durationInFrames / plan.fps;
14871
14894
  if (seconds > SCENE3D_LIMITS.maxDurationSeconds) {
@@ -14953,7 +14976,7 @@ function scene3DPlanIssues(plan) {
14953
14976
  });
14954
14977
  return issues;
14955
14978
  }
14956
- var scene3DPlanSchema = zod.z.object({
14979
+ var scene3DPlanV1ObjectSchema = zod.z.object({
14957
14980
  planType: zod.z.literal(SCENE3D_PLAN_TYPE),
14958
14981
  schemaVersion: zod.z.literal(SCENE3D_SCHEMA_VERSION),
14959
14982
  revisionId: zod.z.uuid(),
@@ -14967,11 +14990,14 @@ var scene3DPlanSchema = zod.z.object({
14967
14990
  objects: zod.z.array(scene3DObjectSchema).min(SCENE3D_LIMITS.minObjects).max(SCENE3D_LIMITS.maxObjects),
14968
14991
  lighting: scene3DLightingSchema,
14969
14992
  references: zod.z.array(scene3DReferenceSchema).max(SCENE3D_LIMITS.maxReferences).optional()
14970
- }).strict().superRefine((plan, ctx) => {
14971
- for (const issue2 of scene3DPlanIssues(plan)) {
14993
+ }).strict();
14994
+ var scene3DPlanV1Schema = scene3DPlanV1ObjectSchema.superRefine((plan, ctx) => {
14995
+ for (const issue2 of scene3DPlanV1Issues(plan)) {
14972
14996
  ctx.addIssue({ code: "custom", path: issue2.path, message: issue2.message });
14973
14997
  }
14974
14998
  });
14999
+ var scene3DPlanSchema = scene3DPlanV1Schema;
15000
+ var scene3DPlanIssues = scene3DPlanV1Issues;
14975
15001
  function scene3DDeepEqual(a, b) {
14976
15002
  if (a === b) return true;
14977
15003
  if (typeof a !== typeof b) return false;
@@ -15002,8 +15028,8 @@ function newScene3DRevisionId() {
15002
15028
  const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
15003
15029
  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
15004
15030
  }
15005
- function isScene3DPlan(value) {
15006
- return scene3DPlanSchema.safeParse(value).success;
15031
+ function isScene3DPlanV1(value) {
15032
+ return scene3DPlanV1Schema.safeParse(value).success;
15007
15033
  }
15008
15034
  var SCENE3D_PLAN_FIELD = "scenePlan";
15009
15035
  var SCENE3D_GENERATE_NODE_TYPE = "generate-3d-scene";
@@ -15072,7 +15098,7 @@ function firstIssueMessage(error) {
15072
15098
  return path ? `${path}: ${issue2.message}` : issue2.message;
15073
15099
  }
15074
15100
  function applyScene3DEditOperations(plan, operations, options = {}) {
15075
- const parsedPlan = scene3DPlanSchema.safeParse(plan);
15101
+ const parsedPlan = scene3DPlanV1Schema.safeParse(plan);
15076
15102
  if (!parsedPlan.success) {
15077
15103
  return { ok: false, code: "invalid_plan", message: `scenePlan is invalid \u2014 ${firstIssueMessage(parsedPlan.error)}` };
15078
15104
  }
@@ -15171,7 +15197,7 @@ function applyScene3DEditOperations(plan, operations, options = {}) {
15171
15197
  }
15172
15198
  next.parentRevisionId = source.revisionId;
15173
15199
  next.revisionId = options.revisionId ?? newScene3DRevisionId();
15174
- const validated = scene3DPlanSchema.safeParse(next);
15200
+ const validated = scene3DPlanV1Schema.safeParse(next);
15175
15201
  if (!validated.success) {
15176
15202
  return {
15177
15203
  ok: false,
@@ -15186,6 +15212,1274 @@ function applyScene3DEditOperations(plan, operations, options = {}) {
15186
15212
  changeSummary: summarizeScene3DOperations(ops)
15187
15213
  };
15188
15214
  }
15215
+ var SCENE3D_SCHEMA_VERSION_V2 = 2;
15216
+ var SCENE3D_SUPPORTED_SCHEMA_VERSIONS = [1, 2];
15217
+ var SCENE3D_V2_ENGINES = ["blender-cloud", "blender-local"];
15218
+ var SCENE3D_V2_LIMITS = {
15219
+ /** Both the seconds and the frame ceiling apply; neither waives the other. */
15220
+ maxDurationSeconds: 60,
15221
+ minDurationInFrames: 1,
15222
+ maxDurationInFrames: 3600,
15223
+ minFps: 15,
15224
+ maxFps: 60,
15225
+ defaultFps: 24,
15226
+ /** Even integers only — an odd axis breaks H.264 chroma subsampling. */
15227
+ minDimensionPx: 100,
15228
+ maxDimensionPx: 1920,
15229
+ minEntities: 1,
15230
+ /** SEMANTIC entities, not exported mesh nodes. */
15231
+ maxEntities: 100,
15232
+ /** Enforced during asset normalization, after decode — see
15233
+ * `scene3DV2NormalizationIssues` in `scene3d-v2-resources.ts`. */
15234
+ maxMeshNodes: 2e3,
15235
+ maxTriangles: 2e5,
15236
+ maxHierarchyDepth: 16,
15237
+ /** Decoded manifest JSON. Measured on the bytes, before `JSON.parse`. */
15238
+ maxManifestBytes: 512 * 1024,
15239
+ /** Decoded camera-track JSON. */
15240
+ maxCameraTrackBytes: 8 * 1024 * 1024,
15241
+ /** Total DECLARED bytes of the assets the renderer downloads. Compression
15242
+ * does not waive the decoded geometry limits above. */
15243
+ maxRendererAssetBytes: 64 * 1024 * 1024,
15244
+ /** A `blend-source` is a separately authorized download, never handed to the
15245
+ * browser renderer, and therefore not part of the renderer budget. */
15246
+ maxBlendSourceBytes: 512 * 1024 * 1024,
15247
+ maxAssets: 64,
15248
+ maxShots: 32,
15249
+ maxShotEntityIds: 16,
15250
+ /** v1's reference limit, unchanged until deliberately expanded. */
15251
+ maxReferences: SCENE3D_LIMITS.maxReferences,
15252
+ maxAnchorsPerEntity: 32,
15253
+ maxMaterialBindingsPerEntity: 16,
15254
+ maxOverrides: 200,
15255
+ minPosterDimensionPx: 16,
15256
+ maxPosterDimensionPx: 4096,
15257
+ maxIdLength: SCENE3D_LIMITS.maxIdLength,
15258
+ maxAssetIdLength: 128,
15259
+ maxNodeIdLength: 128,
15260
+ maxNameLength: SCENE3D_LIMITS.maxNameLength,
15261
+ maxLabelLength: SCENE3D_LIMITS.maxNameLength,
15262
+ maxMaterialNameLength: 120,
15263
+ maxVersionLength: 64,
15264
+ maxCoordinate: SCENE3D_LIMITS.maxCoordinate,
15265
+ minSize: SCENE3D_LIMITS.minSize,
15266
+ maxSize: SCENE3D_LIMITS.maxSize,
15267
+ maxIntensity: SCENE3D_LIMITS.maxIntensity
15268
+ };
15269
+ var SCENE3D_V2_OVERRIDE_OPERATION_VERSION = 1;
15270
+ var SCENE3D_GLB_EXTRAS_ENTITY_ID = "nodaroEntityId";
15271
+ var SCENE3D_GLB_EXTRAS_SUBPART_ID = "nodaroSubpartId";
15272
+ var SCENE3D_GLB_EXTRAS_MATERIAL_ROLE = "nodaroMaterialRole";
15273
+ var SCENE3D_GLB_EXTRAS_ALLOWLIST = [
15274
+ SCENE3D_GLB_EXTRAS_ENTITY_ID,
15275
+ SCENE3D_GLB_EXTRAS_SUBPART_ID,
15276
+ SCENE3D_GLB_EXTRAS_MATERIAL_ROLE
15277
+ ];
15278
+ var SCENE3D_ENTITY_ROLES = [
15279
+ "person",
15280
+ "vehicle",
15281
+ "prop",
15282
+ "environment",
15283
+ "other"
15284
+ ];
15285
+ var SCENE3D_V2_PRIMITIVES = [
15286
+ "box",
15287
+ "sphere",
15288
+ "cylinder",
15289
+ "cone",
15290
+ "plane",
15291
+ "capsule"
15292
+ ];
15293
+ var SCENE3D_ENTITY_CAPABILITIES = [
15294
+ "transform",
15295
+ "color",
15296
+ "visibility"
15297
+ ];
15298
+ var SCENE3D_DEFAULT_ENTITY_CAPABILITIES = SCENE3D_ENTITY_CAPABILITIES;
15299
+ var SCENE3D_ASSET_KINDS = [
15300
+ "glb",
15301
+ "camera-track-json",
15302
+ "poster",
15303
+ "validation-report",
15304
+ "blend-source"
15305
+ ];
15306
+ var SCENE3D_ASSET_ROLES = [
15307
+ "scene-geometry",
15308
+ "entity-geometry",
15309
+ "camera-track",
15310
+ "poster",
15311
+ "validation-report",
15312
+ "source"
15313
+ ];
15314
+ var SCENE3D_ASSET_ROLE_KINDS = {
15315
+ "scene-geometry": "glb",
15316
+ "entity-geometry": "glb",
15317
+ "camera-track": "camera-track-json",
15318
+ poster: "poster",
15319
+ "validation-report": "validation-report",
15320
+ source: "blend-source"
15321
+ };
15322
+ var SCENE3D_RENDERER_ASSET_KINDS = [
15323
+ "glb",
15324
+ "camera-track-json",
15325
+ "poster"
15326
+ ];
15327
+ var SCENE3D_PRIMITIVE_MATERIAL_ROLE = "identity";
15328
+ var SCENE3D_CLAY_LIGHTING_PRESETS = ["clay-studio-v1"];
15329
+ var scene3DAssetIdSchema = zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxAssetIdLength).regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/, "assetId must be an opaque id (letters, digits, '_', '-', '.', ':')").refine((value) => !value.includes(".."), "assetId must not contain '..'");
15330
+ var scene3DNodeIdSchema = zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxNodeIdLength).regex(/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/, "node id must be an exporter-generated stable id");
15331
+ var scene3DSha256Schema = zod.z.string().regex(/^[0-9a-f]{64}$/, "sha256 must be 64 lowercase hex characters");
15332
+ var scene3DVersionTokenSchema = zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxVersionLength).regex(
15333
+ /^[A-Za-z0-9][A-Za-z0-9_.+-]*$/,
15334
+ "version must be a bounded token (letters, digits, '_', '-', '.', '+') \u2014 never a path or prose"
15335
+ );
15336
+ var scene3DEngineIdSchema = zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxVersionLength).regex(/^[a-z0-9][a-z0-9-]*$/, "engine must be a lowercase slug such as blender-cloud");
15337
+ var scene3DAnchorNameSchema = scene3DIdSchema;
15338
+ var scene3DMaterialRoleSchema = scene3DIdSchema;
15339
+ var scene3DMaterialNameSchema = zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxMaterialNameLength).regex(/^[^\u0000-\u001f\u007f]+$/, "material name must not contain control characters");
15340
+ var v2FrameSchema = zod.z.number().int().min(0).max(SCENE3D_V2_LIMITS.maxDurationInFrames);
15341
+ var scene3DEntityCapabilitySchema = zod.z.enum(["transform", "color", "visibility"]);
15342
+ var scene3DAnchorSchema = zod.z.object({
15343
+ name: scene3DAnchorNameSchema,
15344
+ position: vec3Schema,
15345
+ rotation: rotationVec3Schema.optional()
15346
+ }).strict();
15347
+ var scene3DMaterialBindingSchema = zod.z.object({
15348
+ role: scene3DMaterialRoleSchema,
15349
+ materialName: scene3DMaterialNameSchema,
15350
+ color: scene3DColorSchema.optional(),
15351
+ roughness: zod.z.number().min(0).max(1).optional()
15352
+ }).strict();
15353
+ var scene3DAssetAnimationSchema = zod.z.object({
15354
+ clipName: zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxNameLength),
15355
+ startFrame: v2FrameSchema,
15356
+ endFrameExclusive: zod.z.number().int().min(1).max(SCENE3D_V2_LIMITS.maxDurationInFrames),
15357
+ loop: zod.z.boolean().optional()
15358
+ }).strict();
15359
+ var scene3DEntityVisualSchema = zod.z.discriminatedUnion("kind", [
15360
+ zod.z.object({ kind: zod.z.literal("group") }).strict(),
15361
+ zod.z.object({
15362
+ kind: zod.z.literal("primitive"),
15363
+ primitive: zod.z.enum(["box", "sphere", "cylinder", "cone", "plane", "capsule"]),
15364
+ dimensions: sizeVec3Schema,
15365
+ color: scene3DColorSchema
15366
+ }).strict(),
15367
+ zod.z.object({
15368
+ kind: zod.z.literal("asset"),
15369
+ assetId: scene3DAssetIdSchema,
15370
+ rootNodeId: scene3DNodeIdSchema,
15371
+ animation: scene3DAssetAnimationSchema.optional()
15372
+ }).strict()
15373
+ ]);
15374
+ var scene3DEntityV2Schema = zod.z.object({
15375
+ id: scene3DIdSchema,
15376
+ name: zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxNameLength),
15377
+ parentId: scene3DIdSchema.optional(),
15378
+ role: zod.z.enum(["person", "vehicle", "prop", "environment", "other"]).optional(),
15379
+ position: vec3Schema.optional(),
15380
+ rotation: rotationVec3Schema.optional(),
15381
+ scale: scaleVec3Schema.optional(),
15382
+ identityColor: scene3DColorSchema.optional(),
15383
+ anchors: zod.z.array(scene3DAnchorSchema).max(SCENE3D_V2_LIMITS.maxAnchorsPerEntity).optional(),
15384
+ capabilities: zod.z.array(scene3DEntityCapabilitySchema).max(SCENE3D_ENTITY_CAPABILITIES.length).optional(),
15385
+ locks: zod.z.array(scene3DEntityCapabilitySchema).max(SCENE3D_ENTITY_CAPABILITIES.length).optional(),
15386
+ materialBindings: zod.z.array(scene3DMaterialBindingSchema).max(SCENE3D_V2_LIMITS.maxMaterialBindingsPerEntity).optional(),
15387
+ visual: scene3DEntityVisualSchema
15388
+ }).strict();
15389
+ var scene3DAssetRefSchema = zod.z.object({
15390
+ assetId: scene3DAssetIdSchema,
15391
+ kind: zod.z.enum(["glb", "camera-track-json", "poster", "validation-report", "blend-source"]),
15392
+ role: zod.z.enum(["scene-geometry", "entity-geometry", "camera-track", "poster", "validation-report", "source"]),
15393
+ byteLength: zod.z.number().int().min(1).max(SCENE3D_V2_LIMITS.maxBlendSourceBytes),
15394
+ sha256: scene3DSha256Schema,
15395
+ originRevisionId: zod.z.uuid().optional()
15396
+ }).strict();
15397
+ var scene3DShotSchema = zod.z.object({
15398
+ id: scene3DIdSchema,
15399
+ startFrame: v2FrameSchema,
15400
+ endFrameExclusive: zod.z.number().int().min(1).max(SCENE3D_V2_LIMITS.maxDurationInFrames),
15401
+ label: zod.z.string().min(1).max(SCENE3D_V2_LIMITS.maxLabelLength).optional(),
15402
+ subjectEntityIds: zod.z.array(scene3DIdSchema).max(SCENE3D_V2_LIMITS.maxShotEntityIds).optional(),
15403
+ foregroundEntityIds: zod.z.array(scene3DIdSchema).max(SCENE3D_V2_LIMITS.maxShotEntityIds).optional()
15404
+ }).strict();
15405
+ var scene3DClayLightingSchema = zod.z.object({
15406
+ preset: zod.z.enum(SCENE3D_CLAY_LIGHTING_PRESETS),
15407
+ ambientIntensity: zod.z.number().min(0).max(SCENE3D_V2_LIMITS.maxIntensity),
15408
+ keyIntensity: zod.z.number().min(0).max(SCENE3D_V2_LIMITS.maxIntensity),
15409
+ keyPosition: vec3Schema
15410
+ }).strict();
15411
+ var overrideProvenanceShape = {
15412
+ id: scene3DIdSchema,
15413
+ sourceRevisionId: zod.z.uuid(),
15414
+ sourceContentHash: scene3DSha256Schema,
15415
+ operationVersion: zod.z.number().int().min(1).max(255)
15416
+ };
15417
+ var scene3DOverrideSchema = zod.z.discriminatedUnion("kind", [
15418
+ zod.z.object({
15419
+ ...overrideProvenanceShape,
15420
+ kind: zod.z.literal("entity-transform"),
15421
+ entityId: scene3DIdSchema,
15422
+ space: zod.z.enum(["local", "world"]),
15423
+ position: vec3Schema.optional(),
15424
+ rotation: rotationVec3Schema.optional(),
15425
+ scale: scaleVec3Schema.optional()
15426
+ }).strict(),
15427
+ zod.z.object({
15428
+ ...overrideProvenanceShape,
15429
+ kind: zod.z.literal("entity-color"),
15430
+ entityId: scene3DIdSchema,
15431
+ materialRole: scene3DMaterialRoleSchema,
15432
+ color: scene3DColorSchema
15433
+ }).strict(),
15434
+ zod.z.object({
15435
+ ...overrideProvenanceShape,
15436
+ kind: zod.z.literal("entity-visibility"),
15437
+ entityId: scene3DIdSchema,
15438
+ visible: zod.z.boolean()
15439
+ }).strict(),
15440
+ zod.z.object({
15441
+ ...overrideProvenanceShape,
15442
+ kind: zod.z.literal("camera-shot-offset"),
15443
+ shotId: scene3DIdSchema,
15444
+ positionOffset: vec3Schema.optional(),
15445
+ targetOffset: vec3Schema.optional()
15446
+ }).strict()
15447
+ ]);
15448
+ var scene3DProvenanceSchema = zod.z.object({
15449
+ engine: scene3DEngineIdSchema,
15450
+ engineVersion: scene3DVersionTokenSchema,
15451
+ recipeVersion: scene3DVersionTokenSchema,
15452
+ compilerVersion: scene3DVersionTokenSchema,
15453
+ exporterVersion: scene3DVersionTokenSchema,
15454
+ rendererVersion: scene3DVersionTokenSchema,
15455
+ sourceRevisionId: zod.z.uuid().optional(),
15456
+ sourceArtifactId: scene3DAssetIdSchema.optional(),
15457
+ contentHash: scene3DSha256Schema
15458
+ }).strict();
15459
+ function scene3DJsonByteLength(text) {
15460
+ return new TextEncoder().encode(text).length;
15461
+ }
15462
+ function scene3DZodIssues(error) {
15463
+ return error.issues.map((issue2) => ({ path: [...issue2.path], message: issue2.message }));
15464
+ }
15465
+ function entityCapabilities(entity) {
15466
+ return entity.capabilities ?? SCENE3D_DEFAULT_ENTITY_CAPABILITIES;
15467
+ }
15468
+ function scene3DEntityAcceptsOverlay(entity, capability2) {
15469
+ return entityCapabilities(entity).includes(capability2) && !(entity.locks ?? []).includes(capability2);
15470
+ }
15471
+ function checkEntities(plan, byId, issues) {
15472
+ const rootNodeOwners = /* @__PURE__ */ new Map();
15473
+ plan.objects.forEach((entity, index) => {
15474
+ const at = (...rest) => ["objects", index, ...rest];
15475
+ if (entity.visual.kind !== "asset") {
15476
+ for (const field of ["position", "rotation", "scale"]) {
15477
+ if (entity[field] === void 0) {
15478
+ issues.push({
15479
+ path: at(field),
15480
+ message: `entity "${entity.id}" is a ${entity.visual.kind} and must declare ${field}`
15481
+ });
15482
+ }
15483
+ }
15484
+ }
15485
+ if (entity.visual.kind === "asset") {
15486
+ const owner = rootNodeOwners.get(entity.visual.rootNodeId);
15487
+ if (owner !== void 0) {
15488
+ issues.push({
15489
+ path: at("visual", "rootNodeId"),
15490
+ message: `root node "${entity.visual.rootNodeId}" is already the root of entity "${owner}"`
15491
+ });
15492
+ } else {
15493
+ rootNodeOwners.set(entity.visual.rootNodeId, entity.id);
15494
+ }
15495
+ const animation = entity.visual.animation;
15496
+ if (animation) {
15497
+ if (animation.endFrameExclusive <= animation.startFrame) {
15498
+ issues.push({
15499
+ path: at("visual", "animation", "endFrameExclusive"),
15500
+ message: `entity "${entity.id}" animation ends at or before it starts`
15501
+ });
15502
+ }
15503
+ if (animation.endFrameExclusive > plan.durationInFrames) {
15504
+ issues.push({
15505
+ path: at("visual", "animation", "endFrameExclusive"),
15506
+ message: `entity "${entity.id}" animation runs past the scene (${plan.durationInFrames} frames)`
15507
+ });
15508
+ }
15509
+ }
15510
+ } else if (entity.materialBindings && entity.materialBindings.length > 0) {
15511
+ issues.push({
15512
+ path: at("materialBindings"),
15513
+ message: `entity "${entity.id}" is a ${entity.visual.kind}; material bindings name materials in an asset root`
15514
+ });
15515
+ }
15516
+ const roles = /* @__PURE__ */ new Set();
15517
+ (entity.materialBindings ?? []).forEach((binding, bindingIndex) => {
15518
+ if (roles.has(binding.role)) {
15519
+ issues.push({
15520
+ path: at("materialBindings", bindingIndex, "role"),
15521
+ message: `entity "${entity.id}" binds material role "${binding.role}" twice`
15522
+ });
15523
+ }
15524
+ roles.add(binding.role);
15525
+ });
15526
+ const anchorNames = /* @__PURE__ */ new Set();
15527
+ (entity.anchors ?? []).forEach((anchor, anchorIndex) => {
15528
+ if (anchorNames.has(anchor.name)) {
15529
+ issues.push({
15530
+ path: at("anchors", anchorIndex, "name"),
15531
+ message: `entity "${entity.id}" declares anchor "${anchor.name}" twice`
15532
+ });
15533
+ }
15534
+ anchorNames.add(anchor.name);
15535
+ });
15536
+ });
15537
+ plan.objects.forEach((entity, index) => {
15538
+ if (entity.parentId === void 0) return;
15539
+ if (entity.parentId === entity.id) {
15540
+ issues.push({ path: ["objects", index, "parentId"], message: `entity "${entity.id}" cannot parent itself` });
15541
+ return;
15542
+ }
15543
+ if (!byId.has(entity.parentId)) {
15544
+ issues.push({
15545
+ path: ["objects", index, "parentId"],
15546
+ message: `entity "${entity.id}" references unknown parent "${entity.parentId}"`
15547
+ });
15548
+ return;
15549
+ }
15550
+ const seen = /* @__PURE__ */ new Set([entity.id]);
15551
+ let cursor = byId.get(entity.parentId);
15552
+ let depth = 1;
15553
+ while (cursor) {
15554
+ if (seen.has(cursor.id)) {
15555
+ issues.push({ path: ["objects", index, "parentId"], message: `parent cycle through entity "${cursor.id}"` });
15556
+ break;
15557
+ }
15558
+ seen.add(cursor.id);
15559
+ depth += 1;
15560
+ if (depth > SCENE3D_V2_LIMITS.maxHierarchyDepth) {
15561
+ issues.push({
15562
+ path: ["objects", index, "parentId"],
15563
+ message: `hierarchy deeper than ${SCENE3D_V2_LIMITS.maxHierarchyDepth} levels`
15564
+ });
15565
+ break;
15566
+ }
15567
+ cursor = cursor.parentId === void 0 ? void 0 : byId.get(cursor.parentId);
15568
+ }
15569
+ });
15570
+ }
15571
+ function checkAssets(plan, assetsById, issues) {
15572
+ let rendererBytes = 0;
15573
+ let sourceCount = 0;
15574
+ plan.assets.forEach((asset, index) => {
15575
+ const at = (...rest) => ["assets", index, ...rest];
15576
+ const expectedKind = SCENE3D_ASSET_ROLE_KINDS[asset.role];
15577
+ if (asset.kind !== expectedKind) {
15578
+ issues.push({
15579
+ path: at("kind"),
15580
+ message: `asset "${asset.assetId}" has role "${asset.role}", which requires kind "${expectedKind}" (got "${asset.kind}")`
15581
+ });
15582
+ }
15583
+ if (asset.kind === "camera-track-json" && asset.byteLength > SCENE3D_V2_LIMITS.maxCameraTrackBytes) {
15584
+ issues.push({
15585
+ path: at("byteLength"),
15586
+ message: `camera track "${asset.assetId}" is ${asset.byteLength} bytes; the limit is ${SCENE3D_V2_LIMITS.maxCameraTrackBytes}`
15587
+ });
15588
+ }
15589
+ if (SCENE3D_RENDERER_ASSET_KINDS.includes(asset.kind)) {
15590
+ rendererBytes += asset.byteLength;
15591
+ if (asset.byteLength > SCENE3D_V2_LIMITS.maxRendererAssetBytes) {
15592
+ issues.push({
15593
+ path: at("byteLength"),
15594
+ message: `asset "${asset.assetId}" is ${asset.byteLength} bytes; a downloaded scene asset may not exceed ${SCENE3D_V2_LIMITS.maxRendererAssetBytes}`
15595
+ });
15596
+ }
15597
+ }
15598
+ if (asset.kind === "blend-source") {
15599
+ sourceCount += 1;
15600
+ if (sourceCount > 1) {
15601
+ issues.push({ path: at("kind"), message: "a revision may retain at most one blend-source asset" });
15602
+ }
15603
+ }
15604
+ });
15605
+ if (rendererBytes > SCENE3D_V2_LIMITS.maxRendererAssetBytes) {
15606
+ issues.push({
15607
+ path: ["assets"],
15608
+ message: `downloaded scene assets total ${rendererBytes} bytes; the limit is ${SCENE3D_V2_LIMITS.maxRendererAssetBytes}`
15609
+ });
15610
+ }
15611
+ const track = assetsById.get(plan.cameraTrackAssetId);
15612
+ if (!track) {
15613
+ issues.push({
15614
+ path: ["cameraTrackAssetId"],
15615
+ message: `cameraTrackAssetId "${plan.cameraTrackAssetId}" is not in assets`
15616
+ });
15617
+ } else if (track.kind !== "camera-track-json") {
15618
+ issues.push({
15619
+ path: ["cameraTrackAssetId"],
15620
+ message: `cameraTrackAssetId "${plan.cameraTrackAssetId}" is kind "${track.kind}"; a camera track must be camera-track-json`
15621
+ });
15622
+ }
15623
+ const referencedGlbs = /* @__PURE__ */ new Set();
15624
+ for (const entity of plan.objects) {
15625
+ if (entity.visual.kind === "asset") referencedGlbs.add(entity.visual.assetId);
15626
+ }
15627
+ plan.assets.forEach((asset, index) => {
15628
+ if (asset.kind === "glb" && !referencedGlbs.has(asset.assetId)) {
15629
+ issues.push({
15630
+ path: ["assets", index, "assetId"],
15631
+ message: `glb asset "${asset.assetId}" is not referenced by any entity`
15632
+ });
15633
+ }
15634
+ });
15635
+ plan.objects.forEach((entity, index) => {
15636
+ if (entity.visual.kind !== "asset") return;
15637
+ const asset = assetsById.get(entity.visual.assetId);
15638
+ if (!asset) {
15639
+ issues.push({
15640
+ path: ["objects", index, "visual", "assetId"],
15641
+ message: `entity "${entity.id}" references unknown asset "${entity.visual.assetId}"`
15642
+ });
15643
+ } else if (asset.kind !== "glb") {
15644
+ issues.push({
15645
+ path: ["objects", index, "visual", "assetId"],
15646
+ message: `entity "${entity.id}" references asset "${asset.assetId}" of kind "${asset.kind}"; geometry must be glb`
15647
+ });
15648
+ }
15649
+ });
15650
+ if (plan.provenance.sourceArtifactId !== void 0) {
15651
+ const source = assetsById.get(plan.provenance.sourceArtifactId);
15652
+ if (!source) {
15653
+ issues.push({
15654
+ path: ["provenance", "sourceArtifactId"],
15655
+ message: `sourceArtifactId "${plan.provenance.sourceArtifactId}" is not in assets`
15656
+ });
15657
+ } else if (source.kind !== "blend-source") {
15658
+ issues.push({
15659
+ path: ["provenance", "sourceArtifactId"],
15660
+ message: `sourceArtifactId "${source.assetId}" is kind "${source.kind}"; a retained source must be blend-source`
15661
+ });
15662
+ }
15663
+ }
15664
+ }
15665
+ function checkShots(plan, byId, issues) {
15666
+ const seenIds = /* @__PURE__ */ new Set();
15667
+ let expectedStart = 0;
15668
+ plan.shots.forEach((shot, index) => {
15669
+ const at = (...rest) => ["shots", index, ...rest];
15670
+ if (seenIds.has(shot.id)) {
15671
+ issues.push({ path: at("id"), message: `duplicate shot id "${shot.id}"` });
15672
+ }
15673
+ seenIds.add(shot.id);
15674
+ if (shot.endFrameExclusive <= shot.startFrame) {
15675
+ issues.push({
15676
+ path: at("endFrameExclusive"),
15677
+ message: `shot "${shot.id}" ends at or before it starts (${shot.startFrame}..${shot.endFrameExclusive})`
15678
+ });
15679
+ }
15680
+ if (shot.startFrame !== expectedStart) {
15681
+ issues.push({
15682
+ path: at("startFrame"),
15683
+ message: index === 0 ? `shots must start at frame 0 (got ${shot.startFrame})` : `shot "${shot.id}" starts at ${shot.startFrame}; the previous shot ends at ${expectedStart} \u2014 every frame belongs to exactly one shot`
15684
+ });
15685
+ }
15686
+ expectedStart = Math.max(expectedStart, shot.endFrameExclusive);
15687
+ for (const field of ["subjectEntityIds", "foregroundEntityIds"]) {
15688
+ (shot[field] ?? []).forEach((entityId, entityIndex) => {
15689
+ if (!byId.has(entityId)) {
15690
+ issues.push({
15691
+ path: at(field, entityIndex),
15692
+ message: `shot "${shot.id}" references unknown entity "${entityId}"`
15693
+ });
15694
+ }
15695
+ });
15696
+ }
15697
+ });
15698
+ const last = plan.shots[plan.shots.length - 1];
15699
+ if (last && last.endFrameExclusive !== plan.durationInFrames) {
15700
+ issues.push({
15701
+ path: ["shots", plan.shots.length - 1, "endFrameExclusive"],
15702
+ message: `shots end at frame ${last.endFrameExclusive}; the scene is ${plan.durationInFrames} frames and must be covered completely`
15703
+ });
15704
+ }
15705
+ }
15706
+ function checkOverrides(plan, byId, shotIds, issues) {
15707
+ const overrideIds = /* @__PURE__ */ new Set();
15708
+ const transformTargets = /* @__PURE__ */ new Set();
15709
+ const visibilityTargets = /* @__PURE__ */ new Set();
15710
+ const colorTargets = /* @__PURE__ */ new Set();
15711
+ const offsetTargets = /* @__PURE__ */ new Set();
15712
+ (plan.overrides ?? []).forEach((override, index) => {
15713
+ const at = (...rest) => ["overrides", index, ...rest];
15714
+ if (overrideIds.has(override.id)) {
15715
+ issues.push({ path: at("id"), message: `duplicate override id "${override.id}"` });
15716
+ }
15717
+ overrideIds.add(override.id);
15718
+ if (override.operationVersion > SCENE3D_V2_OVERRIDE_OPERATION_VERSION) {
15719
+ issues.push({
15720
+ path: at("operationVersion"),
15721
+ message: `override "${override.id}" uses operation version ${override.operationVersion}; this reader understands up to ${SCENE3D_V2_OVERRIDE_OPERATION_VERSION}`
15722
+ });
15723
+ }
15724
+ if (override.kind === "camera-shot-offset") {
15725
+ if (!shotIds.has(override.shotId)) {
15726
+ issues.push({ path: at("shotId"), message: `override "${override.id}" targets unknown shot "${override.shotId}"` });
15727
+ } else if (offsetTargets.has(override.shotId)) {
15728
+ issues.push({
15729
+ path: at("shotId"),
15730
+ message: `shot "${override.shotId}" already has a camera offset; one owner per channel`
15731
+ });
15732
+ }
15733
+ offsetTargets.add(override.shotId);
15734
+ if (override.positionOffset === void 0 && override.targetOffset === void 0) {
15735
+ issues.push({ path: at(), message: `override "${override.id}" offsets nothing` });
15736
+ }
15737
+ return;
15738
+ }
15739
+ const entity = byId.get(override.entityId);
15740
+ if (!entity) {
15741
+ issues.push({ path: at("entityId"), message: `override "${override.id}" targets unknown entity "${override.entityId}"` });
15742
+ return;
15743
+ }
15744
+ if (override.kind === "entity-transform") {
15745
+ if (transformTargets.has(override.entityId)) {
15746
+ issues.push({
15747
+ path: at("entityId"),
15748
+ message: `entity "${override.entityId}" already has a transform override; one owner per channel`
15749
+ });
15750
+ }
15751
+ transformTargets.add(override.entityId);
15752
+ if (!scene3DEntityAcceptsOverlay(entity, "transform")) {
15753
+ issues.push({
15754
+ path: at("entityId"),
15755
+ message: `entity "${override.entityId}" does not accept a transform overlay (locked or not advertised)`
15756
+ });
15757
+ }
15758
+ if (override.position === void 0 && override.rotation === void 0 && override.scale === void 0) {
15759
+ issues.push({ path: at(), message: `override "${override.id}" changes nothing` });
15760
+ }
15761
+ return;
15762
+ }
15763
+ if (override.kind === "entity-visibility") {
15764
+ if (visibilityTargets.has(override.entityId)) {
15765
+ issues.push({
15766
+ path: at("entityId"),
15767
+ message: `entity "${override.entityId}" already has a visibility override; one owner per channel`
15768
+ });
15769
+ }
15770
+ visibilityTargets.add(override.entityId);
15771
+ if (!scene3DEntityAcceptsOverlay(entity, "visibility")) {
15772
+ issues.push({
15773
+ path: at("entityId"),
15774
+ message: `entity "${override.entityId}" does not accept a visibility overlay (locked or not advertised)`
15775
+ });
15776
+ }
15777
+ return;
15778
+ }
15779
+ const key = `${override.entityId}\0${override.materialRole}`;
15780
+ if (colorTargets.has(key)) {
15781
+ issues.push({
15782
+ path: at("materialRole"),
15783
+ message: `entity "${override.entityId}" already recolours material role "${override.materialRole}"`
15784
+ });
15785
+ }
15786
+ colorTargets.add(key);
15787
+ if (!scene3DEntityAcceptsOverlay(entity, "color")) {
15788
+ issues.push({
15789
+ path: at("entityId"),
15790
+ message: `entity "${override.entityId}" does not accept a colour overlay (locked or not advertised)`
15791
+ });
15792
+ }
15793
+ if (entity.visual.kind === "group") {
15794
+ issues.push({
15795
+ path: at("materialRole"),
15796
+ message: `entity "${override.entityId}" is a group and has no geometry to recolour`
15797
+ });
15798
+ } else if (entity.visual.kind === "primitive") {
15799
+ if (override.materialRole !== SCENE3D_PRIMITIVE_MATERIAL_ROLE) {
15800
+ issues.push({
15801
+ path: at("materialRole"),
15802
+ message: `entity "${override.entityId}" is a primitive; its only material role is "${SCENE3D_PRIMITIVE_MATERIAL_ROLE}"`
15803
+ });
15804
+ }
15805
+ } else if (!(entity.materialBindings ?? []).some((binding) => binding.role === override.materialRole)) {
15806
+ issues.push({
15807
+ path: at("materialRole"),
15808
+ message: `entity "${override.entityId}" declares no material role "${override.materialRole}"; a binding may only name materials in that entity's asset root`
15809
+ });
15810
+ }
15811
+ });
15812
+ }
15813
+ function scene3DPlanV2Issues(plan) {
15814
+ const issues = [];
15815
+ const seconds = plan.durationInFrames / plan.fps;
15816
+ if (seconds > SCENE3D_V2_LIMITS.maxDurationSeconds) {
15817
+ issues.push({
15818
+ path: ["durationInFrames"],
15819
+ message: `scene is ${seconds.toFixed(2)}s; the limit is ${SCENE3D_V2_LIMITS.maxDurationSeconds}s`
15820
+ });
15821
+ }
15822
+ for (const axis of ["width", "height"]) {
15823
+ if (plan[axis] % 2 !== 0) {
15824
+ issues.push({ path: [axis], message: `${axis} must be an even number of pixels (got ${plan[axis]})` });
15825
+ }
15826
+ }
15827
+ const byId = /* @__PURE__ */ new Map();
15828
+ plan.objects.forEach((entity, index) => {
15829
+ if (byId.has(entity.id)) {
15830
+ issues.push({ path: ["objects", index, "id"], message: `duplicate entity id "${entity.id}"` });
15831
+ return;
15832
+ }
15833
+ byId.set(entity.id, entity);
15834
+ });
15835
+ const assetsById = /* @__PURE__ */ new Map();
15836
+ plan.assets.forEach((asset, index) => {
15837
+ if (assetsById.has(asset.assetId)) {
15838
+ issues.push({ path: ["assets", index, "assetId"], message: `duplicate asset id "${asset.assetId}"` });
15839
+ return;
15840
+ }
15841
+ assetsById.set(asset.assetId, asset);
15842
+ });
15843
+ checkEntities(plan, byId, issues);
15844
+ checkAssets(plan, assetsById, issues);
15845
+ checkShots(plan, byId, issues);
15846
+ checkOverrides(plan, byId, new Set(plan.shots.map((shot) => shot.id)), issues);
15847
+ const referenceIds = /* @__PURE__ */ new Set();
15848
+ (plan.references ?? []).forEach((reference, index) => {
15849
+ if (referenceIds.has(reference.id)) {
15850
+ issues.push({ path: ["references", index, "id"], message: `duplicate reference id "${reference.id}"` });
15851
+ }
15852
+ referenceIds.add(reference.id);
15853
+ if (reference.objectId !== void 0 && !byId.has(reference.objectId)) {
15854
+ issues.push({
15855
+ path: ["references", index, "objectId"],
15856
+ message: `reference "${reference.id}" points at unknown entity "${reference.objectId}"`
15857
+ });
15858
+ }
15859
+ if (reference.startSeconds !== void 0 && reference.endSeconds !== void 0 && reference.endSeconds <= reference.startSeconds) {
15860
+ issues.push({
15861
+ path: ["references", index, "endSeconds"],
15862
+ message: `reference "${reference.id}" ends at or before it starts`
15863
+ });
15864
+ }
15865
+ if (reference.kind === "image" && (reference.startSeconds !== void 0 || reference.endSeconds !== void 0)) {
15866
+ issues.push({
15867
+ path: ["references", index, "startSeconds"],
15868
+ message: `reference "${reference.id}" is an image; a time window applies to video only`
15869
+ });
15870
+ }
15871
+ });
15872
+ return issues;
15873
+ }
15874
+ var scene3DPlanV2ObjectSchema = zod.z.object({
15875
+ planType: zod.z.literal(SCENE3D_PLAN_TYPE),
15876
+ schemaVersion: zod.z.literal(SCENE3D_SCHEMA_VERSION_V2),
15877
+ revisionId: zod.z.uuid(),
15878
+ parentRevisionId: zod.z.uuid().optional(),
15879
+ width: zod.z.number().int().min(SCENE3D_V2_LIMITS.minDimensionPx).max(SCENE3D_V2_LIMITS.maxDimensionPx),
15880
+ height: zod.z.number().int().min(SCENE3D_V2_LIMITS.minDimensionPx).max(SCENE3D_V2_LIMITS.maxDimensionPx),
15881
+ fps: zod.z.number().int().min(SCENE3D_V2_LIMITS.minFps).max(SCENE3D_V2_LIMITS.maxFps),
15882
+ durationInFrames: zod.z.number().int().min(SCENE3D_V2_LIMITS.minDurationInFrames).max(SCENE3D_V2_LIMITS.maxDurationInFrames),
15883
+ units: zod.z.literal("meters"),
15884
+ upAxis: zod.z.literal("Y"),
15885
+ handedness: zod.z.literal("right"),
15886
+ objects: zod.z.array(scene3DEntityV2Schema).min(SCENE3D_V2_LIMITS.minEntities).max(SCENE3D_V2_LIMITS.maxEntities),
15887
+ assets: zod.z.array(scene3DAssetRefSchema).min(1).max(SCENE3D_V2_LIMITS.maxAssets),
15888
+ cameraTrackAssetId: scene3DAssetIdSchema,
15889
+ shots: zod.z.array(scene3DShotSchema).min(1).max(SCENE3D_V2_LIMITS.maxShots),
15890
+ lighting: scene3DClayLightingSchema,
15891
+ backgroundColor: scene3DColorSchema,
15892
+ references: zod.z.array(scene3DReferenceSchema).max(SCENE3D_V2_LIMITS.maxReferences).optional(),
15893
+ overrides: zod.z.array(scene3DOverrideSchema).max(SCENE3D_V2_LIMITS.maxOverrides).optional(),
15894
+ provenance: scene3DProvenanceSchema
15895
+ }).strict();
15896
+ var scene3DPlanV2Schema = scene3DPlanV2ObjectSchema.superRefine((plan, ctx) => {
15897
+ for (const issue2 of scene3DPlanV2Issues(plan)) {
15898
+ ctx.addIssue({ code: "custom", path: issue2.path, message: issue2.message });
15899
+ }
15900
+ });
15901
+ var scene3DAnyPlanSchema = zod.z.discriminatedUnion("schemaVersion", [scene3DPlanV1ObjectSchema, scene3DPlanV2ObjectSchema]).superRefine((plan, ctx) => {
15902
+ const issues = plan.schemaVersion === SCENE3D_SCHEMA_VERSION_V2 ? scene3DPlanV2Issues(plan) : scene3DPlanV1Issues(plan);
15903
+ for (const issue2 of issues) {
15904
+ ctx.addIssue({ code: "custom", path: issue2.path, message: issue2.message });
15905
+ }
15906
+ });
15907
+ var scene3DAcceptedSchemaVersionsSchema = zod.z.array(zod.z.union([zod.z.literal(1), zod.z.literal(2)])).min(1).max(SCENE3D_SUPPORTED_SCHEMA_VERSIONS.length);
15908
+ function isScene3DPlanV2(value) {
15909
+ return scene3DPlanV2Schema.safeParse(value).success;
15910
+ }
15911
+ function isScene3DPlan(value) {
15912
+ return scene3DAnyPlanSchema.safeParse(value).success;
15913
+ }
15914
+ function scene3DPlanSchemaVersion(value) {
15915
+ if (typeof value !== "object" || value === null) return null;
15916
+ const record = value;
15917
+ if (record.planType !== SCENE3D_PLAN_TYPE) return null;
15918
+ if (typeof record.schemaVersion !== "number" || !Number.isInteger(record.schemaVersion)) return null;
15919
+ return record.schemaVersion;
15920
+ }
15921
+ function isScene3DSchemaVersionSupported(version) {
15922
+ return SCENE3D_SUPPORTED_SCHEMA_VERSIONS.includes(version);
15923
+ }
15924
+ function isKnownScene3DEngine(engine) {
15925
+ return SCENE3D_V2_ENGINES.includes(engine);
15926
+ }
15927
+ function scene3DShotIndexForFrame(shots, frame) {
15928
+ for (let index = 0; index < shots.length; index++) {
15929
+ const shot = shots[index];
15930
+ if (frame >= shot.startFrame && frame < shot.endFrameExclusive) return index;
15931
+ }
15932
+ return -1;
15933
+ }
15934
+ function scene3DShotForFrame(shots, frame) {
15935
+ const index = scene3DShotIndexForFrame(shots, frame);
15936
+ return index === -1 ? void 0 : shots[index];
15937
+ }
15938
+
15939
+ // src/scene3d-v2-resources.ts
15940
+ function scene3DV2HierarchyDepth(entities) {
15941
+ const byId = new Map(entities.map((entity) => [entity.id, entity]));
15942
+ let deepest = 0;
15943
+ for (const entity of entities) {
15944
+ let depth = 1;
15945
+ let cursor = entity;
15946
+ const seen = /* @__PURE__ */ new Set([entity.id]);
15947
+ while (cursor.parentId !== void 0) {
15948
+ const parent = byId.get(cursor.parentId);
15949
+ if (!parent || seen.has(parent.id)) break;
15950
+ seen.add(parent.id);
15951
+ cursor = parent;
15952
+ depth += 1;
15953
+ }
15954
+ if (depth > deepest) deepest = depth;
15955
+ }
15956
+ return deepest;
15957
+ }
15958
+ function scene3DV2ResourceUsage(plan) {
15959
+ let rendererAssetBytes = 0;
15960
+ let cameraTrackBytes = 0;
15961
+ let blendSourceBytes = 0;
15962
+ for (const asset of plan.assets) {
15963
+ if (SCENE3D_RENDERER_ASSET_KINDS.includes(asset.kind)) rendererAssetBytes += asset.byteLength;
15964
+ if (asset.kind === "camera-track-json") cameraTrackBytes += asset.byteLength;
15965
+ if (asset.kind === "blend-source") blendSourceBytes += asset.byteLength;
15966
+ }
15967
+ return {
15968
+ entities: plan.objects.length,
15969
+ assets: plan.assets.length,
15970
+ shots: plan.shots.length,
15971
+ overrides: plan.overrides?.length ?? 0,
15972
+ references: plan.references?.length ?? 0,
15973
+ frames: plan.durationInFrames,
15974
+ durationSeconds: plan.durationInFrames / plan.fps,
15975
+ hierarchyDepth: scene3DV2HierarchyDepth(plan.objects),
15976
+ rendererAssetBytes,
15977
+ cameraTrackBytes,
15978
+ blendSourceBytes
15979
+ };
15980
+ }
15981
+ function scene3DV2AdmissionIssues(plan, manifestBytes) {
15982
+ const issues = [];
15983
+ const usage = scene3DV2ResourceUsage(plan);
15984
+ const limits = SCENE3D_V2_LIMITS;
15985
+ if (manifestBytes !== void 0 && manifestBytes > limits.maxManifestBytes) {
15986
+ issues.push({
15987
+ path: [],
15988
+ message: `manifest is ${manifestBytes} bytes; the limit is ${limits.maxManifestBytes}`
15989
+ });
15990
+ }
15991
+ if (usage.frames > limits.maxDurationInFrames) {
15992
+ issues.push({
15993
+ path: ["durationInFrames"],
15994
+ message: `scene is ${usage.frames} frames; the limit is ${limits.maxDurationInFrames}`
15995
+ });
15996
+ }
15997
+ if (usage.durationSeconds > limits.maxDurationSeconds) {
15998
+ issues.push({
15999
+ path: ["durationInFrames"],
16000
+ message: `scene is ${usage.durationSeconds.toFixed(2)}s; the limit is ${limits.maxDurationSeconds}s`
16001
+ });
16002
+ }
16003
+ if (usage.entities > limits.maxEntities) {
16004
+ issues.push({ path: ["objects"], message: `${usage.entities} entities; the limit is ${limits.maxEntities}` });
16005
+ }
16006
+ if (usage.shots > limits.maxShots) {
16007
+ issues.push({ path: ["shots"], message: `${usage.shots} shots; the limit is ${limits.maxShots}` });
16008
+ }
16009
+ if (usage.hierarchyDepth > limits.maxHierarchyDepth) {
16010
+ issues.push({
16011
+ path: ["objects"],
16012
+ message: `hierarchy is ${usage.hierarchyDepth} deep; the limit is ${limits.maxHierarchyDepth}`
16013
+ });
16014
+ }
16015
+ if (usage.rendererAssetBytes > limits.maxRendererAssetBytes) {
16016
+ issues.push({
16017
+ path: ["assets"],
16018
+ message: `downloaded scene assets total ${usage.rendererAssetBytes} bytes; the limit is ${limits.maxRendererAssetBytes}`
16019
+ });
16020
+ }
16021
+ if (usage.cameraTrackBytes > limits.maxCameraTrackBytes) {
16022
+ issues.push({
16023
+ path: ["assets"],
16024
+ message: `camera track data totals ${usage.cameraTrackBytes} bytes; the limit is ${limits.maxCameraTrackBytes}`
16025
+ });
16026
+ }
16027
+ return issues;
16028
+ }
16029
+ function scene3DV2NormalizationIssues(plan, stats) {
16030
+ const issues = [];
16031
+ const limits = SCENE3D_V2_LIMITS;
16032
+ const declared = new Map(plan.assets.map((asset) => [asset.assetId, asset]));
16033
+ let meshNodes = 0;
16034
+ let triangles = 0;
16035
+ let rendererBytes = 0;
16036
+ stats.forEach((stat, index) => {
16037
+ const at = (...rest) => [index, ...rest];
16038
+ const asset = declared.get(stat.assetId);
16039
+ if (!asset) {
16040
+ issues.push({ path: at("assetId"), message: `asset "${stat.assetId}" is not declared in the manifest` });
16041
+ return;
16042
+ }
16043
+ if (stat.kind !== asset.kind) {
16044
+ issues.push({
16045
+ path: at("kind"),
16046
+ message: `asset "${stat.assetId}" decoded as "${stat.kind}" but the manifest declares "${asset.kind}"`
16047
+ });
16048
+ }
16049
+ if (stat.byteLength !== asset.byteLength) {
16050
+ issues.push({
16051
+ path: at("byteLength"),
16052
+ message: `asset "${stat.assetId}" is ${stat.byteLength} bytes; the manifest declares ${asset.byteLength}`
16053
+ });
16054
+ }
16055
+ if (stat.sha256 !== void 0 && stat.sha256 !== asset.sha256) {
16056
+ issues.push({
16057
+ path: at("sha256"),
16058
+ message: `asset "${stat.assetId}" digest does not match the manifest`
16059
+ });
16060
+ }
16061
+ if (SCENE3D_RENDERER_ASSET_KINDS.includes(stat.kind)) rendererBytes += stat.byteLength;
16062
+ if (stat.kind === "camera-track-json" && stat.byteLength > limits.maxCameraTrackBytes) {
16063
+ issues.push({
16064
+ path: at("byteLength"),
16065
+ message: `camera track "${stat.assetId}" decoded to ${stat.byteLength} bytes; the limit is ${limits.maxCameraTrackBytes}`
16066
+ });
16067
+ }
16068
+ meshNodes += stat.meshNodes ?? 0;
16069
+ triangles += stat.triangles ?? 0;
16070
+ if (stat.maxNodeDepth !== void 0 && stat.maxNodeDepth > limits.maxHierarchyDepth) {
16071
+ issues.push({
16072
+ path: at("maxNodeDepth"),
16073
+ message: `asset "${stat.assetId}" nests ${stat.maxNodeDepth} levels; the limit is ${limits.maxHierarchyDepth}`
16074
+ });
16075
+ }
16076
+ for (const [field, value] of [
16077
+ ["imageWidth", stat.imageWidth],
16078
+ ["imageHeight", stat.imageHeight]
16079
+ ]) {
16080
+ if (value === void 0) continue;
16081
+ if (!Number.isInteger(value) || value < limits.minPosterDimensionPx || value > limits.maxPosterDimensionPx) {
16082
+ issues.push({
16083
+ path: at(field),
16084
+ message: `asset "${stat.assetId}" ${field} is ${value}; it must be an integer between ${limits.minPosterDimensionPx} and ${limits.maxPosterDimensionPx}`
16085
+ });
16086
+ }
16087
+ }
16088
+ });
16089
+ if (meshNodes > limits.maxMeshNodes) {
16090
+ issues.push({ path: [], message: `resolved assets contain ${meshNodes} mesh nodes; the limit is ${limits.maxMeshNodes}` });
16091
+ }
16092
+ if (triangles > limits.maxTriangles) {
16093
+ issues.push({ path: [], message: `resolved assets contain ${triangles} triangles; the limit is ${limits.maxTriangles}` });
16094
+ }
16095
+ if (rendererBytes > limits.maxRendererAssetBytes) {
16096
+ issues.push({
16097
+ path: [],
16098
+ message: `downloaded scene assets decoded to ${rendererBytes} bytes; the limit is ${limits.maxRendererAssetBytes}`
16099
+ });
16100
+ }
16101
+ return issues;
16102
+ }
16103
+ function parseScene3DPlanV2Json(text) {
16104
+ const bytes = scene3DJsonByteLength(text);
16105
+ if (bytes > SCENE3D_V2_LIMITS.maxManifestBytes) {
16106
+ return {
16107
+ ok: false,
16108
+ issues: [{ path: [], message: `manifest is ${bytes} bytes; the limit is ${SCENE3D_V2_LIMITS.maxManifestBytes}` }]
16109
+ };
16110
+ }
16111
+ let decoded;
16112
+ try {
16113
+ decoded = JSON.parse(text);
16114
+ } catch {
16115
+ return { ok: false, issues: [{ path: [], message: "manifest is not valid JSON" }] };
16116
+ }
16117
+ const parsed = scene3DPlanV2Schema.safeParse(decoded);
16118
+ if (!parsed.success) return { ok: false, issues: scene3DZodIssues(parsed.error) };
16119
+ return { ok: true, value: parsed.data };
16120
+ }
16121
+ var SCENE3D_V2_CONTENT_HASH_EXCLUDED = ["revisionId", "parentRevisionId"];
16122
+ function canonicalize(value) {
16123
+ if (value === null) return "null";
16124
+ if (typeof value === "number") {
16125
+ if (!Number.isFinite(value)) throw new Error("cannot canonicalize a non-finite number");
16126
+ return JSON.stringify(value === 0 ? 0 : value);
16127
+ }
16128
+ if (typeof value === "string" || typeof value === "boolean") return JSON.stringify(value);
16129
+ if (Array.isArray(value)) return `[${value.map((item) => canonicalize(item)).join(",")}]`;
16130
+ if (typeof value === "object") {
16131
+ const record = value;
16132
+ const parts = [];
16133
+ for (const key of Object.keys(record).sort()) {
16134
+ const entry = record[key];
16135
+ if (entry === void 0) continue;
16136
+ parts.push(`${JSON.stringify(key)}:${canonicalize(entry)}`);
16137
+ }
16138
+ return `{${parts.join(",")}}`;
16139
+ }
16140
+ throw new Error(`cannot canonicalize ${typeof value}`);
16141
+ }
16142
+ function canonicalScene3DPlanV2Json(plan) {
16143
+ const { revisionId: _revisionId, parentRevisionId: _parentRevisionId, provenance, ...rest } = plan;
16144
+ const { contentHash: _contentHash, ...provenanceRest } = provenance;
16145
+ return canonicalize({ ...rest, provenance: provenanceRest });
16146
+ }
16147
+ function toHex(buffer) {
16148
+ return Array.from(new Uint8Array(buffer), (byte) => byte.toString(16).padStart(2, "0")).join("");
16149
+ }
16150
+ async function computeScene3DPlanV2ContentHash(plan) {
16151
+ const subtle = globalThis.crypto?.subtle;
16152
+ if (!subtle) throw new Error("WebCrypto SubtleCrypto is required to hash a Scene3D revision");
16153
+ const bytes = new TextEncoder().encode(canonicalScene3DPlanV2Json(plan));
16154
+ return toHex(await subtle.digest("SHA-256", bytes));
16155
+ }
16156
+ async function verifyScene3DPlanV2ContentHash(plan) {
16157
+ return await computeScene3DPlanV2ContentHash(plan) === plan.provenance.contentHash;
16158
+ }
16159
+ var SCENE3D_CAMERA_TRACK_FORMAT = "scene3d-camera-track";
16160
+ var SCENE3D_CAMERA_TRACK_VERSION = 1;
16161
+ var SCENE3D_CAMERA_TRACK_LIMITS = {
16162
+ maxJsonBytes: SCENE3D_V2_LIMITS.maxCameraTrackBytes,
16163
+ maxFrameCount: SCENE3D_V2_LIMITS.maxDurationInFrames,
16164
+ minFps: SCENE3D_V2_LIMITS.minFps,
16165
+ maxFps: SCENE3D_V2_LIMITS.maxFps,
16166
+ /** A unit quaternion off by more than this is a bug, not float noise. */
16167
+ quaternionTolerance: 1e-4,
16168
+ /** Absolute tolerance on the projection entries that must be exactly zero
16169
+ * (or exactly ∓1) in a perspective matrix. */
16170
+ projectionEpsilon: 1e-6,
16171
+ /** Relative tolerance when comparing declared near/far against the values the
16172
+ * projection matrix implies. */
16173
+ nearFarRelativeTolerance: 1e-3,
16174
+ /** Relative tolerance on `m[0]/m[5]` vs the manifest's `height/width`. */
16175
+ aspectRelativeTolerance: 1e-3,
16176
+ minNear: 1e-4,
16177
+ maxFar: 1e7
16178
+ };
16179
+ var coordinate = zod.z.number().min(-SCENE3D_LIMITS.maxCoordinate).max(SCENE3D_LIMITS.maxCoordinate);
16180
+ var positionSchema = zod.z.tuple([coordinate, coordinate, coordinate]);
16181
+ var scene3DCameraSampleSchema = zod.z.object({
16182
+ position: positionSchema,
16183
+ quaternion: zod.z.tuple([zod.z.number(), zod.z.number(), zod.z.number(), zod.z.number()]),
16184
+ projectionMatrix: zod.z.array(zod.z.number()).length(16),
16185
+ near: zod.z.number().min(SCENE3D_CAMERA_TRACK_LIMITS.minNear).max(SCENE3D_CAMERA_TRACK_LIMITS.maxFar),
16186
+ far: zod.z.number().min(SCENE3D_CAMERA_TRACK_LIMITS.minNear).max(SCENE3D_CAMERA_TRACK_LIMITS.maxFar),
16187
+ target: positionSchema.optional(),
16188
+ focalLengthMm: zod.z.number().min(SCENE3D_LIMITS.minFocalLengthMm).max(SCENE3D_LIMITS.maxFocalLengthMm).optional()
16189
+ }).strict();
16190
+ var scene3DCameraTrackObjectSchema = zod.z.object({
16191
+ format: zod.z.literal(SCENE3D_CAMERA_TRACK_FORMAT),
16192
+ version: zod.z.literal(SCENE3D_CAMERA_TRACK_VERSION),
16193
+ frameStart: zod.z.literal(0),
16194
+ frameCount: zod.z.number().int().min(1).max(SCENE3D_CAMERA_TRACK_LIMITS.maxFrameCount),
16195
+ fps: zod.z.number().int().min(SCENE3D_CAMERA_TRACK_LIMITS.minFps).max(SCENE3D_CAMERA_TRACK_LIMITS.maxFps),
16196
+ samples: zod.z.array(scene3DCameraSampleSchema).min(1).max(SCENE3D_CAMERA_TRACK_LIMITS.maxFrameCount)
16197
+ }).strict();
16198
+ function scene3DProjectionIssues(matrix, near, far, path) {
16199
+ const issues = [];
16200
+ const eps = SCENE3D_CAMERA_TRACK_LIMITS.projectionEpsilon;
16201
+ if (matrix.length !== 16) {
16202
+ issues.push({ path, message: `projection matrix must have exactly 16 entries (got ${matrix.length})` });
16203
+ return issues;
16204
+ }
16205
+ if (matrix.some((value) => !Number.isFinite(value))) {
16206
+ issues.push({ path, message: "projection matrix contains a non-finite entry" });
16207
+ return issues;
16208
+ }
16209
+ if (Math.abs(matrix[11]) < eps && Math.abs(matrix[15] - 1) < eps) {
16210
+ issues.push({
16211
+ path,
16212
+ message: "projection matrix is orthographic; only perspective cameras are supported by this schema version"
16213
+ });
16214
+ return issues;
16215
+ }
16216
+ for (const index of [1, 2, 3, 4, 6, 7, 12, 13, 15]) {
16217
+ if (Math.abs(matrix[index]) > eps) {
16218
+ issues.push({ path: [...path, index], message: `projection matrix entry ${index} must be 0 (got ${matrix[index]})` });
16219
+ }
16220
+ }
16221
+ if (Math.abs(matrix[11] + 1) > eps) {
16222
+ issues.push({ path: [...path, 11], message: `projection matrix entry 11 must be -1 for a perspective camera (got ${matrix[11]})` });
16223
+ }
16224
+ if (!(matrix[0] > 0)) {
16225
+ issues.push({ path: [...path, 0], message: `projection matrix entry 0 must be positive (got ${matrix[0]})` });
16226
+ }
16227
+ if (!(matrix[5] > 0)) {
16228
+ issues.push({ path: [...path, 5], message: `projection matrix entry 5 must be positive (got ${matrix[5]})` });
16229
+ }
16230
+ if (!(matrix[10] < 0)) {
16231
+ issues.push({ path: [...path, 10], message: `projection matrix entry 10 must be negative (got ${matrix[10]})` });
16232
+ }
16233
+ if (!(matrix[14] < 0)) {
16234
+ issues.push({ path: [...path, 14], message: `projection matrix entry 14 must be negative (got ${matrix[14]})` });
16235
+ }
16236
+ if (issues.length > 0) return issues;
16237
+ if (!(near > 0) || !(far > near)) {
16238
+ issues.push({ path, message: `near/far must satisfy 0 < near < far (got near ${near}, far ${far})` });
16239
+ return issues;
16240
+ }
16241
+ const tolerance = SCENE3D_CAMERA_TRACK_LIMITS.nearFarRelativeTolerance;
16242
+ const impliedNear = matrix[14] / (matrix[10] - 1);
16243
+ if (Math.abs(impliedNear - near) > Math.abs(near) * tolerance) {
16244
+ issues.push({
16245
+ path,
16246
+ message: `projection matrix implies near ${impliedNear.toPrecision(6)}, but the sample declares ${near}`
16247
+ });
16248
+ }
16249
+ const farDenominator = matrix[10] + 1;
16250
+ if (Math.abs(farDenominator) < eps) {
16251
+ issues.push({
16252
+ path,
16253
+ message: `projection matrix implies an infinite far plane, but the sample declares ${far}`
16254
+ });
16255
+ } else {
16256
+ const impliedFar = matrix[14] / farDenominator;
16257
+ if (Math.abs(impliedFar - far) > Math.abs(far) * tolerance) {
16258
+ issues.push({
16259
+ path,
16260
+ message: `projection matrix implies far ${impliedFar.toPrecision(6)}, but the sample declares ${far}`
16261
+ });
16262
+ }
16263
+ }
16264
+ return issues;
16265
+ }
16266
+ function scene3DCameraTrackIssues(track) {
16267
+ const issues = [];
16268
+ if (track.samples.length !== track.frameCount) {
16269
+ issues.push({
16270
+ path: ["samples"],
16271
+ message: `track declares ${track.frameCount} frames but carries ${track.samples.length} samples; exactly one sample per frame is required`
16272
+ });
16273
+ }
16274
+ const quaternionTolerance = SCENE3D_CAMERA_TRACK_LIMITS.quaternionTolerance;
16275
+ track.samples.forEach((sample, index) => {
16276
+ const [x, y, z23, w] = sample.quaternion;
16277
+ const norm = Math.sqrt(x * x + y * y + z23 * z23 + w * w);
16278
+ if (Math.abs(norm - 1) > quaternionTolerance) {
16279
+ issues.push({
16280
+ path: ["samples", index, "quaternion"],
16281
+ message: `quaternion at frame ${index} has length ${norm.toPrecision(6)}; it must be normalized`
16282
+ });
16283
+ }
16284
+ if (!(sample.far > sample.near)) {
16285
+ issues.push({
16286
+ path: ["samples", index, "far"],
16287
+ message: `frame ${index}: far (${sample.far}) must be greater than near (${sample.near})`
16288
+ });
16289
+ }
16290
+ for (const issue2 of scene3DProjectionIssues(
16291
+ sample.projectionMatrix,
16292
+ sample.near,
16293
+ sample.far,
16294
+ ["samples", index, "projectionMatrix"]
16295
+ )) {
16296
+ issues.push(issue2);
16297
+ }
16298
+ });
16299
+ return issues;
16300
+ }
16301
+ var scene3DCameraTrackSchema = scene3DCameraTrackObjectSchema.superRefine((track, ctx) => {
16302
+ for (const issue2 of scene3DCameraTrackIssues(track)) {
16303
+ ctx.addIssue({ code: "custom", path: issue2.path, message: issue2.message });
16304
+ }
16305
+ });
16306
+ function isScene3DCameraTrack(value) {
16307
+ return scene3DCameraTrackSchema.safeParse(value).success;
16308
+ }
16309
+ function scene3DCameraTrackPlanIssues(track, plan) {
16310
+ const issues = [];
16311
+ if (track.fps !== plan.fps) {
16312
+ issues.push({
16313
+ path: ["fps"],
16314
+ message: `camera track is ${track.fps} fps but the scene is ${plan.fps} fps; changing fps requires an explicit resample and a new revision`
16315
+ });
16316
+ }
16317
+ if (track.frameCount !== plan.durationInFrames) {
16318
+ issues.push({
16319
+ path: ["frameCount"],
16320
+ message: `camera track covers ${track.frameCount} frames but the scene is ${plan.durationInFrames} frames`
16321
+ });
16322
+ }
16323
+ const expected = plan.height / plan.width;
16324
+ const tolerance = SCENE3D_CAMERA_TRACK_LIMITS.aspectRelativeTolerance;
16325
+ track.samples.forEach((sample, index) => {
16326
+ const m0 = sample.projectionMatrix[0];
16327
+ const m5 = sample.projectionMatrix[5];
16328
+ if (!Number.isFinite(m0) || !Number.isFinite(m5) || m5 === 0) return;
16329
+ const actual = m0 / m5;
16330
+ if (Math.abs(actual - expected) > expected * tolerance) {
16331
+ issues.push({
16332
+ path: ["samples", index, "projectionMatrix"],
16333
+ message: `frame ${index}: projection is baked for aspect ${(1 / actual).toPrecision(6)} but the scene renders ${plan.width}\xD7${plan.height}; reprojection requires a new revision`
16334
+ });
16335
+ }
16336
+ });
16337
+ return issues;
16338
+ }
16339
+ function scene3DSampleForFrame(track, frame) {
16340
+ if (!Number.isInteger(frame) || frame < 0 || frame >= track.frameCount) return void 0;
16341
+ return track.samples[frame];
16342
+ }
16343
+ function parseScene3DCameraTrackJson(text) {
16344
+ const bytes = scene3DJsonByteLength(text);
16345
+ if (bytes > SCENE3D_CAMERA_TRACK_LIMITS.maxJsonBytes) {
16346
+ return {
16347
+ ok: false,
16348
+ issues: [
16349
+ {
16350
+ path: [],
16351
+ message: `camera track is ${bytes} bytes; the limit is ${SCENE3D_CAMERA_TRACK_LIMITS.maxJsonBytes}`
16352
+ }
16353
+ ]
16354
+ };
16355
+ }
16356
+ let decoded;
16357
+ try {
16358
+ decoded = JSON.parse(text);
16359
+ } catch {
16360
+ return { ok: false, issues: [{ path: [], message: "camera track is not valid JSON" }] };
16361
+ }
16362
+ const parsed = scene3DCameraTrackSchema.safeParse(decoded);
16363
+ if (!parsed.success) {
16364
+ return { ok: false, issues: scene3DZodIssues(parsed.error) };
16365
+ }
16366
+ return { ok: true, value: parsed.data };
16367
+ }
16368
+ var PRO3D_RENDER_NODE_TYPE = "pro-3d-render";
16369
+ var PRO3D_RENDER_LABEL = "3D Render Pro";
16370
+ var PRO3D_RENDER_CREDIT_ID = "pro-3d-render";
16371
+ var PRO3D_RENDER_ENGINES = ["blender-cloud", "blender-local"];
16372
+ var PRO3D_RENDER_DEFAULT_ENGINE = "blender-cloud";
16373
+ var PRO3D_RENDER_QUALITY_PROFILES = ["standard"];
16374
+ var PRO3D_RENDER_DEFAULT_QUALITY = "standard";
16375
+ var PRO3D_RENDER_STYLES = ["clay"];
16376
+ var PRO3D_RENDER_DEFAULT_STYLE = "clay";
16377
+ var PRO3D_RENDER_MIN_REPAIR_PASSES = 0;
16378
+ var PRO3D_RENDER_MAX_REPAIR_PASSES = 2;
16379
+ var PRO3D_RENDER_DEFAULT_REPAIR_PASSES = 2;
16380
+ var PRO3D_RENDER_ASPECT_RATIOS = ["16:9", "9:16", "1:1", "4:5", "21:9"];
16381
+ var PRO3D_RENDER_PROMPT_MAX = 8e3;
16382
+ var PRO3D_RENDER_LIMITS = {
16383
+ promptMax: PRO3D_RENDER_PROMPT_MAX,
16384
+ editPromptMax: PRO3D_RENDER_PROMPT_MAX,
16385
+ minDurationSeconds: SCENE3D_LIMITS.minDurationSeconds,
16386
+ maxDurationSeconds: SCENE3D_LIMITS.maxDurationSeconds,
16387
+ minFps: SCENE3D_LIMITS.minFps,
16388
+ maxFps: SCENE3D_LIMITS.maxFps,
16389
+ maxReferences: SCENE3D_LIMITS.maxReferences,
16390
+ /** Opaque ids the caller echoes back (quote, export, connection). */
16391
+ maxIdLength: 200,
16392
+ /** `Idempotency-Key` bounds — the platform's floor, with a ceiling so an
16393
+ * unbounded header can never reach a lookup or a database column. */
16394
+ minIdempotencyKeyLength: 8,
16395
+ maxIdempotencyKeyLength: 255
16396
+ };
16397
+ var PRO3D_RENDER_SOURCE_KINDS = ["prompt", "scene", "local-export"];
16398
+ function isPro3DRenderRenderOnly(source) {
16399
+ return source.kind === "scene" && source.editPrompt === void 0;
16400
+ }
16401
+ function pro3DRenderProducedSchemaVersion(source) {
16402
+ return source.kind === "scene" ? null : 2;
16403
+ }
16404
+ var pro3DRenderQuoteSchema = zod.z.object({
16405
+ quoteId: zod.z.string().min(1),
16406
+ expiresAt: zod.z.string().min(1),
16407
+ maxCredits: zod.z.number(),
16408
+ breakdown: zod.z.array(
16409
+ zod.z.object({ code: zod.z.string(), label: zod.z.string(), credits: zod.z.number() }).passthrough()
16410
+ ),
16411
+ pricingVersion: zod.z.string(),
16412
+ capabilitiesVersion: zod.z.string(),
16413
+ normalizedInputHash: zod.z.string().min(1)
16414
+ }).passthrough();
16415
+ function isPro3DRenderQuote(value) {
16416
+ return pro3DRenderQuoteSchema.safeParse(value).success;
16417
+ }
16418
+ var pro3DRenderJobOutputSchema = zod.z.object({
16419
+ videoUrl: zod.z.string().min(1),
16420
+ scenePlan: scene3DAnyPlanSchema,
16421
+ sceneRevisionId: zod.z.string().min(1),
16422
+ posterAssetId: zod.z.string().min(1),
16423
+ sourceArtifactId: zod.z.string().min(1).optional(),
16424
+ validation: zod.z.object({
16425
+ status: zod.z.literal("passed"),
16426
+ reportAssetId: zod.z.string().min(1),
16427
+ warnings: zod.z.array(
16428
+ zod.z.object({
16429
+ code: zod.z.string(),
16430
+ message: zod.z.string(),
16431
+ shotId: zod.z.string().optional()
16432
+ }).passthrough()
16433
+ )
16434
+ }).passthrough(),
16435
+ renderer: zod.z.string().min(1),
16436
+ metadata: zod.z.object({
16437
+ width: zod.z.number().int().positive(),
16438
+ height: zod.z.number().int().positive(),
16439
+ fps: zod.z.number().positive(),
16440
+ frames: zod.z.number().int().positive(),
16441
+ duration: zod.z.number().positive()
16442
+ }).passthrough(),
16443
+ changeSummary: zod.z.string().optional()
16444
+ }).passthrough();
16445
+ function isPro3DRenderJobOutput(value) {
16446
+ return pro3DRenderJobOutputSchema.safeParse(value).success;
16447
+ }
16448
+ var pro3DRenderCoreOutputSchema = zod.z.object({
16449
+ videoUrl: zod.z.string().min(1),
16450
+ scenePlan: scene3DAnyPlanSchema
16451
+ }).passthrough();
16452
+ function buildPro3DRenderSource(input) {
16453
+ if (input.sourceMode === "scene") {
16454
+ const revisionId = input.revisionId?.trim();
16455
+ const sourceJobId = input.sourceJobId?.trim();
16456
+ if (!revisionId) {
16457
+ return { ok: false, message: "no scene to render \u2014 wire a 3D scene in, or run this node once." };
16458
+ }
16459
+ const editPrompt = input.editPrompt?.trim();
16460
+ return {
16461
+ ok: true,
16462
+ source: { kind: "scene", revisionId, ...sourceJobId ? { sourceJobId } : {}, ...editPrompt ? { editPrompt } : {} }
16463
+ };
16464
+ }
16465
+ const prompt = input.prompt?.trim();
16466
+ if (!prompt) {
16467
+ return { ok: false, message: "no brief \u2014 describe the scene, or wire a prompt in." };
16468
+ }
16469
+ const references = input.references ?? [];
16470
+ return {
16471
+ ok: true,
16472
+ source: { kind: "prompt", prompt, ...references.length > 0 ? { references } : {} }
16473
+ };
16474
+ }
16475
+ function pro3DRenderTimingOverrides(input) {
16476
+ if (input.source.kind === "scene" && !input.overrideSourceTiming) return {};
16477
+ const out = {};
16478
+ if (typeof input.durationSeconds === "number") out.durationSeconds = input.durationSeconds;
16479
+ if (typeof input.fps === "number") out.fps = input.fps;
16480
+ if (typeof input.aspectRatio === "string") out.aspectRatio = input.aspectRatio;
16481
+ return out;
16482
+ }
15189
16483
 
15190
16484
  // src/studio-transient.ts
15191
16485
  var STUDIO_TRANSIENT_KEYS = [
@@ -15233,6 +16527,217 @@ function stripStudioTransientSettings(settings) {
15233
16527
  }
15234
16528
  return { ...settings, studio: kept };
15235
16529
  }
16530
+ var scene3DV2OverrideInputSchema = zod.z.discriminatedUnion("kind", [
16531
+ zod.z.object({
16532
+ kind: zod.z.literal("entity-transform"),
16533
+ entityId: scene3DIdSchema,
16534
+ space: zod.z.enum(["local", "world"]),
16535
+ position: vec3Schema.optional(),
16536
+ rotation: rotationVec3Schema.optional(),
16537
+ scale: scaleVec3Schema.optional()
16538
+ }).strict(),
16539
+ zod.z.object({
16540
+ kind: zod.z.literal("entity-color"),
16541
+ entityId: scene3DIdSchema,
16542
+ materialRole: scene3DMaterialRoleSchema,
16543
+ color: scene3DColorSchema
16544
+ }).strict(),
16545
+ zod.z.object({ kind: zod.z.literal("entity-visibility"), entityId: scene3DIdSchema, visible: zod.z.boolean() }).strict(),
16546
+ zod.z.object({
16547
+ kind: zod.z.literal("camera-shot-offset"),
16548
+ shotId: scene3DIdSchema,
16549
+ positionOffset: vec3Schema.optional(),
16550
+ targetOffset: vec3Schema.optional()
16551
+ }).strict()
16552
+ ]);
16553
+ var scene3DV2EditOperationSchema = zod.z.discriminatedUnion("op", [
16554
+ zod.z.object({ op: zod.z.literal("set-override"), override: scene3DV2OverrideInputSchema }).strict(),
16555
+ zod.z.object({ op: zod.z.literal("remove-override"), overrideId: scene3DIdSchema }).strict()
16556
+ ]);
16557
+ var scene3DV2EditOperationsSchema = zod.z.array(scene3DV2EditOperationSchema).min(1).max(100);
16558
+ function channel(override) {
16559
+ switch (override.kind) {
16560
+ case "entity-transform":
16561
+ return `transform:${override.entityId}`;
16562
+ case "entity-color":
16563
+ return `color:${override.entityId}:${override.materialRole}`;
16564
+ case "entity-visibility":
16565
+ return `visibility:${override.entityId}`;
16566
+ case "camera-shot-offset":
16567
+ return `camera:${override.shotId}`;
16568
+ }
16569
+ }
16570
+ function capability(override) {
16571
+ switch (override.kind) {
16572
+ case "entity-transform":
16573
+ return "transform";
16574
+ case "entity-color":
16575
+ return "color";
16576
+ case "entity-visibility":
16577
+ return "visibility";
16578
+ case "camera-shot-offset":
16579
+ return null;
16580
+ }
16581
+ }
16582
+ function lockIssue(plan, override, externalLocks) {
16583
+ if (override.kind === "camera-shot-offset") return null;
16584
+ const target = plan.objects.find((o) => o.id === override.entityId);
16585
+ if (!target) return `Unknown entity: ${override.entityId}`;
16586
+ const cap = capability(override);
16587
+ if (target.capabilities && !target.capabilities.includes(cap)) return `Entity ${target.id} does not allow ${cap} edits`;
16588
+ if (externalLocks.has(target.id) || target.locks?.includes(cap)) return `Entity ${target.id} is locked for ${cap}`;
16589
+ if (cap !== "transform" && cap !== "visibility") return null;
16590
+ const byId = new Map(plan.objects.map((entity) => [entity.id, entity]));
16591
+ for (const entity of plan.objects) {
16592
+ if (!externalLocks.has(entity.id) && !entity.locks?.includes(cap)) continue;
16593
+ let parent = entity.parentId;
16594
+ while (parent) {
16595
+ if (parent === target.id) return `Changing ${target.id} would change locked descendant ${entity.id}`;
16596
+ parent = byId.get(parent)?.parentId;
16597
+ }
16598
+ }
16599
+ return null;
16600
+ }
16601
+ async function applyScene3DV2EditOperations(input, operations, options) {
16602
+ const parsed = scene3DPlanV2Schema.safeParse(input);
16603
+ if (!parsed.success) return { ok: false, code: "invalid_plan", message: parsed.error.issues[0]?.message ?? "Invalid scene" };
16604
+ const base = parsed.data;
16605
+ if (base.revisionId !== options.expectedRevisionId || options.expectedContentHash !== void 0 && base.provenance.contentHash !== options.expectedContentHash) {
16606
+ return { ok: false, code: "stale_revision", message: "The scene changed since this edit was prepared" };
16607
+ }
16608
+ if (!await verifyScene3DPlanV2ContentHash(base)) {
16609
+ return { ok: false, code: "invalid_plan", message: "The scene content does not match its digest" };
16610
+ }
16611
+ const ops = scene3DV2EditOperationsSchema.safeParse(operations);
16612
+ if (!ops.success) return { ok: false, code: "invalid_operations", message: ops.error.issues[0]?.message ?? "Invalid edit" };
16613
+ const revisionId = options.newRevisionId ?? newScene3DRevisionId();
16614
+ if (revisionId === base.revisionId) return { ok: false, code: "invalid_operations", message: "An edit requires a new revision identity" };
16615
+ const externalLocks = new Set(options.lockedObjectIds ?? []);
16616
+ for (const id of externalLocks) {
16617
+ if (!base.objects.some((entity) => entity.id === id)) return { ok: false, code: "invalid_operations", message: `Unknown locked entity: ${id}` };
16618
+ }
16619
+ let overrides = [...base.overrides ?? []];
16620
+ for (const [index, operation] of ops.data.entries()) {
16621
+ if (operation.op === "remove-override") {
16622
+ const existing = overrides.find((override) => override.id === operation.overrideId);
16623
+ if (!existing) return { ok: false, code: "invalid_operations", message: `Unknown override: ${operation.overrideId}` };
16624
+ const issue3 = lockIssue(base, existing, externalLocks);
16625
+ if (issue3) return { ok: false, code: "locked", message: issue3 };
16626
+ overrides = overrides.filter((override) => override.id !== existing.id);
16627
+ continue;
16628
+ }
16629
+ const issue2 = lockIssue(base, operation.override, externalLocks);
16630
+ if (issue2) return { ok: false, code: "locked", message: issue2 };
16631
+ const previous = overrides.find((override) => channel(override) === channel(operation.override));
16632
+ const compatible = previous && (previous.kind !== "entity-transform" || operation.override.kind === "entity-transform" && previous.space === operation.override.space);
16633
+ const next2 = {
16634
+ ...compatible ? previous : {},
16635
+ ...operation.override,
16636
+ id: `edit-${revisionId}-${index}`,
16637
+ sourceRevisionId: base.revisionId,
16638
+ sourceContentHash: base.provenance.contentHash,
16639
+ operationVersion: SCENE3D_V2_OVERRIDE_OPERATION_VERSION
16640
+ };
16641
+ const key = channel(next2);
16642
+ overrides = [...overrides.filter((override) => channel(override) !== key), next2];
16643
+ }
16644
+ const { sourceArtifactId: _sourceArtifactId, ...provenance } = base.provenance;
16645
+ const next = {
16646
+ ...base,
16647
+ revisionId,
16648
+ parentRevisionId: base.revisionId,
16649
+ // Geometry and cameras are reused; derived images, validation and native
16650
+ // exports describe the old revision until regenerated for these overlays.
16651
+ assets: base.assets.filter((asset) => asset.kind === "glb" || asset.kind === "camera-track-json").map((asset) => ({
16652
+ ...asset,
16653
+ originRevisionId: asset.originRevisionId ?? base.revisionId
16654
+ })),
16655
+ overrides,
16656
+ provenance: { ...provenance, sourceRevisionId: base.revisionId }
16657
+ };
16658
+ const validated = scene3DPlanV2Schema.safeParse(next);
16659
+ if (!validated.success) return { ok: false, code: "invalid_operations", message: validated.error.issues[0]?.message ?? "Invalid edited scene" };
16660
+ const plan = validated.data;
16661
+ const contentHash = await computeScene3DPlanV2ContentHash(plan);
16662
+ return { ok: true, plan: { ...plan, provenance: { ...plan.provenance, contentHash } }, changeSummary: `Applied ${ops.data.length} scene edit${ops.data.length === 1 ? "" : "s"}` };
16663
+ }
16664
+
16665
+ // src/scene3d-authoring-engine.ts
16666
+ var SCENE3D_BASIC_ENGINE = "basic";
16667
+ var SCENE3D_AUTHORING_ENGINES = [SCENE3D_BASIC_ENGINE, ...SCENE3D_V2_ENGINES];
16668
+ var SCENE3D_DEFAULT_ADVANCED_ENGINE = "blender-cloud";
16669
+ function isScene3DAuthoringEngine(value) {
16670
+ return typeof value === "string" && SCENE3D_AUTHORING_ENGINES.includes(value);
16671
+ }
16672
+ function advancedFields(engine) {
16673
+ return { engine, acceptedSceneSchemaVersions: [...SCENE3D_SUPPORTED_SCHEMA_VERSIONS] };
16674
+ }
16675
+ function serves(available, engine) {
16676
+ return available === void 0 || available.includes(engine);
16677
+ }
16678
+ function planAuthoringEngine(plan) {
16679
+ const provenance = plan?.provenance;
16680
+ const engine = provenance?.engine;
16681
+ return typeof engine === "string" && isKnownScene3DEngine(engine) ? engine : void 0;
16682
+ }
16683
+ function resolveScene3DAuthoringEngine(input) {
16684
+ const requested = typeof input.requested === "string" && input.requested.trim() !== "" ? input.requested.trim() : void 0;
16685
+ if (requested !== void 0 && !isScene3DAuthoringEngine(requested)) {
16686
+ return {
16687
+ ok: false,
16688
+ code: "unknown_engine",
16689
+ message: `"${requested}" is not a 3D authoring engine \u2014 choose Basic, or an advanced engine this install offers.`
16690
+ };
16691
+ }
16692
+ const version = input.plan === void 0 ? void 0 : scene3DPlanSchemaVersion(input.plan);
16693
+ if (version !== void 0 && version !== null && !SCENE3D_SUPPORTED_SCHEMA_VERSIONS.includes(version)) {
16694
+ return {
16695
+ ok: false,
16696
+ code: "unsupported_schema_version",
16697
+ message: `This scene uses schema version ${version}, which this version of Nodaro cannot edit.`
16698
+ };
16699
+ }
16700
+ const isV2 = version === SCENE3D_SCHEMA_VERSION_V2;
16701
+ if (isV2) {
16702
+ if (requested === SCENE3D_BASIC_ENGINE) {
16703
+ return {
16704
+ ok: false,
16705
+ code: "schema_requires_advanced",
16706
+ message: "This scene was authored by an advanced engine (schema v2) and cannot be edited on the Basic engine \u2014 switch this node's engine to the advanced one."
16707
+ };
16708
+ }
16709
+ if (requested !== void 0) {
16710
+ return serves(input.availableEngines, requested) ? { ok: true, lane: "advanced", engine: requested, fields: advancedFields(requested) } : unavailable(requested);
16711
+ }
16712
+ const preferred = [];
16713
+ const authored = planAuthoringEngine(input.plan);
16714
+ if (authored) preferred.push(authored);
16715
+ if (!preferred.includes(SCENE3D_DEFAULT_ADVANCED_ENGINE)) preferred.push(SCENE3D_DEFAULT_ADVANCED_ENGINE);
16716
+ const engine2 = preferred.find((candidate) => serves(input.availableEngines, candidate));
16717
+ if (!engine2) {
16718
+ return {
16719
+ ok: false,
16720
+ code: "advanced_unavailable",
16721
+ message: "This scene needs an advanced 3D engine to edit, and this install does not have one available."
16722
+ };
16723
+ }
16724
+ return { ok: true, lane: "advanced", engine: engine2, fields: advancedFields(engine2) };
16725
+ }
16726
+ if (requested === void 0 || requested === SCENE3D_BASIC_ENGINE) {
16727
+ return { ok: true, lane: "basic", engine: void 0, fields: {} };
16728
+ }
16729
+ const engine = requested;
16730
+ if (!serves(input.availableEngines, engine)) return unavailable(engine);
16731
+ return { ok: true, lane: "advanced", engine, fields: advancedFields(engine) };
16732
+ }
16733
+ function unavailable(engine) {
16734
+ return {
16735
+ ok: false,
16736
+ code: "engine_unavailable",
16737
+ message: `The "${engine}" 3D authoring engine is not available on this install.`
16738
+ };
16739
+ }
16740
+ var SCENE3D_BASIC_SCHEMA_VERSION = SCENE3D_SCHEMA_VERSION;
15236
16741
 
15237
16742
  exports.ACCESS_LEVELS = ACCESS_LEVELS;
15238
16743
  exports.ACTIVE_SCENE_HELPERS = ACTIVE_SCENE_HELPERS;
@@ -15529,6 +17034,22 @@ exports.PRESET_LABELS = PRESET_LABELS;
15529
17034
  exports.PRESET_SETTING_KEYS = PRESET_SETTING_KEYS;
15530
17035
  exports.PRICING_DEFAULT_DURATION_SEC = PRICING_DEFAULT_DURATION_SEC;
15531
17036
  exports.PRICING_DEFAULT_RESOLUTION = PRICING_DEFAULT_RESOLUTION;
17037
+ exports.PRO3D_RENDER_ASPECT_RATIOS = PRO3D_RENDER_ASPECT_RATIOS;
17038
+ exports.PRO3D_RENDER_CREDIT_ID = PRO3D_RENDER_CREDIT_ID;
17039
+ exports.PRO3D_RENDER_DEFAULT_ENGINE = PRO3D_RENDER_DEFAULT_ENGINE;
17040
+ exports.PRO3D_RENDER_DEFAULT_QUALITY = PRO3D_RENDER_DEFAULT_QUALITY;
17041
+ exports.PRO3D_RENDER_DEFAULT_REPAIR_PASSES = PRO3D_RENDER_DEFAULT_REPAIR_PASSES;
17042
+ exports.PRO3D_RENDER_DEFAULT_STYLE = PRO3D_RENDER_DEFAULT_STYLE;
17043
+ exports.PRO3D_RENDER_ENGINES = PRO3D_RENDER_ENGINES;
17044
+ exports.PRO3D_RENDER_LABEL = PRO3D_RENDER_LABEL;
17045
+ exports.PRO3D_RENDER_LIMITS = PRO3D_RENDER_LIMITS;
17046
+ exports.PRO3D_RENDER_MAX_REPAIR_PASSES = PRO3D_RENDER_MAX_REPAIR_PASSES;
17047
+ exports.PRO3D_RENDER_MIN_REPAIR_PASSES = PRO3D_RENDER_MIN_REPAIR_PASSES;
17048
+ exports.PRO3D_RENDER_NODE_TYPE = PRO3D_RENDER_NODE_TYPE;
17049
+ exports.PRO3D_RENDER_PROMPT_MAX = PRO3D_RENDER_PROMPT_MAX;
17050
+ exports.PRO3D_RENDER_QUALITY_PROFILES = PRO3D_RENDER_QUALITY_PROFILES;
17051
+ exports.PRO3D_RENDER_SOURCE_KINDS = PRO3D_RENDER_SOURCE_KINDS;
17052
+ exports.PRO3D_RENDER_STYLES = PRO3D_RENDER_STYLES;
15532
17053
  exports.PROMPT_HARD_CEILING = PROMPT_HARD_CEILING;
15533
17054
  exports.PROMPT_PREFIX_KEY = PROMPT_PREFIX_KEY;
15534
17055
  exports.PROMPT_SUFFIX_KEY = PROMPT_SUFFIX_KEY;
@@ -15561,15 +17082,42 @@ exports.REPEATABLE_NODE_TYPES = REPEATABLE_NODE_TYPES;
15561
17082
  exports.REPEAT_PLACEHOLDER = REPEAT_PLACEHOLDER;
15562
17083
  exports.REPLICATE_LIP_SYNC_PROVIDERS = REPLICATE_LIP_SYNC_PROVIDERS;
15563
17084
  exports.RESERVED_TEMPLATE_VARS = RESERVED_TEMPLATE_VARS;
17085
+ exports.SCENE3D_ASSET_KINDS = SCENE3D_ASSET_KINDS;
17086
+ exports.SCENE3D_ASSET_ROLES = SCENE3D_ASSET_ROLES;
17087
+ exports.SCENE3D_ASSET_ROLE_KINDS = SCENE3D_ASSET_ROLE_KINDS;
17088
+ exports.SCENE3D_AUTHORING_ENGINES = SCENE3D_AUTHORING_ENGINES;
17089
+ exports.SCENE3D_BASIC_ENGINE = SCENE3D_BASIC_ENGINE;
17090
+ exports.SCENE3D_BASIC_SCHEMA_VERSION = SCENE3D_BASIC_SCHEMA_VERSION;
17091
+ exports.SCENE3D_CAMERA_TRACK_FORMAT = SCENE3D_CAMERA_TRACK_FORMAT;
17092
+ exports.SCENE3D_CAMERA_TRACK_LIMITS = SCENE3D_CAMERA_TRACK_LIMITS;
17093
+ exports.SCENE3D_CAMERA_TRACK_VERSION = SCENE3D_CAMERA_TRACK_VERSION;
17094
+ exports.SCENE3D_CLAY_LIGHTING_PRESETS = SCENE3D_CLAY_LIGHTING_PRESETS;
17095
+ exports.SCENE3D_DEFAULT_ADVANCED_ENGINE = SCENE3D_DEFAULT_ADVANCED_ENGINE;
15564
17096
  exports.SCENE3D_DEFAULT_DURATION_SECONDS = SCENE3D_DEFAULT_DURATION_SECONDS;
17097
+ exports.SCENE3D_DEFAULT_ENTITY_CAPABILITIES = SCENE3D_DEFAULT_ENTITY_CAPABILITIES;
15565
17098
  exports.SCENE3D_DEFAULT_FPS = SCENE3D_DEFAULT_FPS;
15566
17099
  exports.SCENE3D_EDIT_NODE_TYPE = SCENE3D_EDIT_NODE_TYPE;
17100
+ exports.SCENE3D_ENTITY_CAPABILITIES = SCENE3D_ENTITY_CAPABILITIES;
17101
+ exports.SCENE3D_ENTITY_ROLES = SCENE3D_ENTITY_ROLES;
15567
17102
  exports.SCENE3D_GENERATE_NODE_TYPE = SCENE3D_GENERATE_NODE_TYPE;
17103
+ exports.SCENE3D_GLB_EXTRAS_ALLOWLIST = SCENE3D_GLB_EXTRAS_ALLOWLIST;
17104
+ exports.SCENE3D_GLB_EXTRAS_ENTITY_ID = SCENE3D_GLB_EXTRAS_ENTITY_ID;
17105
+ exports.SCENE3D_GLB_EXTRAS_MATERIAL_ROLE = SCENE3D_GLB_EXTRAS_MATERIAL_ROLE;
17106
+ exports.SCENE3D_GLB_EXTRAS_SUBPART_ID = SCENE3D_GLB_EXTRAS_SUBPART_ID;
15568
17107
  exports.SCENE3D_LIMITS = SCENE3D_LIMITS;
15569
17108
  exports.SCENE3D_PLAN_FIELD = SCENE3D_PLAN_FIELD;
15570
17109
  exports.SCENE3D_PLAN_TYPE = SCENE3D_PLAN_TYPE;
15571
17110
  exports.SCENE3D_PRIMITIVES = SCENE3D_PRIMITIVES;
17111
+ exports.SCENE3D_PRIMITIVE_MATERIAL_ROLE = SCENE3D_PRIMITIVE_MATERIAL_ROLE;
17112
+ exports.SCENE3D_RENDERER_ASSET_KINDS = SCENE3D_RENDERER_ASSET_KINDS;
15572
17113
  exports.SCENE3D_SCHEMA_VERSION = SCENE3D_SCHEMA_VERSION;
17114
+ exports.SCENE3D_SCHEMA_VERSION_V2 = SCENE3D_SCHEMA_VERSION_V2;
17115
+ exports.SCENE3D_SUPPORTED_SCHEMA_VERSIONS = SCENE3D_SUPPORTED_SCHEMA_VERSIONS;
17116
+ exports.SCENE3D_V2_CONTENT_HASH_EXCLUDED = SCENE3D_V2_CONTENT_HASH_EXCLUDED;
17117
+ exports.SCENE3D_V2_ENGINES = SCENE3D_V2_ENGINES;
17118
+ exports.SCENE3D_V2_LIMITS = SCENE3D_V2_LIMITS;
17119
+ exports.SCENE3D_V2_OVERRIDE_OPERATION_VERSION = SCENE3D_V2_OVERRIDE_OPERATION_VERSION;
17120
+ exports.SCENE3D_V2_PRIMITIVES = SCENE3D_V2_PRIMITIVES;
15573
17121
  exports.SCENE_HELPER_NAMES = SCENE_HELPER_NAMES;
15574
17122
  exports.SCRAPER_ACTOR_LABELS = SCRAPER_ACTOR_LABELS;
15575
17123
  exports.SCRAPER_CREDIT_COSTS = SCRAPER_CREDIT_COSTS;
@@ -15734,6 +17282,7 @@ exports.applyHandleInputOverride = applyHandleInputOverride;
15734
17282
  exports.applyRange = applyRange;
15735
17283
  exports.applyRangeIndices = applyRangeIndices;
15736
17284
  exports.applyScene3DEditOperations = applyScene3DEditOperations;
17285
+ exports.applyScene3DV2EditOperations = applyScene3DV2EditOperations;
15737
17286
  exports.applySlots = applySlots;
15738
17287
  exports.applyVideoAudioToggle = applyVideoAudioToggle;
15739
17288
  exports.applyVideoNegativePrompt = applyVideoNegativePrompt;
@@ -15756,6 +17305,7 @@ exports.buildModelTree = buildModelTree;
15756
17305
  exports.buildMotionCreditModelIdentifier = buildMotionCreditModelIdentifier;
15757
17306
  exports.buildNodePresetExport = buildNodePresetExport;
15758
17307
  exports.buildPanelPrompt = buildPanelPrompt;
17308
+ exports.buildPro3DRenderSource = buildPro3DRenderSource;
15759
17309
  exports.buildProgressSegments = buildProgressSegments;
15760
17310
  exports.buildRangeLabel = buildRangeLabel;
15761
17311
  exports.buildScraperCreditId = buildScraperCreditId;
@@ -15766,6 +17316,7 @@ exports.calculateCombinedProgress = calculateCombinedProgress;
15766
17316
  exports.calculateMonetizationMarkup = calculateMonetizationMarkup;
15767
17317
  exports.calculateMonetizedCost = calculateMonetizedCost;
15768
17318
  exports.calculateProgress = calculateProgress;
17319
+ exports.canonicalScene3DPlanV2Json = canonicalScene3DPlanV2Json;
15769
17320
  exports.canonicalVarName = canonicalVarName;
15770
17321
  exports.characterBoardItems = characterBoardItems;
15771
17322
  exports.characterBucketDisplayRank = characterBucketDisplayRank;
@@ -15785,6 +17336,7 @@ exports.clipLookSchema = clipLookSchema;
15785
17336
  exports.collectAncestorRefs = collectAncestorRefs;
15786
17337
  exports.combineSameLabelRefs = combineSameLabelRefs;
15787
17338
  exports.computeAggregateLanes = computeAggregateLanes;
17339
+ exports.computeScene3DPlanV2ContentHash = computeScene3DPlanV2ContentHash;
15788
17340
  exports.countRefModalityEdges = countRefModalityEdges;
15789
17341
  exports.creditRangesAll = creditRangesAll;
15790
17342
  exports.creditsToUsd = creditsToUsd;
@@ -15906,14 +17458,23 @@ exports.isGeminiOmniProvider = isGeminiOmniProvider;
15906
17458
  exports.isGvpSupportedProvider = isGvpSupportedProvider;
15907
17459
  exports.isHandleInputWired = isHandleInputWired;
15908
17460
  exports.isKineticCaptionStyle = isKineticCaptionStyle;
17461
+ exports.isKnownScene3DEngine = isKnownScene3DEngine;
15909
17462
  exports.isLocationUsageMode = isLocationUsageMode;
15910
17463
  exports.isMinimaxH3Provider = isMinimaxH3Provider;
15911
17464
  exports.isObjectAspectRatio = isObjectAspectRatio;
15912
17465
  exports.isOversizedScene = isOversizedScene;
15913
17466
  exports.isPaygRetentionActive = isPaygRetentionActive;
15914
17467
  exports.isPerSecondLipSyncProvider = isPerSecondLipSyncProvider;
17468
+ exports.isPro3DRenderJobOutput = isPro3DRenderJobOutput;
17469
+ exports.isPro3DRenderQuote = isPro3DRenderQuote;
17470
+ exports.isPro3DRenderRenderOnly = isPro3DRenderRenderOnly;
17471
+ exports.isScene3DAuthoringEngine = isScene3DAuthoringEngine;
17472
+ exports.isScene3DCameraTrack = isScene3DCameraTrack;
15915
17473
  exports.isScene3DHttpUrl = isScene3DHttpUrl;
15916
17474
  exports.isScene3DPlan = isScene3DPlan;
17475
+ exports.isScene3DPlanV1 = isScene3DPlanV1;
17476
+ exports.isScene3DPlanV2 = isScene3DPlanV2;
17477
+ exports.isScene3DSchemaVersionSupported = isScene3DSchemaVersionSupported;
15917
17478
  exports.isScraperActor = isScraperActor;
15918
17479
  exports.isSeedance2Provider = isSeedance2Provider;
15919
17480
  exports.isTiltDirection = isTiltDirection;
@@ -15968,6 +17529,8 @@ exports.parseListExpression = parseListExpression;
15968
17529
  exports.parseLocationMentionToken = parseLocationMentionToken;
15969
17530
  exports.parseNodePresetExport = parseNodePresetExport;
15970
17531
  exports.parseNodeRef = parseNodeRef;
17532
+ exports.parseScene3DCameraTrackJson = parseScene3DCameraTrackJson;
17533
+ exports.parseScene3DPlanV2Json = parseScene3DPlanV2Json;
15971
17534
  exports.pickAiAvatarBucket = pickAiAvatarBucket;
15972
17535
  exports.pickIds = pickIds;
15973
17536
  exports.pickLipSyncBucket = pickLipSyncBucket;
@@ -15981,6 +17544,11 @@ exports.presetApplyClearKeys = presetApplyClearKeys;
15981
17544
  exports.presetDataMatches = presetDataMatches;
15982
17545
  exports.presetEntries = presetEntries;
15983
17546
  exports.pricedVideoSelection = pricedVideoSelection;
17547
+ exports.pro3DRenderCoreOutputSchema = pro3DRenderCoreOutputSchema;
17548
+ exports.pro3DRenderJobOutputSchema = pro3DRenderJobOutputSchema;
17549
+ exports.pro3DRenderProducedSchemaVersion = pro3DRenderProducedSchemaVersion;
17550
+ exports.pro3DRenderQuoteSchema = pro3DRenderQuoteSchema;
17551
+ exports.pro3DRenderTimingOverrides = pro3DRenderTimingOverrides;
15984
17552
  exports.qualityOptionsByKind = qualityOptionsByKind;
15985
17553
  exports.readPromptAffixes = readPromptAffixes;
15986
17554
  exports.refHandleCategory = refHandleCategory;
@@ -16017,6 +17585,7 @@ exports.resolveNormalizedImageGen = resolveNormalizedImageGen;
16017
17585
  exports.resolveObjectAspectRatio = resolveObjectAspectRatio;
16018
17586
  exports.resolvePipelineModel = resolvePipelineModel;
16019
17587
  exports.resolveRelativeWindowToken = resolveRelativeWindowToken;
17588
+ exports.resolveScene3DAuthoringEngine = resolveScene3DAuthoringEngine;
16020
17589
  exports.resolveScraperCreditId = resolveScraperCreditId;
16021
17590
  exports.resolveSelectorRefs = resolveSelectorRefs;
16022
17591
  exports.resolveSeparator = resolveSeparator;
@@ -16040,25 +17609,72 @@ exports.runSelector = runSelector;
16040
17609
  exports.safetyRetryPolicy = safetyRetryPolicy;
16041
17610
  exports.sanitizeRole = sanitizeRole;
16042
17611
  exports.scaleVec3Schema = scaleVec3Schema;
17612
+ exports.scene3DAcceptedSchemaVersionsSchema = scene3DAcceptedSchemaVersionsSchema;
17613
+ exports.scene3DAnchorNameSchema = scene3DAnchorNameSchema;
17614
+ exports.scene3DAnchorSchema = scene3DAnchorSchema;
17615
+ exports.scene3DAnyPlanSchema = scene3DAnyPlanSchema;
17616
+ exports.scene3DAssetAnimationSchema = scene3DAssetAnimationSchema;
17617
+ exports.scene3DAssetIdSchema = scene3DAssetIdSchema;
17618
+ exports.scene3DAssetRefSchema = scene3DAssetRefSchema;
16043
17619
  exports.scene3DCameraChangesSchema = scene3DCameraChangesSchema;
16044
17620
  exports.scene3DCameraKeyframeSchema = scene3DCameraKeyframeSchema;
17621
+ exports.scene3DCameraSampleSchema = scene3DCameraSampleSchema;
16045
17622
  exports.scene3DCameraSchema = scene3DCameraSchema;
17623
+ exports.scene3DCameraTrackIssues = scene3DCameraTrackIssues;
17624
+ exports.scene3DCameraTrackObjectSchema = scene3DCameraTrackObjectSchema;
17625
+ exports.scene3DCameraTrackPlanIssues = scene3DCameraTrackPlanIssues;
17626
+ exports.scene3DCameraTrackSchema = scene3DCameraTrackSchema;
17627
+ exports.scene3DClayLightingSchema = scene3DClayLightingSchema;
16046
17628
  exports.scene3DColorSchema = scene3DColorSchema;
16047
17629
  exports.scene3DDeepEqual = scene3DDeepEqual;
16048
17630
  exports.scene3DEasingSchema = scene3DEasingSchema;
16049
17631
  exports.scene3DEditOperationSchema = scene3DEditOperationSchema;
16050
17632
  exports.scene3DEditOperationsSchema = scene3DEditOperationsSchema;
17633
+ exports.scene3DEngineIdSchema = scene3DEngineIdSchema;
17634
+ exports.scene3DEntityAcceptsOverlay = scene3DEntityAcceptsOverlay;
17635
+ exports.scene3DEntityCapabilitySchema = scene3DEntityCapabilitySchema;
17636
+ exports.scene3DEntityV2Schema = scene3DEntityV2Schema;
17637
+ exports.scene3DEntityVisualSchema = scene3DEntityVisualSchema;
16051
17638
  exports.scene3DIdSchema = scene3DIdSchema;
17639
+ exports.scene3DJsonByteLength = scene3DJsonByteLength;
16052
17640
  exports.scene3DLightingChangesSchema = scene3DLightingChangesSchema;
16053
17641
  exports.scene3DLightingSchema = scene3DLightingSchema;
17642
+ exports.scene3DMaterialBindingSchema = scene3DMaterialBindingSchema;
17643
+ exports.scene3DMaterialNameSchema = scene3DMaterialNameSchema;
17644
+ exports.scene3DMaterialRoleSchema = scene3DMaterialRoleSchema;
17645
+ exports.scene3DNodeIdSchema = scene3DNodeIdSchema;
16054
17646
  exports.scene3DObjectChangesSchema = scene3DObjectChangesSchema;
16055
17647
  exports.scene3DObjectKeyframeSchema = scene3DObjectKeyframeSchema;
16056
17648
  exports.scene3DObjectSchema = scene3DObjectSchema;
17649
+ exports.scene3DOverrideSchema = scene3DOverrideSchema;
16057
17650
  exports.scene3DPlanIssues = scene3DPlanIssues;
16058
17651
  exports.scene3DPlanSchema = scene3DPlanSchema;
17652
+ exports.scene3DPlanSchemaVersion = scene3DPlanSchemaVersion;
17653
+ exports.scene3DPlanV1Issues = scene3DPlanV1Issues;
17654
+ exports.scene3DPlanV1ObjectSchema = scene3DPlanV1ObjectSchema;
17655
+ exports.scene3DPlanV1Schema = scene3DPlanV1Schema;
17656
+ exports.scene3DPlanV2Issues = scene3DPlanV2Issues;
17657
+ exports.scene3DPlanV2ObjectSchema = scene3DPlanV2ObjectSchema;
17658
+ exports.scene3DPlanV2Schema = scene3DPlanV2Schema;
16059
17659
  exports.scene3DPrimitiveSchema = scene3DPrimitiveSchema;
17660
+ exports.scene3DProjectionIssues = scene3DProjectionIssues;
17661
+ exports.scene3DProvenanceSchema = scene3DProvenanceSchema;
16060
17662
  exports.scene3DReferenceSchema = scene3DReferenceSchema;
17663
+ exports.scene3DSampleForFrame = scene3DSampleForFrame;
17664
+ exports.scene3DSha256Schema = scene3DSha256Schema;
17665
+ exports.scene3DShotForFrame = scene3DShotForFrame;
17666
+ exports.scene3DShotIndexForFrame = scene3DShotIndexForFrame;
17667
+ exports.scene3DShotSchema = scene3DShotSchema;
16061
17668
  exports.scene3DUrlSchema = scene3DUrlSchema;
17669
+ exports.scene3DV2AdmissionIssues = scene3DV2AdmissionIssues;
17670
+ exports.scene3DV2EditOperationSchema = scene3DV2EditOperationSchema;
17671
+ exports.scene3DV2EditOperationsSchema = scene3DV2EditOperationsSchema;
17672
+ exports.scene3DV2HierarchyDepth = scene3DV2HierarchyDepth;
17673
+ exports.scene3DV2NormalizationIssues = scene3DV2NormalizationIssues;
17674
+ exports.scene3DV2OverrideInputSchema = scene3DV2OverrideInputSchema;
17675
+ exports.scene3DV2ResourceUsage = scene3DV2ResourceUsage;
17676
+ exports.scene3DVersionTokenSchema = scene3DVersionTokenSchema;
17677
+ exports.scene3DZodIssues = scene3DZodIssues;
16062
17678
  exports.searchModelVariants = searchModelVariants;
16063
17679
  exports.seedance2AudioLimitSec = seedance2AudioLimitSec;
16064
17680
  exports.segmentDurationsFor = segmentDurationsFor;
@@ -16114,6 +17730,7 @@ exports.validateProviderForNodeType = validateProviderForNodeType;
16114
17730
  exports.validateSubWorkflowRoutes = validateSubWorkflowRoutes;
16115
17731
  exports.variantJobId = variantJobId;
16116
17732
  exports.vec3Schema = vec3Schema;
17733
+ exports.verifyScene3DPlanV2ContentHash = verifyScene3DPlanV2ContentHash;
16117
17734
  exports.videoAnalysisCreditSegment = videoAnalysisCreditSegment;
16118
17735
  exports.videoAnalysisNumWindows = videoAnalysisNumWindows;
16119
17736
  exports.videoAnalysisResultSchema = videoAnalysisResultSchema;