"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.still = void 0; const client_1 = require("@remotion/renderer/client"); const no_react_1 = require("remotion/no-react"); const cleanup_before_quit_1 = require("./cleanup-before-quit"); const preview_server_1 = require("./config/preview-server"); const convert_entry_point_to_serve_url_1 = require("./convert-entry-point-to-serve-url"); const entry_point_1 = require("./entry-point"); const get_cli_options_1 = require("./get-cli-options"); const log_1 = require("./log"); const parsed_cli_1 = require("./parsed-cli"); const still_1 = require("./render-flows/still"); const { offthreadVideoCacheSizeInBytesOption, scaleOption, jpegQualityOption, enableMultiprocessOnLinuxOption, glOption, delayRenderTimeoutInMillisecondsOption, headlessOption, overwriteOption, binariesDirectoryOption, publicPathOption, publicDirOption, chromeModeOption, offthreadVideoThreadsOption, audioLatencyHintOption, mediaCacheSizeInBytesOption, darkModeOption, askAIOption, experimentalClientSideRenderingOption, keyboardShortcutsOption, } = client_1.BrowserSafeApis.options; const still = async (remotionRoot, args, logLevel) => { const { file, remainingArgs, reason: entryPointReason, } = (0, entry_point_1.findEntryPoint)({ args, remotionRoot, logLevel, allowDirectory: true }); if (!file) { log_1.Log.error({ indent: false, logLevel }, 'No entry point specified. Pass more arguments:'); log_1.Log.error({ indent: false, logLevel }, ' npx remotion render [entry-point] [composition-name] [out-name]'); log_1.Log.error({ indent: false, logLevel }, 'Documentation: https://www.remotion.dev/docs/render'); process.exit(1); } const fullEntryPoint = (0, convert_entry_point_to_serve_url_1.convertEntryPointToServeUrl)(file); if (parsed_cli_1.parsedCli.frames) { log_1.Log.error({ indent: false, logLevel }, '--frames flag was passed to the `still` command. This flag only works with the `render` command. Did you mean `--frame`? See reference: https://www.remotion.dev/docs/cli/'); process.exit(1); } const { browserExecutable, envVariables, height, inputProps, stillFrame, width, disableWebSecurity, ignoreCertificateErrors, userAgent, } = (0, get_cli_options_1.getCliOptions)({ isStill: true, logLevel, indent: false, }); const jpegQuality = jpegQualityOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const scale = scaleOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value; const enableMultiProcessOnLinux = enableMultiprocessOnLinuxOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const gl = glOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value; const offthreadVideoCacheSizeInBytes = offthreadVideoCacheSizeInBytesOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const mediaCacheSizeInBytes = mediaCacheSizeInBytesOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const offthreadVideoThreads = offthreadVideoThreadsOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const puppeteerTimeout = delayRenderTimeoutInMillisecondsOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const headless = headlessOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const overwrite = overwriteOption.getValue({ commandLine: parsed_cli_1.parsedCli, }, true).value; const binariesDirectory = binariesDirectoryOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const publicPath = publicPathOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const publicDir = publicDirOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const chromeMode = chromeModeOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const audioLatencyHint = audioLatencyHintOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const darkMode = darkModeOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value; const askAIEnabled = askAIOption.getValue({ commandLine: parsed_cli_1.parsedCli }).value; const keyboardShortcutsEnabled = keyboardShortcutsOption.getValue({ commandLine: parsed_cli_1.parsedCli, }).value; const chromiumOptions = { disableWebSecurity, enableMultiProcessOnLinux, gl, headless, ignoreCertificateErrors, userAgent, darkMode, }; await (0, still_1.renderStillFlow)({ remotionRoot, entryPointReason, fullEntryPoint, remainingArgs, browser: 'chrome', browserExecutable, chromiumOptions, envVariables, height, serializedInputPropsWithCustomSchema: no_react_1.NoReactInternals.serializeJSONWithSpecialTypes({ data: inputProps, indent: undefined, staticBase: null, }).serializedString, overwrite, port: (0, preview_server_1.getRendererPortFromConfigFileAndCliFlag)(), publicDir, puppeteerTimeout, jpegQuality, scale, stillFrame, width, compositionIdFromUi: null, imageFormatFromUi: null, logLevel, onProgress: () => undefined, indent: false, addCleanupCallback: (label, c) => { (0, cleanup_before_quit_1.registerCleanupJob)(label, c); }, cancelSignal: null, outputLocationFromUi: null, offthreadVideoCacheSizeInBytes, offthreadVideoThreads, binariesDirectory, publicPath, chromeMode, audioLatencyHint, mediaCacheSizeInBytes, askAIEnabled, experimentalClientSideRenderingEnabled: experimentalClientSideRenderingOption.getValue({ commandLine: parsed_cli_1.parsedCli }) .value, keyboardShortcutsEnabled, }); }; exports.still = still;