Add .gitignore to exclude all node packages and lock files

This commit is contained in:
Adolfo Reyna
2026-02-23 21:56:04 -05:00
parent faae96c9ed
commit dcc5c6c044
9747 changed files with 1555105 additions and 2 deletions
File diff suppressed because one or more lines are too long
@@ -0,0 +1,25 @@
var __create = Object.create;
var __getProtoOf = Object.getPrototypeOf;
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __toESM = (mod, isNodeMode, target) => {
target = mod != null ? __create(__getProtoOf(mod)) : {};
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
for (let key of __getOwnPropNames(mod))
if (!__hasOwnProp.call(to, key))
__defProp(to, key, {
get: () => mod[key],
enumerable: true
});
return to;
};
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined")
return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
export { __toESM, __require };
@@ -0,0 +1,623 @@
var __create = Object.create;
var __getProtoOf = Object.getPrototypeOf;
var __defProp = Object.defineProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __toESM = (mod, isNodeMode, target) => {
target = mod != null ? __create(__getProtoOf(mod)) : {};
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
for (let key of __getOwnPropNames(mod))
if (!__hasOwnProp.call(to, key))
__defProp(to, key, {
get: () => mod[key],
enumerable: true
});
return to;
};
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
}) : x)(function(x) {
if (typeof require !== "undefined")
return require.apply(this, arguments);
throw Error('Dynamic require of "' + x + '" is not supported');
});
// src/api/create-composition.tsx
import { Composition, Still } from "remotion";
import { jsx } from "react/jsx-runtime";
var createComposition = ({
...other
}) => () => {
return /* @__PURE__ */ jsx(Composition, {
...other
});
};
var createStill = ({
...other
}) => () => {
return /* @__PURE__ */ jsx(Still, {
...other
});
};
// src/api/delete-static-file.ts
import { getRemotionEnvironment } from "remotion";
// src/components/call-api.ts
var callApi = (endpoint, body, signal) => {
return new Promise((resolve, reject) => {
fetch(endpoint, {
method: "post",
headers: {
"content-type": "application/json"
},
signal,
body: JSON.stringify(body)
}).then((res) => res.json()).then((data) => {
if (data.success) {
resolve(data.data);
} else {
reject(new Error(data.error));
}
}).catch((err) => {
reject(err);
});
});
};
// src/api/delete-static-file.ts
var deleteStaticFile = async (relativePath) => {
if (!getRemotionEnvironment().isStudio) {
throw new Error("deleteStaticFile() is only available in the Studio");
}
if (window.remotion_isReadOnlyStudio) {
throw new Error("deleteStaticFile() is not available in Read-Only Studio");
}
if (relativePath.startsWith(window.remotion_staticBase)) {
relativePath = relativePath.substring(window.remotion_staticBase.length + 1);
}
const res = await callApi("/api/delete-static-file", { relativePath });
return res;
};
// src/components/RenderModal/SchemaEditor/scroll-to-default-props-path.ts
import React from "react";
var DEFAULT_PROPS_PATH_CLASSNAME = "__remotion-default-props-editor-label";
var DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME = "__remotion-default-props-editor-label-active";
var defaultPropsEditorScrollableAreaRef = React.createRef();
// src/api/focus-default-props-path.ts
var focusDefaultPropsPath = ({
path,
scrollBehavior
}) => {
const currentlyActive = document.querySelector(`.${DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME}`);
if (currentlyActive !== null) {
currentlyActive.classList.remove(DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME);
}
const query = document.querySelector(`.${DEFAULT_PROPS_PATH_CLASSNAME}[data-json-path="${path.join(".")}"]`);
if (query === null) {
return {
success: false
};
}
query.scrollIntoView({ behavior: scrollBehavior });
query.classList.add(DEFAULT_PROPS_PATH_ACTIVE_CLASSNAME);
return {
success: true
};
};
// src/api/get-static-files.ts
var warnedServer = false;
var warnedPlayer = false;
var warnServerOnce = () => {
if (warnedServer) {
return;
}
warnedServer = true;
console.warn("Called getStaticFiles() on the server. The API is only available in the browser. An empty array was returned.");
};
var warnPlayerOnce = () => {
if (warnedPlayer) {
return;
}
warnedPlayer = true;
console.warn("Called getStaticFiles() while using the Remotion Player. The API is only available while using the Remotion Studio. An empty array was returned.");
};
var getStaticFiles = () => {
if (typeof document === "undefined") {
warnServerOnce();
return [];
}
if (window.remotion_isPlayer) {
warnPlayerOnce();
return [];
}
return window.remotion_staticFiles;
};
// src/api/go-to-composition.ts
import { Internals } from "remotion";
var goToComposition = (compositionId) => {
Internals.compositionSelectorRef.current?.selectComposition(compositionId);
};
// src/api/helpers/calc-new-props.ts
import { Internals as Internals2, getRemotionEnvironment as getRemotionEnvironment2 } from "remotion";
var calcNewProps = (compositionId, defaultProps) => {
if (!getRemotionEnvironment2().isStudio) {
throw new Error("saveDefaultProps can only be called in the Remotion Studio.");
}
const { compositionsRef, editorPropsProviderRef } = Internals2;
const compositionsStore = compositionsRef.current;
if (!compositionsStore) {
throw new Error("No compositions ref found. Are you in the Remotion Studio and are the Remotion versions aligned?");
}
const compositions = compositionsStore.getCompositions();
const composition = compositions.find((c) => c.id === compositionId);
if (!composition) {
throw new Error(`No composition with the ID ${compositionId} found. Available compositions: ${compositions.map((c) => c.id).join(", ")}`);
}
const propsStore = editorPropsProviderRef.current;
if (!propsStore) {
throw new Error("No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?");
}
const savedDefaultProps = composition.defaultProps ?? {};
const unsavedDefaultProps = propsStore.getProps()[compositionId] ?? savedDefaultProps;
const generatedDefaultProps = defaultProps({
schema: composition.schema,
savedDefaultProps,
unsavedDefaultProps
});
return {
composition,
generatedDefaultProps
};
};
// src/api/pause.ts
import { Internals as Internals3 } from "remotion";
var pause = () => {
Internals3.timeValueRef.current?.pause();
};
// src/api/play.ts
import { Internals as Internals4 } from "remotion";
var play = (e) => {
Internals4.timeValueRef.current?.play(e);
};
// src/api/reevaluate-composition.ts
import { Internals as Internals5 } from "remotion";
var reevaluateComposition = () => {
Internals5.resolveCompositionsRef.current?.reloadCurrentlySelectedComposition();
};
// src/api/restart-studio.ts
import { getRemotionEnvironment as getRemotionEnvironment3 } from "remotion";
var restartStudio = () => {
if (!getRemotionEnvironment3().isStudio) {
throw new Error("restartStudio() is only available in the Studio");
}
if (window.remotion_isReadOnlyStudio) {
throw new Error("restartStudio() is not available in read-only Studio");
}
return callApi("/api/restart-studio", {});
};
// src/api/save-default-props.ts
import { getRemotionEnvironment as getRemotionEnvironment4 } from "remotion";
// src/components/RenderModal/SchemaEditor/extract-enum-json-paths.ts
var extractEnumJsonPaths = ({
schema,
zodRuntime,
currentPath,
zodTypes
}) => {
const def = schema._def;
const typeName = def.typeName;
switch (typeName) {
case zodRuntime.ZodFirstPartyTypeKind.ZodObject: {
const shape = def.shape();
const keys = Object.keys(shape);
return keys.map((key) => {
return extractEnumJsonPaths({
schema: shape[key],
zodRuntime,
currentPath: [...currentPath, key],
zodTypes
});
}).flat(1);
}
case zodRuntime.ZodFirstPartyTypeKind.ZodArray: {
return extractEnumJsonPaths({
schema: def.type,
zodRuntime,
currentPath: [...currentPath, "[]"],
zodTypes
});
}
case zodRuntime.ZodFirstPartyTypeKind.ZodUnion: {
return def.options.map((option) => {
return extractEnumJsonPaths({
schema: option,
zodRuntime,
currentPath,
zodTypes
});
}).flat(1);
}
case zodRuntime.ZodFirstPartyTypeKind.ZodDiscriminatedUnion: {
return def.options.map((op) => {
return extractEnumJsonPaths({
schema: op,
zodRuntime,
currentPath,
zodTypes
});
}).flat(1);
}
case zodRuntime.ZodFirstPartyTypeKind.ZodLiteral: {
return [currentPath];
}
case zodRuntime.ZodFirstPartyTypeKind.ZodEffects: {
if (zodTypes && schema._def.description === zodTypes.ZodZypesInternals.REMOTION_MATRIX_BRAND) {
return [currentPath];
}
return extractEnumJsonPaths({
schema: def.schema,
zodRuntime,
currentPath,
zodTypes
});
}
case zodRuntime.ZodFirstPartyTypeKind.ZodIntersection: {
const { left, right } = def;
const leftValue = extractEnumJsonPaths({
schema: left,
zodRuntime,
currentPath,
zodTypes
});
const rightValue = extractEnumJsonPaths({
schema: right,
zodRuntime,
currentPath,
zodTypes
});
return [...leftValue, ...rightValue];
}
case zodRuntime.ZodFirstPartyTypeKind.ZodTuple: {
return def.items.map((item, i) => extractEnumJsonPaths({
schema: item,
zodRuntime,
currentPath: [...currentPath, i],
zodTypes
})).flat(1);
}
case zodRuntime.ZodFirstPartyTypeKind.ZodRecord: {
const values = extractEnumJsonPaths({
schema: def.valueType,
zodRuntime,
currentPath: [...currentPath, "{}"],
zodTypes
});
return values;
}
case zodRuntime.ZodFirstPartyTypeKind.ZodFunction: {
throw new Error("Cannot create a value for type function");
}
case zodRuntime.ZodFirstPartyTypeKind.ZodEnum: {
return [currentPath];
}
case zodRuntime.ZodFirstPartyTypeKind.ZodNativeEnum: {
return [];
}
case zodRuntime.ZodFirstPartyTypeKind.ZodOptional: {
const defType = def;
const value = extractEnumJsonPaths({
schema: defType.innerType,
zodRuntime,
currentPath,
zodTypes
});
return value;
}
case zodRuntime.ZodFirstPartyTypeKind.ZodNullable: {
const defType = def;
const value = extractEnumJsonPaths({
schema: defType.innerType,
zodRuntime,
currentPath,
zodTypes
});
return value;
}
case zodRuntime.ZodFirstPartyTypeKind.ZodDefault: {
const defType = def;
return extractEnumJsonPaths({
schema: defType.innerType,
zodRuntime,
currentPath,
zodTypes
});
}
case zodRuntime.ZodFirstPartyTypeKind.ZodCatch: {
const defType = def;
return extractEnumJsonPaths({
schema: defType.innerType,
zodRuntime,
currentPath,
zodTypes
});
}
case zodRuntime.ZodFirstPartyTypeKind.ZodPromise: {
return [];
}
case zodRuntime.ZodFirstPartyTypeKind.ZodBranded: {
const defType = def;
const value = extractEnumJsonPaths({
schema: defType.type,
zodRuntime,
currentPath,
zodTypes
});
return value;
}
case zodRuntime.ZodFirstPartyTypeKind.ZodPipeline: {
const defType = def;
const value = extractEnumJsonPaths({
schema: defType.out,
zodRuntime,
currentPath,
zodTypes
});
return value;
}
case zodRuntime.ZodFirstPartyTypeKind.ZodString:
case zodRuntime.ZodFirstPartyTypeKind.ZodNumber:
case zodRuntime.ZodFirstPartyTypeKind.ZodBigInt:
case zodRuntime.ZodFirstPartyTypeKind.ZodBoolean:
case zodRuntime.ZodFirstPartyTypeKind.ZodNaN:
case zodRuntime.ZodFirstPartyTypeKind.ZodDate:
case zodRuntime.ZodFirstPartyTypeKind.ZodSymbol:
case zodRuntime.ZodFirstPartyTypeKind.ZodUndefined:
case zodRuntime.ZodFirstPartyTypeKind.ZodNull:
case zodRuntime.ZodFirstPartyTypeKind.ZodAny:
case zodRuntime.ZodFirstPartyTypeKind.ZodUnknown:
case zodRuntime.ZodFirstPartyTypeKind.ZodNever:
case zodRuntime.ZodFirstPartyTypeKind.ZodVoid:
case zodRuntime.ZodFirstPartyTypeKind.ZodMap:
case zodRuntime.ZodFirstPartyTypeKind.ZodLazy:
case zodRuntime.ZodFirstPartyTypeKind.ZodSet: {
return [];
}
default:
throw new Error("Not implemented: " + typeName);
}
};
// src/components/RenderQueue/actions.ts
import { NoReactInternals } from "remotion/no-react";
var callUpdateDefaultPropsApi = (compositionId, defaultProps, enumPaths) => {
return callApi("/api/update-default-props", {
compositionId,
defaultProps: NoReactInternals.serializeJSONWithSpecialTypes({
data: defaultProps,
indent: undefined,
staticBase: window.remotion_staticBase
}).serializedString,
enumPaths
});
};
// src/api/save-default-props.ts
var saveDefaultProps = async ({
compositionId,
defaultProps
}) => {
if (!getRemotionEnvironment4().isStudio) {
throw new Error("saveDefaultProps() is only available in the Studio");
}
if (window.remotion_isReadOnlyStudio) {
throw new Error("saveDefaultProps() is not available in read-only Studio");
}
try {
await import("zod");
} catch {
throw new Error('"zod" is required to use saveDefaultProps(), but is not installed.');
}
const z = await import("zod");
let zodTypes = null;
try {
zodTypes = await import("@remotion/zod-types");
} catch {}
const { generatedDefaultProps, composition } = calcNewProps(compositionId, defaultProps);
const res = await callUpdateDefaultPropsApi(compositionId, generatedDefaultProps, composition.schema ? extractEnumJsonPaths({
schema: composition.schema,
zodRuntime: z,
currentPath: [],
zodTypes
}) : []);
if (res.success) {
return Promise.resolve();
}
const err = new Error(res.reason);
err.stack = res.stack;
return Promise.reject(err);
};
// src/api/seek.ts
import { Internals as Internals6 } from "remotion";
var seek = (frame) => {
Internals6.timeValueRef.current?.seek(Math.max(0, frame));
};
// src/api/toggle.ts
import { Internals as Internals7 } from "remotion";
var toggle = (e) => {
Internals7.timeValueRef.current?.toggle(e);
};
// src/api/update-default-props.ts
import { Internals as Internals8 } from "remotion";
var updateDefaultProps = ({
compositionId,
defaultProps
}) => {
const { generatedDefaultProps, composition } = calcNewProps(compositionId, defaultProps);
const propsStore = Internals8.editorPropsProviderRef.current;
if (!propsStore) {
throw new Error("No props store found. Are you in the Remotion Studio and are the Remotion versions aligned?");
}
propsStore.setProps((prev) => {
return {
...prev,
[composition.id]: generatedDefaultProps
};
});
window.dispatchEvent(new CustomEvent(Internals8.PROPS_UPDATED_EXTERNALLY, {
detail: {
resetUnsaved: null
}
}));
};
// src/api/visual-control.ts
import { getRemotionEnvironment as getRemotionEnvironment5 } from "remotion";
// src/visual-controls/VisualControls.tsx
import {
createContext,
createRef,
useCallback,
useEffect,
useImperativeHandle,
useMemo,
useRef,
useState
} from "react";
import { useRemotionEnvironment } from "remotion";
import { jsx as jsx2 } from "react/jsx-runtime";
var VisualControlsTabActivatedContext = createContext(false);
var VisualControlsContext = createContext({
handles: {}
});
var visualControlRef = createRef();
var SetVisualControlsContext = createContext({
updateHandles: () => {
throw new Error("updateHandles is not implemented");
},
updateValue: () => {
throw new Error("updateValue is not implemented");
},
visualControl: () => {
throw new Error("visualControl is not implemented");
}
});
// src/api/visual-control.ts
var visualControl = (key, value, schema) => {
if (getRemotionEnvironment5().isRendering) {
return value;
}
if (!visualControlRef.current) {
return value;
}
return visualControlRef.current.globalVisualControl(key, value, schema);
};
// src/api/watch-public-folder.ts
import { getRemotionEnvironment as getRemotionEnvironment6 } from "remotion";
var WATCH_REMOTION_STATIC_FILES = "remotion_staticFilesChanged";
var watchPublicFolder = (callback) => {
if (!getRemotionEnvironment6().isStudio) {
console.warn("The watchPublicFolder() API is only available while using the Remotion Studio.");
return { cancel: () => {
return;
} };
}
if (window.remotion_isReadOnlyStudio) {
throw new Error("watchPublicFolder() is not available in read-only Studio");
}
const emitUpdate = () => {
callback(getStaticFiles());
};
window.addEventListener(WATCH_REMOTION_STATIC_FILES, emitUpdate);
const cancel = () => {
return window.removeEventListener(WATCH_REMOTION_STATIC_FILES, emitUpdate);
};
return { cancel };
};
// src/api/watch-static-file.ts
import { getRemotionEnvironment as getRemotionEnvironment7 } from "remotion";
var watchStaticFile = (fileName, callback) => {
if (!getRemotionEnvironment7().isStudio) {
console.warn("watchStaticFile() is only available while using the Remotion Studio.");
return { cancel: () => {
return;
} };
}
if (window.remotion_isReadOnlyStudio) {
console.warn("watchStaticFile() is only available in an interactive Studio.");
return { cancel: () => {
return;
} };
}
const withoutStaticBase = fileName.startsWith(window.remotion_staticBase) ? fileName.replace(window.remotion_staticBase, "") : fileName;
const withoutLeadingSlash = withoutStaticBase.startsWith("/") ? withoutStaticBase.slice(1) : withoutStaticBase;
let prevFileData = window.remotion_staticFiles.find((file) => file.name === withoutLeadingSlash);
const { cancel } = watchPublicFolder((staticFiles) => {
const newFileData = staticFiles.find((file) => file.name === withoutLeadingSlash);
if (!newFileData) {
if (prevFileData !== undefined) {
callback(null);
}
prevFileData = undefined;
return;
}
if (prevFileData === undefined || prevFileData.lastModified !== newFileData.lastModified) {
callback(newFileData);
prevFileData = newFileData;
}
});
return { cancel };
};
// src/api/write-static-file.ts
var writeStaticFile = async ({
contents,
filePath
}) => {
if (window.remotion_isReadOnlyStudio) {
throw new Error("writeStaticFile() is not available in read-only Studio");
}
const url = new URL(`${window.remotion_staticBase}/api/add-asset`, window.location.origin);
if (filePath.includes("\\")) {
return Promise.reject(new Error("File path cannot contain backslashes"));
}
url.search = new URLSearchParams({
filePath
}).toString();
const response = await fetch(url, {
method: "POST",
body: contents
});
if (!response.ok) {
const jsonResponse = await response.json();
throw new Error(jsonResponse.error);
}
};
// src/index.ts
var StudioInternals = {
createComposition,
createStill
};
export {
writeStaticFile,
watchStaticFile,
watchPublicFolder,
visualControl,
updateDefaultProps,
toggle,
seek,
saveDefaultProps,
restartStudio,
reevaluateComposition,
play,
pause,
goToComposition,
getStaticFiles,
focusDefaultPropsPath,
deleteStaticFile,
StudioInternals
};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,352 @@
import {
__require,
__toESM
} from "./chunk-6jf1natv.js";
// src/renderEntry.tsx
import { useContext, useEffect, useRef, useState } from "react";
import ReactDOM from "react-dom/client";
import {
AbsoluteFill,
getInputProps,
getRemotionEnvironment,
continueRender as globalContinueRender,
delayRender as globalDelayRender,
Internals,
useDelayRender
} from "remotion";
import { NoReactInternals } from "remotion/no-react";
import { jsx, jsxs } from "react/jsx-runtime";
var currentBundleMode = {
type: "index"
};
var setBundleMode = (state) => {
currentBundleMode = state;
};
var getBundleMode = () => {
return currentBundleMode;
};
Internals.CSSUtils.injectCSS(Internals.CSSUtils.makeDefaultPreviewCSS(null, "#1f2428"));
var getCanSerializeDefaultProps = (object) => {
try {
const str = JSON.stringify(object);
return str.length < 256 * 1024 * 1024 * 0.9;
} catch (err) {
if (err.message.includes("Invalid string length")) {
return false;
}
throw err;
}
};
var isInHeadlessBrowser = () => {
return typeof window.remotion_puppeteerTimeout !== "undefined";
};
var DelayedSpinner = () => {
const [show, setShow] = useState(false);
useEffect(() => {
const timeout = setTimeout(() => {
setShow(true);
}, 2000);
return () => {
clearTimeout(timeout);
};
}, []);
if (!show) {
return null;
}
return /* @__PURE__ */ jsx(AbsoluteFill, {
style: {
justifyContent: "center",
alignItems: "center",
fontSize: 13,
opacity: 0.6,
color: "white",
fontFamily: "Helvetica, Arial, sans-serif"
},
children: "Loading Studio"
});
};
var GetVideoComposition = ({ state }) => {
const { compositions, currentCompositionMetadata, canvasContent } = useContext(Internals.CompositionManager);
const { setCanvasContent } = useContext(Internals.CompositionSetters);
const portalContainer = useRef(null);
const { delayRender, continueRender } = useDelayRender();
const [handle] = useState(() => delayRender(`Waiting for Composition "${state.compositionName}"`));
useEffect(() => {
return () => continueRender(handle);
}, [handle, continueRender]);
useEffect(() => {
if (compositions.length === 0) {
return;
}
const foundComposition = compositions.find((c) => c.id === state.compositionName);
if (!foundComposition) {
throw new Error(`Found no composition with the name ${state.compositionName}. The following compositions were found instead: ${compositions.map((c) => c.id).join(", ")}. All compositions must have their ID calculated deterministically and must be mounted at the same time.`);
}
setCanvasContent({
type: "composition",
compositionId: foundComposition.id
});
}, [compositions, state, currentCompositionMetadata, setCanvasContent]);
useEffect(() => {
if (!canvasContent) {
return;
}
const { current } = portalContainer;
if (!current) {
throw new Error("portal did not render");
}
current.appendChild(Internals.portalNode());
continueRender(handle);
return () => {
current.removeChild(Internals.portalNode());
};
}, [canvasContent, handle, continueRender]);
if (!currentCompositionMetadata) {
return null;
}
return /* @__PURE__ */ jsx("div", {
ref: portalContainer,
id: "remotion-canvas",
style: {
width: currentCompositionMetadata.width,
height: currentCompositionMetadata.height,
display: "flex",
backgroundColor: "transparent"
}
});
};
var DEFAULT_ROOT_COMPONENT_TIMEOUT = 1e4;
var waitForRootHandle = globalDelayRender("Loading root component - See https://remotion.dev/docs/troubleshooting/loading-root-component if you experience a timeout", {
timeoutInMilliseconds: typeof window === "undefined" ? DEFAULT_ROOT_COMPONENT_TIMEOUT : window.remotion_puppeteerTimeout ?? DEFAULT_ROOT_COMPONENT_TIMEOUT
});
var videoContainer = document.getElementById("video-container");
var root = null;
var getRootForElement = () => {
if (root) {
return root;
}
root = ReactDOM.createRoot(videoContainer);
return root;
};
var renderToDOM = (content) => {
if (!ReactDOM.createRoot) {
if (NoReactInternals.ENABLE_V5_BREAKING_CHANGES) {
throw new Error("Remotion 5.0 does only support React 18+. However, ReactDOM.createRoot() is undefined.");
}
ReactDOM.render(content, videoContainer);
return;
}
getRootForElement().render(content);
};
var renderContent = (Root) => {
const bundleMode = getBundleMode();
if (bundleMode.type === "composition") {
const markup = /* @__PURE__ */ jsx(Internals.CompositionManagerProvider, {
initialCanvasContent: null,
onlyRenderComposition: bundleMode.compositionName,
currentCompositionMetadata: {
props: NoReactInternals.deserializeJSONWithSpecialTypes(bundleMode.serializedResolvedPropsWithSchema),
durationInFrames: bundleMode.compositionDurationInFrames,
fps: bundleMode.compositionFps,
height: bundleMode.compositionHeight,
width: bundleMode.compositionWidth,
defaultCodec: bundleMode.compositionDefaultCodec,
defaultOutName: bundleMode.compositionDefaultOutName,
defaultVideoImageFormat: bundleMode.compositionDefaultVideoImageFormat,
defaultPixelFormat: bundleMode.compositionDefaultPixelFormat,
defaultProResProfile: bundleMode.compositionDefaultProResProfile
},
initialCompositions: [],
children: /* @__PURE__ */ jsx(Internals.RemotionRootContexts, {
frameState: null,
audioEnabled: window.remotion_audioEnabled,
videoEnabled: window.remotion_videoEnabled,
logLevel: window.remotion_logLevel,
numberOfAudioTags: 0,
nonceContextSeed: 0,
audioLatencyHint: window.remotion_audioLatencyHint ?? "interactive",
children: /* @__PURE__ */ jsxs(Internals.RenderAssetManagerProvider, {
collectAssets: null,
children: [
/* @__PURE__ */ jsx(Root, {}),
/* @__PURE__ */ jsx(GetVideoComposition, {
state: bundleMode
})
]
})
})
});
renderToDOM(markup);
}
if (bundleMode.type === "evaluation") {
const markup = /* @__PURE__ */ jsx(Internals.CompositionManagerProvider, {
initialCanvasContent: null,
onlyRenderComposition: null,
currentCompositionMetadata: null,
initialCompositions: [],
children: /* @__PURE__ */ jsx(Internals.RemotionRootContexts, {
frameState: null,
audioEnabled: window.remotion_audioEnabled,
videoEnabled: window.remotion_videoEnabled,
logLevel: window.remotion_logLevel,
numberOfAudioTags: 0,
audioLatencyHint: window.remotion_audioLatencyHint ?? "interactive",
nonceContextSeed: 0,
children: /* @__PURE__ */ jsx(Internals.RenderAssetManagerProvider, {
collectAssets: null,
children: /* @__PURE__ */ jsx(Root, {})
})
})
});
renderToDOM(markup);
}
if (bundleMode.type === "index") {
if (isInHeadlessBrowser()) {
return;
}
renderToDOM(/* @__PURE__ */ jsx("div", {
children: /* @__PURE__ */ jsx(DelayedSpinner, {})
}));
import("./chunk-112w480k.js").then(({ StudioInternals }) => {
window.remotion_isStudio = true;
window.remotion_isReadOnlyStudio = true;
window.remotion_inputProps = "{}";
Internals.enableSequenceStackTraces();
renderToDOM(/* @__PURE__ */ jsx(StudioInternals.Studio, {
readOnly: true,
rootComponent: Root
}));
}).catch((err) => {
renderToDOM(/* @__PURE__ */ jsxs("div", {
children: [
"Failed to load Remotion Studio: ",
err.message
]
}));
});
}
};
Internals.waitForRoot((Root) => {
renderContent(Root);
globalContinueRender(waitForRootHandle);
});
var setBundleModeAndUpdate = (state) => {
setBundleMode(state);
const delay = globalDelayRender("Waiting for root component to load - See https://remotion.dev/docs/troubleshooting/loading-root-component if you experience a timeout");
Internals.waitForRoot((Root) => {
renderContent(Root);
requestAnimationFrame(() => {
globalContinueRender(delay);
});
});
};
if (typeof window !== "undefined") {
const getUnevaluatedComps = () => {
if (!Internals.getRoot()) {
throw new Error("registerRoot() was never called. 1. Make sure you specified the correct entrypoint for your bundle. 2. If your registerRoot() call is deferred, use the delayRender/continueRender pattern to tell Remotion to wait.");
}
if (!Internals.compositionsRef.current) {
throw new Error("Unexpectedly did not have a CompositionManager");
}
const compositions = Internals.compositionsRef.current.getCompositions();
const canSerializeDefaultProps = getCanSerializeDefaultProps(compositions);
if (!canSerializeDefaultProps) {
Internals.Log.warn({ logLevel: window.remotion_logLevel, tag: null }, "defaultProps are too big to serialize - trying to find the problematic composition...");
Internals.Log.warn({ logLevel: window.remotion_logLevel, tag: null }, "Serialization:", compositions);
for (const comp of compositions) {
if (!getCanSerializeDefaultProps(comp)) {
throw new Error(`defaultProps too big - could not serialize - the defaultProps of composition with ID ${comp.id} - the object that was passed to defaultProps was too big. Learn how to mitigate this error by visiting https://remotion.dev/docs/troubleshooting/serialize-defaultprops`);
}
}
Internals.Log.warn({ logLevel: window.remotion_logLevel, tag: null }, "Could not single out a problematic composition - The composition list as a whole is too big to serialize.");
throw new Error("defaultProps too big - Could not serialize - an object that was passed to defaultProps was too big. Learn how to mitigate this error by visiting https://remotion.dev/docs/troubleshooting/serialize-defaultprops");
}
return compositions;
};
window.getStaticCompositions = () => {
const compositions = getUnevaluatedComps();
const inputProps = typeof window === "undefined" || getRemotionEnvironment().isPlayer ? {} : getInputProps() ?? {};
return Promise.all(compositions.map(async (c) => {
const handle = globalDelayRender(`Running calculateMetadata() for composition ${c.id}. If you didn't want to evaluate this composition, use "selectComposition()" instead of "getCompositions()"`);
const originalProps = {
...c.defaultProps ?? {},
...inputProps ?? {}
};
const comp = Internals.resolveVideoConfig({
calculateMetadata: c.calculateMetadata,
compositionDurationInFrames: c.durationInFrames ?? null,
compositionFps: c.fps ?? null,
compositionHeight: c.height ?? null,
compositionWidth: c.width ?? null,
signal: new AbortController().signal,
inputProps: originalProps,
defaultProps: c.defaultProps ?? {},
compositionId: c.id
});
const resolved = await Promise.resolve(comp);
globalContinueRender(handle);
const { props, defaultProps, ...data } = resolved;
return {
...data,
serializedResolvedPropsWithCustomSchema: NoReactInternals.serializeJSONWithSpecialTypes({
data: props,
indent: undefined,
staticBase: null
}).serializedString,
serializedDefaultPropsWithCustomSchema: NoReactInternals.serializeJSONWithSpecialTypes({
data: defaultProps,
indent: undefined,
staticBase: null
}).serializedString
};
}));
};
window.remotion_getCompositionNames = () => {
return getUnevaluatedComps().map((c) => c.id);
};
window.remotion_calculateComposition = async (compId) => {
const compositions = getUnevaluatedComps();
const selectedComp = compositions.find((c) => c.id === compId);
if (!selectedComp) {
throw new Error(`Could not find composition with ID ${compId}. Available compositions: ${compositions.map((c) => c.id).join(", ")}`);
}
const abortController = new AbortController;
const handle = globalDelayRender(`Running the calculateMetadata() function for composition ${compId}`);
const inputProps = typeof window === "undefined" || getRemotionEnvironment().isPlayer ? {} : getInputProps() ?? {};
const originalProps = {
...selectedComp.defaultProps ?? {},
...inputProps ?? {}
};
const prom = await Promise.resolve(Internals.resolveVideoConfig({
calculateMetadata: selectedComp.calculateMetadata,
compositionDurationInFrames: selectedComp.durationInFrames ?? null,
compositionFps: selectedComp.fps ?? null,
compositionHeight: selectedComp.height ?? null,
compositionWidth: selectedComp.width ?? null,
inputProps: originalProps,
signal: abortController.signal,
defaultProps: selectedComp.defaultProps ?? {},
compositionId: selectedComp.id
}));
globalContinueRender(handle);
const { props, defaultProps, ...data } = prom;
return {
...data,
serializedResolvedPropsWithCustomSchema: NoReactInternals.serializeJSONWithSpecialTypes({
data: props,
indent: undefined,
staticBase: null
}).serializedString,
serializedDefaultPropsWithCustomSchema: NoReactInternals.serializeJSONWithSpecialTypes({
data: defaultProps,
indent: undefined,
staticBase: null
}).serializedString
};
};
window.remotion_setBundleMode = setBundleModeAndUpdate;
}
export {
setBundleModeAndUpdate
};