"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getOutputLocation = exports.getUserPassedOutputLocation = void 0; const studio_server_1 = require("@remotion/studio-server"); const config_1 = require("./config"); const parsed_cli_1 = require("./parsed-cli"); const getUserPassedOutputLocation = (args, uiPassedOutName) => { var _a, _b; const filename = (_b = (_a = uiPassedOutName !== null && uiPassedOutName !== void 0 ? uiPassedOutName : args[0]) !== null && _a !== void 0 ? _a : parsed_cli_1.parsedCli.output) !== null && _b !== void 0 ? _b : config_1.ConfigInternals.getOutputLocation(); return filename ? String(filename) : null; }; exports.getUserPassedOutputLocation = getUserPassedOutputLocation; const getOutputLocation = ({ compositionId, defaultExtension, args, type, outputLocationFromUi, compositionDefaultOutName, }) => { var _a; if (typeof args[0] !== 'undefined' && typeof parsed_cli_1.parsedCli.output !== 'undefined') { throw new Error('Both an output flag (--output) and an output location as a positional argument were passed. Please choose only one of the ways.'); } return ((_a = (0, exports.getUserPassedOutputLocation)(args, outputLocationFromUi)) !== null && _a !== void 0 ? _a : (0, studio_server_1.getDefaultOutLocation)({ compositionName: compositionId, defaultExtension, type, compositionDefaultOutName, })); }; exports.getOutputLocation = getOutputLocation;