remotion 4.0.490 → 4.0.492

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.
@@ -1184,6 +1184,7 @@ var InnerComposition = ({
1184
1184
  }
1185
1185
  const { folderName, parentName } = useContext9(FolderContext);
1186
1186
  const stack = compProps.stack ?? null;
1187
+ const componentFromProps = "component" in compProps ? compProps.component : null;
1187
1188
  useEffect2(() => {
1188
1189
  if (!id) {
1189
1190
  throw new Error("No id for composition passed.");
@@ -1201,6 +1202,7 @@ var InnerComposition = ({
1201
1202
  defaultProps: serializeThenDeserializeInStudio(defaultProps ?? {}),
1202
1203
  nonce: nonce.get(),
1203
1204
  parentFolderName: parentName,
1205
+ componentFromProps,
1204
1206
  schema: schema ?? null,
1205
1207
  calculateMetadata: compProps.calculateMetadata ?? null,
1206
1208
  stack
@@ -1219,6 +1221,7 @@ var InnerComposition = ({
1219
1221
  width,
1220
1222
  nonce,
1221
1223
  parentName,
1224
+ componentFromProps,
1222
1225
  schema,
1223
1226
  compProps.calculateMetadata,
1224
1227
  stack,
@@ -1278,14 +1281,34 @@ var Composition = (props) => {
1278
1281
  };
1279
1282
 
1280
1283
  // src/enable-sequence-stack-traces.ts
1284
+ import React9 from "react";
1281
1285
  var componentsToAddStacksTo = [];
1286
+ var sequenceComponent = null;
1282
1287
  var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
1283
1288
  var addSequenceStackTraces = (component) => {
1284
1289
  componentsToAddStacksTo.push(component);
1285
1290
  };
1291
+ var setSequenceComponent = (component) => {
1292
+ sequenceComponent = component;
1293
+ };
1294
+ var getSequenceComponent = () => sequenceComponent;
1295
+ var getSingleChildComponent = (children) => {
1296
+ const mountedChildren = React9.Children.toArray(children);
1297
+ if (mountedChildren.length !== 1) {
1298
+ return null;
1299
+ }
1300
+ const child = mountedChildren[0];
1301
+ if (!React9.isValidElement(child)) {
1302
+ return null;
1303
+ }
1304
+ if (typeof child.type !== "function" && typeof child.type !== "object") {
1305
+ return null;
1306
+ }
1307
+ return child.type;
1308
+ };
1286
1309
 
1287
1310
  // src/version.ts
1288
- var VERSION = "4.0.490";
1311
+ var VERSION = "4.0.492";
1289
1312
 
1290
1313
  // src/multiple-versions-warning.ts
1291
1314
  var checkMultipleRemotionVersions = () => {
@@ -1949,9 +1972,9 @@ var PremountContext = createContext14({
1949
1972
  });
1950
1973
 
1951
1974
  // src/SequenceManager.tsx
1952
- import React11, { useCallback as useCallback5, useMemo as useMemo12, useRef as useRef4, useState as useState3 } from "react";
1975
+ import React12, { useCallback as useCallback5, useMemo as useMemo12, useRef as useRef4, useState as useState3 } from "react";
1953
1976
  import { jsx as jsx10 } from "react/jsx-runtime";
1954
- var SequenceManager = React11.createContext({
1977
+ var SequenceManager = React12.createContext({
1955
1978
  registerSequence: () => {
1956
1979
  throw new Error("SequenceManagerContext not initialized");
1957
1980
  },
@@ -1960,19 +1983,19 @@ var SequenceManager = React11.createContext({
1960
1983
  },
1961
1984
  sequences: []
1962
1985
  });
1963
- var SequenceManagerRefContext = React11.createContext({
1986
+ var SequenceManagerRefContext = React12.createContext({
1964
1987
  current: []
1965
1988
  });
1966
1989
  var makeSequencePropsSubscriptionKey = (key) => {
1967
- return `${key.nodePath.join(".")}.${key.sequenceKeys.join(".")}.${key.effectKeys.map((keys) => keys.join(".")).join(".")}`;
1990
+ return `${key.absolutePath}\x00${key.nodePath.join(".")}\x00${key.sequenceKeys.join(".")}\x00${key.effectKeys.map((keys) => keys.join(".")).join(".")}`;
1968
1991
  };
1969
- var VisualModePropStatusesContext = React11.createContext({
1992
+ var VisualModePropStatusesContext = React12.createContext({
1970
1993
  propStatuses: {}
1971
1994
  });
1972
- var VisualModePropStatusesRefContext = React11.createContext({
1995
+ var VisualModePropStatusesRefContext = React12.createContext({
1973
1996
  current: {}
1974
1997
  });
1975
- var VisualModeDragOverridesContext = React11.createContext({
1998
+ var VisualModeDragOverridesContext = React12.createContext({
1976
1999
  getDragOverrides: () => {
1977
2000
  throw new Error("VisualModeDragOverridesContext not initialized");
1978
2001
  },
@@ -1980,7 +2003,7 @@ var VisualModeDragOverridesContext = React11.createContext({
1980
2003
  throw new Error("VisualModeDragOverridesContext not initialized");
1981
2004
  }
1982
2005
  });
1983
- var VisualModeSettersContext = React11.createContext({
2006
+ var VisualModeSettersContext = React12.createContext({
1984
2007
  setDragOverrides: () => {
1985
2008
  throw new Error("VisualModeSettersContext not initialized");
1986
2009
  },
@@ -2132,7 +2155,7 @@ var SequenceManagerProvider = ({ children }) => {
2132
2155
  };
2133
2156
 
2134
2157
  // src/series/is-inside-series.tsx
2135
- import React12, { createContext as createContext15 } from "react";
2158
+ import React13, { createContext as createContext15 } from "react";
2136
2159
  import { jsx as jsx11 } from "react/jsx-runtime";
2137
2160
  var IsInsideSeriesContext = createContext15(false);
2138
2161
  var IsInsideSeriesContainer = ({ children }) => {
@@ -2148,7 +2171,7 @@ var IsNotInsideSeriesProvider = ({ children }) => {
2148
2171
  });
2149
2172
  };
2150
2173
  var useRequireToBeInsideSeries = () => {
2151
- const isInsideSeries = React12.useContext(IsInsideSeriesContext);
2174
+ const isInsideSeries = React13.useContext(IsInsideSeriesContext);
2152
2175
  if (!isInsideSeries) {
2153
2176
  throw new Error("This component must be inside a <Series /> component.");
2154
2177
  }
@@ -2158,7 +2181,7 @@ var useRequireToBeInsideSeries = () => {
2158
2181
  var ENABLE_V5_BREAKING_CHANGES = false;
2159
2182
 
2160
2183
  // src/with-interactivity-schema.ts
2161
- import React13, { forwardRef as forwardRef2, useContext as useContext16, useMemo as useMemo13, useState as useState4 } from "react";
2184
+ import React14, { forwardRef as forwardRef2, useContext as useContext16, useMemo as useMemo13, useState as useState4 } from "react";
2162
2185
 
2163
2186
  // src/delete-nested-key.ts
2164
2187
  var deleteNestedKey = (obj, keysToRemove) => {
@@ -4262,6 +4285,9 @@ var computeEffectiveSchemaValuesDotNotation = ({
4262
4285
  shouldResortToDefaultValueIfUndefined: false
4263
4286
  });
4264
4287
  }
4288
+ if (field?.type === "asset" && typeof value === "string" && value.startsWith(FILE_TOKEN)) {
4289
+ value = `${window.remotion_staticBase}/${value.slice(FILE_TOKEN.length)}`;
4290
+ }
4265
4291
  if (value === undefined) {
4266
4292
  propsToDelete.add(key);
4267
4293
  }
@@ -4362,7 +4388,7 @@ var withInteractivitySchema = ({
4362
4388
  const Wrapped = forwardRef2((props, ref) => {
4363
4389
  const env = useRemotionEnvironment();
4364
4390
  if (!env.isStudio || env.isReadOnlyStudio || env.isRendering) {
4365
- return React13.createElement(Component, {
4391
+ return React14.createElement(Component, {
4366
4392
  ...props,
4367
4393
  controls: null,
4368
4394
  ref
@@ -4373,7 +4399,7 @@ var withInteractivitySchema = ({
4373
4399
  const nodePathMapping = useContext16(OverrideIdsToNodePathsGettersContext);
4374
4400
  const frame = useCurrentFrame();
4375
4401
  if (props.controls) {
4376
- return React13.createElement(Component, {
4402
+ return React14.createElement(Component, {
4377
4403
  ...props,
4378
4404
  ref
4379
4405
  });
@@ -4431,7 +4457,7 @@ var withInteractivitySchema = ({
4431
4457
  schemaKeys: activeKeys,
4432
4458
  propsToDelete
4433
4459
  });
4434
- return React13.createElement(Component, {
4460
+ return React14.createElement(Component, {
4435
4461
  ...mergedProps,
4436
4462
  controls,
4437
4463
  ref
@@ -4460,6 +4486,7 @@ var RegularSequenceRefForwardingFunction = ({
4460
4486
  _remotionInternalLoopDisplay: loopDisplay,
4461
4487
  _remotionInternalStack: stack,
4462
4488
  _remotionInternalDocumentationLink: documentationLink,
4489
+ _remotionInternalSingleChildComponent: singleChildComponent,
4463
4490
  _remotionInternalPremountDisplay: premountDisplay,
4464
4491
  _remotionInternalPostmountDisplay: postmountDisplay,
4465
4492
  _remotionInternalIsMedia: isMedia,
@@ -4606,7 +4633,8 @@ var RegularSequenceRefForwardingFunction = ({
4606
4633
  getStack: () => stackRef.current,
4607
4634
  refForOutline: refForOutline ?? null,
4608
4635
  isInsideSeries,
4609
- frozenFrame: registeredFrozenFrame
4636
+ frozenFrame: registeredFrozenFrame,
4637
+ singleChildComponent: singleChildComponent ?? null
4610
4638
  });
4611
4639
  } else {
4612
4640
  registerSequence({
@@ -4631,11 +4659,13 @@ var RegularSequenceRefForwardingFunction = ({
4631
4659
  src: isMedia.data.src,
4632
4660
  getStack: () => stackRef.current,
4633
4661
  startMediaFrom: startMediaFrom ?? isMedia.data.startMediaFrom,
4662
+ mediaFrameAtSequenceZero,
4634
4663
  volume: isMedia.data.volumes,
4635
4664
  refForOutline: refForOutline ?? null,
4636
4665
  isInsideSeries,
4637
4666
  frozenFrame: registeredFrozenFrame,
4638
- frozenMediaFrame
4667
+ frozenMediaFrame,
4668
+ singleChildComponent: singleChildComponent ?? null
4639
4669
  });
4640
4670
  }
4641
4671
  return () => {
@@ -4662,7 +4692,8 @@ var RegularSequenceRefForwardingFunction = ({
4662
4692
  effects: _remotionInternalEffects ?? EMPTY_EFFECTS,
4663
4693
  refForOutline: refForOutline ?? null,
4664
4694
  isInsideSeries,
4665
- frozenFrame: registeredFrozenFrame
4695
+ frozenFrame: registeredFrozenFrame,
4696
+ singleChildComponent: singleChildComponent ?? null
4666
4697
  });
4667
4698
  return () => {
4668
4699
  unregisterSequence(id);
@@ -4694,7 +4725,9 @@ var RegularSequenceRefForwardingFunction = ({
4694
4725
  isInsideSeries,
4695
4726
  registeredFrozenFrame,
4696
4727
  startMediaFrom,
4697
- frozenMediaFrame
4728
+ mediaFrameAtSequenceZero,
4729
+ frozenMediaFrame,
4730
+ singleChildComponent
4698
4731
  ]);
4699
4732
  const endThreshold = Math.ceil(cumulatedFrom + from + durationInFrames - 1);
4700
4733
  const content = absoluteFrame < cumulatedFrom + from ? null : absoluteFrame > endThreshold ? null : children;
@@ -4834,7 +4867,7 @@ import {
4834
4867
  } from "react";
4835
4868
 
4836
4869
  // src/animated-image/canvas.tsx
4837
- import React15, { useCallback as useCallback7, useImperativeHandle, useMemo as useMemo16, useRef as useRef8 } from "react";
4870
+ import React16, { useCallback as useCallback7, useImperativeHandle, useMemo as useMemo16, useRef as useRef8 } from "react";
4838
4871
 
4839
4872
  // src/calculate-image-fit.ts
4840
4873
  var calculateImageFit = (fit, imageSize, canvasSize) => {
@@ -5225,7 +5258,7 @@ var CanvasRefForwardingFunction = ({ width, height, fit, className, style, effec
5225
5258
  ...props
5226
5259
  });
5227
5260
  };
5228
- var Canvas = React15.forwardRef(CanvasRefForwardingFunction);
5261
+ var Canvas = React16.forwardRef(CanvasRefForwardingFunction);
5229
5262
 
5230
5263
  // src/animated-image/decode-image.ts
5231
5264
  var CACHE_SIZE = 5;
@@ -5395,6 +5428,12 @@ var resolveAnimatedImageSource = (src) => {
5395
5428
  // src/animated-image/AnimatedImage.tsx
5396
5429
  import { jsx as jsx14 } from "react/jsx-runtime";
5397
5430
  var animatedImageSchema = {
5431
+ src: {
5432
+ type: "asset",
5433
+ default: undefined,
5434
+ description: "Source",
5435
+ keyframable: false
5436
+ },
5398
5437
  ...baseSchema,
5399
5438
  playbackRate: {
5400
5439
  type: "number",
@@ -5839,11 +5878,11 @@ var calculateMediaDuration = ({
5839
5878
  };
5840
5879
 
5841
5880
  // src/loop/index.tsx
5842
- import React16, { createContext as createContext18, useMemo as useMemo18 } from "react";
5881
+ import React17, { createContext as createContext18, useMemo as useMemo18 } from "react";
5843
5882
  import { jsx as jsx16 } from "react/jsx-runtime";
5844
5883
  var LoopContext = createContext18(null);
5845
5884
  var useLoop = () => {
5846
- return React16.useContext(LoopContext);
5885
+ return React17.useContext(LoopContext);
5847
5886
  };
5848
5887
  var Loop = ({
5849
5888
  durationInFrames,
@@ -6287,7 +6326,7 @@ var DurationsContextProvider = ({ children }) => {
6287
6326
 
6288
6327
  // src/audio/AudioForPreview.tsx
6289
6328
  import { useCallback as useCallback13 } from "react";
6290
- import React22, {
6329
+ import React23, {
6291
6330
  forwardRef as forwardRef5,
6292
6331
  useContext as useContext28,
6293
6332
  useEffect as useEffect14,
@@ -6319,7 +6358,7 @@ var getCrossOriginValue = ({
6319
6358
  import { useContext as useContext21, useLayoutEffect as useLayoutEffect5, useRef as useRef14 } from "react";
6320
6359
 
6321
6360
  // src/audio/shared-audio-tags.tsx
6322
- import React19, {
6361
+ import React20, {
6323
6362
  createContext as createContext21,
6324
6363
  createRef as createRef2,
6325
6364
  useCallback as useCallback9,
@@ -6754,7 +6793,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
6754
6793
  };
6755
6794
  });
6756
6795
  }, [audioContext, numberOfAudioTags]);
6757
- const effectToUse = React19.useInsertionEffect ?? React19.useLayoutEffect;
6796
+ const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
6758
6797
  effectToUse(() => {
6759
6798
  return () => {
6760
6799
  requestAnimationFrame(() => {
@@ -6773,7 +6812,9 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
6773
6812
  return;
6774
6813
  }
6775
6814
  if (data === undefined) {
6776
- current.src = EMPTY_AUDIO;
6815
+ if (current.src !== EMPTY_AUDIO) {
6816
+ current.src = EMPTY_AUDIO;
6817
+ }
6777
6818
  return;
6778
6819
  }
6779
6820
  if (!data) {
@@ -6842,7 +6883,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
6842
6883
  if (prevA.id === id) {
6843
6884
  const isTheSame = compareProps(aud, prevA.props) && prevA.premounting === premounting && prevA.postmounting === postmounting;
6844
6885
  if (isTheSame) {
6845
- return prevA;
6886
+ return prevA.audioMounted === audioMounted ? prevA : { ...prevA, audioMounted };
6846
6887
  }
6847
6888
  changed = true;
6848
6889
  return {
@@ -6854,7 +6895,7 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
6854
6895
  audioMounted
6855
6896
  };
6856
6897
  }
6857
- return prevA;
6898
+ return prevA.audioMounted === audioMounted ? prevA : { ...prevA, audioMounted };
6858
6899
  });
6859
6900
  if (changed) {
6860
6901
  rerenderAudios();
@@ -6893,16 +6934,19 @@ var SharedAudioTagsContextProvider = ({ children, numberOfAudioTags }) => {
6893
6934
  unregisterAudio,
6894
6935
  updateAudio
6895
6936
  ]);
6937
+ const sharedAudioTagElements = useMemo21(() => {
6938
+ return refs.map(({ id, ref }) => {
6939
+ return /* @__PURE__ */ jsx19("audio", {
6940
+ ref,
6941
+ preload: "metadata",
6942
+ src: EMPTY_AUDIO
6943
+ }, id);
6944
+ });
6945
+ }, [refs]);
6896
6946
  return /* @__PURE__ */ jsxs2(SharedAudioTagsContext.Provider, {
6897
6947
  value: audioTagsValue,
6898
6948
  children: [
6899
- refs.map(({ id, ref }) => {
6900
- return /* @__PURE__ */ jsx19("audio", {
6901
- ref,
6902
- preload: "metadata",
6903
- src: EMPTY_AUDIO
6904
- }, id);
6905
- }),
6949
+ sharedAudioTagElements,
6906
6950
  children
6907
6951
  ]
6908
6952
  });
@@ -6919,7 +6963,7 @@ var useSharedAudio = ({
6919
6963
  if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
6920
6964
  return tagsCtx.registerAudio({ aud, audioId, premounting, postmounting });
6921
6965
  }
6922
- const el = React19.createRef();
6966
+ const el = React20.createRef();
6923
6967
  const mediaElementSourceNode = audioCtx?.audioContext ? makeSharedElementSourceNode({
6924
6968
  audioContext: audioCtx.audioContext,
6925
6969
  ref: el
@@ -6938,7 +6982,7 @@ var useSharedAudio = ({
6938
6982
  }
6939
6983
  };
6940
6984
  });
6941
- const effectToUse = React19.useInsertionEffect ?? React19.useLayoutEffect;
6985
+ const effectToUse = React20.useInsertionEffect ?? React20.useLayoutEffect;
6942
6986
  if (typeof document !== "undefined") {
6943
6987
  effectToUse(() => {
6944
6988
  if (tagsCtx && tagsCtx.numberOfAudioTags > 0) {
@@ -7384,6 +7428,7 @@ var useMediaInTimeline = ({
7384
7428
  showInTimeline: true,
7385
7429
  nonce: nonce.get(),
7386
7430
  startMediaFrom: 0 - startsAt,
7431
+ mediaFrameAtSequenceZero: null,
7387
7432
  doesVolumeChange,
7388
7433
  loopDisplay,
7389
7434
  playbackRate,
@@ -7442,7 +7487,7 @@ import { useCallback as useCallback11, useMemo as useMemo25, useRef as useRef16
7442
7487
  import { useContext as useContext25, useMemo as useMemo24 } from "react";
7443
7488
 
7444
7489
  // src/buffering.tsx
7445
- import React20, {
7490
+ import React21, {
7446
7491
  useCallback as useCallback10,
7447
7492
  useContext as useContext24,
7448
7493
  useEffect as useEffect9,
@@ -7537,7 +7582,7 @@ var useBufferManager = (logLevel, mountTime) => {
7537
7582
  return { addBlock, listenForBuffering, listenForResume, buffering };
7538
7583
  }, [addBlock, buffering, listenForBuffering, listenForResume]);
7539
7584
  };
7540
- var BufferingContextReact = React20.createContext(null);
7585
+ var BufferingContextReact = React21.createContext(null);
7541
7586
  var BufferingProvider = ({ children }) => {
7542
7587
  const { logLevel, mountTime } = useContext24(LogLevelContext);
7543
7588
  const bufferManager = useBufferManager(logLevel ?? "info", mountTime);
@@ -7757,9 +7802,9 @@ var getMediaSyncAction = (input) => {
7757
7802
  };
7758
7803
 
7759
7804
  // src/media-tag-current-time-timestamp.ts
7760
- import React21 from "react";
7805
+ import React22 from "react";
7761
7806
  var useCurrentTimeOfMediaTagWithUpdateTimeStamp = (mediaRef) => {
7762
- const lastUpdate = React21.useRef({
7807
+ const lastUpdate = React22.useRef({
7763
7808
  time: mediaRef.current?.currentTime ?? 0,
7764
7809
  lastUpdate: performance.now()
7765
7810
  });
@@ -8537,7 +8582,7 @@ var AudioForDevelopmentForwardRefFunction = (props, ref) => {
8537
8582
  volume: userPreferredVolume,
8538
8583
  shouldUseWebAudioApi: useWebAudioApi ?? false
8539
8584
  });
8540
- const effectToUse = React22.useInsertionEffect ?? React22.useLayoutEffect;
8585
+ const effectToUse = React23.useInsertionEffect ?? React23.useLayoutEffect;
8541
8586
  effectToUse(() => {
8542
8587
  return () => {
8543
8588
  requestAnimationFrame(() => {
@@ -9115,16 +9160,16 @@ var isMissingPaintRecordError = (error2) => {
9115
9160
  return error2 instanceof DOMException && error2.name === "InvalidStateError";
9116
9161
  };
9117
9162
  var missingPaintRecordMessage = "HtmlInCanvas: Expected the element to be inside the viewport during rendering, but Chrome had no cached paint record for it.";
9118
- var resizeOffscreenCanvas = ({
9119
- offscreen,
9163
+ var resizePaintTarget = ({
9164
+ target,
9120
9165
  width,
9121
9166
  height
9122
9167
  }) => {
9123
- if (offscreen.width !== width) {
9124
- offscreen.width = width;
9168
+ if (target.width !== width) {
9169
+ target.width = width;
9125
9170
  }
9126
- if (offscreen.height !== height) {
9127
- offscreen.height = height;
9171
+ if (target.height !== height) {
9172
+ target.height = height;
9128
9173
  }
9129
9174
  };
9130
9175
  var defaultOnPaint = ({
@@ -9140,7 +9185,7 @@ var defaultOnPaint = ({
9140
9185
  const transform = ctx.drawElementImage(elementImage, 0, 0);
9141
9186
  element.style.transform = transform.toString();
9142
9187
  };
9143
- var HtmlInCanvasAncestorContext = createContext23(false);
9188
+ var HtmlInCanvasAncestorContext = createContext23(null);
9144
9189
  var HtmlInCanvasContent = forwardRef9(({
9145
9190
  width,
9146
9191
  height,
@@ -9152,20 +9197,22 @@ var HtmlInCanvasContent = forwardRef9(({
9152
9197
  controls,
9153
9198
  style
9154
9199
  }, ref) => {
9155
- const isInsideAncestorHtmlInCanvas = useContext31(HtmlInCanvasAncestorContext);
9200
+ const ancestor = useContext31(HtmlInCanvasAncestorContext);
9156
9201
  assertHtmlInCanvasDimensions(width, height);
9157
9202
  const resolvedPixelDensity = resolveHtmlInCanvasPixelDensity(pixelDensity);
9158
9203
  const canvasWidth = Math.ceil(width * resolvedPixelDensity);
9159
9204
  const canvasHeight = Math.ceil(height * resolvedPixelDensity);
9160
9205
  const { continueRender: continueRender2, cancelRender: cancelRender2 } = useDelayRender();
9161
- const { isRendering } = useRemotionEnvironment();
9206
+ const { isClientSideRendering, isRendering } = useRemotionEnvironment();
9207
+ const canRetryMissingPaintRecord = !isRendering || isClientSideRendering;
9208
+ const usesDirectLayoutCanvas = onPaint === undefined && onInit === undefined;
9162
9209
  if (!isHtmlInCanvasSupported()) {
9163
9210
  cancelRender2(new Error(HTML_IN_CANVAS_UNSUPPORTED_MESSAGE));
9164
9211
  }
9165
9212
  const canvas2dRef = useRef22(null);
9166
- const offscreenRef = useRef22(null);
9213
+ const paintTargetRef = useRef22(null);
9167
9214
  const divRef = useRef22(null);
9168
- const canvasSizeKey = `${width}x${height}@${resolvedPixelDensity}`;
9215
+ const canvasSizeKey = `${width}x${height}@${resolvedPixelDensity}-${usesDirectLayoutCanvas ? "direct" : "offscreen"}`;
9169
9216
  const setLayoutCanvasRef = useCallback16((node) => {
9170
9217
  canvas2dRef.current = node;
9171
9218
  if (typeof ref === "function") {
@@ -9188,17 +9235,19 @@ var HtmlInCanvasContent = forwardRef9(({
9188
9235
  const initializedRef = useRef22(false);
9189
9236
  const onInitCleanupRef = useRef22(null);
9190
9237
  const unmountedRef = useRef22(false);
9238
+ const ancestorRef = useRef22(ancestor);
9239
+ ancestorRef.current = ancestor;
9191
9240
  const onPaintCb = useCallback16(async () => {
9192
9241
  const element = divRef.current;
9193
9242
  if (!element) {
9194
9243
  throw new Error("Canvas or scene element not found");
9195
9244
  }
9196
- const offscreen = offscreenRef.current;
9197
- if (!offscreen) {
9198
- throw new Error("HtmlInCanvas: offscreen canvas not ready (transferControlToOffscreen failed or canvas is remounting)");
9245
+ const paintTarget = paintTargetRef.current;
9246
+ if (!paintTarget) {
9247
+ throw new Error("HtmlInCanvas: paint target is not ready because the canvas is remounting");
9199
9248
  }
9200
- resizeOffscreenCanvas({
9201
- offscreen,
9249
+ resizePaintTarget({
9250
+ target: paintTarget,
9202
9251
  width: canvasWidth,
9203
9252
  height: canvasHeight
9204
9253
  });
@@ -9209,22 +9258,30 @@ var HtmlInCanvasContent = forwardRef9(({
9209
9258
  }
9210
9259
  const handle = delayRender("onPaint");
9211
9260
  if (!initializedRef.current) {
9212
- let initImage = null;
9213
- try {
9214
- initImage = placeholderCanvas.captureElementImage(element);
9215
- } catch (error2) {
9216
- if (isMissingPaintRecordError(error2) && !isRendering) {} else if (isMissingPaintRecordError(error2)) {
9217
- throw new Error(missingPaintRecordMessage);
9218
- } else {
9261
+ const currentOnInit = onInitRef.current;
9262
+ if (!currentOnInit) {
9263
+ initializedRef.current = true;
9264
+ } else {
9265
+ let initImage;
9266
+ try {
9267
+ initImage = placeholderCanvas.captureElementImage(element);
9268
+ } catch (error2) {
9269
+ if (isMissingPaintRecordError(error2) && canRetryMissingPaintRecord) {
9270
+ continueRender2(handle);
9271
+ return;
9272
+ }
9273
+ if (isMissingPaintRecordError(error2)) {
9274
+ throw new Error(missingPaintRecordMessage);
9275
+ }
9219
9276
  throw error2;
9220
9277
  }
9221
- }
9222
- if (initImage) {
9223
9278
  initializedRef.current = true;
9224
- const currentOnInit = onInitRef.current;
9225
- if (currentOnInit) {
9279
+ try {
9280
+ if (paintTarget instanceof HTMLCanvasElement) {
9281
+ throw new Error("HtmlInCanvas: onInit requires an OffscreenCanvas paint target");
9282
+ }
9226
9283
  const cleanup = await currentOnInit({
9227
- canvas: offscreen,
9284
+ canvas: paintTarget,
9228
9285
  element,
9229
9286
  elementImage: initImage,
9230
9287
  pixelDensity: resolvedPixelDensity
@@ -9237,15 +9294,16 @@ var HtmlInCanvasContent = forwardRef9(({
9237
9294
  } else {
9238
9295
  onInitCleanupRef.current = cleanup;
9239
9296
  }
9297
+ } finally {
9298
+ initImage.close();
9240
9299
  }
9241
9300
  }
9242
9301
  }
9243
- const handler = onPaintRef.current ?? defaultOnPaint;
9244
9302
  let elImage;
9245
9303
  try {
9246
9304
  elImage = placeholderCanvas.captureElementImage(element);
9247
9305
  } catch (error2) {
9248
- if (isMissingPaintRecordError(error2) && !isRendering) {
9306
+ if (isMissingPaintRecordError(error2) && canRetryMissingPaintRecord) {
9249
9307
  continueRender2(handle);
9250
9308
  return;
9251
9309
  }
@@ -9254,20 +9312,41 @@ var HtmlInCanvasContent = forwardRef9(({
9254
9312
  }
9255
9313
  throw error2;
9256
9314
  }
9257
- await handler({
9258
- canvas: offscreen,
9259
- element,
9260
- elementImage: elImage,
9261
- pixelDensity: resolvedPixelDensity
9262
- });
9263
- await runEffectChain({
9264
- state: chainState.get(canvasWidth, canvasHeight),
9265
- source: offscreen,
9266
- effects: effectsRef.current,
9267
- output: offscreen,
9268
- width: canvasWidth,
9269
- height: canvasHeight
9270
- });
9315
+ try {
9316
+ const currentOnPaint = onPaintRef.current;
9317
+ if (currentOnPaint) {
9318
+ if (paintTarget instanceof HTMLCanvasElement) {
9319
+ throw new Error("HtmlInCanvas: onPaint requires an OffscreenCanvas paint target");
9320
+ }
9321
+ const paintResult = currentOnPaint({
9322
+ canvas: paintTarget,
9323
+ element,
9324
+ elementImage: elImage,
9325
+ pixelDensity: resolvedPixelDensity
9326
+ });
9327
+ if (paintResult) {
9328
+ await paintResult;
9329
+ }
9330
+ } else {
9331
+ defaultOnPaint({
9332
+ canvas: paintTarget,
9333
+ element,
9334
+ elementImage: elImage,
9335
+ pixelDensity: resolvedPixelDensity
9336
+ });
9337
+ }
9338
+ await runEffectChain({
9339
+ state: chainState.get(canvasWidth, canvasHeight),
9340
+ source: paintTarget,
9341
+ effects: effectsRef.current,
9342
+ output: paintTarget,
9343
+ width: canvasWidth,
9344
+ height: canvasHeight
9345
+ });
9346
+ } finally {
9347
+ elImage.close();
9348
+ }
9349
+ ancestorRef.current?.requestParentPaint();
9271
9350
  continueRender2(handle);
9272
9351
  } catch (error2) {
9273
9352
  cancelRender2(error2);
@@ -9279,7 +9358,7 @@ var HtmlInCanvasContent = forwardRef9(({
9279
9358
  continueRender2,
9280
9359
  cancelRender2,
9281
9360
  resolvedPixelDensity,
9282
- isRendering
9361
+ canRetryMissingPaintRecord
9283
9362
  ]);
9284
9363
  useLayoutEffect9(() => {
9285
9364
  const placeholder = canvas2dRef.current;
@@ -9287,10 +9366,10 @@ var HtmlInCanvasContent = forwardRef9(({
9287
9366
  throw new Error("Canvas not found");
9288
9367
  }
9289
9368
  placeholder.layoutSubtree = true;
9290
- const offscreen = placeholder.transferControlToOffscreen();
9291
- offscreenRef.current = offscreen;
9292
- resizeOffscreenCanvas({
9293
- offscreen,
9369
+ const paintTarget = usesDirectLayoutCanvas ? placeholder : placeholder.transferControlToOffscreen();
9370
+ paintTargetRef.current = paintTarget;
9371
+ resizePaintTarget({
9372
+ target: paintTarget,
9294
9373
  width: canvasWidth,
9295
9374
  height: canvasHeight
9296
9375
  });
@@ -9299,13 +9378,19 @@ var HtmlInCanvasContent = forwardRef9(({
9299
9378
  placeholder.addEventListener("paint", onPaintCb);
9300
9379
  return () => {
9301
9380
  placeholder.removeEventListener("paint", onPaintCb);
9302
- offscreenRef.current = null;
9381
+ paintTargetRef.current = null;
9303
9382
  initializedRef.current = false;
9304
9383
  unmountedRef.current = true;
9305
9384
  onInitCleanupRef.current?.();
9306
9385
  onInitCleanupRef.current = null;
9307
9386
  };
9308
- }, [onPaintCb, cancelRender2, canvasWidth, canvasHeight]);
9387
+ }, [
9388
+ onPaintCb,
9389
+ cancelRender2,
9390
+ canvasWidth,
9391
+ canvasHeight,
9392
+ usesDirectLayoutCanvas
9393
+ ]);
9309
9394
  const onPaintChangedRef = useRef22(false);
9310
9395
  useLayoutEffect9(() => {
9311
9396
  if (!onPaintChangedRef.current) {
@@ -9344,11 +9429,15 @@ var HtmlInCanvasContent = forwardRef9(({
9344
9429
  ...style ?? {}
9345
9430
  };
9346
9431
  }, [height, style, width]);
9347
- if (isInsideAncestorHtmlInCanvas) {
9348
- throw new Error("<HtmlInCanvas> effects cannot be nested together. Chrome will only display the outer effect. Consider merging the effects into one if you can.");
9349
- }
9432
+ const ancestorValue = useMemo30(() => {
9433
+ return {
9434
+ requestParentPaint: () => {
9435
+ canvas2dRef.current?.requestPaint?.();
9436
+ }
9437
+ };
9438
+ }, []);
9350
9439
  return /* @__PURE__ */ jsx25(HtmlInCanvasAncestorContext.Provider, {
9351
- value: true,
9440
+ value: ancestorValue,
9352
9441
  children: /* @__PURE__ */ jsx25("canvas", {
9353
9442
  ref: setLayoutCanvasRef,
9354
9443
  width: canvasWidth,
@@ -10135,6 +10224,12 @@ var NativeImgInner = ({
10135
10224
  };
10136
10225
  var CanvasImageWithPrivateProps = CanvasImage;
10137
10226
  var imgSchema = {
10227
+ src: {
10228
+ type: "asset",
10229
+ default: undefined,
10230
+ description: "Source",
10231
+ keyframable: false
10232
+ },
10138
10233
  ...baseSchema,
10139
10234
  ...transformSchema
10140
10235
  };
@@ -10280,7 +10375,7 @@ var Img = withInteractivitySchema({
10280
10375
  });
10281
10376
  addSequenceStackTraces(Img);
10282
10377
  // src/Interactive.tsx
10283
- import React29, { forwardRef as forwardRef12, useCallback as useCallback20, useRef as useRef25 } from "react";
10378
+ import React30, { forwardRef as forwardRef12, useCallback as useCallback20, useRef as useRef25 } from "react";
10284
10379
  import { jsx as jsx29 } from "react/jsx-runtime";
10285
10380
  var sourcePathToIdentityPrefix = (packageName) => {
10286
10381
  if (packageName === "remotion") {
@@ -10348,7 +10443,7 @@ var makeInteractiveElement = (tag, displayName) => {
10348
10443
  _remotionInternalStack: stack,
10349
10444
  _remotionInternalDocumentationLink: "https://www.remotion.dev/docs/interactive",
10350
10445
  outlineRef: refForOutline,
10351
- children: React29.createElement(tag, {
10446
+ children: React30.createElement(tag, {
10352
10447
  ...props2,
10353
10448
  ref: callbackRef
10354
10449
  })
@@ -10416,8 +10511,8 @@ var Interactive = {
10416
10511
  import { createRef as createRef3 } from "react";
10417
10512
 
10418
10513
  // src/CompositionManager.tsx
10419
- import React30 from "react";
10420
- var compositionsRef = React30.createRef();
10514
+ import React31 from "react";
10515
+ var compositionsRef = React31.createRef();
10421
10516
 
10422
10517
  // src/CompositionManagerProvider.tsx
10423
10518
  import {
@@ -10582,8 +10677,8 @@ var getPreviewDomElement = () => {
10582
10677
  };
10583
10678
 
10584
10679
  // src/max-video-cache-size.ts
10585
- import React31 from "react";
10586
- var MaxMediaCacheSizeContext = React31.createContext(null);
10680
+ import React32 from "react";
10681
+ var MaxMediaCacheSizeContext = React32.createContext(null);
10587
10682
 
10588
10683
  // src/register-root.ts
10589
10684
  var Root = null;
@@ -10888,8 +10983,8 @@ var resolveVideoConfigOrCatch = (params) => {
10888
10983
  };
10889
10984
 
10890
10985
  // src/sequence-stack-traces.ts
10891
- import React33 from "react";
10892
- var SequenceStackTracesUpdateContext = React33.createContext(() => {});
10986
+ import React34 from "react";
10987
+ var SequenceStackTracesUpdateContext = React34.createContext(() => {});
10893
10988
 
10894
10989
  // src/setup-env-variables.ts
10895
10990
  var getEnvVariables = () => {
@@ -10919,8 +11014,8 @@ var setupEnvVariables = () => {
10919
11014
  };
10920
11015
 
10921
11016
  // src/use-current-scale.ts
10922
- import React34, { createContext as createContext25 } from "react";
10923
- var CurrentScaleContext = React34.createContext(null);
11017
+ import React35, { createContext as createContext25 } from "react";
11018
+ var CurrentScaleContext = React35.createContext(null);
10924
11019
  var PreviewSizeContext = createContext25({
10925
11020
  setSize: () => {
10926
11021
  return;
@@ -10945,8 +11040,8 @@ var calculateScale = ({
10945
11040
  return Number(previewSize);
10946
11041
  };
10947
11042
  var useCurrentScale = (options) => {
10948
- const hasContext = React34.useContext(CurrentScaleContext);
10949
- const zoomContext = React34.useContext(PreviewSizeContext);
11043
+ const hasContext = React35.useContext(CurrentScaleContext);
11044
+ const zoomContext = React35.useContext(PreviewSizeContext);
10950
11045
  const config = useUnsafeVideoConfig();
10951
11046
  const env = useRemotionEnvironment();
10952
11047
  if (hasContext === null || config === null || zoomContext === null) {
@@ -10976,8 +11071,8 @@ var useCurrentScale = (options) => {
10976
11071
  };
10977
11072
 
10978
11073
  // src/use-pixel-density.ts
10979
- import React35, { useContext as useContext35 } from "react";
10980
- var PixelDensityContext = React35.createContext(null);
11074
+ import React36, { useContext as useContext35 } from "react";
11075
+ var PixelDensityContext = React36.createContext(null);
10981
11076
  var getBrowserPixelDensity = () => {
10982
11077
  if (typeof window === "undefined") {
10983
11078
  return 1;
@@ -11231,7 +11326,7 @@ var OffthreadVideoForRendering = ({
11231
11326
  };
11232
11327
 
11233
11328
  // src/video/VideoForPreview.tsx
11234
- import React37, {
11329
+ import React38, {
11235
11330
  forwardRef as forwardRef13,
11236
11331
  useCallback as useCallback23,
11237
11332
  useContext as useContext37,
@@ -11304,7 +11399,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
11304
11399
  ref: videoRef
11305
11400
  });
11306
11401
  }, [context.audioContext]);
11307
- const effectToUse = React37.useInsertionEffect ?? React37.useLayoutEffect;
11402
+ const effectToUse = React38.useInsertionEffect ?? React38.useLayoutEffect;
11308
11403
  effectToUse(() => {
11309
11404
  return () => {
11310
11405
  requestAnimationFrame(() => {
@@ -11720,23 +11815,23 @@ var watchStaticFile = (fileName, callback) => {
11720
11815
  };
11721
11816
 
11722
11817
  // src/wrap-remotion-context.tsx
11723
- import React39, { useMemo as useMemo37 } from "react";
11818
+ import React40, { useMemo as useMemo37 } from "react";
11724
11819
  import { jsx as jsx36 } from "react/jsx-runtime";
11725
11820
  function useRemotionContexts() {
11726
- const compositionManagerCtx = React39.useContext(CompositionManager);
11727
- const timelineContext = React39.useContext(TimelineContext);
11728
- const setTimelineContext = React39.useContext(SetTimelineContext);
11729
- const sequenceContext = React39.useContext(SequenceContext);
11730
- const nonceContext = React39.useContext(NonceContext);
11731
- const canUseRemotionHooksContext = React39.useContext(CanUseRemotionHooks);
11732
- const preloadContext = React39.useContext(PreloadContext);
11733
- const resolveCompositionContext = React39.useContext(ResolveCompositionContext);
11734
- const renderAssetManagerContext = React39.useContext(RenderAssetManager);
11735
- const sequenceManagerContext = React39.useContext(SequenceManager);
11736
- const sequenceManagerRefContext = React39.useContext(SequenceManagerRefContext);
11737
- const visualModePropStatusesRefContext = React39.useContext(VisualModePropStatusesRefContext);
11738
- const bufferManagerContext = React39.useContext(BufferingContextReact);
11739
- const logLevelContext = React39.useContext(LogLevelContext);
11821
+ const compositionManagerCtx = React40.useContext(CompositionManager);
11822
+ const timelineContext = React40.useContext(TimelineContext);
11823
+ const setTimelineContext = React40.useContext(SetTimelineContext);
11824
+ const sequenceContext = React40.useContext(SequenceContext);
11825
+ const nonceContext = React40.useContext(NonceContext);
11826
+ const canUseRemotionHooksContext = React40.useContext(CanUseRemotionHooks);
11827
+ const preloadContext = React40.useContext(PreloadContext);
11828
+ const resolveCompositionContext = React40.useContext(ResolveCompositionContext);
11829
+ const renderAssetManagerContext = React40.useContext(RenderAssetManager);
11830
+ const sequenceManagerContext = React40.useContext(SequenceManager);
11831
+ const sequenceManagerRefContext = React40.useContext(SequenceManagerRefContext);
11832
+ const visualModePropStatusesRefContext = React40.useContext(VisualModePropStatusesRefContext);
11833
+ const bufferManagerContext = React40.useContext(BufferingContextReact);
11834
+ const logLevelContext = React40.useContext(LogLevelContext);
11740
11835
  return useMemo37(() => ({
11741
11836
  compositionManagerCtx,
11742
11837
  timelineContext,
@@ -11912,6 +12007,8 @@ var Internals = {
11912
12007
  BufferingProvider,
11913
12008
  BufferingContextReact,
11914
12009
  getComponentsToAddStacksTo,
12010
+ getSequenceComponent,
12011
+ getSingleChildComponent,
11915
12012
  CurrentScaleContext,
11916
12013
  PixelDensityContext,
11917
12014
  PreviewSizeContext,
@@ -11969,18 +12066,17 @@ var Internals = {
11969
12066
  fromField
11970
12067
  };
11971
12068
  // src/series/index.tsx
11972
- import {
11973
- Children,
12069
+ import React42, {
11974
12070
  forwardRef as forwardRef14,
11975
12071
  useMemo as useMemo38
11976
12072
  } from "react";
11977
12073
 
11978
12074
  // src/series/flatten-children.tsx
11979
- import React40 from "react";
12075
+ import React41 from "react";
11980
12076
  var flattenChildren = (children) => {
11981
- const childrenArray = React40.Children.toArray(children);
12077
+ const childrenArray = React41.Children.toArray(children);
11982
12078
  return childrenArray.reduce((flatChildren, child) => {
11983
- if (child.type === React40.Fragment) {
12079
+ if (child.type === React41.Fragment) {
11984
12080
  return flatChildren.concat(flattenChildren(child.props.children));
11985
12081
  }
11986
12082
  flatChildren.push(child);
@@ -11989,67 +12085,131 @@ var flattenChildren = (children) => {
11989
12085
  };
11990
12086
 
11991
12087
  // src/series/index.tsx
11992
- import { jsx as jsx37 } from "react/jsx-runtime";
11993
- var SeriesSequenceRefForwardingFunction = ({ children }, _ref) => {
12088
+ import { jsx as jsx37, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
12089
+ var seriesSequenceSchema = {
12090
+ durationInFrames: Interactive.baseSchema.durationInFrames,
12091
+ name: Interactive.sequenceSchema.name,
12092
+ hidden: Interactive.sequenceSchema.hidden,
12093
+ showInTimeline: Interactive.sequenceSchema.showInTimeline,
12094
+ freeze: Interactive.baseSchema.freeze,
12095
+ layout: Interactive.sequenceSchema.layout
12096
+ };
12097
+ var SeriesSequenceInner = forwardRef14(({
12098
+ offset = 0,
12099
+ className = "",
12100
+ stack = null,
12101
+ _remotionInternalRender = null,
12102
+ ...props2
12103
+ }, ref) => {
11994
12104
  useRequireToBeInsideSeries();
12105
+ if (_remotionInternalRender) {
12106
+ return _remotionInternalRender({ ...props2, offset, className: className || undefined, stack }, ref);
12107
+ }
11995
12108
  return /* @__PURE__ */ jsx37(IsNotInsideSeriesProvider, {
11996
- children
12109
+ children: props2.children
11997
12110
  });
11998
- };
11999
- var SeriesSequence = forwardRef14(SeriesSequenceRefForwardingFunction);
12111
+ });
12112
+ var SeriesSequence = Interactive.withSchema({
12113
+ Component: SeriesSequenceInner,
12114
+ componentName: "<Series.Sequence>",
12115
+ componentIdentity: "dev.remotion.remotion.Series.Sequence",
12116
+ schema: seriesSequenceSchema,
12117
+ supportsEffects: false
12118
+ });
12000
12119
  var SequenceWithoutSchemaWithRef = SequenceWithoutSchema;
12120
+ var validateSeriesSequenceProps = ({
12121
+ durationInFrames,
12122
+ offset: offsetProp,
12123
+ index,
12124
+ childrenLength
12125
+ }) => {
12126
+ const debugInfo = `index = ${index}, duration = ${durationInFrames}`;
12127
+ if (index !== childrenLength - 1 || durationInFrames !== Infinity) {
12128
+ validateDurationInFrames(durationInFrames, {
12129
+ component: `of a <Series.Sequence /> component`,
12130
+ allowFloats: true
12131
+ });
12132
+ }
12133
+ const offset = offsetProp ?? 0;
12134
+ if (Number.isNaN(offset)) {
12135
+ throw new TypeError(`The "offset" property of a <Series.Sequence /> must not be NaN, but got NaN (${debugInfo}).`);
12136
+ }
12137
+ if (!Number.isFinite(offset)) {
12138
+ throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${offset} (${debugInfo}).`);
12139
+ }
12140
+ if (offset % 1 !== 0) {
12141
+ throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${offset} (${debugInfo}).`);
12142
+ }
12143
+ return offset;
12144
+ };
12001
12145
  var SeriesInner = (props2) => {
12002
12146
  const childrenValue = useMemo38(() => {
12003
- let startFrame = 0;
12004
12147
  const flattenedChildren = flattenChildren(props2.children);
12005
- return Children.map(flattenedChildren, (child, i) => {
12148
+ const renderChildren = (i, startFrame) => {
12149
+ if (i === flattenedChildren.length) {
12150
+ return null;
12151
+ }
12152
+ const child = flattenedChildren[i];
12006
12153
  const castedChild = child;
12007
12154
  if (typeof castedChild === "string") {
12008
12155
  if (castedChild.trim() === "") {
12009
- return null;
12156
+ return renderChildren(i + 1, startFrame);
12010
12157
  }
12011
12158
  throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but you passed a string "${castedChild}"`);
12012
12159
  }
12013
12160
  if (castedChild.type !== SeriesSequence) {
12014
12161
  throw new TypeError(`The <Series /> component only accepts a list of <Series.Sequence /> components as its children, but got ${castedChild} instead`);
12015
12162
  }
12016
- const debugInfo = `index = ${i}, duration = ${castedChild.props.durationInFrames}`;
12017
- const durationInFramesProp = castedChild.props.durationInFrames;
12018
- const {
12019
- durationInFrames,
12020
- children: _children,
12021
- from,
12022
- name,
12023
- ...passedProps
12024
- } = castedChild.props;
12025
- if (i !== flattenedChildren.length - 1 || durationInFramesProp !== Infinity) {
12026
- validateDurationInFrames(durationInFramesProp, {
12027
- component: `of a <Series.Sequence /> component`,
12028
- allowFloats: true
12029
- });
12030
- }
12031
- const offset = castedChild.props.offset ?? 0;
12032
- if (Number.isNaN(offset)) {
12033
- throw new TypeError(`The "offset" property of a <Series.Sequence /> must not be NaN, but got NaN (${debugInfo}).`);
12034
- }
12035
- if (!Number.isFinite(offset)) {
12036
- throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${offset} (${debugInfo}).`);
12037
- }
12038
- if (offset % 1 !== 0) {
12039
- throw new TypeError(`The "offset" property of a <Series.Sequence /> must be finite, but got ${offset} (${debugInfo}).`);
12040
- }
12041
- const currentStartFrame = startFrame + offset;
12042
- startFrame += durationInFramesProp + offset;
12043
- return /* @__PURE__ */ jsx37(SequenceWithoutSchemaWithRef, {
12044
- ref: castedChild.ref,
12045
- name: name || "<Series.Sequence>",
12046
- _remotionInternalDocumentationLink: name ? undefined : "https://www.remotion.dev/docs/series",
12047
- from: currentStartFrame,
12048
- durationInFrames: durationInFramesProp,
12049
- ...passedProps,
12050
- children: child
12163
+ const castedElement = castedChild;
12164
+ validateSeriesSequenceProps({
12165
+ durationInFrames: castedElement.props.durationInFrames,
12166
+ offset: castedElement.props.offset,
12167
+ index: i,
12168
+ childrenLength: flattenedChildren.length
12051
12169
  });
12052
- });
12170
+ return React42.cloneElement(castedElement, {
12171
+ _remotionInternalRender: (resolvedProps, ref) => {
12172
+ const durationInFramesProp = resolvedProps.durationInFrames;
12173
+ const {
12174
+ durationInFrames: _durationInFrames,
12175
+ children: sequenceChildren,
12176
+ offset: offsetProp,
12177
+ controls,
12178
+ stack,
12179
+ from: _from,
12180
+ name,
12181
+ ...passedProps
12182
+ } = resolvedProps;
12183
+ const offset = validateSeriesSequenceProps({
12184
+ durationInFrames: durationInFramesProp,
12185
+ offset: offsetProp,
12186
+ index: i,
12187
+ childrenLength: flattenedChildren.length
12188
+ });
12189
+ const currentStartFrame = startFrame + offset;
12190
+ const nextStartFrame = startFrame + durationInFramesProp + offset;
12191
+ return /* @__PURE__ */ jsxs3(Fragment, {
12192
+ children: [
12193
+ /* @__PURE__ */ jsx37(SequenceWithoutSchemaWithRef, {
12194
+ ref,
12195
+ name: name || "<Series.Sequence>",
12196
+ _remotionInternalDocumentationLink: name ? undefined : "https://www.remotion.dev/docs/series",
12197
+ _remotionInternalStack: stack ?? undefined,
12198
+ controls: controls ?? undefined,
12199
+ from: currentStartFrame,
12200
+ durationInFrames: durationInFramesProp,
12201
+ ...passedProps,
12202
+ children: /* @__PURE__ */ jsx37(IsNotInsideSeriesProvider, {
12203
+ children: sequenceChildren
12204
+ })
12205
+ }),
12206
+ renderChildren(i + 1, nextStartFrame)
12207
+ ]
12208
+ });
12209
+ }
12210
+ });
12211
+ };
12212
+ return renderChildren(0, 0);
12053
12213
  }, [props2.children]);
12054
12214
  return /* @__PURE__ */ jsx37(IsInsideSeriesContainer, {
12055
12215
  children: /* @__PURE__ */ jsx37(Sequence, {
@@ -12161,14 +12321,14 @@ var staticFile = (path) => {
12161
12321
  return preparsed;
12162
12322
  };
12163
12323
  // src/Still.tsx
12164
- import React42 from "react";
12324
+ import React43 from "react";
12165
12325
  var Still = (props2) => {
12166
12326
  const newProps = {
12167
12327
  ...props2,
12168
12328
  durationInFrames: 1,
12169
12329
  fps: 1
12170
12330
  };
12171
- return React42.createElement(Composition, newProps);
12331
+ return React43.createElement(Composition, newProps);
12172
12332
  };
12173
12333
  addSequenceStackTraces(Still);
12174
12334
  // src/video/html5-video.tsx
@@ -12675,6 +12835,7 @@ var Config = new Proxy(proxyObj, {
12675
12835
  });
12676
12836
  Sequence.displayName = "Sequence";
12677
12837
  addSequenceStackTraces(Sequence);
12838
+ setSequenceComponent(Sequence);
12678
12839
  addSequenceStackTraces(Composition);
12679
12840
  addSequenceStackTraces(Folder);
12680
12841
  export {